/* EMA Capacitación — sistema visual "Mosaico" (Campus y Studio), con modo claro y oscuro.
   El motivo de cuadritos inclinados en ola viene del logo de EMA y se usa como firma visual.
   Los nombres de las variables (--bg, --surface, --brand, ...) los usa también studio.css: no renombrarlas. */

/* ---------- Tokens ---------- */
:root {
  --font: 'Inter Variable', Inter, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-display: 'Bricolage Grotesque Variable', 'Inter Variable', system-ui, sans-serif;
  --r: 20px; --r-sm: 12px; --r-xs: 9px;
  --side: 252px; --shell-gap: 14px;

  --bg: #edf2f8;
  --surface: #ffffff;
  --surface-2: #f6f8fc;
  --surface-3: #e8eef7;
  --ink: #0a1a33;
  --ink-2: #384962;
  --muted: #627290;
  --line: #dce4ef;
  --line-2: #eaeff6;
  --brand: #00438f;
  --brand-hover: #00346f;
  --brand-ink: #ffffff;
  --brand-soft: #e4edfa;
  --brand-text: #0a4c9b;
  --accent: #7dc1e8;
  --sun: #f5a524; --sun-soft: #fff2d9;
  --ok: #0d8a5b; --ok-soft: #dbf4e9;
  --warn: #9a5800; --warn-soft: #fff0d6;
  --err: #d0393e; --err-soft: #fdeaeb;
  --prog: #d38600; --prog-soft: #fff1d6;
  --focus: 0 0 0 3px rgba(10, 92, 200, .28);
  --sh-1: 0 1px 2px rgba(10, 26, 51, .05), 0 2px 6px rgba(10, 26, 51, .04);
  --sh-2: 0 14px 34px -14px rgba(10, 40, 90, .25), 0 2px 6px rgba(10, 26, 51, .05);
  --sh-3: 0 30px 70px -20px rgba(0, 40, 90, .38);
  --hero-1: #002b63; --hero-2: #0a5cc4; --hero-3: #4aa7e6;
  --side-bg: rgba(255, 255, 255, .88);
  --glow-1: rgba(125, 193, 232, .38); --glow-2: rgba(0, 67, 143, .10);
  --tile-a: #7dc1e8; --tile-b: #ffffff;
  --logo-plate: transparent; --logo-pad: 0;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #050b17;
  --surface: #0c1527;
  --surface-2: #101c33;
  --surface-3: #16253f;
  --ink: #e8eef8;
  --ink-2: #b6c3d7;
  --muted: #8192ab;
  --line: #1c2b47;
  --line-2: #15223a;
  --brand: #5aa8ff;
  --brand-hover: #82bdff;
  --brand-ink: #03101f;
  --brand-soft: rgba(90, 168, 255, .14);
  --brand-text: #93c7ff;
  --sun: #fbbf3c; --sun-soft: rgba(251, 191, 60, .14);
  --ok: #3dd598; --ok-soft: rgba(61, 213, 152, .14);
  --warn: #fbbf3c; --warn-soft: rgba(251, 191, 60, .14);
  --err: #ff7377; --err-soft: rgba(255, 115, 119, .14);
  --prog: #fbbf3c; --prog-soft: rgba(251, 191, 60, .14);
  --focus: 0 0 0 3px rgba(90, 168, 255, .42);
  --sh-1: 0 1px 2px rgba(0, 0, 0, .4);
  --sh-2: 0 16px 36px -14px rgba(0, 0, 0, .7), 0 2px 6px rgba(0, 0, 0, .3);
  --sh-3: 0 30px 70px -20px rgba(0, 0, 0, .8);
  --hero-1: #061f47; --hero-2: #0c4795; --hero-3: #2b86d0;
  --side-bg: rgba(12, 21, 39, .9);
  --glow-1: rgba(37, 110, 235, .22); --glow-2: rgba(125, 193, 232, .07);
  --logo-plate: #ffffff; --logo-pad: 6px 10px;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --bg: #050b17;
    --surface: #0c1527;
    --surface-2: #101c33;
    --surface-3: #16253f;
    --ink: #e8eef8;
    --ink-2: #b6c3d7;
    --muted: #8192ab;
    --line: #1c2b47;
    --line-2: #15223a;
    --brand: #5aa8ff;
    --brand-hover: #82bdff;
    --brand-ink: #03101f;
    --brand-soft: rgba(90, 168, 255, .14);
    --brand-text: #93c7ff;
    --sun: #fbbf3c; --sun-soft: rgba(251, 191, 60, .14);
    --ok: #3dd598; --ok-soft: rgba(61, 213, 152, .14);
    --warn: #fbbf3c; --warn-soft: rgba(251, 191, 60, .14);
    --err: #ff7377; --err-soft: rgba(255, 115, 119, .14);
    --prog: #fbbf3c; --prog-soft: rgba(251, 191, 60, .14);
    --focus: 0 0 0 3px rgba(90, 168, 255, .42);
    --sh-1: 0 1px 2px rgba(0, 0, 0, .4);
    --sh-2: 0 16px 36px -14px rgba(0, 0, 0, .7), 0 2px 6px rgba(0, 0, 0, .3);
    --sh-3: 0 30px 70px -20px rgba(0, 0, 0, .8);
    --hero-1: #061f47; --hero-2: #0c4795; --hero-3: #2b86d0;
    --side-bg: rgba(12, 21, 39, .9);
    --glow-1: rgba(37, 110, 235, .22); --glow-2: rgba(125, 193, 232, .07);
    --logo-plate: #ffffff; --logo-pad: 6px 10px;
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font: 15px/1.6 var(--font); color: var(--ink); min-height: 100vh;
  background: radial-gradient(1100px 620px at 105% -12%, var(--glow-1), transparent 62%),
              radial-gradient(900px 560px at -12% 112%, var(--glow-2), transparent 60%), var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--brand-text); text-decoration: none; }
a:hover { color: var(--brand); }
h1, h2, h3 { font-family: var(--font-display); }
h1 { font-size: 2.05rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; margin: 0; }
h2 { font-size: 1.13rem; font-weight: 650; margin: 0 0 14px; letter-spacing: -.015em; }
h3 { font-size: .98rem; font-weight: 650; margin: 22px 0 10px; letter-spacing: -.01em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
code { background: var(--surface-3); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; font-size: .84em; word-break: break-all; }
::selection { background: color-mix(in srgb, var(--accent) 40%, transparent); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .right { text-align: right; } .nowrap { white-space: nowrap; } .center { text-align: center; }
.dim { opacity: .55; } .late { color: var(--err); font-weight: 600; }
/* En modo oscuro el logo va sobre una placa blanca para conservar sus colores originales */
.logo-img { background: var(--logo-plate); padding: var(--logo-pad); border-radius: 10px; }

/* Firma: tres cuadritos inclinados como en el logo */
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--brand-text); margin: 0 0 8px; }
.eyebrow::before { content: ''; flex: none; width: 21px; height: 8px; transform: skewX(-16deg); border-radius: 1px;
  background: linear-gradient(90deg, var(--accent) 0 5px, transparent 5px 8px, color-mix(in srgb, var(--accent) 60%, transparent) 8px 13px, transparent 13px 16px, color-mix(in srgb, var(--accent) 30%, transparent) 16px 21px); }

/* Mosaico generado (src/util.js → mosaic) */
.mosaic { display: block; pointer-events: none; }
.mosaic .ta { fill: var(--tile-a); }
.mosaic .tb { fill: var(--tile-b); }

/* ---------- Estructura del Campus ---------- */
.side {
  position: fixed; top: var(--shell-gap); bottom: var(--shell-gap); left: var(--shell-gap); width: var(--side); z-index: 40;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--side-bg); backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--sh-2);
}
.side-top { padding: 22px 20px 10px; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.side-logo img { width: 148px; height: auto; display: block; }
.app-name { display: inline-flex; align-items: center; gap: 6px; font-size: .7rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--brand-text); background: var(--brand-soft); padding: 5px 10px; border-radius: 999px; }
.app-name .ico { width: 14px; height: 14px; }
.side-nav { flex: 1; overflow-y: auto; padding: 4px 12px 12px; display: flex; flex-direction: column; gap: 3px; }
.side-sec { font-size: .67rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 16px 12px 6px; }
.side-nav a { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; color: var(--ink-2); font-weight: 560; font-size: .93rem; transition: background .15s, color .15s; }
.side-nav a:hover { background: var(--surface-3); color: var(--ink); }
.side-nav a.on { color: #fff; background: linear-gradient(120deg, var(--hero-1), var(--hero-2)); box-shadow: 0 10px 22px -12px rgba(0, 67, 143, .8); }
.side-nav a.on .ico { color: var(--accent); }
.side-nav a.on::after { content: ''; margin-left: auto; flex: none; width: 21px; height: 8px; transform: skewX(-16deg);
  background: linear-gradient(90deg, var(--accent) 0 5px, transparent 5px 8px, rgba(125, 193, 232, .6) 8px 13px, transparent 13px 16px, rgba(125, 193, 232, .3) 16px 21px); }
.side-nav .count { margin-left: auto; font-size: .72rem; font-weight: 700; background: var(--err); color: #fff; border-radius: 999px; padding: 1px 7px; }
.side-bottom { padding: 12px; }
.app-switch { position: relative; isolation: isolate; overflow: hidden; display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 18px; color: #fff !important; background: linear-gradient(135deg, #071a3d, #00438f 55%, #1873cf); box-shadow: 0 14px 30px -16px rgba(0, 67, 143, .9); }
.app-switch .as-art { position: absolute; right: -4px; top: 50%; transform: translateY(-50%); height: 120%; width: auto; opacity: .5; z-index: -1;
  mask-image: linear-gradient(90deg, transparent 25%, #000 80%); -webkit-mask-image: linear-gradient(90deg, transparent 25%, #000 80%); }
.app-switch .as-ico { width: 36px; height: 36px; border-radius: 11px; background: rgba(255, 255, 255, .16); display: grid; place-items: center; flex: none; }
.app-switch b { display: block; font-family: var(--font-display); font-size: 1rem; }
.app-switch small { display: block; font-size: .76rem; opacity: .82; }
.app-switch .ico.go { margin-left: auto; transition: transform .15s; }
.app-switch:hover .ico.go { transform: translateX(3px); }
.page { margin-left: calc(var(--side) + var(--shell-gap) * 2); min-height: 100vh; }
.page-inner { max-width: 1240px; margin: 0 auto; padding: 6px 34px 72px; }
.scrim { display: none; }

/* Barra superior: fecha, modo claro/oscuro y usuario */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 16px 34px 14px;
  background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.tb-date { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .86rem; font-weight: 560; }
.tb-date .ico { width: 16px; height: 16px; }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.tb-user { display: flex; align-items: center; gap: 10px; padding: 4px 14px 4px 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.tb-user:hover, .tb-user.on { border-color: var(--brand); color: var(--ink); }
.tb-user .avatar { width: 32px; height: 32px; }
.tb-user-t b { display: block; font-size: .85rem; line-height: 1.2; }
.tb-user-t small { display: block; font-size: .72rem; color: var(--muted); line-height: 1.2; }
.topbar .tb-menu, .topbar .tb-logo { display: none; }
.tb-logo img { height: 28px; display: block; }

/* Botón de modo claro / oscuro (muestra la opción a la que cambia) */
.theme-toggle { display: inline-flex; align-items: center; height: 42px; padding: 0 14px 0 5px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; font-size: .85rem; cursor: pointer; transition: border-color .15s; }
.theme-toggle:hover { border-color: var(--brand); }
.theme-toggle > span { display: inline-flex; align-items: center; gap: 8px; }
.theme-toggle .tt-ico { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--brand-text); }
.theme-toggle .tt-ico .ico { width: 17px; height: 17px; }
.theme-toggle .to-light { display: none; }
:root[data-theme="dark"] .theme-toggle .to-light { display: inline-flex; }
:root[data-theme="dark"] .theme-toggle .to-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] .theme-toggle .to-light { display: inline-flex; }
  :root[data-theme="system"] .theme-toggle .to-dark { display: none; }
}
:root[data-theme="dark"] .theme-toggle .tt-ico, :root[data-theme="system"] .theme-toggle .to-light .tt-ico { color: var(--sun); }
/* Versión compacta (solo el ícono) en barras angostas */
.studio-bar .theme-toggle, .sx-top .theme-toggle, .player-bar .theme-toggle { padding: 0 4px; height: 40px; }
.studio-bar .theme-toggle .tt-l, .sx-top .theme-toggle .tt-l, .player-bar .theme-toggle .tt-l { display: none; }

/* Selector de tema con 3 opciones (perfil) */
.theme-switch { display: inline-flex; background: var(--surface-3); border: 1px solid var(--line); border-radius: 14px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.theme-switch button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 0 14px; border: 0; background: transparent; color: var(--muted); border-radius: 10px; cursor: pointer; font: inherit; font-weight: 600; font-size: .88rem; }
.theme-switch button .ico { width: 16px; height: 16px; }
.theme-switch button:hover { color: var(--ink); }
.theme-switch button[aria-checked="true"] { background: var(--surface); color: var(--brand-text); box-shadow: var(--sh-1); }

/* ---------- Encabezados de página ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 10px 0 26px; flex-wrap: wrap; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.page-sub { margin: 8px 0 0; color: var(--muted); max-width: 720px; }
.crumbs { margin: 6px 0 6px; font-size: .85rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.crumbs a { color: var(--muted); font-weight: 560; }
.crumbs a:hover { color: var(--brand-text); }

/* Banda de bienvenida con mosaico */
.hero { position: relative; isolation: isolate; overflow: hidden; border-radius: 28px; padding: 34px 36px; margin: 6px 0 26px; color: #fff;
  background: linear-gradient(115deg, var(--hero-1) 0%, var(--hero-2) 62%, var(--hero-3) 135%); box-shadow: var(--sh-2);
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.hero .hero-art { position: absolute; right: -6px; top: 50%; transform: translateY(-50%); width: min(64%, 760px); height: auto; z-index: -1; opacity: .85;
  mask-image: linear-gradient(90deg, transparent, #000 45%); -webkit-mask-image: linear-gradient(90deg, transparent, #000 45%); }
.hero h1 { color: #fff; font-size: 2.3rem; }
.hero p { margin: 10px 0 0; color: rgba(255, 255, 255, .84); max-width: 560px; }
.hero .eyebrow { color: rgba(255, 255, 255, .78) !important; }
.hero-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-stats div { background: rgba(4, 22, 52, .32); border: 1px solid rgba(255, 255, 255, .18); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-radius: 18px; padding: 14px 18px; min-width: 120px; }
.hero-stats b { display: block; font-family: var(--font-display); font-size: 2.1rem; font-weight: 700; line-height: 1.05; letter-spacing: -.03em; }
.hero-stats span { font-size: .8rem; color: rgba(255, 255, 255, .82); }

/* ---------- Tarjetas y grillas ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 24px; box-shadow: var(--sh-1); }
.card + .card { margin-top: 18px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-h h2 { margin: 0; display: flex; align-items: center; gap: 9px; }
.card-h h2 .ico { color: var(--brand-text); }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.cols.wide { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.cols.side-r { grid-template-columns: minmax(0, 1fr) 340px; }
.stack-col { display: flex; flex-direction: column; gap: 18px; }
.stack-col > .card + .card, .cols > .card + .card { margin-top: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { position: relative; display: flex; align-items: center; gap: 14px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); color: var(--ink); box-shadow: var(--sh-1); transition: transform .18s, box-shadow .18s, border-color .18s; }
a.stat:hover { color: var(--ink); transform: translateY(-2px); box-shadow: var(--sh-2); border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.stat b { display: block; font-family: var(--font-display); font-size: 1.75rem; font-weight: 700; line-height: 1.05; letter-spacing: -.025em; }
.stat span { font-size: .82rem; color: var(--muted); }
.stat-ico { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); flex: none; }
.stat.ok .stat-ico { background: var(--ok-soft); color: var(--ok); }
.stat.warn .stat-ico { background: var(--err-soft); color: var(--err); }
.stat.warn b { color: var(--err); }
.ring { --p: 0; width: 48px; height: 48px; border-radius: 50%; flex: none; background: radial-gradient(closest-side, var(--surface) 70%, transparent 71% 100%), conic-gradient(var(--ok) calc(var(--p) * 1%), var(--surface-3) 0); }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 620; font-size: .9rem; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .15s, filter .15s; }
.btn:hover { border-color: var(--brand); color: var(--brand-text); }
.btn.primary { background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 86%, #fff), var(--brand)); border-color: var(--brand); color: var(--brand-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 8px 18px -10px color-mix(in srgb, var(--brand) 80%, transparent); }
.btn.primary:hover { color: var(--brand-ink); transform: translateY(-1px); filter: brightness(1.07); }
.btn.soft { background: var(--brand-soft); border-color: transparent; color: var(--brand-text); }
.btn.soft:hover { border-color: var(--brand); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn.danger { background: transparent; color: var(--err); border-color: color-mix(in srgb, var(--err) 30%, transparent); }
.btn.danger:hover { background: var(--err-soft); border-color: var(--err); color: var(--err); }
.btn.small { padding: 6px 11px; font-size: .82rem; border-radius: 10px; }
.btn.lg { padding: 13px 22px; font-size: 1rem; border-radius: 14px; }
.btn.block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; filter: none; }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; color: var(--muted); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.spin { width: 15px; height: 15px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Formularios ---------- */
label { display: flex; flex-direction: column; gap: 6px; font-size: .86rem; font-weight: 600; color: var(--ink-2); }
input, select, textarea { font: inherit; font-size: .93rem; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 13px; width: 100%; transition: border-color .15s, box-shadow .15s, background .15s; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--brand) 30%, var(--line)); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:focus, select:focus, textarea:focus { outline: none; background: var(--surface); border-color: var(--brand); box-shadow: var(--focus); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; padding: 0; accent-color: var(--brand); flex: none; }
input[type=file] { padding: 8px; }
.check { flex-direction: row; align-items: center; gap: 9px; font-weight: 500; color: var(--ink); cursor: pointer; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.inline-form { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.inline-form label { flex: 1; min-width: 160px; }
form.inline { display: inline; }
.hint { font-weight: 400; color: var(--muted); font-size: .8rem; }
label > .hint { margin-top: -5px; }
.dropzone { position: relative; border: 2px dashed var(--line); border-radius: var(--r); padding: 28px 18px; text-align: center; align-items: center; gap: 4px; color: var(--muted); font-weight: 500; cursor: pointer; background: var(--surface-2); transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-soft); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone b { color: var(--ink); }
.dz-ico { width: 48px; height: 48px; border-radius: 15px; background: var(--brand-soft); color: var(--brand-text); display: grid; place-items: center; margin-bottom: 6px; }
.dz-files { color: var(--brand-text); font-weight: 600; font-size: .85rem; word-break: break-all; }
.dropzone.has { border-style: solid; border-color: var(--brand); }
.picklist { max-height: 230px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 6px; display: flex; flex-direction: column; gap: 2px; background: var(--surface-2); }
.picklist.row { flex-direction: row; flex-wrap: wrap; max-height: none; gap: 6px; }
.picklist .check { padding: 7px 9px; border-radius: 9px; }
.picklist .check:hover { background: var(--surface-3); }
.picklist.row .check { background: var(--surface); border: 1px solid var(--line); }
.search { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 0 12px; color: var(--muted); flex: 1; max-width: 420px; }
.search input { border: 0; background: transparent; padding: 9px 0; box-shadow: none !important; }
.mini { padding: 7px 10px; font-size: .86rem; }

/* ---------- Mensajes ---------- */
.flash { display: flex; align-items: flex-start; gap: 10px; padding: 13px 16px; border-radius: 14px; margin: 6px 0 18px; font-size: .92rem; font-weight: 520; border: 1px solid color-mix(in srgb, currentColor 22%, transparent); }
.flash .ico { margin-top: 2px; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.err { background: var(--err-soft); color: var(--err); }
.flash.warn { background: var(--warn-soft); color: var(--warn); }
.flash.info { background: var(--brand-soft); color: var(--brand-text); }
.flash ul { margin: 0; padding-left: 18px; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 36px 16px; color: var(--muted); text-align: center; }
.empty-state > .ico { width: 36px; height: 36px; color: var(--brand-text); opacity: .75; margin-bottom: 4px; }
.empty-state b { color: var(--ink); font-family: var(--font-display); font-size: 1.08rem; font-weight: 650; }

/* ---------- Insignias y etiquetas ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: .76rem; font-weight: 650; white-space: nowrap; background: var(--surface-3); color: var(--muted); }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 2px; transform: skewX(-12deg); background: currentColor; }
.badge.plain::before { display: none; }
.s-incomplete, .s-browsed { background: var(--prog-soft); color: var(--prog); }
.s-failed { background: var(--err-soft); color: var(--err); }
.s-completed, .s-passed, .badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.brand { background: var(--brand-soft); color: var(--brand-text); }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: .8rem; color: var(--ink-2); background: var(--surface-3); padding: 3px 10px; border-radius: 999px; font-weight: 560; }
.pill .ico { width: 14px; height: 14px; }
.tag { display: inline-block; font-size: .75rem; background: var(--brand-soft); color: var(--brand-text); padding: 2px 8px; border-radius: 7px; margin: 1px 4px 1px 0; font-weight: 650; }
.due { display: inline-flex; align-items: center; gap: 5px; font-size: .8rem; font-weight: 620; color: var(--ink-2); }
.due .ico { width: 14px; height: 14px; }
.due.soon { color: var(--warn); }
.due.late { color: var(--err); }
.avatar { width: 34px; height: 34px; border-radius: 12px; background: linear-gradient(135deg, var(--brand-soft), color-mix(in srgb, var(--accent) 30%, var(--brand-soft))); color: var(--brand-text); display: grid; place-items: center; font-weight: 750; font-size: .76rem; flex: none; letter-spacing: .02em; }
.avatar.lg { width: 58px; height: 58px; font-size: 1.05rem; border-radius: 18px; }

/* ---------- Pestañas ---------- */
.tabs { display: flex; gap: 4px; padding: 5px; margin-bottom: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 15px; width: fit-content; max-width: 100%; overflow-x: auto; box-shadow: var(--sh-1); }
.tabs a, .tabs button { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border: 0; border-radius: 11px; background: none; font: inherit; font-weight: 620; font-size: .88rem; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs a:hover, .tabs button:hover { color: var(--ink); background: var(--surface-2); }
.tabs .on, .tabs .on:hover { color: var(--brand-text); background: var(--brand-soft); }
.tabs .n { font-size: .72rem; background: var(--surface-3); color: var(--ink-2); padding: 1px 7px; border-radius: 999px; }
.tabs .on .n { background: var(--surface); color: var(--brand-text); }

/* ---------- Tablas ---------- */
.table-card { padding: 0; overflow: hidden; }
.table-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.table-top .tabs { box-shadow: none; }
.scroll-x { overflow-x: auto; }
.audit-scroll { overflow-y: auto; overscroll-behavior: contain; }
.tbl.sticky-head thead th { position: sticky; top: 0; z-index: 1; }
.infinite-status { display: flex; align-items: center; gap: 8px; justify-content: center; padding: 10px 16px; margin: 0; }
.infinite-status[hidden] { display: none; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover td { background: color-mix(in srgb, var(--brand-soft) 45%, transparent); }
.tbl.compact td { padding: 10px 4px; }
.tbl.compact tbody tr:hover td { background: transparent; }
.card .tbl.compact { margin-top: 4px; }
.cell-user { display: flex; align-items: center; gap: 11px; color: var(--ink); min-width: 0; }
.cell-user strong { display: block; font-weight: 620; }
.cell-user small { display: block; color: var(--muted); font-size: .8rem; }
a.cell-user:hover strong { color: var(--brand-text); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 9px 18px; margin: 0; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 560; }

/* ---------- Barras de avance y listas ---------- */
.bar-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 10px 8px; border-radius: 12px; color: var(--ink); }
.bar-row:hover { background: var(--surface-2); color: var(--ink); }
.bar-label { font-weight: 560; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { display: flex; height: 10px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar i { display: block; height: 100%; }
.b-done { background: linear-gradient(90deg, color-mix(in srgb, var(--ok) 80%, #fff), var(--ok)); }
.b-prog { background: linear-gradient(90deg, var(--sun), var(--prog)); }
.bar-num { font-size: .82rem; color: var(--muted); font-weight: 650; min-width: 44px; text-align: right; }
.legend { display: flex; gap: 16px; margin-top: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; transform: skewX(-12deg); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-2); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .grow b { display: block; font-weight: 620; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .grow small { display: block; color: var(--muted); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Tarjetas de curso (alumno) ---------- */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.course-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; overflow: hidden; box-shadow: var(--sh-1); transition: transform .2s, box-shadow .2s, border-color .2s; }
.course-card:hover { transform: translateY(-3px); box-shadow: var(--sh-2); border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
.cc-cover { position: relative; isolation: isolate; height: 136px; padding: 16px; display: flex; align-items: flex-start; justify-content: space-between; color: #fff; background: linear-gradient(125deg, #002b63, #0a5cc4); }
.cc-cover .cc-art { position: absolute; right: 0; top: 0; height: 100%; width: auto; max-width: 78%; z-index: -1; opacity: .95;
  mask-image: linear-gradient(90deg, transparent, #000 35%); -webkit-mask-image: linear-gradient(90deg, transparent, #000 35%); }
.course-card.v1 .cc-cover { background: linear-gradient(125deg, #04366f, #2c8ad1); }
.course-card.v2 .cc-cover { background: linear-gradient(125deg, #071a3d, #1d5db5); }
.course-card.is-done .cc-cover { background: linear-gradient(125deg, #053d2e, #10a06a); }
/* Estado sobre la portada: vidrio oscuro con el punto del color del estado */
.cc-cover .badge { background: rgba(4, 18, 42, .38); color: #fff; border: 1px solid rgba(255, 255, 255, .22); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.cc-cover .badge::before { background: #b6c3d7; }
.cc-cover .s-incomplete::before, .cc-cover .s-browsed::before { background: #fbbf3c; }
.cc-cover .s-failed::before { background: #ff7377; }
.cc-cover .s-completed::before, .cc-cover .s-passed::before { background: #3dd598; }
.cc-cover .cc-ico { position: absolute; left: 18px; bottom: -22px; width: 50px; height: 50px; border-radius: 16px; display: grid; place-items: center; background: var(--surface); color: var(--brand-text); box-shadow: var(--sh-2); border: 1px solid var(--line); z-index: 2; }
.cc-body { display: flex; flex-direction: column; gap: 10px; padding: 34px 20px 20px; flex: 1; }
.cc-body h3 { margin: 0; font-size: 1.12rem; font-weight: 680; letter-spacing: -.015em; }
.cc-body p { margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cc-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.steps i { height: 6px; border-radius: 2px; transform: skewX(-18deg); background: var(--surface-3); }
.steps.s1 i:nth-child(-n+1) { background: var(--accent); }
.steps.s2 i:nth-child(-n+2) { background: linear-gradient(90deg, var(--sun), var(--prog)); }
.steps.s3 i { background: var(--ok); }
.steps-l { display: flex; justify-content: space-between; font-size: .72rem; color: var(--muted); margin-top: -4px; }
.cc-foot { margin-top: auto; padding-top: 6px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cc-files summary { cursor: pointer; font-size: .85rem; font-weight: 620; color: var(--brand-text); display: inline-flex; align-items: center; gap: 6px; list-style: none; }
.cc-files summary::-webkit-details-marker { display: none; }

/* ---------- Archivos ---------- */
.files { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.file { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--ink); background: var(--surface); }
a.file:hover { border-color: var(--brand); color: var(--ink); }
.file-ico { --fk: var(--muted); width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: .66rem; font-weight: 800; text-transform: uppercase; flex: none; color: var(--fk); background: color-mix(in srgb, var(--fk) 15%, transparent); }
.fk-xls { --fk: #1f9d5c; } .fk-doc { --fk: #3b7ddd; } .fk-pdf { --fk: #e0464b; }
.fk-ppt { --fk: #ef7a2c; } .fk-zip { --fk: #8b5cf6; } .fk-img { --fk: #13a3a3; }
.file-t { flex: 1; min-width: 0; }
.file-t b { display: block; font-size: .88rem; font-weight: 620; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-t small { color: var(--muted); font-size: .78rem; }
.files.compact .file { padding: 7px 9px; }
.files.compact .file-ico { width: 32px; height: 32px; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; gap: 14px; padding: 14px; }
.login-art { position: relative; isolation: isolate; overflow: hidden; border-radius: 30px; padding: 56px; display: flex; flex-direction: column; justify-content: flex-end; color: #fff;
  background: radial-gradient(760px 480px at 85% 8%, rgba(74, 167, 230, .55), transparent 62%), linear-gradient(150deg, #001634, #00438f 58%, #0a5cc4); }
.login-art .login-mosaic { position: absolute; top: 5%; right: -3%; width: 82%; height: auto; z-index: -1; opacity: .95;
  mask-image: linear-gradient(200deg, #000 30%, transparent 85%); -webkit-mask-image: linear-gradient(200deg, #000 30%, transparent 85%); }
.login-mosaic rect { animation: twinkle 7s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { filter: none; } 50% { filter: brightness(1.5); } }
.login-art h2 { font-size: 2.6rem; font-weight: 700; letter-spacing: -.035em; line-height: 1.06; margin: 0 0 14px; max-width: 540px; }
.login-art p { color: rgba(255, 255, 255, .82); max-width: 470px; margin: 0 0 24px; font-size: 1.04rem; }
.login-feats { display: flex; gap: 10px; flex-wrap: wrap; }
.login-feats span { display: inline-flex; align-items: center; gap: 7px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .2); backdrop-filter: blur(6px); padding: 8px 14px; border-radius: 999px; font-size: .86rem; font-weight: 560; }
.login-form { position: relative; display: grid; place-items: center; padding: 40px 18px; }
.login-form .theme-toggle { position: absolute; top: 10px; right: 10px; }
.login-box { width: 100%; max-width: 410px; background: var(--surface); border: 1px solid var(--line); border-radius: 28px; padding: 38px 34px; box-shadow: var(--sh-2); }
.login-box img { width: 180px; margin-bottom: 28px; }
.login-box h1 { font-size: 1.8rem; margin-bottom: 6px; }
.login-box > p { margin: 0 0 24px; }

/* ---------- Reproductor ---------- */
body.player { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.player-bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); flex: none; }
.player-bar .logo { height: 28px; }
.player-bar .sep { width: 1px; height: 24px; background: var(--line); }
.ptitle { font-family: var(--font-display); font-weight: 650; font-size: 1.02rem; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.save-status { font-size: .8rem; color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.save-status::before { content: ''; width: 7px; height: 7px; border-radius: 2px; transform: skewX(-12deg); background: var(--muted); }
.save-status.ok { color: var(--ok); } .save-status.ok::before { background: var(--ok); }
.save-status.err { color: var(--err); } .save-status.err::before { background: var(--err); }
#sco-frame { flex: 1; width: 100%; border: 0; background: #fff; }
.mat { position: relative; }
.mat .count { background: var(--brand); color: var(--brand-ink); border-radius: 99px; font-size: .72rem; padding: 0 7px; }
.mat-panel { display: none; position: absolute; right: 0; top: calc(100% + 8px); width: 360px; max-height: 70vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-3); padding: 16px; z-index: 30; }
.mat.open .mat-panel { display: block; }
.mat-panel h3 { margin-top: 0; }
.review-note { font-size: .8rem; }

/* ---------- Studio ---------- */
body.studio { min-height: 100vh; }
.studio-bar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; padding: 12px 26px; background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.studio-bar .brand { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.studio-bar .brand img { height: 30px; }
.studio-bar .brand .app-name { margin: 0; background: linear-gradient(120deg, var(--hero-1), var(--hero-2)); color: #fff; }
.studio-bar nav { display: flex; gap: 4px; margin-left: 10px; }
.studio-bar nav a { display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 11px; color: var(--ink-2); font-weight: 620; font-size: .9rem; }
.studio-bar nav a.on, .studio-bar nav a:hover { background: var(--surface-3); color: var(--ink); }
.studio-bar .right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.studio-main { max-width: 1180px; margin: 0 auto; padding: 30px 28px 70px; }
.roadmap { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.roadmap .card { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.roadmap .card .stat-ico { width: 38px; height: 38px; }
.roadmap .card b { font-size: .96rem; }
.roadmap .card p { margin: 0; color: var(--muted); font-size: .88rem; }
.dashed { border-style: dashed; background: var(--surface-2); box-shadow: none; }

/* ---------- Entrada suave del contenido ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.page-inner > *, .studio-main > * { animation: rise .45s cubic-bezier(.2, .7, .2, 1) both; }
.page-inner > :nth-child(2), .studio-main > :nth-child(2) { animation-delay: .04s; }
.page-inner > :nth-child(3), .studio-main > :nth-child(3) { animation-delay: .08s; }
.page-inner > :nth-child(4), .studio-main > :nth-child(4) { animation-delay: .12s; }
.page-inner > :nth-child(n+5), .studio-main > :nth-child(n+5) { animation-delay: .16s; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .cols, .cols.wide, .cols.side-r { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .side { transform: translateX(calc(-100% - 20px)); transition: transform .22s ease; }
  body.side-open .side { transform: none; }
  body.side-open .scrim { display: block; position: fixed; inset: 0; background: rgba(3, 10, 22, .5); z-index: 35; }
  .page { margin-left: 0; }
  .topbar { padding: 10px 14px; }
  .topbar .tb-menu, .topbar .tb-logo { display: grid; }
  .tb-date, .tb-user-t, .topbar .theme-toggle .tt-l { display: none; }
  .tb-user { padding: 3px; }
  .topbar .theme-toggle { padding: 0 4px; }
  .page-inner { padding: 6px 16px 60px; }
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .studio-bar { padding: 10px 14px; flex-wrap: wrap; }
  .studio-bar nav { display: none; }
  .studio-main { padding: 22px 16px 60px; }
}
@media (max-width: 640px) {
  h1 { font-size: 1.6rem; }
  .hero h1 { font-size: 1.8rem; }
  .two, .form-grid { grid-template-columns: 1fr; }
  .hero { padding: 24px 20px; border-radius: 22px; }
  .hero .hero-art { top: -4px; transform: none; width: 80%; opacity: .45; }
  .hero-stats { width: 100%; }
  .hero-stats div { min-width: 0; flex: 1; padding: 11px 13px; }
  .hero-stats b { font-size: 1.7rem; }
  .card { padding: 18px; }
  .login-box { padding: 30px 22px; }
  .bar-row { grid-template-columns: 1fr auto; }
  .bar-row .bar { grid-column: 1 / -1; grid-row: 2; }
  .player-bar .logo, .player-bar .sep, .save-status { display: none; }
  .mat-panel { width: min(92vw, 360px); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---- Modo lectura (editores en el panel) ---- */
.read-only .ro-note { margin-bottom: 18px; }
.read-only [hidden] { display: none !important; }
.read-only .ro-form input:disabled, .read-only .ro-form select:disabled, .read-only .ro-form textarea:disabled { opacity: 1; cursor: default; background: var(--surface-2); }
