/* ==========================================================================
   RutaTest · Sistema de diseño
   Tokens → base → layout → componentes → páginas
   ========================================================================== */

:root {
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  /* Marca */
  --brand: #0ae88a;
  --brand-2: #75fabf;
  --brand-strong: #08b56b;
  --brand-ink: #06140d;
  --brand-grad: linear-gradient(135deg, #0ae88a 0%, #4ff7ad 100%);
  --brand-text: #0ae88a;
  --amber: #ffb020;

  /* Estados (paleta validada, nunca para series) */
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --info: #c4c8ce;

  /* Superficies (oscuro por defecto) */
  --bg: #141414;
  --bg-2: #0f0f0f;
  --surface: #1c1c1c;
  --surface-2: #232524;
  --surface-3: #2e3130;
  --border: #292929;
  --border-strong: #3b403d;
  --text: #f7faf7;
  --text-2: #b5bab8;
  --muted: #919996;
  --grid: rgba(255, 255, 255, .06);
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, .5);
  --glow: 0 0 0 1px rgba(10, 232, 138, .45), 0 8px 24px rgba(10, 232, 138, .12);
  --good-text: #3ddc84;
  --critical-text: #ff6b6b;
  --warning-text: #fab219;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --sidebar-w: 220px;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f7faf7;
  --bg-2: #eef2ef;
  --surface: #ffffff;
  --surface-2: #f3f6f4;
  --surface-3: #e6ebe8;
  --border: #e1e6e3;
  --border-strong: #c9d0cc;
  --text: #141414;
  --text-2: #3b403d;
  --muted: #636966;
  --grid: rgba(20, 20, 20, .07);
  --brand-text: #05824d;
  --info: #636966;
  --shadow: 0 8px 24px rgba(20, 24, 60, .08);
  --shadow-lg: 0 30px 70px rgba(20, 24, 60, .14);
  --good-text: #067a06;
  --critical-text: #c02c2c;
  --warning-text: #a86b00;
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
a { color: inherit; text-decoration: none; }
a.link { color: var(--brand-text); font-weight: 600; }
a.link:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.2; letter-spacing: -.02em; }
h1 { font-size: clamp(1.35rem, 2vw, 1.65rem); font-weight: 800; }
h2 { font-size: 1.15rem; font-weight: 800; }
h3 { font-size: .98rem; font-weight: 700; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }
.ic { display: inline-block; vertical-align: middle; flex-shrink: 0; stroke-width: 2; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
::selection { background: rgba(10, 232, 138, .35); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

/* ---------- Utilidades ---------- */
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: .85rem; }
.xs { font-size: .75rem; }
.bold { font-weight: 700; }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.eyebrow { font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.grad-text { background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack-lg { display: flex; flex-direction: column; gap: 18px; }
.grow { flex: 1; min-width: 0; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; } .mt-4 { margin-top: 28px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; }
.grid { display: grid; gap: 14px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; } .span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }
@media (max-width: 1100px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-12 > [class*="span-"] { grid-column: span 12; }
}
@media (max-width: 720px) {
  .g-2, .g-3, .g-4 { grid-template-columns: minmax(0, 1fr); }
  .g-4.keep-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Tonos: cualquier componente con .tone-* expone --tone */
.tone-brand { --tone: var(--brand); --tone-text: var(--brand-text); }
.tone-good { --tone: var(--good); --tone-text: var(--good-text); }
.tone-warning { --tone: var(--warning); --tone-text: var(--warning-text); }
.tone-serious { --tone: var(--serious); --tone-text: var(--serious); }
.tone-critical { --tone: var(--critical); --tone-text: var(--critical-text); }
.tone-info { --tone: var(--info); --tone-text: var(--text-2); }
.tone-muted { --tone: var(--muted); --tone-text: var(--muted); }
.tone-amber { --tone: var(--amber); --tone-text: var(--amber); }

/* ---------- Botones ---------- */
.btn {
  --b-bg: var(--surface-3); --b-fg: var(--text); --b-bd: var(--border);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: 8px;
  font: 700 .85rem/1 var(--font); letter-spacing: -.005em;
  color: var(--b-fg); background: var(--b-bg); border: 1px solid var(--b-bd);
  cursor: pointer; transition: transform .15s ease, box-shadow .2s ease, background .2s, border-color .2s;
  white-space: nowrap; text-decoration: none;
}
.btn:hover { transform: translateY(-1px); border-color: var(--border-strong); }
.btn:active { transform: translateY(0); }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.btn-primary { --b-bg: var(--brand); --b-fg: var(--brand-ink); --b-bd: transparent; background: var(--brand); }
.btn-primary:hover { background: #4ff7ad; border-color: transparent; }
.btn-ghost { --b-bg: transparent; --b-bd: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-outline { --b-bg: transparent; --b-bd: var(--border-strong); }
.btn-good { --b-bg: var(--good); --b-fg: #fff; --b-bd: transparent; }
.btn-danger { --b-bg: transparent; --b-fg: var(--critical-text); --b-bd: color-mix(in srgb, var(--critical) 45%, transparent); }
.btn-sm { height: 30px; padding: 0 10px; font-size: .78rem; border-radius: 7px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: .92rem; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; padding: 0; }
form.inline { display: inline; }

/* ---------- Chips y badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border);
  font-size: .8rem; font-weight: 700; color: var(--text-2); white-space: nowrap;
}
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: .72rem; font-weight: 700; line-height: 1.4; white-space: nowrap;
  color: var(--tone-text, var(--text-2));
  background: color-mix(in srgb, var(--tone, var(--muted)) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--tone, var(--muted)) 28%, transparent);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tone, var(--muted)); display: inline-block; flex-shrink: 0; }

/* ---------- Tarjetas ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; position: relative; min-width: 0;
}
.card.pad-lg { padding: 22px; }
.card.flush { padding: 0; overflow: hidden; }
.card.hover { transition: transform .2s ease, border-color .2s, box-shadow .2s; }
.card.hover:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-title { display: flex; align-items: center; gap: 8px; font-size: .92rem; font-weight: 800; margin: 0; }
.card-title .ic { color: var(--muted); }
.card-sub { font-size: .82rem; color: var(--muted); margin: 2px 0 0; }
.card-glow { background: radial-gradient(120% 140% at 100% 0%, rgba(10, 232, 138, .10), transparent 55%), var(--surface); }
.icon-tile {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0;
  color: var(--tone, var(--brand));
  background: color-mix(in srgb, var(--tone, var(--brand)) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--tone, var(--brand)) 25%, transparent);
}
.icon-tile.lg { width: 42px; height: 42px; border-radius: 11px; }

/* KPI */
.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi-label { font-size: .78rem; font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: 1.4rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.kpi-value small { font-size: .9rem; color: var(--muted); font-weight: 700; margin-left: 2px; }
.kpi-foot { font-size: .78rem; color: var(--muted); }
.delta { font-weight: 800; font-size: .8rem; }
.delta.up { color: var(--good-text); }
.delta.down { color: var(--critical-text); }

/* Barras de progreso */
.bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; position: relative; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: var(--tone, var(--brand-grad)); width: calc(var(--p, 0) * 1%); transition: width .8s cubic-bezier(.2, .8, .2, 1); }
.bar.brand > span { background: var(--brand-grad); }
.bar.thin { height: 6px; }
.bar.thick { height: 12px; }

/* Anillo de progreso (conic-gradient) */
.ring {
  --size: 120px; --thick: 12px; --p: 0; --c: var(--brand);
  width: var(--size); height: var(--size); border-radius: 50%; position: relative; flex-shrink: 0;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-3) 0);
  display: grid; place-items: center;
}
.ring::before { content: ""; position: absolute; inset: var(--thick); border-radius: 50%; background: var(--ring-bg, var(--surface)); }
.ring > * { position: relative; text-align: center; line-height: 1.1; }
.ring .ring-value { font-size: calc(var(--size) * .24); font-weight: 800; letter-spacing: -.03em; }
.ring .ring-label { font-size: .7rem; color: var(--muted); font-weight: 700; }
.ring.grad { background: conic-gradient(var(--brand) calc(var(--p) * 1%), var(--surface-3) 0); }

/* ---------- Formularios ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label, .label { font-size: .85rem; font-weight: 700; color: var(--text-2); }
.field .help, .helptext { font-size: .78rem; color: var(--muted); }
.field .error, .errorlist { color: var(--critical-text); font-size: .82rem; font-weight: 600; list-style: none; padding: 0; margin: 4px 0 0; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=url], input[type=search], select, textarea {
  width: 100%; height: 38px; padding: 0 12px; border-radius: 8px;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong);
  font: 500 .95rem var(--font); transition: border-color .2s, box-shadow .2s;
}
textarea { height: auto; padding: 12px 14px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(10, 232, 138, .18); }
input[type=checkbox], input[type=radio] { accent-color: var(--brand); width: 18px; height: 18px; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: .88rem; color: var(--text-2); cursor: pointer; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.choice-grid label {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border); font-size: .88rem; font-weight: 600; transition: border-color .15s, background .15s;
}
.choice-grid label:hover { border-color: var(--border-strong); }
.choice-grid label:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, var(--surface-2)); }
.segmented { display: flex; flex-wrap: wrap; gap: 8px; }
.segmented label { flex: 1; min-width: 120px; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: flex; align-items: center; justify-content: center; height: 36px; padding: 0 12px; border-radius: 8px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border); font-weight: 700; font-size: .88rem; color: var(--text-2);
}
.segmented input:checked + span { border-color: var(--brand); color: var(--text); background: color-mix(in srgb, var(--brand) 14%, var(--surface-2)); }
.segmented input:focus-visible + span { outline: 2px solid var(--brand); }

/* ---------- Tablas ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: var(--surface-2); }

/* ---------- Mensajes ---------- */
.messages { position: fixed; top: 16px; right: 16px; z-index: 100; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 32px)); }
.toast {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg);
  animation: toast-in .35s cubic-bezier(.2, .8, .2, 1); font-size: .9rem; font-weight: 600;
}
.toast .ic { color: var(--tone); margin-top: 2px; }
.toast button { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px) scale(.98); } }

.banner {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--tone, var(--brand)) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--tone, var(--brand)) 30%, transparent);
}
.banner .ic { color: var(--tone, var(--brand)); }
.banner p { margin: 0; }

/* ==========================================================================
   Layout de la aplicación
   ========================================================================== */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 16px 12px;
  background: var(--bg-2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 6px;
}
.logo { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.05rem; letter-spacing: -.03em; padding: 4px 8px 12px; }
.logo-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--brand); display: grid; place-items: center; color: var(--brand-ink); }
.logo b { font-weight: 800; }
.logo .logo-tld { font-weight: 600; color: var(--muted); }
.logo span.tag { font-size: .62rem; padding: 2px 6px; border-radius: 6px; background: var(--surface-3); color: var(--muted); letter-spacing: .05em; }
.nav-section { font-size: .68rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: 10px 10px 4px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px;
  color: var(--text-2); font-weight: 650; font-size: .86rem; transition: background .15s, color .15s; position: relative;
}
.nav-link:hover { background: var(--surface); color: var(--text); }
.nav-link.is-active { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.nav-link.is-active::before { content: ""; position: absolute; left: -12px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.nav-link.is-active .ic { color: var(--brand); }
.nav-link .count { margin-left: auto; font-size: .72rem; font-weight: 800; padding: 1px 8px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); }
.nav-link .new { margin-left: auto; font-size: .62rem; font-weight: 800; padding: 2px 6px; border-radius: 5px; background: var(--brand); color: var(--brand-ink); letter-spacing: .05em; }
.sidebar-foot { margin-top: auto; padding-top: 16px; }
.plan-card { padding: 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); }
.plan-card.upsell { background: var(--surface); border-color: rgba(10, 232, 138, .35); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
  padding: 9px 24px; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--border);
}
.topbar .greeting { font-weight: 700; color: var(--text-2); }
.topbar .spacer { flex: 1; }
.streak-chip { color: var(--amber); }
.streak-chip.off { color: var(--muted); }
.level-chip { gap: 8px; padding-right: 6px; }
.level-chip .lvl { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; background: var(--brand); color: var(--brand-ink); font-size: .7rem; }
.level-chip .mini-bar { width: 54px; height: 5px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.level-chip .mini-bar span { display: block; height: 100%; background: var(--brand); }
.avatar {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  background: var(--surface-3); color: var(--text); font-weight: 800; font-size: .8rem;
  border: 1px solid var(--border-strong);
}
.menu { position: relative; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; padding: 8px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); display: none; z-index: 50;
}
.menu.open .menu-panel { display: block; }
.menu-panel a, .menu-panel button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 10px; font: 600 .9rem var(--font);
  color: var(--text-2); background: none; border: 0; cursor: pointer; text-align: left;
}
.menu-panel a:hover, .menu-panel button:hover { background: var(--surface-2); color: var(--text); }
.menu-panel .menu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
/* Campana de avisos */
.notif-btn { position: relative; }
.notif-count {
  position: absolute; top: 3px; right: 3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px;
  display: grid; place-items: center; background: var(--brand); color: var(--brand-ink); font-size: .62rem; font-weight: 800; line-height: 1;
}
.notif-panel { width: 300px; }
.notif-panel a { align-items: flex-start; }
.notif-panel a .ic { margin-top: 2px; color: var(--brand-text); flex-shrink: 0; }
.notif-panel .grow { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-title { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-empty { padding: 6px 12px 10px; margin: 0; }
.notif-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.notif-item { display: flex; align-items: flex-start; gap: 2px; border-radius: 10px; }
.notif-item:hover { background: var(--surface-2); }
.notif-item > a { flex: 1; min-width: 0; }
.notif-item > a:hover { background: none; }
.menu-panel .notif-x {
  width: 28px; height: 28px; padding: 0; margin: 6px 6px 0 0; justify-content: center; border-radius: 8px; color: var(--muted);
  opacity: 0; transition: opacity .15s;
}
.notif-item:hover .notif-x, .notif-x:focus-visible { opacity: 1; }
.menu-panel .notif-x:hover { background: var(--surface-3); color: var(--text); }
.menu-panel .notif-clear { width: auto; padding: 4px 8px; font-size: .78rem; font-weight: 700; color: var(--brand-text); }
.menu-panel .notif-clear:hover { background: var(--surface-2); color: var(--brand-text); }
@media (hover: none) { .notif-x { opacity: 1; } }
.content { padding: 18px 24px 48px; max-width: 1320px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.menu-toggle { display: none; }
.mobile-nav { display: none; }

@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 60; width: 280px; transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 55; }
  .menu-toggle { display: inline-flex; }
  .topbar { padding: 12px 16px; }
  .topbar .greeting, .level-chip .mini-bar { display: none; }
  .content { padding: 20px 16px 96px; }
  .mobile-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; justify-content: space-around;
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg-2) 92%, transparent);
    backdrop-filter: blur(12px); border-top: 1px solid var(--border);
  }
  .mobile-nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: .68rem; font-weight: 700; color: var(--muted); padding: 4px 8px; border-radius: 10px; }
  .mobile-nav a.is-active { color: var(--text); }
  .mobile-nav a.is-active .ic { color: var(--brand); }
}

/* ==========================================================================
   Layout público
   ========================================================================== */
.public-nav {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 24px; padding: 14px max(16px, calc((100vw - 1200px) / 2));
  background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border);
}
.public-nav .links { display: flex; gap: 6px; }
.public-nav .links a { padding: 8px 12px; border-radius: 10px; font-weight: 650; color: var(--text-2); font-size: .92rem; }
.public-nav .links a:hover { color: var(--text); background: var(--surface); }
.public-nav .spacer { flex: 1; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.section { padding: 64px 0; }
.section-head { text-align: center; max-width: 680px; margin: 0 auto 32px; }
.section-head h2 { font-size: clamp(1.5rem, 2.6vw, 2.1rem); letter-spacing: -.035em; }
.section-head p { color: var(--text-2); font-size: .98rem; }
.footer { border-top: 1px solid var(--border); padding: 40px 0; color: var(--muted); font-size: .88rem; }
@media (max-width: 760px) {
  .public-nav .links { display: none; }
  .section { padding: 64px 0; }
}

/* ---------- Landing ---------- */
.hero { position: relative; overflow: hidden; padding: 48px 0 64px; }
.hero::before {
  content: ""; position: absolute; inset: -20% -10% auto; height: 120%;
  background:
    radial-gradient(40% 50% at 20% 20%, rgba(10, 232, 138, .14), transparent 70%),
    radial-gradient(35% 45% at 85% 30%, rgba(10, 232, 138, .08), transparent 70%);
  pointer-events: none; filter: blur(10px);
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 56px 56px; mask-image: radial-gradient(70% 70% at 50% 30%, #000, transparent);
}
.hero .container { position: relative; z-index: 1; display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center; }
.hero h1 { font-size: clamp(2rem, 4vw, 3.1rem); letter-spacing: -.045em; line-height: 1.05; margin-bottom: 16px; }
.hero .lead { font-size: 1rem; color: var(--text-2); max-width: 520px; margin-bottom: 22px; }
.hero-stats { display: flex; gap: 28px; margin-top: 26px; flex-wrap: wrap; }
.hero-stats b { display: block; font-size: 1.3rem; font-weight: 800; letter-spacing: -.03em; }
.hero-stats span { font-size: .82rem; color: var(--muted); font-weight: 600; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); font-size: .84rem; font-weight: 700; color: var(--text-2); margin-bottom: 22px; }
.pill b { padding: 3px 10px; border-radius: 99px; background: var(--brand); color: var(--brand-ink); font-size: .7rem; }
.demo-card { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow-lg); position: relative; }
.demo-card .floating {
  position: absolute; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow); font-size: .8rem; font-weight: 700; display: flex; align-items: center; gap: 10px; animation: float 6s ease-in-out infinite;
}
.demo-card .floating.f1 { top: -22px; right: -18px; }
.demo-card .floating.f2 { bottom: -24px; left: -24px; animation-delay: -3s; }
@keyframes float { 50% { transform: translateY(-8px); } }
@media (max-width: 960px) {
  .hero .container { grid-template-columns: minmax(0, 1fr); }
  .demo-card .floating { display: none; }
}
.feature { padding: 18px; }
.feature h3 { margin-top: 16px; }
.feature p { color: var(--text-2); margin: 0; font-size: .93rem; }
.showcase { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.showcase + .showcase { margin-top: 96px; }
.showcase.reverse > :first-child { order: 2; }
.showcase ul { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 12px; }
.showcase li { display: flex; gap: 12px; align-items: flex-start; color: var(--text-2); }
.showcase li .ic { color: var(--good-text); margin-top: 2px; }
@media (max-width: 900px) { .showcase { grid-template-columns: minmax(0, 1fr); } .showcase.reverse > :first-child { order: 0; } }
.faq details { border-bottom: 1px solid var(--border); padding: 18px 0; }
.faq summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.3rem; color: var(--muted); line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq p { color: var(--text-2); margin: 12px 0 0; }
.cta-band { border-radius: var(--radius-lg); padding: 40px 24px; text-align: center; background: radial-gradient(80% 140% at 50% 0%, rgba(10, 232, 138, .16), transparent 60%), var(--surface); border: 1px solid rgba(10, 232, 138, .3); }

/* ---------- Precios ---------- */
.plans { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: stretch; }
.plan { display: flex; flex-direction: column; gap: 12px; padding: 20px; }
.plan.featured { border-color: var(--brand); box-shadow: var(--glow); }
.plan .price { font-size: 2rem; font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.plan .price small { font-size: .95rem; color: var(--muted); font-weight: 700; letter-spacing: 0; }
.plan ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; flex: 1; }
.plan li { display: flex; gap: 10px; font-size: .92rem; color: var(--text-2); }
.plan li .ic { color: var(--good-text); }
.ribbon { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); padding: 4px 12px; border-radius: 99px; background: var(--brand); color: var(--brand-ink); font-size: .7rem; font-weight: 800; letter-spacing: .04em; white-space: nowrap; }
@media (max-width: 1180px) { .plans { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .plans { grid-template-columns: minmax(0, 1fr); } }
.plan li.plan-headline { color: var(--text); font-weight: 700; }
.plan ul { gap: 8px; align-content: start; }
.plan li { font-size: .86rem; }
.plan-free { background: var(--bg-2); }

/* ---------- Auth: ver static/css/auth.css ---------- */

/* ==========================================================================
   Dashboard
   ========================================================================== */
.welcome { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: center; padding: 18px 20px; overflow: hidden; }
.welcome h1 { font-size: 1.35rem; }
.welcome .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.welcome-rings { display: flex; gap: 16px; }
.ring-block { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ring-block .caption { font-size: .78rem; font-weight: 700; color: var(--text-2); text-align: center; }
@media (max-width: 860px) { .welcome { grid-template-columns: minmax(0, 1fr); } .welcome-rings { justify-content: space-around; } }

.stat-tile { display: flex; gap: 14px; align-items: flex-start; }
.topic-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) 92px; gap: 12px; align-items: center; padding: 10px 0; }
.topic-row + .topic-row { border-top: 1px solid var(--border); }
.topic-row .t-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); }
.topic-row .t-name { font-weight: 700; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topic-row .t-meta { font-size: .75rem; color: var(--muted); }
.topic-row .t-val { text-align: right; font-weight: 800; font-size: .95rem; }

.reco { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.reco h4 { margin: 0 0 3px; font-size: .88rem; }
.reco p { margin: 0 0 8px; font-size: .8rem; color: var(--text-2); }
.reco .row { gap: 8px; }

.session-item { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 0; }
.session-item + .session-item { border-top: 1px solid var(--border); }
.score-pill { min-width: 58px; text-align: center; padding: 6px 10px; border-radius: 10px; font-weight: 800; font-size: .88rem;
  color: var(--tone-text); background: color-mix(in srgb, var(--tone) 14%, transparent); }

/* Heatmap de actividad */
.heatmap { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.heatmap .cell { width: 12px; height: 12px; border-radius: 3px; background: var(--surface-3); }
.heatmap .cell.l1 { background: color-mix(in srgb, var(--brand) 30%, var(--surface-3)); }
.heatmap .cell.l2 { background: color-mix(in srgb, var(--brand) 55%, var(--surface-3)); }
.heatmap .cell.l3 { background: color-mix(in srgb, var(--brand) 80%, var(--surface-3)); }
.heatmap .cell.l4 { background: var(--brand-2); }
.heatmap .cell.future { background: transparent; border: 1px dashed var(--border); }
.heat-legend { display: flex; align-items: center; gap: 4px; font-size: .72rem; color: var(--muted); }
.heat-legend .cell { width: 11px; height: 11px; border-radius: 3px; }

.chart-box { position: relative; height: 200px; }
.chart-box.sm { height: 150px; }
.chart-box.lg { height: 250px; }

.empty { text-align: center; padding: 28px 16px; color: var(--muted); }
.empty .ic { color: var(--muted); margin-bottom: 8px; }
.empty p { margin: 6px 0 14px; }

.challenge { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; align-items: center; }
.challenge + .challenge { margin-top: 12px; }
.challenge.done .icon-tile { --tone: var(--good); }

/* ==========================================================================
   Hub de tests
   ========================================================================== */
.mode-card { display: flex; flex-direction: column; gap: 8px; padding: 16px; cursor: pointer; text-align: left; width: 100%; font: inherit; color: inherit; overflow: hidden; }
.mode-card h3 { margin: 4px 0 0; }
.mode-card p { margin: 0; color: var(--text-2); font-size: .82rem; }
.mode-card .foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: .8rem; font-weight: 700; color: var(--muted); }
.mode-card .foot .go { color: var(--text); display: inline-flex; align-items: center; gap: 4px; }
.mode-card.locked { opacity: .75; }
.mode-card.hero-mode { grid-column: span 2; background: radial-gradient(100% 140% at 100% 0%, rgba(10, 232, 138, .12), transparent 55%), var(--surface); border-color: rgba(10, 232, 138, .4); }
.mode-card.hero-mode h3 { font-size: 1.15rem; }
.mode-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.mode-grid form { display: contents; }
@media (max-width: 1100px) { .mode-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .mode-grid { grid-template-columns: minmax(0, 1fr); } .mode-card.hero-mode { grid-column: auto; } }
.exam-facts { display: flex; gap: 18px; flex-wrap: wrap; font-size: .82rem; font-weight: 700; color: var(--text-2); }
.exam-facts span { display: inline-flex; gap: 6px; align-items: center; }
.test-tile { display: flex; flex-direction: column; gap: 8px; padding: 14px; }
.test-tile .n { font-size: 1.5rem; font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.topic-tile { display: flex; flex-direction: column; gap: 9px; padding: 14px; border-top: 3px solid var(--c); }

/* ==========================================================================
   Ejecución del test (runner)
   ========================================================================== */
.runner-page { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.runner-top {
  position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 8px 20px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border);
}
.runner-top .title { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.runner-top .right { display: flex; justify-content: flex-end; gap: 10px; align-items: center; }
.timer { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border-strong); font-family: var(--mono); font-weight: 700; font-size: 1.05rem; }
.timer.warn { color: var(--warning-text); border-color: color-mix(in srgb, var(--warning) 50%, transparent); }
.timer.danger { color: #fff; background: var(--critical); border-color: transparent; animation: pulse 1s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(208, 59, 59, .25); } }
.runner-progress { height: 4px; background: var(--surface-3); }
.runner-progress span { display: block; height: 100%; background: var(--brand); transition: width .35s ease; }
.runner-body { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 18px; padding: 20px 20px 96px; max-width: 1120px; width: 100%; margin: 0 auto; }
.q-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow); animation: q-in .3s ease; }
@keyframes q-in { from { opacity: 0; transform: translateY(8px); } }
.q-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.q-number { font-size: .85rem; font-weight: 800; color: var(--muted); }
.q-number b { color: var(--text); font-size: 1.05rem; }
.q-topic { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; color: var(--text-2); }
.q-topic .dot { background: var(--c); }
.q-text { font-size: clamp(1.02rem, 1.4vw, 1.15rem); font-weight: 700; letter-spacing: -.01em; line-height: 1.4; margin: 0 0 16px; }
.q-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.q-layout.has-image { grid-template-columns: 170px minmax(0, 1fr); align-items: start; }
.q-image { background: #fff; border-radius: 12px; padding: 12px; display: grid; place-items: center; border: 1px solid var(--border); aspect-ratio: 1; }
.q-image img { max-height: 140px; object-fit: contain; }
.zoomable { position: relative; display: grid; place-items: center; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 8px; }
.zoomable .zoom-hint { position: absolute; right: -4px; bottom: -4px; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: rgba(15, 17, 26, .72); color: #fff; opacity: .8; transition: opacity .15s; }
.zoomable.inline { display: inline-grid; width: auto; margin-bottom: 10px; }
.zoomable:hover .zoom-hint, .zoomable:focus-visible .zoom-hint { opacity: 1; }
.lightbox { position: fixed; inset: 0; z-index: 90; display: none; place-items: center; padding: 24px; background: rgba(5, 6, 12, .86); backdrop-filter: blur(6px); cursor: zoom-out; }
.lightbox.open { display: grid; }
.lightbox img { width: min(92vw, 760px); max-height: 86vh; object-fit: contain; background: #fff; border-radius: 14px; padding: 14px; box-shadow: var(--shadow-lg); animation: q-in .2s ease; }
.lightbox-close { position: absolute; top: 16px; right: 16px; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); }
@media (max-width: 700px) { .q-layout.has-image { grid-template-columns: minmax(0, 1fr); } .q-image { aspect-ratio: auto; max-height: 200px; } }
.choices { display: grid; gap: 8px; }
.choice {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) 22px; align-items: center; gap: 10px; width: 100%;
  padding: 9px 12px; border-radius: 10px; text-align: left; cursor: pointer;
  background: var(--surface-2); border: 1.5px solid var(--border); color: var(--text);
  font: 600 .92rem/1.4 var(--font); transition: border-color .15s, background .15s, transform .15s;
}
.choice:hover:not(:disabled) { border-color: var(--border-strong); transform: translateX(3px); }
.choice .letter { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; background: var(--surface-3); color: var(--text-2); transition: background .15s, color .15s; }
.choice .state { color: transparent; }
.choice.selected { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, var(--surface-2)); }
.choice.selected .letter { background: var(--brand); color: var(--brand-ink); }
.choice.correct { border-color: var(--good); background: color-mix(in srgb, var(--good) 14%, var(--surface-2)); }
.choice.correct .letter { background: var(--good); color: #fff; }
.choice.correct .state { color: var(--good-text); }
.choice.wrong { border-color: var(--critical); background: color-mix(in srgb, var(--critical) 12%, var(--surface-2)); }
.choice.wrong .letter { background: var(--critical); color: #fff; }
.choice.wrong .state { color: var(--critical-text); }
.choice:disabled { cursor: default; }
.choice.dim { opacity: .55; }
.explain { margin-top: 14px; padding: 12px 14px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--tone) 35%, transparent); background: color-mix(in srgb, var(--tone) 9%, var(--surface)); animation: q-in .3s ease; }
.explain h4 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; color: var(--tone-text); }
.explain p { margin: 0; color: var(--text-2); }
.explain .ref { margin-top: 10px; font-size: .78rem; color: var(--muted); font-weight: 700; }
.runner-actions { display: flex; align-items: center; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.runner-actions .spacer { flex: 1; }
.bookmark-btn.on { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 50%, transparent); background: color-mix(in srgb, var(--amber) 10%, transparent); }
.bookmark-btn.on .ic { fill: currentColor; }
/* Lectura en voz alta: botón, resaltado de lo que se está leyendo y controles del panel */
.voice-btn.on { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 50%, transparent); background: color-mix(in srgb, var(--brand) 10%, transparent); }
.voice-btn.on .ic { fill: currentColor; }
.q-text.reading { color: var(--brand); transition: color .2s; }
.choice.reading { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.explain.reading { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.voice-switch { font-weight: 700; line-height: 1.3; }
.aeol-switch.voice-switch input:checked + .track { background: color-mix(in srgb, var(--brand) 30%, var(--surface-3)); border-color: var(--brand); }
.aeol-switch.voice-switch input:checked + .track::after { background: var(--brand); }
.voice-rate { display: flex; align-items: center; gap: 10px; }
.voice-rate input { flex: 1; min-width: 0; accent-color: var(--brand); }
.kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px; background: var(--surface-3); border: 1px solid var(--border-strong); font: 700 .72rem var(--mono); color: var(--text-2); }
.runner-side { position: sticky; top: 70px; align-self: start; display: flex; flex-direction: column; gap: 12px; }
.navigator { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.nav-q {
  aspect-ratio: 1; border-radius: 7px; border: 1px solid var(--border); background: var(--surface-2);
  font: 800 .8rem var(--mono); color: var(--text-2); cursor: pointer; position: relative; transition: transform .1s;
}
.nav-q:hover { transform: scale(1.06); }
.nav-q.answered { background: color-mix(in srgb, var(--brand) 22%, var(--surface-2)); color: var(--text); border-color: color-mix(in srgb, var(--brand) 40%, transparent); }
.nav-q.correct { background: color-mix(in srgb, var(--good) 25%, var(--surface-2)); border-color: color-mix(in srgb, var(--good) 50%, transparent); color: var(--text); }
.nav-q.wrong { background: color-mix(in srgb, var(--critical) 25%, var(--surface-2)); border-color: color-mix(in srgb, var(--critical) 50%, transparent); color: var(--text); }
.nav-q.current { outline: 2px solid var(--brand); outline-offset: 2px; }
.nav-q.marked::after { content: ""; position: absolute; top: -3px; right: -3px; width: 9px; height: 9px; border-radius: 50%; background: var(--amber); border: 2px solid var(--surface); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: .72rem; color: var(--muted); font-weight: 600; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.live-score { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.live-score div { padding: 8px; border-radius: 8px; background: var(--surface-2); text-align: center; }
.live-score b { display: block; font-size: 1.15rem; font-weight: 800; }
.live-score span { font-size: .72rem; font-weight: 700; color: var(--muted); }
.runner-bottom { display: none; }
@media (max-width: 980px) {
  .runner-body { grid-template-columns: minmax(0, 1fr); padding: 18px 12px 120px; }
  .runner-side { position: static; }
  .q-card { padding: 20px; border-radius: 20px; }
  .runner-top { grid-template-columns: auto 1fr auto; padding: 10px 12px; }
  .runner-top .title { font-size: .9rem; }
  .runner-actions .desktop { display: none; }
  .runner-bottom { display: flex; position: fixed; left: 0; right: 0; bottom: 0; gap: 10px; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg-2) 92%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--border); z-index: 20; }
  .runner-bottom .btn { flex: 1; }
}
.modal-backdrop { position: fixed; inset: 0; background: rgba(5, 6, 12, .7); backdrop-filter: blur(6px); display: none; place-items: center; z-index: 80; padding: 16px; }
.modal-backdrop.open { display: grid; }
.modal { width: 100%; max-width: 460px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); padding: 28px; box-shadow: var(--shadow-lg); animation: q-in .25s ease; }

/* ==========================================================================
   Resultados
   ========================================================================== */
.result-hero { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px; align-items: center; padding: 20px; overflow: hidden; }
.result-hero.passed { background: radial-gradient(70% 120% at 0% 0%, rgba(12, 163, 12, .25), transparent 60%), var(--surface); }
.result-hero.failed { background: radial-gradient(70% 120% at 0% 0%, rgba(208, 59, 59, .22), transparent 60%), var(--surface); }
.result-hero .verdict { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 800; letter-spacing: -.04em; margin: 6px 0; }
.result-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.result-stats > div { padding: 10px; border-radius: 10px; background: color-mix(in srgb, var(--surface-2) 80%, transparent); border: 1px solid var(--border); }
.result-stats b { display: block; font-size: 1.2rem; font-weight: 800; letter-spacing: -.03em; }
.result-stats span { font-size: .75rem; font-weight: 700; color: var(--muted); }
@media (max-width: 760px) { .result-hero { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; } .result-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.review-item { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow: hidden; }
.review-item + .review-item { margin-top: 8px; }
.review-item summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 14px; }
.review-item summary::-webkit-details-marker { display: none; }
.review-item .n { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font: 800 .82rem var(--mono); color: #fff; background: var(--tone); }
.review-item .body { padding: 0 14px 14px 52px; }
.review-item .answer-line { display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px; border-radius: 10px; margin-bottom: 6px; font-size: .9rem; }
.review-item .answer-line.yours { background: color-mix(in srgb, var(--critical) 10%, transparent); color: var(--critical-text); }
.review-item .answer-line.right { background: color-mix(in srgb, var(--good) 10%, transparent); color: var(--good-text); }
.review-item .answer-line.other { color: var(--muted); }
@media (max-width: 600px) { .review-item .body { padding-left: 18px; } }
.compare-bars { display: flex; align-items: flex-end; gap: 10px; height: 160px; padding-top: 10px; }
.compare-bars .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.compare-bars .b { width: 100%; max-width: 46px; border-radius: 4px 4px 0 0; background: var(--surface-3); height: calc(var(--p) * 1%); min-height: 4px; position: relative; }
.compare-bars .col.current .b { background: var(--brand); }
.compare-bars .v { font-size: .75rem; font-weight: 800; color: var(--text-2); }
.compare-bars .l { font-size: .7rem; color: var(--muted); font-weight: 600; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; }

/* ==========================================================================
   OPS · centro de operaciones
   ========================================================================== */
.ops { --ops-line: rgba(10, 232, 138, .18); }
.ops-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.ops-title { display: flex; align-items: center; gap: 14px; }
.ops-title h1 { margin: 0; font-size: 1.5rem; }
.ops-status { display: inline-flex; align-items: center; gap: 8px; font: 700 .78rem var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); padding: 6px 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); }
.ops-status .live { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 rgba(12, 163, 12, .6); animation: live 2s infinite; }
@keyframes live { 70% { box-shadow: 0 0 0 8px rgba(12, 163, 12, 0); } 100% { box-shadow: 0 0 0 0 rgba(12, 163, 12, 0); } }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; position: relative; overflow: hidden; min-width: 0; }
.panel.grid-bg { background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 28px 28px; background-color: var(--surface); }
.panel-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.panel-label span:first-child { font: 700 .72rem var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); display: inline-flex; gap: 8px; align-items: center; }
.panel-id { font: 700 .68rem var(--mono); color: var(--muted); opacity: .7; }
.readiness-panel { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; align-items: center; padding: 18px;
  background: radial-gradient(60% 120% at 0% 50%, color-mix(in srgb, var(--tone) 22%, transparent), transparent 70%), var(--surface); }
@media (max-width: 900px) { .readiness-panel { grid-template-columns: minmax(0, 1fr); } }
.gauge { position: relative; width: 100%; max-width: 300px; margin: 0 auto; }
.gauge svg { width: 100%; height: auto; display: block; }
.gauge .g-value { position: absolute; left: 0; right: 0; bottom: 6%; text-align: center; }
.gauge .g-value b { font-size: 2.4rem; font-weight: 800; letter-spacing: -.05em; line-height: 1; }
.gauge .g-value span { display: block; font: 700 .7rem var(--mono); letter-spacing: .12em; color: var(--muted); text-transform: uppercase; margin-top: 6px; }
.verdict-line { display: flex; align-items: center; gap: 8px; font-size: 1.2rem; font-weight: 800; letter-spacing: -.03em; color: var(--tone-text); margin: 0 0 6px; }
.big-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.big-metrics > div { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.big-metrics b { display: block; font: 800 1.25rem var(--mono); letter-spacing: -.04em; }
.big-metrics span { font-size: .75rem; font-weight: 700; color: var(--muted); }
@media (max-width: 600px) { .big-metrics { grid-template-columns: minmax(0, 1fr); } }
.component { display: grid; grid-template-columns: minmax(0, 1fr) 46px; gap: 6px 12px; align-items: center; }
.component + .component { margin-top: 8px; }
.component .c-label { font-size: .82rem; font-weight: 700; }
.component .c-hint { grid-column: 1 / -1; font-size: .72rem; color: var(--muted); margin-top: -2px; }
.component .c-val { text-align: right; font: 800 .9rem var(--mono); }
.exam-strip { display: flex; gap: 8px; }
.exam-strip .ex { flex: 1; padding: 8px 4px; border-radius: 8px; text-align: center; background: color-mix(in srgb, var(--tone) 14%, var(--surface-2)); border: 1px solid color-mix(in srgb, var(--tone) 35%, transparent); }
.exam-strip .ex b { display: block; font: 800 1.2rem var(--mono); color: var(--tone-text); }
.exam-strip .ex span { font-size: .68rem; font-weight: 700; color: var(--muted); }
.exam-strip .ex.empty-slot { --tone: var(--muted); border-style: dashed; background: transparent; }
.matrix { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.matrix .cell { padding: 9px 10px; border-radius: 8px; background: color-mix(in srgb, var(--tone) 12%, var(--surface-2)); border: 1px solid color-mix(in srgb, var(--tone) 28%, transparent); min-width: 0; }
.matrix .cell .name { font-size: .78rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.matrix .cell .val { font: 800 1.05rem var(--mono); margin-top: 2px; }
.matrix .cell .st { font-size: .66rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--tone-text); display: flex; align-items: center; gap: 4px; }
.alert-row { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border-radius: 8px; background: color-mix(in srgb, var(--tone) 9%, var(--surface-2)); border-left: 3px solid var(--tone); font-size: .87rem; font-weight: 600; }
.alert-row + .alert-row { margin-top: 10px; }
.alert-row .ic { color: var(--tone-text); margin-top: 1px; }
.vel { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.vel > div { padding: 10px; border-radius: 8px; background: var(--surface-2); }
.vel b { font: 800 1.15rem var(--mono); display: block; }
.vel span { font-size: .72rem; font-weight: 700; color: var(--muted); }
.risk-row { display: grid; grid-template-columns: minmax(0, 1fr) 60px; gap: 10px; align-items: center; padding: 8px 0; font-size: .86rem; }
.risk-row + .risk-row { border-top: 1px dashed var(--border); }
.countdown { display: flex; align-items: baseline; gap: 6px; }
.countdown b { font: 800 2.1rem var(--mono); letter-spacing: -.05em; line-height: 1; }
.err-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 10px 0; font-size: .86rem; }
.err-item + .err-item { border-top: 1px solid var(--border); }
.locked-wrap { position: relative; }
.locked-wrap > .locked-content { filter: blur(7px); pointer-events: none; user-select: none; }
.locked-overlay { position: absolute; inset: 0; display: grid; place-items: start center; padding-top: 120px; z-index: 5; }
.locked-overlay .card { max-width: 460px; text-align: center; box-shadow: var(--shadow-lg); }

/* ==========================================================================
   Temario y lecciones
   ========================================================================== */
.path { position: relative; }
.path-block + .path-block { margin-top: 36px; }
.lesson-body { font-size: 1.02rem; line-height: 1.75; color: var(--text-2); }
.lesson-body h3 { color: var(--text); margin-top: 1.6em; font-size: 1.2rem; }
.lesson-body strong { color: var(--text); }
.lesson-body ul { padding-left: 1.2em; }
.lesson-body li { margin-bottom: .45em; }
.lesson-body .callout { padding: 16px 18px; border-radius: 14px; background: color-mix(in srgb, var(--brand) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent); margin: 1.4em 0; color: var(--text); }
.lesson-body .table { margin: 1em 0; background: var(--surface); border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }
.lesson-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 28px; }
@media (max-width: 960px) { .lesson-layout { grid-template-columns: minmax(0, 1fr); } }

/* ==========================================================================
   Gamificación
   ========================================================================== */
.ach { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 7px; padding: 14px 12px; }
.ach .medal { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; color: #fff; position: relative; }
.ach .medal.bronze { background: linear-gradient(135deg, #d08b52, #8a4b22); }
.ach .medal.silver { background: linear-gradient(135deg, #e4e8f1, #8a93a8); color: #1c2030; }
.ach .medal.gold { background: linear-gradient(135deg, #ffd56b, #d38b00); color: #3a2500; }
.ach.locked .medal { background: var(--surface-3); color: var(--muted); }
.ach.locked h4 { color: var(--text-2); }
.ach h4 { margin: 0; font-size: .95rem; }
.ach p { margin: 0; font-size: .8rem; color: var(--muted); }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; }
.level-track { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.level-step { min-width: 110px; padding: 9px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-size: .78rem; }
.level-step b { display: block; font-size: .9rem; }
.level-step.reached { border-color: color-mix(in srgb, var(--brand) 45%, transparent); background: color-mix(in srgb, var(--brand) 10%, var(--surface-2)); }
.level-step.current { box-shadow: var(--glow); }
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 14px; align-items: end; margin-bottom: 20px; }
.podium .p { text-align: center; padding: 14px 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.podium .p .pos { font-size: 1.6rem; }
.podium .p.first { padding-top: 34px; border-color: color-mix(in srgb, var(--amber) 50%, transparent); background: radial-gradient(100% 80% at 50% 0%, rgba(255, 176, 32, .18), transparent 70%), var(--surface); }
.rank-row.me { background: color-mix(in srgb, var(--brand) 12%, transparent) !important; }

/* Ocultar elementos sólo para pantallas pequeñas / grandes */
@media (max-width: 720px) { .hide-sm { display: none !important; } }
@media (min-width: 721px) { .show-sm { display: none !important; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Ajustes tras revisión visual ---------- */
.card.fill { display: flex; flex-direction: column; }
.card.fill > .chart-box, .card.fill > .compare-bars { flex: 1; min-height: 240px; }
.topic-row { grid-template-columns: 30px minmax(0, 1fr) 60px; }
.topic-row .t-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.25; }
.demo-card .floating.f2 { bottom: -40px; left: -28px; }
@media (max-width: 700px) {
  .q-image { max-height: none; padding: 12px; }
  .q-image img { max-height: 140px; }
}
.demo-card .floating.f1 { top: -46px; right: -16px; }

/* ---------- Barra de desplazamiento fina (zona del alumno y web pública) ---------- */
/* Chrome y Edge */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; border: 1px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); background-clip: padding-box; }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
::-webkit-scrollbar-corner { background: transparent; }
/* En el menú lateral sólo aparece al pasar el ratón */
.sidebar::-webkit-scrollbar-thumb { background: transparent; }
.sidebar:hover::-webkit-scrollbar-thumb { background: var(--surface-3); background-clip: padding-box; }
/* Firefox */
@supports not selector(::-webkit-scrollbar) {
  html, body * { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
  .sidebar { scrollbar-color: transparent transparent; }
  .sidebar:hover { scrollbar-color: var(--surface-3) transparent; }
}

/* ---------- Medallas del ranking (iconos, no emojis) ---------- */
.medal-ic { position: relative; display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; margin: 0 auto;
  color: #1c1405; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18), 0 6px 16px rgba(0, 0, 0, .25); }
.medal-ic.gold { background: linear-gradient(135deg, #ffe08a, #e0a100); }
.medal-ic.silver { background: linear-gradient(135deg, #f1f4f8, #9aa3b5); color: #1d2230; }
.medal-ic.bronze { background: linear-gradient(135deg, #f0b07a, #a65a26); color: #2a1406; }
.medal-ic.lg { width: 60px; height: 60px; }
.medal-ic b { position: absolute; right: -4px; bottom: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px; display: grid; place-items: center;
  font: 800 11px var(--mono); background: var(--surface); color: var(--text); border: 2px solid var(--surface-2); }
.medal-ic.sm { width: 26px; height: 26px; box-shadow: none; margin: 0; }
.podium .p { display: flex; flex-direction: column; align-items: center; }
.podium .p.first { border-color: color-mix(in srgb, #e0a100 55%, transparent); background: radial-gradient(100% 80% at 50% 0%, rgba(224, 161, 0, .16), transparent 70%), var(--surface); }
.podium .p.second { border-color: color-mix(in srgb, #9aa3b5 40%, transparent); }
.podium .p.third { border-color: color-mix(in srgb, #a65a26 45%, transparent); }
.rank-n { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); color: var(--text-2); font-size: .8rem; }
.streak-cell { display: inline-flex; align-items: center; gap: 5px; color: var(--amber); font-weight: 800; }

/* Comparación con AEOL en los tests (solo personal) */
.aeol-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: .8rem; font-weight: 800; color: var(--text-2); user-select: none; }
.aeol-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.aeol-switch .track { width: 38px; height: 22px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--border-strong); position: relative; flex-shrink: 0; transition: background .15s, border-color .15s; }
.aeol-switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.aeol-switch input:checked + .track { background: color-mix(in srgb, var(--warning) 30%, var(--surface-3)); border-color: var(--warning); }
.aeol-switch input:checked + .track::after { transform: translateX(16px); background: var(--warning); }
.aeol-switch input:focus-visible + .track { outline: 2px solid var(--brand); outline-offset: 2px; }
.aeol-tag { display: inline-flex; align-items: center; gap: 4px; color: var(--warning-text); font-weight: 800; }

/* Marca (partials/logo_marca.html) */
.logo-mark .logo-svg { width: 70%; height: 70%; }
.logo-mark .carril { stroke: var(--brand); }

/* Página de tests: tipo de test y modo */
.tests-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.tests-filtros { display: flex; flex-wrap: wrap; gap: 12px; }
.tests-filtros .field { min-width: 200px; }
@media (max-width: 560px) { .tests-filtros, .tests-filtros .field { width: 100%; } }

/* Suscripción y facturación */
.bill-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 16px 0; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); }
.bill-facts dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.bill-facts dd { margin: 2px 0 0; font-weight: 700; font-size: .92rem; }
.bill-plans { display: grid; gap: 8px; }
.bill-plan { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
@media (max-width: 560px) { .bill-plan { flex-wrap: wrap; } .bill-plan form { width: 100%; } .bill-plan .btn { width: 100%; } }
