/* ==========================================================================
   MediPortal — mp-base.css
   Sistema visual v4 «Papel editorial» (D-064) para todo el sitio. Diseño: docs/diseno/v4-papel-editorial.md.
   Antes: v3 «Clinical Academics» (D-041, D-042) y Minimalismo Académico (D-023, v2).
   Se carga en todas las pantallas internas: fuentes, tokens (solo claro, D-102), base y componentes.
   Todo acotado a .mp-app y prefijado mp-. Los nombres de clase de v2 se conservan.
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. FUENTES (D-064: Inter para la interfaz y la lectura; MP Serif para los titulares)
   Subconjunto latino con tildes y ñ (ver assets/fonts/README.md).
   -------------------------------------------------------------------------- */
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-var-latin.woff2") format("woff2-variations"),
       url("../fonts/inter-var-latin.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2190-2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* MP Serif (Source Serif 4, OFL): titulares en todo el sitio desde D-064. Normal y cursiva (una palabra por titular). */
@font-face {
  font-family: "MP Serif";
  src: url("../fonts/mp-serif-var-latin.woff2") format("woff2-variations"),
       url("../fonts/mp-serif-var-latin.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2190-2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "MP Serif";
  src: url("../fonts/mp-serif-italic-var-latin.woff2") format("woff2-variations"),
       url("../fonts/mp-serif-italic-var-latin.woff2") format("woff2");
  font-weight: 400 600;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2190-2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Respaldo con métricas ajustadas: mientras carga Inter, Arial al mismo tamaño aparente (menos CLS).
   Valores calculados con fontTools sobre nuestro woff2 y Arial de Windows (ver README de fuentes). */
@font-face {
  font-family: "Inter Fallback";
  src: local("Arial"), local("ArialMT");
  size-adjust: 106.62%;
  ascent-override: 90.86%;
  descent-override: 22.62%;
  line-gap-override: 0%;
}


/* --------------------------------------------------------------------------
   1. TOKENS · v4 «Papel editorial» con los neutros de Steep (D-102; docs/diseno/steep-sistema.md)
   Solo modo claro (D-102). Contraste medido (WCAG 2.1) en el documento de diseño.
   -------------------------------------------------------------------------- */
:root {
  color-scheme: light;

  /* Superficies: papel tibio (D-103). Lienzo crema; campos, menús y diálogos en hojas blancas encima */
  --mp-bg: #FAF8F4;
  --mp-surface: #FFFFFF;            /* campos, menús, diálogos y paneles sobre el papel */
  --mp-card: #F2EFE9;               /* tarjetas (sin borde) */
  --mp-surface-2: #F2EFE9;          /* hover, cabeceras de tabla */
  --mp-fog: #F6F4EF;                /* temario del aula, cabeceras de tabla */
  --mp-line: #E9E4DC;               /* SOLO divisores finos (decorativo) */
  --mp-line-strong: #D9D3C8;        /* bordes decorativos (el texto identifica el control) */
  --mp-track: #DDD7CC;              /* riel de las barras de progreso */
  --mp-field-line: #8A8D96;         /* borde de campos: 3,32:1 sobre #FFFFFF (WCAG 1.4.11) */

  /* Texto: tinta de Steep y su slate oscurecido para llegar a AA */
  --mp-ink: #17191C;                /* 16,61 / 15,35 sobre papel / tarjeta */
  --mp-ink-2: #62666F;              /* 5,42 / 5,01 / 5,24 / 4,60 sobre papel / tarjeta / niebla / durazno */
  --mp-ink-3: #62666F;

  /* Botón principal: píldora en tinta */
  --mp-btn: #17191C;
  --mp-btn-hover: #2E3136;
  --mp-on-btn: #FFFFFF;             /* 17,61 */

  /* Logotipo (D-066): no cambia con el estilo */
  --mp-logo-ink: #0A1128;
  --mp-logo-med: #08C0F0;
  --mp-logo-mark-bg: #0A1128;

  /* Azul de CríticaMed (D-066): SOLO lo activo. Enlaces, progreso, foco, opción elegida */
  --mp-accent: #006A92;             /* 5,69 / 5,26 sobre papel / tarjeta */
  --mp-accent-hover: #00577A;
  --mp-accent-ink: #004B68;         /* texto sobre el tinte */
  --mp-accent-strong: #0089BD;      /* barras, checks, íconos. NUNCA texto pequeño */
  --mp-accent-weak: #E3F5FC;        /* tinte: opción elegida, aviso de éxito */
  --mp-accent-line: #A9DEF2;
  --mp-on-accent: #FFFFFF;

  /* Estados (solo para su significado). Durazno y siena: una tarjeta destacada por página («En vivo» o un aviso). */
  --mp-success: var(--mp-accent);
  --mp-success-weak: var(--mp-accent-weak);
  --mp-success-line: var(--mp-accent-line);
  --mp-success-ink: var(--mp-accent-ink);
  --mp-live: #5D2A1A;     --mp-live-weak: #FBE1D1;   --mp-live-line: #F2C9B2;   --mp-live-ink: #5D2A1A;   --mp-on-live: #FFFFFF;
  --mp-danger: #BA1A1A;   --mp-danger-weak: #FDECEC; --mp-danger-line: #F3C2C2; --mp-danger-ink: #8A1B12; --mp-on-danger: #FFFFFF;

  /* Toast y velo de diálogos */
  --mp-toast-bg: #17191C;
  --mp-toast-ink: #FFFFFF;
  --mp-scrim: rgba(23, 25, 28, 0.45);

  /* Tipografía: MP Serif 400 para titulares (escala de Steep 44 · 64 · 90) e Inter con pesos intermedios */
  --mp-font-ui: "Inter", "Inter Fallback", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mp-font-head: "MP Serif", Georgia, "Times New Roman", serif;
  --mp-font-read: var(--mp-font-ui);
  --mp-w-text: 430;                 /* texto */
  --mp-w-ui: 480;                   /* botones y etiquetas */
  --mp-w-strong: 500;               /* lo que se destaca */
  --mp-fs-xs: 0.75rem;              /* 12 etiqueta mínima */
  --mp-fs-sm: 0.875rem;             /* 14 interfaz compacta, tablas */
  --mp-fs-caption: 0.9375rem;       /* 15 texto de interfaz y leyendas */
  --mp-fs-base: 1rem;
  --mp-fs-read: 1.0625rem;          /* 17 lectura */
  --mp-lh-read: 1.6;                /* no 1,35: los textos clínicos son largos (steep-sistema.md) */
  --mp-fs-lg: 1.125rem;             /* 18 subsección */
  --mp-fs-xl: clamp(1.375rem, 1.2rem + 0.6vw, 1.625rem);  /* 22 a 26: sección, serif */
  --mp-fs-2xl: clamp(2rem, 1.5rem + 1.6vw, 2.75rem);      /* 32 a 44: título de pantalla, serif */
  --mp-fs-display: clamp(2.75rem, 1.9rem + 2.8vw, 4rem);  /* 44 a 64: display, serif */
  --mp-fs-hero: clamp(2.75rem, 1rem + 6vw, 5.625rem);     /* 44 a 90: solo la Home */
  --mp-text-scale: 1;               /* botón «TT» del aula: 1 · 1.125 · 1.25 */

  /* Espaciado (base de 4 px) */
  --mp-s1: 4px;  --mp-s2: 8px;  --mp-s3: 12px; --mp-s4: 16px;
  --mp-s5: 24px; --mp-s6: 32px; --mp-s7: 40px; --mp-s8: 64px; --mp-s9: 80px;

  /* Forma: tarjetas 24 · elevadas 20 · pequeñas y campos 16 · imágenes 12 · controles en píldora */
  --mp-r-sm: 8px;
  --mp-r: 16px;
  --mp-r-md: 16px;
  --mp-r-img: 12px;
  --mp-r-float: 20px;
  --mp-r-lg: 24px;
  --mp-r-pill: 9999px;
  --mp-shadow-1: none;              /* las tarjetas no llevan sombra */
  --mp-shadow-pop: 0 0 0 1px rgba(4, 23, 43, 0.05), 0 4px 24px 0 rgba(0, 0, 0, 0.08);    /* menús */
  --mp-shadow-modal: 0 0 0 1px rgba(4, 23, 43, 0.05), 0 8px 40px 0 rgba(0, 0, 0, 0.10);  /* diálogos */
  --mp-shadow-float: 0 0 0 1px rgba(4, 23, 43, 0.05), 0 20px 25px -5px rgba(0, 0, 0, 0.10), 0 8px 10px -6px rgba(0, 0, 0, 0.10); /* piezas flotantes */
  --mp-ring: 0 0 0 2px var(--mp-bg), 0 0 0 4px var(--mp-accent);                      /* foco: 2 px con separación */

  /* Layout */
  --mp-topbar-h: 64px;
  --mp-sidebar-w: 280px;
  --mp-read-w: 70ch;
  --mp-page-w: 1200px;
  --mp-speed: 140ms;
  --mp-admin-offset: 0px;
}

body.admin-bar { --mp-admin-offset: 32px; }
@media (max-width: 782px) { body.admin-bar { --mp-admin-offset: 46px; } }
body.mp-body { margin: 0; background: var(--mp-bg); font-family: var(--mp-font-ui); } /* Tutor hereda la fuente del body. */
/* Barra y pie v3 alrededor de contenido de Tutor (contexto public, D-054): sin el alto mínimo de pantalla completa. */
.mp-app.mp-app--chrome { min-height: 0; background: transparent; }

/* --------------------------------------------------------------------------
   2. BASE
   -------------------------------------------------------------------------- */
.mp-app {
  font-family: var(--mp-font-ui);
  font-size: var(--mp-fs-caption);
  font-weight: var(--mp-w-text);
  line-height: 1.5;                 /* 15/22: texto de interfaz (D-102) */
  color: var(--mp-ink);
  background: var(--mp-bg);
  min-height: 100vh;
  min-height: 100dvh;               /* en el celular, sin contar la barra del navegador */
  -webkit-font-smoothing: antialiased;
}
.mp-app *, .mp-app *::before, .mp-app *::after { box-sizing: border-box; }
.mp-app img, .mp-app svg { display: block; max-width: 100%; }
/* Enlaces de texto (D-102): azul, sin subrayado en reposo; subrayado al pasar el mouse y con el foco */
.mp-app :where(a) { color: var(--mp-accent); text-decoration: none; text-underline-offset: 3px; }
.mp-app :where(a):hover, .mp-app :where(a):focus-visible { color: var(--mp-accent-hover); text-decoration: underline; }
.mp-app :where(h1, h2, h3, h4) { margin: 0 0 var(--mp-s3); line-height: 1.25; color: var(--mp-ink); text-wrap: balance; }
.mp-app :where(p) { margin: 0 0 var(--mp-s4); }
.mp-app :where(button, input, select, textarea) { font: inherit; color: inherit; }
.mp-app :where(code) { font-size: 0.92em; }

/* Titulares (v4 §2.3): MP Serif SIEMPRE en 400, interletra negativa; una palabra en <em> va en cursiva.
   Subtítulos en Inter 500 (el sistema no usa 700). */
.mp-display, .mp-h1, .mp-h2 { font-family: var(--mp-font-head); font-weight: 400; font-optical-sizing: auto; }
.mp-display em, .mp-h1 em, .mp-h2 em { font-style: italic; }
/* Escala de Steep (D-102): 64 y 44 a 1,3 con tracking −0,015 em; sección 26/1,18 */
.mp-display { font-size: var(--mp-fs-display); line-height: 1.3; letter-spacing: -0.015em; }
.mp-h1 { font-size: var(--mp-fs-2xl); line-height: 1.3; letter-spacing: -0.015em; }
.mp-h2 { font-size: var(--mp-fs-xl); line-height: 1.18; letter-spacing: -0.01em; }
.mp-h3 { font-size: var(--mp-fs-lg); font-weight: var(--mp-w-strong); line-height: 1.4; letter-spacing: -0.009em; }
.mp-h4 { font-size: var(--mp-fs-base); font-weight: var(--mp-w-strong); }
.mp-serif { font-family: var(--mp-font-read); }   /* v2: hoy es Inter (D-041); se conserva la clase */
.mp-eyebrow { display: block; font-size: var(--mp-fs-sm); font-weight: 400; color: var(--mp-ink-2); margin-bottom: var(--mp-s2); }  /* etiqueta tipográfica, sin mayúsculas (v4) */
.mp-muted { color: var(--mp-ink-2); }
.mp-small { font-size: var(--mp-fs-sm); }
.mp-xs { font-size: var(--mp-fs-xs); }
.mp-num { font-variant-numeric: tabular-nums; }

.mp-app :focus-visible { outline: none; box-shadow: var(--mp-ring); border-radius: var(--mp-r-sm); }

.mp-sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.mp-skip-link { position: absolute; left: var(--mp-s4); top: -100px; z-index: 1000; padding: var(--mp-s2) var(--mp-s4); background: var(--mp-surface); border-radius: var(--mp-r-pill); box-shadow: var(--mp-shadow-pop); font-weight: 500; }
.mp-skip-link:focus { top: calc(var(--mp-s3) + var(--mp-admin-offset)); }

/* Utilidades */
.mp-row { display: flex; align-items: center; gap: var(--mp-s3); flex-wrap: wrap; }
.mp-row--between { justify-content: space-between; }
.mp-stack > * + * { margin-top: var(--mp-s4); }
.mp-stack-lg > * + * { margin-top: var(--mp-s6); }
.mp-grow { flex: 1; min-width: 0; }
.mp-divider { height: 1px; background: var(--mp-line); border: 0; margin: var(--mp-s5) 0; }
.mp-icon { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mp-icon--sm { width: 14px; height: 14px; }
.mp-icon--lg { width: 22px; height: 22px; }

/* --------------------------------------------------------------------------
   3. BOTONES (píldora)
   -------------------------------------------------------------------------- */
.mp-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--mp-s2);
  min-height: 44px; padding: 10px 20px;
  font-size: var(--mp-fs-sm); font-weight: var(--mp-w-ui); line-height: 1.2; text-decoration: none; white-space: nowrap;
  color: var(--mp-ink); background: transparent;
  border: 1px solid var(--mp-ink); border-radius: var(--mp-r-pill);   /* secundario: píldora con borde (v4 §3) */
  cursor: pointer;
  transition: background var(--mp-speed) ease, border-color var(--mp-speed) ease, color var(--mp-speed) ease, box-shadow var(--mp-speed) ease;
  -webkit-tap-highlight-color: transparent;
}
.mp-btn:hover { background: var(--mp-surface-2); color: var(--mp-ink); }
.mp-btn:active { background: var(--mp-line); }
.mp-btn--primary { background: var(--mp-btn); border-color: var(--mp-btn); color: var(--mp-on-btn); }   /* píldora en tinta (D-102) */
.mp-btn--primary:hover { background: var(--mp-btn-hover); border-color: var(--mp-btn-hover); color: var(--mp-on-btn); }
.mp-btn--primary:active { background: var(--mp-btn-hover); }
.mp-btn--tint { background: var(--mp-accent-weak); border-color: transparent; color: var(--mp-accent-ink); }  /* acción de módulo (Stitch «ghost») */
.mp-btn--tint:hover { background: var(--mp-accent-line); color: var(--mp-accent-ink); }
.mp-btn--live { background: var(--mp-live); border-color: var(--mp-live); color: var(--mp-on-live); }
.mp-btn--live:hover { filter: brightness(1.12); color: var(--mp-on-live); }
.mp-btn--danger { color: var(--mp-danger); border-color: var(--mp-danger-line); }
.mp-btn--danger:hover { background: var(--mp-danger-weak); color: var(--mp-danger); }
.mp-btn--danger-solid { background: var(--mp-danger); border-color: var(--mp-danger); color: var(--mp-on-danger); }
.mp-btn--danger-solid:hover { filter: brightness(0.92); color: var(--mp-on-danger); }
.mp-btn--ghost { border-color: transparent; background: transparent; }
.mp-btn--ghost:hover { background: var(--mp-surface-2); }
.mp-btn--sm { min-height: 36px; padding: 6px 14px; font-size: var(--mp-fs-xs); }
.mp-btn--lg { min-height: 52px; padding: 14px 28px; font-size: var(--mp-fs-base); }
.mp-btn--block { display: flex; width: 100%; }
.mp-btn--icon { padding: 0; width: 44px; }
.mp-btn--icon.mp-btn--sm { width: 36px; }
.mp-btn[disabled], .mp-btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.mp-btn--complete[aria-pressed="true"] { background: var(--mp-accent-weak); border-color: var(--mp-accent-line); color: var(--mp-accent-ink); }
.mp-link-btn { background: none; border: 0; padding: 0; color: var(--mp-accent); font-weight: var(--mp-w-ui); cursor: pointer; text-decoration: none; text-underline-offset: 3px; }
.mp-link-btn:hover, .mp-link-btn:focus-visible { text-decoration: underline; }

/* --------------------------------------------------------------------------
   4. BADGES, CHIPS, ESTADOS
   -------------------------------------------------------------------------- */
/* Etiqueta neutra (D-102): texto gris de 14 px, sin cápsula. Las variantes de estado conservan su tinte: el color es la información. */
.mp-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0; border-radius: var(--mp-r-pill);
  font-size: var(--mp-fs-sm); font-weight: var(--mp-w-text); line-height: 1.33; white-space: nowrap;
  color: var(--mp-ink-2); background: none; border: 0;
}
.mp-badge--accent, .mp-badge--success, .mp-badge--live, .mp-badge--danger { padding: 4px 12px; font-size: var(--mp-fs-xs); font-weight: var(--mp-w-strong); }
.mp-badge--accent  { color: var(--mp-accent);  background: var(--mp-accent-weak); border-color: transparent; }
.mp-badge--success { color: var(--mp-accent);  background: var(--mp-accent-weak); border-color: transparent; }
.mp-badge--live    { color: var(--mp-live);    background: var(--mp-live-weak);   border-color: transparent; }
.mp-badge--danger  { color: var(--mp-danger);  background: var(--mp-danger-weak); border-color: transparent; }
.mp-badge--code    { font-size: 0.6875rem; letter-spacing: 0.05em; text-transform: uppercase; }  /* COHORTE 2026-A */
.mp-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.mp-dot--pulse { animation: mp-pulse 1.6s ease-in-out 3; } /* marca un estado real («En vivo»): late 3 veces y se queda quieto (antislop R-19, R-39) */
@keyframes mp-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* Indicador de estado de lección/subpágina en el esquema */
.mp-status { display: inline-grid; place-items: center; width: 20px; height: 20px; flex-shrink: 0; border-radius: 50%; border: 1.5px solid var(--mp-field-line); background: var(--mp-surface); color: var(--mp-ink-2); }
.mp-status svg { width: 12px; height: 12px; }
.mp-status--done { background: var(--mp-accent-strong); border-color: var(--mp-accent-strong); color: var(--mp-surface); }
.mp-status--quiz { border-radius: 5px; }
.mp-status--locked { border-style: dashed; }  /* v2; sin uso en v3 (no hay goteo, filtro §1) */

/* Avatar de iniciales (nunca fotos, D-034) */
.mp-avatar { display: inline-grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%; background: var(--mp-accent-weak); color: var(--mp-accent-ink); font-size: var(--mp-fs-sm); font-weight: 500; }
.mp-avatar--lg { width: 72px; height: 72px; font-size: var(--mp-fs-xl); }

/* --------------------------------------------------------------------------
   5. CARDS, ALERTAS, PROGRESO
   -------------------------------------------------------------------------- */
.mp-card { background: var(--mp-card); border: 1px solid transparent; border-radius: var(--mp-r-lg); padding: var(--mp-s5); }   /* gris, sin borde ni sombra (v4) */
.mp-card--flush { padding: 0; overflow: hidden; }
.mp-card--link { display: block; color: inherit; text-decoration: none; transition: border-color var(--mp-speed) ease; }
.mp-card--link:hover { border-color: var(--mp-line-strong); color: inherit; }
.mp-card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--mp-s3); padding: var(--mp-s4) var(--mp-s5); border-bottom: 1px solid var(--mp-line); }
.mp-card__body { padding: var(--mp-s5); }
.mp-card__foot { padding: var(--mp-s4) var(--mp-s5); border-top: 1px solid var(--mp-line); background: transparent; }

.mp-alert { display: flex; gap: var(--mp-s3); align-items: flex-start; padding: var(--mp-s4) var(--mp-s5); border-radius: var(--mp-r-md); border: 1px solid transparent; background: var(--mp-card); font-size: var(--mp-fs-sm); }
.mp-alert > .mp-icon { margin-top: 2px; }
.mp-alert p { margin: 0; }
.mp-alert strong { display: block; margin-bottom: 2px; font-weight: 500; }
.mp-alert--info    { background: var(--mp-accent-weak); border-color: transparent; color: var(--mp-accent-ink); }
.mp-alert--success { background: var(--mp-accent-weak); border-color: transparent; color: var(--mp-accent-ink); }
.mp-alert--warn    { background: var(--mp-live-weak);   border-color: transparent; color: var(--mp-live-ink); }
.mp-alert--danger  { background: var(--mp-danger-weak); border-color: transparent; color: var(--mp-danger-ink); }

/* Barra de progreso: 4 px, avance en el verde fuerte (gráfico, ≥ 3:1) sobre un riel visible en la tarjeta */
.mp-progress { height: 4px; background: var(--mp-track); border-radius: var(--mp-r-pill); overflow: hidden; }
.mp-progress__bar { height: 100%; background: var(--mp-accent-strong); border-radius: var(--mp-r-pill); transition: width 300ms ease; }
.mp-progress--accent .mp-progress__bar { background: var(--mp-accent-strong); }

/* Caja con borde izquierdo (información, objetivos, cita CON fuente real) */
.mp-callout { padding: var(--mp-s4) var(--mp-s5); border-left: 3px solid var(--mp-accent-strong); border-radius: 0 var(--mp-r-md) var(--mp-r-md) 0; background: var(--mp-card); }
.mp-callout__label { display: block; font-size: var(--mp-fs-xs); font-weight: 500; color: var(--mp-accent); margin-bottom: var(--mp-s1); }

.mp-empty { text-align: center; padding: var(--mp-s7) var(--mp-s5); }
.mp-empty .mp-icon { width: 40px; height: 40px; margin: 0 auto var(--mp-s4); color: var(--mp-accent-strong); stroke-width: 1.5; }

.mp-stat { padding: var(--mp-s4) var(--mp-s5); }
.mp-stat__value { display: block; font-size: var(--mp-fs-2xl); font-weight: 500; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.mp-stat__label { display: block; font-size: var(--mp-fs-xs); color: var(--mp-ink-2); margin-top: var(--mp-s1); }

/* --------------------------------------------------------------------------
   6. FORMULARIOS
   -------------------------------------------------------------------------- */
.mp-field { display: grid; gap: 6px; }
.mp-field + .mp-field { margin-top: var(--mp-s4); }
.mp-label { font-size: var(--mp-fs-sm); font-weight: var(--mp-w-ui); color: var(--mp-ink); }
.mp-label .mp-opt { font-weight: 400; color: var(--mp-ink-2); }
.mp-hint { font-size: var(--mp-fs-xs); color: var(--mp-ink-2); margin: 0; }
.mp-input, .mp-select, .mp-textarea {
  width: 100%; min-height: 48px; padding: 12px 16px;
  background: var(--mp-surface); color: var(--mp-ink);
  border: 1px solid var(--mp-field-line); border-radius: var(--mp-r);
  transition: border-color var(--mp-speed) ease, box-shadow var(--mp-speed) ease;
}
.mp-input::placeholder, .mp-textarea::placeholder { color: var(--mp-ink-2); opacity: 1; }
.mp-input:hover, .mp-select:hover, .mp-textarea:hover { border-color: var(--mp-ink-2); }
.mp-input:focus, .mp-select:focus, .mp-textarea:focus { outline: none; border-color: var(--mp-accent); box-shadow: 0 0 0 1px var(--mp-accent); }
.mp-textarea { min-height: 96px; resize: vertical; }
.mp-input--code { border-radius: var(--mp-r-pill); padding-left: 20px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; }
.mp-field.is-invalid .mp-input, .mp-field.is-invalid .mp-select { border-color: var(--mp-danger); box-shadow: 0 0 0 1px var(--mp-danger); }
.mp-error { display: flex; gap: 6px; align-items: center; font-size: var(--mp-fs-xs); font-weight: 500; color: var(--mp-danger); margin: 0; }
.mp-input-group { position: relative; }
.mp-input-group .mp-input { padding-right: 52px; }
.mp-input-group__btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.mp-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--mp-s4); align-items: start; }
.mp-form-row + .mp-field, .mp-field + .mp-form-row, .mp-form-row + .mp-form-row { margin-top: var(--mp-s4); }
.mp-form-row .mp-field + .mp-field { margin-top: 0; }
.mp-check-row { display: flex; gap: var(--mp-s3); align-items: flex-start; font-size: var(--mp-fs-sm); cursor: pointer; }
.mp-check-row input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--mp-accent); flex-shrink: 0; }
.mp-form-actions { display: flex; gap: var(--mp-s3); flex-wrap: wrap; margin-top: var(--mp-s5); }

/* Opciones del quiz: filas anchas de 16 px; elegida = tinte + borde verde */
.mp-choice { display: flex; gap: var(--mp-s3); align-items: flex-start; padding: var(--mp-s4); border: 1px solid var(--mp-line); border-radius: var(--mp-r); background: var(--mp-surface); font-size: var(--mp-fs-base); cursor: pointer; transition: border-color var(--mp-speed) ease, background var(--mp-speed) ease; }
.mp-choice + .mp-choice { margin-top: var(--mp-s2); }
.mp-choice:hover { border-color: var(--mp-field-line); }
.mp-choice input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--mp-accent); flex-shrink: 0; }
.mp-choice:has(input:checked) { border-color: var(--mp-accent); background: var(--mp-accent-weak); }
.mp-choice--correct { border-color: var(--mp-accent-line); background: var(--mp-accent-weak); }
.mp-choice--wrong { border-color: var(--mp-danger-line); background: var(--mp-danger-weak); }

/* Medidor de fuerza de contraseña (PANT-01, 04 y 09) */
.mp-pass-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 2px; }
.mp-pass-meter span { height: 4px; border-radius: var(--mp-r-pill); background: var(--mp-line); }
.mp-pass-meter[data-level="1"] span:nth-child(-n+1) { background: var(--mp-danger); }
.mp-pass-meter[data-level="2"] span:nth-child(-n+2) { background: var(--mp-live); }
.mp-pass-meter[data-level="3"] span:nth-child(-n+3) { background: var(--mp-accent-strong); }
.mp-pass-meter[data-level="4"] span { background: var(--mp-accent); }

/* --------------------------------------------------------------------------
   7. TABLAS
   -------------------------------------------------------------------------- */
.mp-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.mp-table { width: 100%; border-collapse: collapse; font-size: var(--mp-fs-sm); }
.mp-table th, .mp-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--mp-line); vertical-align: middle; }
.mp-table th { font-size: var(--mp-fs-xs); font-weight: 500; color: var(--mp-ink-2); background: var(--mp-fog); white-space: nowrap; }
.mp-table tbody tr:hover { background: var(--mp-fog); }
.mp-table tbody tr:last-child td { border-bottom: 0; }
.mp-table .is-num { text-align: right; font-variant-numeric: tabular-nums; }
.mp-table th button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.mp-table th button:focus-visible { box-shadow: var(--mp-ring); border-radius: 4px; }
.mp-table th[aria-sort="ascending"] button::after { content: "\2191"; }
.mp-table th[aria-sort="descending"] button::after { content: "\2193"; }
.mp-table .is-sticky { position: sticky; left: 0; background: var(--mp-surface); z-index: 1; }
.mp-table th.is-sticky { background: var(--mp-fog); }
.mp-grade-low { color: var(--mp-danger); font-weight: 500; }
.mp-grade-none { color: var(--mp-ink-2); }

/* Tabla dentro de la lección */
.mp-prose table { width: 100%; border-collapse: collapse; font-family: var(--mp-font-ui); font-size: var(--mp-fs-sm); margin: var(--mp-s5) 0; }
.mp-prose th, .mp-prose td { padding: 10px 12px; border: 1px solid var(--mp-line); text-align: left; vertical-align: top; }
.mp-prose thead th { background: var(--mp-fog); font-weight: 500; }
.mp-prose caption { caption-side: bottom; text-align: left; font-size: var(--mp-fs-xs); color: var(--mp-ink-2); padding-top: var(--mp-s2); }

/* --------------------------------------------------------------------------
   8. ENCABEZADO, WORDMARK, MENÚS, PESTAÑAS, DIÁLOGO, TOAST
   -------------------------------------------------------------------------- */
.mp-topbar {
  position: sticky; top: var(--mp-admin-offset); z-index: 50;
  height: var(--mp-topbar-h);
  display: flex; align-items: center; gap: var(--mp-s4);
  padding: 0 var(--mp-s7);
  background: var(--mp-bg);         /* el mismo papel del lienzo: se ve transparente; opaca porque es fija (D-102) */
}
/* Wordmark: ícono de pulso en verde de marca + «MediPortal» en serif + «Educación médica». */
/* Logotipo de texto de CríticaMed (D-066, template-parts/logo.php), provisional hasta los SVG originales:
   «CRÍTICA» en azul marino + «MED» en el celeste del logo; ícono de pulso celeste sobre azul marino.
   Un logotipo no tiene mínimo de contraste (WCAG 1.4.3); el nombre se lee igual en las dos versiones. */
.mp-logo { display: inline-flex; align-items: center; gap: var(--mp-s3); color: var(--mp-ink); text-decoration: none; white-space: nowrap; }
.mp-logo:hover { color: var(--mp-ink); }
.mp-logo__mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--mp-logo-mark-bg); color: var(--mp-logo-med); }
.mp-logo__mark svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.mp-logo__text { display: flex; flex-direction: column; gap: 2px; line-height: 1; }
.mp-logo__name { color: var(--mp-logo-ink); font-family: var(--mp-font-ui); font-weight: 700; font-size: 1.125rem; letter-spacing: 0.01em; text-transform: uppercase; }
.mp-logo__med { color: var(--mp-logo-med); }
.mp-logo__sub { font-family: var(--mp-font-ui); font-size: 0.5625rem; font-weight: 500; letter-spacing: 0.32em; text-transform: uppercase; color: var(--mp-ink-2); }
.mp-topbar__nav { display: flex; gap: var(--mp-s1); margin-left: var(--mp-s5); }
.mp-topbar__link { display: inline-flex; align-items: center; min-height: 40px; padding: 0 var(--mp-s4); border-radius: var(--mp-r-pill); color: var(--mp-ink); font-size: var(--mp-fs-sm); font-weight: 400; text-decoration: none; }
.mp-topbar__link:hover { background: var(--mp-surface-2); color: var(--mp-ink); }
.mp-topbar__link[aria-current="page"] { color: var(--mp-accent-ink); background: var(--mp-accent-weak); font-weight: 500; }
.mp-topbar__end { margin-left: auto; display: flex; align-items: center; gap: var(--mp-s3); }
.mp-topbar__course { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.mp-topbar__course-name { font-family: var(--mp-font-head); font-size: 1.25rem; font-weight: 400; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-topbar__progress { display: flex; align-items: center; gap: var(--mp-s3); font-size: var(--mp-fs-xs); color: var(--mp-ink-2); font-weight: 500; }
.mp-topbar__progress .mp-progress { width: 140px; }
.mp-topbar__menu-btn { display: none; }

.mp-menu { position: relative; }
.mp-menu__btn { display: inline-flex; align-items: center; gap: var(--mp-s2); padding: 4px; padding-right: 8px; border: 1px solid transparent; border-radius: var(--mp-r-pill); background: none; cursor: pointer; }
.mp-menu__btn:hover { background: var(--mp-surface-2); }
.mp-menu__list { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; padding: var(--mp-s2); margin: 0; list-style: none; background: var(--mp-surface); border-radius: var(--mp-r-md); box-shadow: var(--mp-shadow-pop); z-index: 60; }
.mp-menu__list[hidden] { display: none; }
.mp-menu__list a, .mp-menu__list button { display: flex; align-items: center; gap: var(--mp-s2); width: 100%; min-height: 40px; padding: 0 var(--mp-s3); border: 0; background: none; border-radius: var(--mp-r-sm); color: var(--mp-ink); font-size: var(--mp-fs-sm); text-decoration: none; text-align: left; cursor: pointer; }
.mp-menu__list a:hover, .mp-menu__list button:hover { background: var(--mp-surface-2); color: var(--mp-ink); }
.mp-menu__head { padding: var(--mp-s2) var(--mp-s3) var(--mp-s3); border-bottom: 1px solid var(--mp-line); margin-bottom: var(--mp-s2); }

/* Pestañas: subrayado de acento (Contenido / Mis notas / Avisos; Esquema / Recursos) */
.mp-tabs { display: flex; gap: var(--mp-s1); border-bottom: 1px solid var(--mp-line); margin-bottom: var(--mp-s5); overflow-x: auto; }
.mp-tab { display: inline-flex; align-items: center; gap: var(--mp-s2); min-height: 48px; padding: 0 var(--mp-s4); border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; color: var(--mp-ink-2); font-size: var(--mp-fs-sm); font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap; }
.mp-tab:hover { color: var(--mp-ink); }
.mp-tab[aria-selected="true"], .mp-tab[aria-current="page"] { color: var(--mp-ink); border-bottom-color: var(--mp-accent); font-weight: 500; }
/* Variante segmentada (filtros «Todas / Correctas / Incorrectas») */
.mp-segmented { display: inline-flex; gap: 2px; padding: 4px; border-radius: var(--mp-r-pill); background: var(--mp-surface-2); }
.mp-segmented button { min-height: 36px; padding: 0 var(--mp-s4); border: 0; border-radius: var(--mp-r-pill); background: none; color: var(--mp-ink-2); font-size: var(--mp-fs-xs); font-weight: 500; cursor: pointer; }
.mp-segmented button[aria-pressed="true"] { background: var(--mp-btn); color: var(--mp-on-btn); }

.mp-dialog { width: min(480px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: var(--mp-r-lg); box-shadow: var(--mp-shadow-modal); background: var(--mp-surface); color: var(--mp-ink); font-family: var(--mp-font-ui); }
.mp-dialog::backdrop { background: var(--mp-scrim); }
.mp-dialog__body { padding: var(--mp-s5); }
.mp-dialog__foot { display: flex; justify-content: flex-end; gap: var(--mp-s3); padding: var(--mp-s4) var(--mp-s5); border-top: 1px solid var(--mp-line); background: transparent; }

/* Toast: solo cuando de verdad se guarda algo (v3 §3.3) */
.mp-toast { position: fixed; left: 50%; bottom: var(--mp-s5); transform: translateX(-50%); z-index: 200; display: flex; align-items: center; gap: var(--mp-s2); padding: var(--mp-s3) var(--mp-s5); background: var(--mp-toast-bg); color: var(--mp-toast-ink); border-radius: var(--mp-r-pill); box-shadow: var(--mp-shadow-pop); font-size: var(--mp-fs-sm); font-weight: 500; }
.mp-toast[hidden] { display: none; }


/* Pie (filtro §2): «Términos de uso · Política de privacidad» + «© 2026 MediPortal». Sin sellos. */
.mp-footer { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: var(--mp-s2) var(--mp-s5); padding: var(--mp-s6) var(--mp-s4); font-size: var(--mp-fs-xs); color: var(--mp-ink-2); }
.mp-footer a { color: var(--mp-ink-2); }
.mp-footer a:hover { color: var(--mp-accent); }

/* Pie completo del sitio público (Home, ficha del curso, 404 y páginas; D-060, template-parts/site-footer.php) */
.mp-site-footer { max-width: 1120px; margin: 0 auto; padding: var(--mp-s8) clamp(16px, 4vw, 40px) var(--mp-s6); border-top: 1px solid var(--mp-line); font-size: var(--mp-fs-sm); color: var(--mp-ink-2); }
.mp-site-footer__grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.8fr) minmax(0, 1fr) minmax(0, 1.4fr); gap: var(--mp-s6); }
.mp-site-footer p { margin: 0 0 var(--mp-s3); max-width: 34em; }
.mp-site-footer__about .mp-logo { margin-bottom: var(--mp-s4); }
.mp-site-footer__notice { color: var(--mp-ink); font-weight: 500; }
.mp-site-footer__title { margin: 0 0 var(--mp-s3); font-size: var(--mp-fs-sm); font-weight: 500; color: var(--mp-ink); }
.mp-site-footer ul { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--mp-s2); }
.mp-site-footer a { color: var(--mp-ink-2); text-underline-offset: 3px; }
.mp-site-footer a:hover { color: var(--mp-accent); }
.mp-site-footer__data strong { color: var(--mp-ink); font-weight: 500; }
.mp-site-footer__bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--mp-s2) var(--mp-s5); margin-top: var(--mp-s7); padding-top: var(--mp-s4); border-top: 1px solid var(--mp-line); font-size: var(--mp-fs-xs); }
@media (max-width: 1023px) { .mp-site-footer__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
@media (max-width: 599px) { .mp-site-footer__grid { grid-template-columns: minmax(0, 1fr); gap: var(--mp-s5); } .mp-site-footer { padding-top: var(--mp-s7); } }

/* --------------------------------------------------------------------------
   10. LAYOUT: PÁGINA DE APP (PANT-05, 08, 09)
   -------------------------------------------------------------------------- */
.mp-page { width: 100%; max-width: var(--mp-page-w); margin: 0 auto; padding: var(--mp-s7) var(--mp-s7) var(--mp-s8); }
.mp-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--mp-s4); flex-wrap: wrap; margin-bottom: var(--mp-s6); }
.mp-page-head .mp-h1, .mp-page-head .mp-display { margin-bottom: var(--mp-s1); }
.mp-page-head p { margin: 0; color: var(--mp-ink-2); }
.mp-grid-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: var(--mp-s5); align-items: start; }
.mp-grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--mp-s4); margin-bottom: var(--mp-s6); }
.mp-grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--mp-s5); }
.mp-section-title { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--mp-s2) var(--mp-s3); margin: var(--mp-s6) 0 var(--mp-s4); }
.mp-section-title:first-child { margin-top: 0; }
.mp-toolbar { display: flex; gap: var(--mp-s3); flex-wrap: wrap; align-items: center; margin-bottom: var(--mp-s4); }
.mp-toolbar .mp-input, .mp-toolbar .mp-select { width: auto; min-width: 200px; }
.mp-toolbar__end { margin-left: auto; display: flex; gap: var(--mp-s2); }

/* Tarjeta de curso (PANT-05): portada (D-034) · cohorte · título · progreso · «Siguiente» · «Reanudar» */
.mp-course { display: flex; flex-direction: column; height: 100%; }
.mp-course__cover { aspect-ratio: 16 / 9; margin: var(--mp-s3) var(--mp-s3) 0; border-radius: var(--mp-r-md); background: var(--mp-accent-weak); display: grid; place-items: center; color: var(--mp-accent-strong); overflow: hidden; }   /* portada como imagen enmarcada dentro de la tarjeta */
.mp-course__cover img { width: 100%; height: 100%; object-fit: cover; }
.mp-course__cover .mp-icon { width: 40px; height: 40px; stroke-width: 1.5; }
.mp-course__body { flex: 1; padding: var(--mp-s5); display: flex; flex-direction: column; gap: var(--mp-s3); }
.mp-course__body .mp-h3 { margin: 0; }
.mp-course__meta { display: flex; gap: var(--mp-s4); flex-wrap: wrap; font-size: var(--mp-fs-xs); color: var(--mp-ink-2); }
.mp-course__progress { margin-top: auto; }
.mp-course__progress-label { display: flex; justify-content: space-between; font-size: var(--mp-fs-xs); color: var(--mp-ink-2); font-weight: 500; margin-bottom: 6px; }
.mp-course__progress-label strong { color: var(--mp-ink); font-weight: 500; }
.mp-course__next { margin-top: var(--mp-s2); padding-top: var(--mp-s3); border-top: 1px solid var(--mp-line-strong); font-size: var(--mp-fs-sm); }

/* Próximas clases (PANT-05, 08) */
.mp-agenda { list-style: none; margin: 0; padding: 0; }
.mp-agenda li { display: flex; gap: var(--mp-s3); padding: var(--mp-s3) 0; border-bottom: 1px solid var(--mp-line); }
.mp-agenda li:last-child { border-bottom: 0; }
.mp-agenda__date { flex-shrink: 0; width: 48px; text-align: center; border: 1px solid var(--mp-line); border-radius: var(--mp-r); overflow: hidden; }
.mp-agenda__date span { display: block; font-size: 10px; font-weight: 500; text-transform: uppercase; background: var(--mp-surface); color: var(--mp-ink-2); padding: 2px 0; }
.mp-agenda__date strong { display: block; font-family: var(--mp-font-head); font-weight: 400; font-size: var(--mp-fs-lg); line-height: 1.6; }

/* --------------------------------------------------------------------------
   14. RESPONSIVE (parte común)
   -------------------------------------------------------------------------- */
.mp-nav-toggle { display: none !important; }

@media (max-width: 1024px) {
  .mp-grid-2 { grid-template-columns: 1fr; }
  .mp-topbar { padding: 0 var(--mp-s5); }
  .mp-topbar__nav { display: none; }
  .mp-topbar__nav.is-open { display: flex; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; padding: var(--mp-s2); margin: 0; background: var(--mp-surface); border-bottom: 1px solid var(--mp-line); box-shadow: var(--mp-shadow-pop); }
  .mp-nav-toggle { display: inline-flex !important; }
  .mp-page { padding: var(--mp-s6) var(--mp-s5) var(--mp-s8); }
}

@media (max-width: 720px) {
  .mp-topbar { padding: 0 var(--mp-s4); gap: var(--mp-s2); }
  .mp-logo__sub { display: none; }
  .mp-hide-sm { display: none; }
  .mp-page { padding: var(--mp-s5) var(--mp-s4) var(--mp-s7); }
  .mp-form-row { grid-template-columns: 1fr; }
  .mp-toolbar .mp-input, .mp-toolbar .mp-select { flex: 1 1 100%; min-width: 0; width: 100%; }
  .mp-toolbar__end { margin-left: 0; width: 100%; }
  .mp-toolbar__end .mp-btn { flex: 1; }
  .mp-page-head > .mp-btn, .mp-page-head > .mp-row { width: 100%; }
  .mp-page-head > .mp-btn { justify-content: center; }
  .mp-grid-stats { grid-template-columns: 1fr 1fr; gap: var(--mp-s3); }
  .mp-grid-cards { grid-template-columns: 1fr; }
  .mp-stat { padding: var(--mp-s3) var(--mp-s4); }
  .mp-stat__value { font-size: var(--mp-fs-xl); }
  /* Tabla responsive: filas como tarjetas */
  .mp-table--stack thead { display: none; }
  .mp-table--stack, .mp-table--stack tbody, .mp-table--stack tr, .mp-table--stack td { display: block; width: 100%; }
  .mp-table--stack tr { padding: var(--mp-s3) var(--mp-s4); border-bottom: 1px solid var(--mp-line); }
  .mp-table--stack td { display: flex; justify-content: space-between; gap: var(--mp-s3); padding: 6px 0; border: 0; text-align: right; }
  .mp-table--stack td::before { content: attr(data-label); font-size: var(--mp-fs-xs); font-weight: 500; color: var(--mp-ink-2); text-align: left; }
  .mp-table--stack td.is-num { text-align: right; }
  .mp-table--stack td:first-child { font-weight: 500; }
}

/* Pantallas táctiles: todo lo que se toca mide al menos 44 px de alto (R-03). En la PC se queda el tamaño compacto. */
@media (max-width: 1023px), (pointer: coarse) {
  .mp-btn--sm { min-height: 44px; }
  .mp-btn--icon.mp-btn--sm { width: 44px; }
  .mp-topbar__link, .mp-logo { min-height: 44px; }
  .mp-app nav.mp-small a, .mp-breadcrumb a { display: inline-flex; align-items: center; min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .mp-app *, .mp-app *::before, .mp-app *::after { animation: none !important; transition: none !important; }
}

@media print {
  :root { color-scheme: light; }
  .mp-topbar, .mp-sidebar, .mp-lesson-nav, .mp-session, .mp-overlay, .mp-toast { display: none !important; }
  .mp-classroom { display: block; }
  .mp-app { background: #fff; color: #000; }
}

/* Controles: cursor de mano en todo lo que se puede usar y «no permitido» en lo desactivado (antislop R-39) */
a[href], button:not(:disabled), summary, select:not(:disabled), label[for], input[type="checkbox"]:not(:disabled), input[type="radio"]:not(:disabled), [role="button"], [role="tab"], [role="switch"] { cursor: pointer; }
button:disabled, select:disabled, input:disabled, [aria-disabled="true"] { cursor: not-allowed; }
