/* =========================================================
   SimulaPro — Design System "Premium SaaS" v4.0
   Una sola familia tipográfica (Plus Jakarta Sans), números
   tabulares, superficies blancas con sombras en capas, acentos en
   degradé de marca, gráficos SVG con curvas suaves y rellenos.
   Las clases se conservan de v3 (las plantillas no cambian).
   ========================================================= */

/* =========================================================
   TOKENS
   ========================================================= */
:root {
  /* Marca (sobrescritos inline por tenant) */
  --brand:   #143a6b;
  --brand-2: #0f766e;

  /* Acentos derivados */
  --brand-light:  #e3ecfb;
  --brand-mid:    #2563eb;
  --brand-2-light:#d8f3ef;
  --brand-2-mid:  #14b8a6;
  --grad-brand:   linear-gradient(135deg, var(--brand) 0%, var(--brand-mid) 100%);
  --grad-brand-2: linear-gradient(135deg, var(--brand-2) 0%, var(--brand-2-mid) 100%);

  /* Tipografía */
  --font-ui: "Plus Jakarta Sans", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Plus Jakarta Sans", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Fondos y superficies */
  --bg:        #f5f7fb;
  --bg-2:      #ffffff;
  --bg-3:      #eef2f8;
  --surface:   #ffffff;
  --surface-2: #f6f8fc;
  --surface-3: #eef2f8;
  --card:      #ffffff;
  --card-border: rgba(15, 23, 42, .07);

  /* Texto */
  --text:      #0f172a;
  --text-2:    #334155;
  --muted:     #64748b;
  --dim:       #6b7a90;

  /* Bordes */
  --line:      rgba(15, 23, 42, .07);
  --line-2:    rgba(15, 23, 42, .12);
  --line-3:    rgba(15, 23, 42, .22);

  /* Semánticos */
  --ok:        #059669;
  --ok-dim:    #e8f8f1;
  --warn:      #d97706;
  --warn-dim:  #fff5e6;
  --bad:       #e11d48;
  --bad-dim:   #fff0f3;
  --info:      #0284c7;
  --info-dim:  #eef7fd;

  /* Radios */
  --r-xs:  8px;
  --r-sm:  12px;
  --r:     16px;
  --r-lg:  20px;
  --r-xl:  24px;
  --r-2xl: 28px;

  /* Sombras en capas */
  --shadow-sm:  0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .05);
  --shadow:     0 1px 2px rgba(15, 23, 42, .04), 0 14px 34px -18px rgba(15, 23, 42, .16);
  --shadow-lg:  0 2px 4px rgba(15, 23, 42, .04), 0 28px 56px -28px rgba(15, 23, 42, .28);
  --shadow-brand: 0 10px 26px -12px rgba(37, 99, 235, .55);

  /* Transiciones */
  --t-fast: .12s ease;
  --t:      .2s cubic-bezier(.2, .7, .3, 1);
  --t-slow: .32s cubic-bezier(.2, .7, .3, 1);

  /* Espaciado */
  --gap:    20px;
  --gap-sm: 14px;
  --gap-lg: 32px;

  /* Gráficos (apps/web/charts.py). Independientes de --brand: el color
     institucional del tenant no debe afectar la lectura. Paleta categórica
     validada para daltonismo. */
  --chart-1: #4338ca;   /* el alumno / serie principal */
  --chart-2: #0d9488;   /* oponentes / cohorte */
  --chart-3: #d97706;   /* tercera serie / "vos" en rankings */
  --chart-4: #be185d;
  --chart-muted: #c3cdd9;
  --chart-grid: #e8edf5;
  --chart-ref: #94a3b8;
  --chart-ink: #1e293b;
  --chart-dim: #64748b;
  --chart-ok: #059669;
  --chart-bad: #e11d48;
  --chart-seq-1: #e0e7ff;   /* No logrado */
  --chart-seq-2: #a5b4fc;   /* En proceso */
  --chart-seq-3: #6366f1;   /* Logrado */
  --chart-seq-4: #3730a3;   /* Destacado */
  /* Un acento + neutros (competidores, resto de la cohorte) */
  --chart-n1: #cbd5e1;
  --chart-n2: #a9b6c9;
  --chart-n3: #8797ae;
  --chart-n4: #dfe5ee;
  /* Cascada (estado de resultados), estilo informe */
  --chart-total: #1e293b;
  --chart-resta: #b9c5d6;
  --chart-suma: #0d9488;
}

/* =========================================================
   RESET Y BASE
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  background:
    radial-gradient(900px 420px at 12% -10%, rgba(37, 99, 235, .10), transparent 60%),
    radial-gradient(760px 380px at 92% -6%, rgba(20, 184, 166, .09), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
a { color: var(--brand-mid); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--brand); }
a:focus-visible { outline: 2px solid var(--brand-mid); outline-offset: 3px; border-radius: 6px; }
img { max-width: 100%; height: auto; }

/* =========================================================
   TIPOGRAFÍA
   ========================================================= */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  line-height: 1.2;
  color: var(--text);
  letter-spacing: -.02em;
  text-wrap: balance;
}
h1 { font-size: clamp(26px, 3.4vw, 36px); font-weight: 800; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15.5px; font-weight: 700; }
h4 { font-size: 13.5px; font-weight: 700; }
p { color: var(--text-2); line-height: 1.7; }
p + p { margin-top: .6em; }
.lead { font-size: 15.5px; color: var(--muted); max-width: 66ch; line-height: 1.65; }
.eyebrow {
  display: inline-block;
  font-size: 11px; font-weight: 700;
  font-family: var(--font-ui);
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--brand-mid);
  margin-bottom: 8px;
}
.muted  { color: var(--muted) !important; }
.dim    { color: var(--dim) !important; }
.ok     { color: var(--ok); }
.warn   { color: var(--warn); }
.bad    { color: var(--bad); }
.info   { color: var(--info); }
.mono { font-family: "SF Mono", "Fira Code", "Roboto Mono", monospace; font-size: .875em; color: var(--muted); }
strong, b { font-weight: 700; }
.kpi, .kpi-tile .val, .stat-val, .podium-score, .countdown, td, .kpi-motor-val { font-variant-numeric: tabular-nums; }

/* =========================================================
   TOPBAR
   ========================================================= */
.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: stretch;
  height: 64px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  width: 100%; max-width: 1280px; margin: 0 auto;
  padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; flex-shrink: 0; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-size: 17px; font-weight: 800; color: #fff;
  background: var(--grad-brand);
  box-shadow: var(--shadow-brand);
  transition: transform var(--t), box-shadow var(--t);
  flex-shrink: 0;
}
.brand:hover .brand-mark { transform: translateY(-1px) scale(1.03); }
.brand-text { display: flex; flex-direction: column; gap: 2px; line-height: 1; }
.brand-text small {
  font-size: 10px; font-weight: 700; color: var(--dim);
  text-transform: uppercase; letter-spacing: .1em;
}
.brand-text span { font-family: var(--font-display); font-size: 15px; font-weight: 800; color: var(--text); letter-spacing: -.02em; }
.top-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chip {
  font-size: 12.5px; font-weight: 600;
  font-family: var(--font-ui);
  color: var(--text-2);
  border: 1px solid transparent;
  background: var(--surface-2);
  padding: 7px 14px; border-radius: 999px;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
  cursor: default; user-select: none; white-space: nowrap;
}
a.chip, button.chip { cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 600; background: var(--surface-2); border: 1px solid transparent; }
a.chip:hover, button.chip:hover { background: var(--brand-light); color: var(--brand); }
button.chip:focus-visible { outline: 2px solid var(--brand-mid); outline-offset: 2px; }
.chip.tenant { color: var(--brand); background: var(--brand-light); }
.chip.role { color: var(--brand-2); background: var(--brand-2-light); }

/* =========================================================
   LAYOUT
   ========================================================= */
.container {
  max-width: 1200px; margin: 0 auto;
  padding: 40px 28px 88px;
  animation: page-enter .35s cubic-bezier(.16, 1, .3, 1) both;
}
@keyframes page-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.page-hero {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
  padding: 0 0 8px; margin-bottom: 32px;
}
.page-hero h1 { margin-bottom: 6px; }
.page-hero .lead { margin-top: 4px; }

h2.accented, .card h2 { display: flex; align-items: center; gap: 10px; }
h2.accented::before, .card h2::before { content: none; }

.grid { display: grid; gap: var(--gap); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .container { padding: 22px 16px 64px; }
}

/* =========================================================
   CARDS
   ========================================================= */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--r-lg);
  padding: 26px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
}
.card:hover { border-color: var(--line-2); }
.card.accent {
  border-color: rgba(37, 99, 235, .18);
  background: linear-gradient(135deg, rgba(227, 236, 251, .55) 0%, #fff 55%);
}
.card.soft { background: var(--surface-2); border-color: var(--line); box-shadow: none; }
.card.table-card { padding: 0; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; }
.card.table-card table { border-radius: 0; }
.card.table-card[tabindex="0"]:focus-visible { outline: 2px solid var(--brand-mid); outline-offset: 3px; }
.card.stripe-top::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--grad-brand);
}

/* =========================================================
   KPI TILES
   ========================================================= */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--gap-sm); }
.kpi-tile {
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: var(--r);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t), transform var(--t);
}
.kpi-tile:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.kpi-tile .label {
  font-size: 11px; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: .1em;
  margin-bottom: 8px;
}
.kpi-tile .val {
  font-family: var(--font-display);
  font-size: 27px; font-weight: 800; letter-spacing: -.03em;
  line-height: 1.05;
  color: var(--text);
}
.kpi-tile .val small { font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: 0; }
.kpi-tile .sub { font-size: 12px; color: var(--dim); margin-top: 6px; }
.kpi-card { padding: 26px 28px; }
.kpi-label { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.kpi {
  font-family: var(--font-display);
  font-size: 40px; font-weight: 800; letter-spacing: -.04em;
  line-height: 1;
  background: var(--grad-brand);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  display: inline-block;
}
.kpi-card .muted { font-size: 12.5px; margin-top: 8px; }
.icon-badge {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-size: 16px; font-weight: 800; color: #fff;
  background: var(--grad-brand);
  box-shadow: var(--shadow-brand);
  margin-bottom: 16px;
}

/* =========================================================
   SECCIÓN HEAD
   ========================================================= */
.section-head { display: flex; align-items: center; gap: 12px; margin: 40px 0 16px; }
.section-head h2 { margin: 0; font-size: 21px; font-weight: 800; }
.section-head h2::before { display: none; }

/* =========================================================
   BOTONES
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-ui); font-size: 14px; font-weight: 700;
  padding: 11px 22px; border-radius: var(--r-sm); border: 0;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform var(--t), box-shadow var(--t), filter var(--t), background var(--t), color var(--t);
  background: var(--grad-brand);
  color: #fff;
  box-shadow: var(--shadow-brand);
  letter-spacing: -.005em;
}
.btn:hover { filter: brightness(1.07); transform: translateY(-1px); color: #fff; box-shadow: 0 14px 30px -12px rgba(37, 99, 235, .6); }
.btn:active { transform: translateY(0); filter: brightness(.98); }
.btn:focus-visible { outline: 2px solid var(--brand-mid); outline-offset: 3px; }
.btn.ghost {
  background: var(--surface);
  border: 1px solid var(--line-2);
  color: var(--text-2);
  box-shadow: var(--shadow-sm);
}
.btn.ghost:hover { border-color: var(--brand-mid); color: var(--brand-mid); background: #fff; filter: none; }
.btn.teal { background: var(--grad-brand-2); box-shadow: 0 10px 26px -12px rgba(15, 118, 110, .55); }
.btn.teal:hover { filter: brightness(1.06); }
.btn.ok { background: linear-gradient(135deg, #047857, #10b981); box-shadow: 0 10px 26px -12px rgba(5, 150, 105, .55); }
.btn.ok:hover { filter: brightness(1.06); }
.btn.block { width: 100%; }
.btn.small { font-size: 12.5px; padding: 7px 14px; border-radius: 10px; box-shadow: none; }
.btn.lg { font-size: 15px; padding: 14px 30px; border-radius: 14px; }
.btn:disabled, .btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; filter: none; }

/* =========================================================
   FORMULARIOS
   ========================================================= */
.field { margin-bottom: 18px; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; font-family: var(--font-ui); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="search"], input[type="url"], select, textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line-2);
  color: var(--text);
  border-radius: var(--r-sm);
  padding: 11px 14px;
  font-size: 14px; font-family: var(--font-ui);
  line-height: 1.5;
  transition: border-color var(--t), box-shadow var(--t);
  appearance: none; -webkit-appearance: none;
  box-shadow: var(--shadow-sm);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand-mid);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .14);
}
input::placeholder, textarea::placeholder { color: var(--dim); }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px;
}
select option { background: #fff; color: var(--text); }
textarea { resize: vertical; min-height: 96px; }
@media (forced-colors: active) {
  select { appearance: auto; -webkit-appearance: auto; background-image: none; padding-right: 14px; }
  input:focus, select:focus, textarea:focus { outline: 2px solid CanvasText; outline-offset: 2px; }
}
form p { margin: 0 0 16px; }
form p label { display: block; }
form p input, form p select, form p textarea { margin-top: 4px; }
.field-hint { font-size: 12px; color: var(--dim); margin-top: 5px; }
.field-warn { font-size: 12px; color: var(--warn); margin-top: 5px; }
.field-ok   { font-size: 12px; color: var(--ok); margin-top: 5px; }

/* =========================================================
   TABLAS
   ========================================================= */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead { background: transparent; }
th {
  color: var(--muted); font-weight: 700; font-size: 11px;
  text-transform: uppercase; letter-spacing: .09em;
  padding: 14px 18px; text-align: left;
  border-bottom: 1px solid var(--line-2);
  font-family: var(--font-ui);
  white-space: nowrap;
}
td { padding: 14px 18px; border-bottom: 1px solid var(--line); color: var(--text-2); vertical-align: middle; font-family: var(--font-ui); }
td strong { color: var(--text); font-weight: 700; }
tbody tr { transition: background var(--t-fast); }
tbody tr:hover td { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
.table-card thead th:first-child, .table-card td:first-child { padding-left: 24px; }

/* =========================================================
   BADGES / PILLS
   ========================================================= */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 700;
  padding: 4px 11px; border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
  background: var(--surface-3);
  color: var(--text-2);
  font-family: var(--font-ui);
  letter-spacing: .01em;
}
.lvl-DESTACADO  { color: #065f46; background: #d1fae5; }
.lvl-LOGRADO    { color: #047857; background: #e8f8f1; }
.lvl-EN_PROCESO { color: #b45309; background: #fff1d6; }
.lvl-NO_LOGRADO { color: #be123c; background: #ffe4e9; }
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600;
  color: var(--brand); border: 1px solid transparent;
  padding: 4px 12px; border-radius: 999px;
  background: var(--brand-light);
  font-family: var(--font-ui);
}
.pill.violet { color: #6d28d9; background: #ede9fe; }
.pill.indigo { color: var(--brand); background: var(--brand-light); }
.pill.ok   { color: var(--ok); background: var(--ok-dim); }
.pill.warn { color: var(--warn); background: var(--warn-dim); }
.pill.bad  { color: var(--bad); background: var(--bad-dim); }

/* =========================================================
   FLASH
   ========================================================= */
.flash {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 16px; border-radius: 14px;
  margin: 0 0 16px; border: 1px solid var(--line);
  background: var(--surface);
  font-size: 14px; line-height: 1.55;
  font-family: var(--font-ui);
  box-shadow: var(--shadow-sm);
}
.flash.success { border-color: rgba(5, 150, 105, .25); background: var(--ok-dim); color: #065f46; }
.flash.error   { border-color: rgba(225, 29, 72, .25); background: var(--bad-dim); color: #9f1239; }
.flash.warning, .flash.warn { border-color: rgba(217, 119, 6, .3); background: var(--warn-dim); color: #92400e; }
.flash.info    { border-color: rgba(2, 132, 199, .25); background: var(--info-dim); color: #075985; }

/* =========================================================
   PROGRESS
   ========================================================= */
.progress-wrap { display: flex; align-items: center; gap: 10px; }
.bar { flex: 1; height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.bar > span {
  display: block; height: 100%;
  background: var(--grad-brand);
  border-radius: 999px;
  transition: width .7s cubic-bezier(.16, 1, .3, 1);
}
.bar.thin { height: 6px; }
.bar.ok > span   { background: linear-gradient(90deg, #047857, #10b981); }
.bar.warn > span { background: linear-gradient(90deg, #b45309, #f59e0b); }
.round-bar { display: flex; align-items: center; gap: 12px; padding: 10px 0; margin-bottom: 2px; }
.round-bar .label { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; letter-spacing: .02em; }

/* Barra de competencia con los cortes de la rúbrica (40 / 70 / 90) */
.bar.niveles { position: relative; overflow: visible; }
.bar.niveles::after {
  content: ""; position: absolute; inset: -3px 0; pointer-events: none;
  background:
    linear-gradient(90deg, transparent calc(40% - 1px), var(--line-3) calc(40% - 1px) 40%, transparent 40%),
    linear-gradient(90deg, transparent calc(70% - 1px), var(--line-3) calc(70% - 1px) 70%, transparent 70%),
    linear-gradient(90deg, transparent calc(90% - 1px), var(--line-3) calc(90% - 1px) 90%, transparent 90%);
}
.bar.niveles > span { border-radius: 999px; }
.bar.niveles.n-NO_LOGRADO > span { background: linear-gradient(90deg, #be123c, #fb7185); }
.bar.niveles.n-EN_PROCESO > span { background: linear-gradient(90deg, #b45309, #fbbf24); }
.bar.niveles.n-LOGRADO > span    { background: linear-gradient(90deg, #047857, #34d399); }
.bar.niveles.n-DESTACADO > span  { background: linear-gradient(90deg, #3730a3, #6366f1); }

/* =========================================================
   EMPTY / INLINE FORM
   ========================================================= */
.empty { text-align: center; padding: 34px 24px; color: var(--dim); font-size: 14px; }
td .empty, .card.empty { padding: 24px; }
.inline-form { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.inline-form .field { flex: 1; min-width: 200px; margin-bottom: 0; }

/* =========================================================
   LOGIN
   ========================================================= */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; position: relative; background: var(--bg); }
@media (max-width: 700px) { .login-wrap { grid-template-columns: 1fr; } .login-visual { display: none !important; } }
.login-visual {
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 56px 60px;
  background:
    radial-gradient(700px 420px at 85% 15%, rgba(37, 99, 235, .55), transparent 60%),
    radial-gradient(600px 380px at 10% 95%, rgba(20, 184, 166, .35), transparent 60%),
    linear-gradient(160deg, var(--brand) 0%, #0a1a33 100%);
  position: relative; overflow: hidden;
  color: #fff;
}
.login-visual::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .06) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(600px 500px at 60% 40%, #000 20%, transparent 80%);
  -webkit-mask-image: radial-gradient(600px 500px at 60% 40%, #000 20%, transparent 80%);
  pointer-events: none;
}
.login-visual::after {
  content: ""; position: absolute; bottom: -120px; right: -80px;
  width: 380px; height: 380px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .12), transparent 70%);
  pointer-events: none;
}
.login-visual-stripe { position: absolute; top: 0; left: 0; right: 0; height: 4px; background: linear-gradient(90deg, var(--brand-2-mid), #60a5fa); }
.login-logo { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }
.login-logo .brand-mark {
  width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center;
  font-family: var(--font-display); font-size: 20px; font-weight: 800; color: var(--brand);
  background: #fff; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .5);
}
.login-logo span { font-family: var(--font-display); font-size: 20px; font-weight: 800; color: #fff; letter-spacing: -.02em; }
.login-copy { max-width: 420px; position: relative; z-index: 1; }
.login-copy .eyebrow { color: rgba(255, 255, 255, .8); margin-bottom: 14px; display: block; }
.login-copy h1 { font-size: clamp(26px, 3.6vw, 38px); font-weight: 800; letter-spacing: -.03em; line-height: 1.12; margin-bottom: 16px; color: #fff; }
.login-copy p { color: rgba(255, 255, 255, .82); font-size: 15.5px; line-height: 1.65; }
.login-features { display: flex; flex-direction: column; gap: 12px; margin-top: 30px; }
.login-feature { display: flex; align-items: center; gap: 12px; font-size: 13.5px; color: rgba(255, 255, 255, .92); font-weight: 500; }
.login-feature-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--brand-2-mid); box-shadow: 0 0 0 4px rgba(20, 184, 166, .25); }
.login-footer { font-size: 12px; color: rgba(255, 255, 255, .6); position: relative; z-index: 1; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 48px 40px; background: var(--bg); }
.login-card {
  width: 100%; max-width: 420px;
  background: var(--surface); border: 1px solid var(--card-border); border-radius: var(--r-xl);
  padding: 40px; box-shadow: var(--shadow-lg);
}
.login-card h2 { font-size: 24px; margin-bottom: 6px; display: block; color: var(--text); font-weight: 800; letter-spacing: -.03em; }
.login-card h2::before { display: none; }

/* =========================================================
   HERO BRIEFING
   ========================================================= */
.briefing-hero {
  position: relative; overflow: hidden;
  border-radius: var(--r-2xl);
  padding: 46px 48px 42px;
  margin-bottom: 28px;
  border: 1px solid var(--card-border);
  background:
    radial-gradient(600px 300px at 90% 0%, rgba(37, 99, 235, .12), transparent 60%),
    radial-gradient(500px 260px at 0% 100%, rgba(20, 184, 166, .12), transparent 60%),
    #fff;
  box-shadow: var(--shadow);
}
.briefing-hero::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--grad-brand); }
.briefing-hero::after { content: none; }
.briefing-hero h1 { font-size: clamp(28px, 4.5vw, 44px); font-weight: 800; letter-spacing: -.035em; margin-bottom: 16px; color: var(--text); position: relative; z-index: 1; }
.briefing-hero .meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; position: relative; z-index: 1; }
.briefing-hero .cta-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 28px; position: relative; z-index: 1; }
.meta-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 700;
  padding: 6px 14px; border-radius: 999px;
  border: 1px solid transparent;
  background: var(--surface-3);
  color: var(--text-2);
  white-space: nowrap;
}
.meta-chip.sector { color: var(--brand-2); background: var(--brand-2-light); }
.meta-chip.dific  { color: var(--warn); background: var(--warn-dim); }
.meta-chip.rondas { color: #6d28d9; background: #ede9fe; }
.meta-chip.sim    { color: var(--brand); background: var(--brand-light); }

/* =========================================================
   PARTIDA
   ========================================================= */
.partida-header { padding: 0 0 22px; border-bottom: 1px solid var(--line); margin-bottom: 28px; }
.partida-header-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.partida-header h1 { font-size: clamp(24px, 3vw, 32px); margin-bottom: 6px; }
.partida-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.decision-fields { display: flex; flex-direction: column; gap: 8px; }
.decision-field {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  background: var(--surface-2);
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
}
.decision-field:focus-within { border-color: var(--brand-mid); background: #fff; box-shadow: 0 0 0 4px rgba(37, 99, 235, .10); }
.decision-field label { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 8px; display: block; cursor: pointer; }
.decision-field input, .decision-field select { background: #fff; border: 1px solid var(--line-2); box-shadow: none; }
.decision-field input:focus, .decision-field select:focus { border-color: var(--brand-mid); box-shadow: 0 0 0 4px rgba(37, 99, 235, .12); }
.field-meta { margin-top: 8px; display: flex; flex-direction: column; gap: 3px; }
.field-hint-text { font-size: 12px; color: var(--muted); line-height: 1.5; }
.field-hint-text strong { color: var(--text-2); }
.field-warn-text { font-size: 12px; color: var(--warn); line-height: 1.5; }
.diagnostico-opcion { transition: border-color var(--t), background var(--t), box-shadow var(--t); border-radius: 12px !important; }
.diagnostico-opcion:hover, .diagnostico-opcion:focus-within { border-color: var(--brand-mid) !important; box-shadow: 0 0 0 4px rgba(37, 99, 235, .10); }
.diagnostico-opcion:has(input:checked) { border-color: var(--brand-mid) !important; background: var(--brand-light) !important; }
.diagnostico-opcion input[type="radio"]:focus-visible { outline: 2px solid var(--brand-mid); outline-offset: 3px; }

/* =========================================================
   HOME ESTUDIANTE
   ========================================================= */
.career-section { margin-bottom: 44px; }
.career-header { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.career-icon {
  width: 48px; height: 48px; border-radius: 14px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 22px;
  background: var(--surface); border: 1px solid var(--card-border); box-shadow: var(--shadow-sm);
}
.career-header h2 { font-size: 17px; margin: 0; color: var(--text); }
.career-header h2::before { display: none; }
.career-header p { font-size: 13px; color: var(--dim); margin-top: 2px; }
.sim-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--gap-sm); }
.sim-card { display: flex; flex-direction: column; gap: 12px; min-height: 176px; padding: 22px 24px; cursor: pointer; }
.sim-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: rgba(37, 99, 235, .3); }
.sim-card-ico {
  width: 46px; height: 46px; border-radius: 13px;
  display: grid; place-items: center; font-size: 21px;
  background: var(--brand-light); border: 1px solid transparent;
  flex-shrink: 0; transition: background var(--t), transform var(--t);
}
.sim-card:hover .sim-card-ico { background: var(--grad-brand); color: #fff; transform: scale(1.04); }
.sim-card h3 { font-size: 15px; margin-bottom: 2px; color: var(--text); }
.sim-card .sim-meta { font-size: 12.5px; color: var(--dim); line-height: 1.45; }
.sim-card .sim-estado { margin-top: auto; }
.sim-card .btn { margin-top: 8px; }

/* =========================================================
   PUNTUACIONES / RANKING / TABLERO
   ========================================================= */
.score-hi { color: var(--ok); font-weight: 800; }
.score-md { color: var(--warn); font-weight: 700; }
.score-lo { color: var(--bad); font-weight: 700; }
.ranking-me td { background: var(--brand-light) !important; }
.ranking-leader td:first-child { color: #d97706; font-weight: 800; }
.ranking-pos-1 { color: #d97706; font-weight: 800; }
.actividad-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-bottom: 22px; margin-bottom: 28px; border-bottom: 1px solid var(--line); }
.resultado-card { border-color: rgba(37, 99, 235, .2); background: linear-gradient(135deg, rgba(227, 236, 251, .5) 0%, #fff 60%); }
.resultado-card h3 { color: var(--brand); }
.noticias-list { list-style: none; display: flex; flex-direction: column; gap: 8px; margin: 0; }
.noticias-list li { padding: 11px 14px; border-radius: 12px; background: var(--info-dim); border-left: 3px solid var(--info); font-size: 13.5px; color: var(--text-2); }
.cat-title { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); margin: 32px 0 12px; display: flex; align-items: center; gap: 10px; font-weight: 700; }
.cat-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* =========================================================
   FOOTER / UTILIDADES
   ========================================================= */
footer.page-footer { text-align: center; padding: 22px 24px 34px; font-size: 12.5px; color: var(--dim); border-top: 1px solid var(--line); margin-top: 48px; background: transparent; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center{ align-items: center; }
.gap-8       { gap: 8px; }
.gap-12      { gap: 12px; }
.mt-4        { margin-top: 4px; }
.mt-8        { margin-top: 8px; }
.mt-16       { margin-top: 16px; }
.mt-24       { margin-top: 24px; }
.mb-0        { margin-bottom: 0; }
.w-full      { width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.divider { height: 1px; background: var(--line); margin: 24px 0; border: none; }
.skip-link { position: absolute; top: -100%; left: 16px; background: var(--brand); color: #fff; padding: 8px 16px; border-radius: 0 0 10px 10px; font-size: 13px; font-weight: 700; z-index: 9999; text-decoration: none; transition: top .1s; }
.skip-link:focus { top: 0; }
.accent-rule { height: 2px; background: linear-gradient(90deg, var(--brand) 0%, var(--brand-2) 60%, transparent 100%); border: none; margin: 32px 0; border-radius: 1px; }
.stat-block { display: inline-flex; flex-direction: column; align-items: flex-start; padding: 12px 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--card-border); box-shadow: var(--shadow-sm); min-width: 90px; }
.stat-block .stat-val { font-family: var(--font-display); font-size: 20px; font-weight: 800; color: var(--text); letter-spacing: -.03em; line-height: 1; }
.stat-block .stat-lbl { font-size: 10.5px; font-weight: 700; color: var(--dim); text-transform: uppercase; letter-spacing: .1em; margin-top: 5px; }

@media (max-width: 600px) {
  .topbar { height: auto; min-height: 60px; }
  .topbar-inner { padding: 8px 16px; flex-wrap: wrap; gap: 8px; }
  .brand-text small { display: none; }
  .top-actions { width: 100%; flex-wrap: nowrap; justify-content: flex-end; overflow-x: auto; padding-bottom: 2px; }
  .top-actions .chip.tenant, .top-actions .chip.user { display: none; }
}
@media print {
  .topbar, footer.page-footer, .btn { display: none !important; }
  .container { padding: 0; }
  .card { box-shadow: none; border-color: #ccc; }
  body { font-size: 12px; background: #fff; }
}

/* =========================================================
   GAMIFICACIÓN
   ========================================================= */
.logros-cintillo { border-color: rgba(20, 184, 166, .3); background: linear-gradient(135deg, rgba(216, 243, 239, .6) 0%, #fff 60%); }
.logros-cintillo-list { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.logro-chip {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--card-border); box-shadow: var(--shadow-sm);
  animation: logro-pop .6s ease-out both;
}
.logro-chip.logro-nuevo { border-color: rgba(20, 184, 166, .4); background: linear-gradient(135deg, rgba(216, 243, 239, .5), #fff); }
.logro-chip.logro-bloqueado { opacity: .55; filter: grayscale(.7); box-shadow: none; background: var(--surface-2); }
.logro-ico { font-size: 24px; line-height: 1; }
.logro-chip strong { font-size: 13.5px; color: var(--text); display: block; }
.logro-desc { font-size: 11.5px; color: var(--dim); line-height: 1.35; display: block; margin-top: 2px; }
.logros-todos summary::-webkit-details-marker { display: none; }
.logros-todos summary::marker { content: ""; }
.htmx-indicator.htmx-request, .htmx-request .htmx-indicator { display: block !important; }
.spinner { display: inline-block; width: 18px; height: 18px; border: 2.5px solid var(--line-2); border-top-color: var(--brand-mid); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-circle-lg { width: 58px; height: 58px; border-radius: 18px; background: var(--brand-light); display: grid; place-items: center; margin: 0 auto 16px; font-size: 26px; }
.icon-circle-md { width: 46px; height: 46px; border-radius: 14px; background: var(--brand-light); display: grid; place-items: center; margin: 0 auto 12px; font-size: 20px; }
.kpi-danger { color: var(--bad) !important; -webkit-text-fill-color: currentColor; }
.obj-callout { font-size: 13.5px; color: #0f5f57; margin-bottom: 20px; font-weight: 600; background: var(--brand-2-light); padding: 12px 16px; border-radius: 12px; border: 1px solid rgba(15, 118, 110, .15); }
.flex-ai-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gamif-next-lvl { display: block; margin-top: 6px; font-size: 11.5px; font-weight: 600; color: var(--dim); }
.logro-xp { font-size: 11px; font-weight: 800; color: var(--brand-2); letter-spacing: .02em; }
@keyframes logro-pop { 0% { opacity: 0; transform: scale(.8) translateY(6px); } 60% { transform: scale(1.05) translateY(0); } 100% { opacity: 1; transform: scale(1); } }
.gamif-card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 18px 20px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--card-border); box-shadow: var(--shadow);
  min-width: 240px;
}
.gamif-nivel { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.gamif-nivel-num { font-family: var(--font-display); font-weight: 800; font-size: 16px; color: var(--text); letter-spacing: -.02em; }
.gamif-xp-num { font-weight: 700; font-size: 13px; color: var(--muted); }
.gamif-xp .bar { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.gamif-xp .bar > span { display: block; height: 100%; background: var(--grad-brand); transition: width .7s ease; }
.gamif-logros { display: flex; align-items: baseline; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.gamif-logros-num { font-family: var(--font-display); font-weight: 800; font-size: 16px; color: var(--brand-2); }
.gamif-logros-txt { font-size: 12px; color: var(--dim); }

/* Podio */
.podio { display: flex; align-items: flex-end; justify-content: center; gap: 16px; margin: 0 auto var(--gap); max-width: 680px; padding: 24px 16px 0; list-style: none; }
@media (min-width: 601px) {
  .podio:not(.podio-mini) .pos-2 { order: 1; }
  .podio:not(.podio-mini) .pos-1 { order: 2; }
  .podio:not(.podio-mini) .pos-3 { order: 3; }
}
.podium-slot { display: flex; flex-direction: column; align-items: center; flex: 1; max-width: 210px; text-align: center; animation: podium-rise .8s cubic-bezier(.2, .7, .3, 1) both; }
.podium-slot.pos-2 { animation-delay: .1s; }
.podium-slot.pos-1 { animation-delay: 0s; }
.podium-slot.pos-3 { animation-delay: .2s; }
.podium-medal { font-size: 34px; line-height: 1; margin-bottom: 8px; filter: drop-shadow(0 6px 10px rgba(15, 23, 42, .18)); }
.podium-name { font-weight: 700; font-size: 13.5px; color: var(--text); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium-score { font-family: var(--font-display); font-weight: 800; font-size: 24px; color: var(--text); margin: 2px 0 10px; letter-spacing: -.03em; }
.podium-block { width: 100%; border-radius: 14px 14px 0 0; background: linear-gradient(180deg, var(--brand-light) 0%, var(--surface-2) 100%); border: 1px solid var(--line); border-bottom: none; box-shadow: var(--shadow-sm); }
.podium-block.h-1 { height: 104px; background: linear-gradient(180deg, #fde68a 0%, #fffbeb 100%); border-color: rgba(245, 158, 11, .35); }
.podium-block.h-2 { height: 74px;  background: linear-gradient(180deg, #e2e8f0 0%, #f8fafc 100%); border-color: rgba(148, 163, 184, .4); }
.podium-block.h-3 { height: 52px;  background: linear-gradient(180deg, #fdba74 0%, #fff7ed 100%); border-color: rgba(249, 115, 22, .35); }
.podium-slot.pos-1 .podium-medal { animation: medal-bounce 1s ease-out .3s both; }
@keyframes podium-rise { 0% { opacity: 0; transform: translateY(40px); } 100% { opacity: 1; transform: translateY(0); } }
@keyframes medal-bounce { 0% { transform: translateY(-20px) scale(.6); opacity: 0; } 60% { transform: translateY(4px) scale(1.15); opacity: 1; } 100% { transform: translateY(0) scale(1); } }
.podio-mini { max-width: 440px; }

/* KPI causal */
.kpi-tile-causal { padding-bottom: 14px; }
.kpi-causa { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line-2); display: flex; flex-direction: column; gap: 3px; }
.kpi-delta { font-size: 12.5px; font-weight: 800; display: inline-flex; align-items: baseline; gap: 5px; font-variant-numeric: tabular-nums; }
.kpi-delta.ok  { color: var(--ok); }
.kpi-delta.bad { color: var(--bad); }
.kpi-delta.neutro { color: var(--dim); }
.kpi-delta small { font-weight: 600; color: var(--dim); font-size: 10.5px; }
.kpi-causa-txt { font-size: 12px; color: var(--dim); line-height: 1.45; }

/* KPI del motor (partida) */
.kpi-motor { padding: 16px 18px; border-radius: 16px; background: var(--surface); border: 1px solid var(--card-border); box-shadow: var(--shadow-sm); display: grid; gap: 8px; }
.kpi-motor-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.kpi-motor-label { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: var(--muted); }
.kpi-motor-val { font-family: var(--font-display); font-size: 20px; font-weight: 800; color: var(--text); white-space: nowrap; letter-spacing: -.02em; }
.kpi-motor-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.kpi-motor-help { font-size: 12.5px; color: var(--muted); line-height: 1.5; }

/* Ronda en vivo */
.round-status-live { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 14px 18px; border-radius: 16px; background: var(--surface); border: 1px solid var(--card-border); box-shadow: var(--shadow-sm); }
.rsl-item { display: flex; align-items: center; gap: 8px; }
.rsl-ico { font-size: 18px; }
.countdown { font-family: var(--font-display); font-weight: 800; font-size: 20px; color: var(--text); letter-spacing: .02em; }
.countdown.closed { color: var(--bad); }
.countdown.muted { color: var(--dim); font-weight: 600; font-size: 13px; }
.rsl-feed strong { color: var(--text); }
.rsl-bar { display: inline-block; width: 90px; height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.rsl-bar > span { display: block; height: 100%; background: var(--grad-brand); transition: width .5s ease; }
.rsl-listo { background: var(--ok-dim); }
.rsl-pendiente { background: var(--warn-dim); color: #b45309; }

/* Trayectoria (modal) */
.trayectoria-modal { position: fixed; inset: 0; z-index: 1000; background: rgba(15, 23, 42, .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: grid; place-items: center; padding: 20px; animation: tray-fade .2s ease both; }
@keyframes tray-fade { from { opacity: 0; } to { opacity: 1; } }
.trayectoria-card { width: min(96vw, 780px); max-width: 780px; max-height: 88vh; overflow: auto; animation: tray-rise .25s ease both; box-shadow: var(--shadow-lg); }
@keyframes tray-rise { from { opacity: 0; transform: translateY(20px) scale(.98); } to { opacity: 1; transform: none; } }
.trayectoria-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.trayectoria-charts { display: grid; gap: 22px; }
.traj-chart { width: 100%; max-width: 560px; height: auto; }

@media (max-width: 600px) {
  .podio { flex-direction: column; align-items: stretch; gap: 10px; max-width: 100%; padding: 12px 8px 0; }
  .podium-slot { max-width: 100%; flex-direction: row; align-items: center; gap: 10px; text-align: left; }
  .podium-slot .podium-block { width: auto; min-width: 8px; align-self: stretch; border-radius: 8px 0 0 8px; }
  .podium-slot.pos-1 { order: 1; } .podium-slot.pos-2 { order: 2; } .podium-slot.pos-3 { order: 3; }
  .podium-block.h-1, .podium-block.h-2, .podium-block.h-3 { height: 56px; }
  .podium-medal { font-size: 24px; margin-bottom: 0; }
  .podium-name { white-space: normal; }
  .podium-score { margin: 0 0 0 auto; font-size: 18px; }
  .logros-cintillo-list { flex-direction: column; gap: 8px; }
  .gamif-card { width: 100%; min-width: 0; }
  .round-status-live { gap: 10px; }
  .rsl-bar { width: 64px; }
  .trayectoria-modal { padding: 8px; }
  .trayectoria-card { max-width: 100%; max-height: 94vh; }
}
@media (max-width: 600px) {
  .card > table, .table-card > table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
}
@media (prefers-reduced-motion: reduce) {
  .podium-slot, .podium-slot.pos-1 .podium-medal, .logro-chip, .trayectoria-modal, .trayectoria-card { animation: none !important; }
}

/* =========================================================
   GRÁFICOS (apps/web/charts.py + static/js/charts.js)
   ========================================================= */
.chart { margin: 0; display: grid; gap: 10px; min-width: 0; }
.chart-body { min-width: 0; overflow-x: auto; }
.chart svg.chart-svg { width: 100%; height: auto; display: block; margin: 0 auto; font-family: var(--font-ui); }
.chart svg.chart-svg text { font-variant-numeric: tabular-nums; }
.chart-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 14px; }
.chart-title { font-family: var(--font-display); font-weight: 800; font-size: 14.5px; color: var(--text); letter-spacing: -.01em; }
.chart-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); font-weight: 500; }
.chart-legend li { display: inline-flex; align-items: center; gap: 7px; }
.chart-legend i { display: inline-block; width: 18px; height: 3px; border-radius: 2px; background: var(--c); }
.chart-legend i.punteada { background: repeating-linear-gradient(90deg, var(--c) 0 5px, transparent 5px 8px); }
.chart-legend i.fina { height: 1.5px; }
.chart-legend i.bloque { width: 12px; height: 12px; border-radius: 4px; }
.chart-note { font-size: 12px; color: var(--dim); margin: 0; line-height: 1.5; }
.chart-data summary { cursor: pointer; font-size: 12.5px; color: var(--brand-mid); font-weight: 700; list-style: none; }
.chart-data summary::before { content: "▸ "; }
.chart-data[open] summary::before { content: "▾ "; }
.chart-data .table-scroll { overflow-x: auto; margin-top: 8px; }
.chart-data table { font-size: 12.5px; min-width: 320px; }
.chart-area { opacity: 1; }
.chart-banda.zona-riesgo { fill: var(--chart-bad); opacity: .07; }
.chart-banda.zona-ok { fill: var(--chart-ok); opacity: .06; }
.chart .col .xh, .chart .col .pt { opacity: 0; transition: opacity .12s; pointer-events: none; }
.chart .col:hover .xh, .chart .col:focus-within .xh { opacity: .35; }
.chart .col:hover .pt, .chart .col:focus-within .pt { opacity: 1; }
.chart [data-tip] { cursor: crosshair; outline: none; }
.chart [data-tip]:focus-visible { stroke: var(--brand-mid); stroke-width: 2; }
.chart-celda.seq-1 { fill: var(--chart-seq-1); }
.chart-celda.seq-2 { fill: var(--chart-seq-2); }
.chart-celda.seq-3 { fill: var(--chart-seq-3); }
.chart-celda.seq-4 { fill: var(--chart-seq-4); }
.chart-celda-txt.seq-1, .chart-celda-txt.seq-2 { fill: var(--chart-ink); }
.chart-celda-txt.seq-3, .chart-celda-txt.seq-4 { fill: #fff; }
.chart-tip {
  position: absolute; z-index: 60; pointer-events: none;
  background: rgba(15, 23, 42, .96); color: #fff;
  font: 12.5px/1.5 var(--font-ui);
  padding: 9px 12px; border-radius: 12px;
  box-shadow: 0 16px 40px -12px rgba(15, 23, 42, .55);
  opacity: 0; transition: opacity .1s, transform .1s;
  transform: translateY(2px);
  max-width: 300px; display: grid; gap: 2px;
  font-variant-numeric: tabular-nums;
}
.chart-tip.on { opacity: 1; transform: none; }
.chart-tip b { font-weight: 800; color: #fff; }
.chart-tip span { color: rgba(255, 255, 255, .85); }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr)); gap: var(--gap); align-items: start; }
.chart-grid > .card { margin: 0; min-width: 0; }
.sparkline { display: block; }
.ranking-fig { margin-bottom: var(--gap); }
@media (max-width: 640px) { .chart-grid { grid-template-columns: 1fr; } }

/* Mapa de competencias: radar + tabla por simulador */
.mapa-sim { display: grid; grid-template-columns: minmax(300px, 420px) 1fr; gap: var(--gap); align-items: start; }
.mapa-sim .mapa-radar { margin: 0; }
.mapa-sim .mapa-tabla { margin: 0; min-width: 0; overflow-x: auto; }
@media (max-width: 900px) { .mapa-sim { grid-template-columns: 1fr; } }

/* Resultado de la ronda: cascada + estado de resultados (informe financiero) */
.resultado-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, 1fr); gap: 28px; align-items: start; }
.resultado-chart { min-width: 0; }
.pl { display: grid; gap: 12px; padding: 18px 20px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); }
.pl .eyebrow { margin: 0; }
.pl-list { display: grid; gap: 0; margin: 0; }
.pl-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px 14px; align-items: baseline; padding: 8px 0; border-bottom: 1px dashed var(--line-2); }
.pl-row:last-child { border-bottom: 0; }
.pl-row dt { font-size: 13px; color: var(--text-2); font-weight: 500; display: flex; align-items: baseline; gap: 8px; }
.pl-row dd { margin: 0; }
.pl-signo { display: inline-block; width: 14px; text-align: center; font-weight: 800; }
.pl-signo.bad { color: var(--bad); }
.pl-signo.ok { color: var(--ok); }
.pl-valor { font-size: 13.5px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pl-pct { font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; min-width: 52px; text-align: right; }
.pl-row.pl-total dt { font-weight: 700; color: var(--text); }
.pl-row.pl-total { border-top: 1px solid var(--line-2); border-bottom: 0; margin-top: 2px; }
.pl-row.pl-neta { background: var(--brand-light); border-radius: 10px; padding: 10px 12px; margin: 6px -12px 0; border: 0; }
.pl-row.pl-neta dt, .pl-row.pl-neta .pl-valor { color: var(--brand); font-weight: 800; }
.pl-row.pl-neta .pl-pct { color: var(--brand); font-weight: 700; }
.pl-margen { display: grid; gap: 2px; padding-top: 6px; }
.pl-margen-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.pl-margen-val { font-family: var(--font-display); font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.pl-margen-val.ok { color: var(--ok); }
.pl-margen-val.bad { color: var(--bad); }
.pl-margen-sub { font-size: 12px; color: var(--dim); }
@media (max-width: 860px) { .resultado-grid { grid-template-columns: 1fr; } }
