/* ═══════════════════════════════════════════════════════════════════════════
   PSY-MACHINA-001 · Plataforma de Evaluación Psicométrica · index.css
   Versión : 0.1.0
   Tema    : Indigo científico — DM Sans, #4338CA, fondos blancos
   Fork de LEX-MACHINA-001 v0.2.1 — todos los selectores estructurales
   preservados; paleta y componentes de examen añadidos.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────────────────────────── */
:root {
  /* Brand PSY */
  --primary-color:  #4338ca;
  --indigo:         #4338ca;
  --indigo-dk:      #3730a3;
  --indigo-lt:      #eef2ff;
  --indigo-md:      #c7d2fe;
  --indigo-glow:    rgba(67,56,202,.12);
  --indigo-glow2:   rgba(67,56,202,.22);

  /* Semántica — heredan de LEX con paleta PSY */
  --green:          #16a34a;
  --green-lt:       #dcfce7;
  --amber:          #b45309;
  --amber-lt:       #fef3c7;
  --red:            #dc2626;
  --red-lt:         #fff5f5;
  --purple:         #7c3aed;
  --teal:           #0d9488;

  /* Backgrounds */
  --light-bg:  #f8fafc;
  --bg0:       #f8fafc;
  --bg1:       #ffffff;
  --bg2:       #f1f5f9;
  --bg3:       #e8edf5;
  --surface:   rgba(0,0,0,.03);
  --surface2:  rgba(0,0,0,.05);
  --glass:     rgba(255,255,255,.92);
  --glass2:    rgba(255,255,255,.97);
  --dark-bg:   #1e1b4b;   /* Sidebar oscuro índigo */

  /* Borders */
  --border-color: #e2e8f0;
  --border:       #e2e8f0;
  --border2:      #c7d2fe;
  --border-hi:    #4338ca;

  /* Text */
  --txt0: #0f172a;
  --txt1: #1e293b;
  --txt2: #475569;
  --txt3: #94a3b8;

  /* States — badges */
  --state-borrador:   #64748b;
  --state-validacion: #1d4ed8;
  --state-firma:      #b45309;
  --state-ejecucion:  #7c3aed;
  --state-cerrado:    #16a34a;
  --state-cancelado:  #dc2626;
  --state-proceso:    #b45309;
  --state-activo:     #16a34a;

  /* Geometry */
  --r:     6px;
  --r-lg:  10px;
  --r-xl:  14px;
  --r-2xl: 20px;

  /* Typography */
  --font-head: 'DM Sans', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'DM Sans', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;

  /* Motion */
  --ease: cubic-bezier(.4,0,.2,1);
  --fast: .15s;
  --med:  .25s;
  --slow: .4s;

  /* Shadows */
  --shadow:    0 4px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.12);
  --shadow-up: 0 -4px 12px rgba(0,0,0,.06);
  --glow-indigo: 0 0 28px var(--indigo-glow);

  /* Exam shell — pantalla inmersiva del candidato */
  --exam-bg:       #0f172a;
  --exam-card-bg:  #1e293b;
  --exam-border:   #334155;
  --exam-txt:      #f1f5f9;
  --exam-txt2:     #94a3b8;
  --exam-accent:   #818cf8;
}


/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-size: .9375rem; line-height: 1.6;
  background: var(--light-bg); color: var(--txt1);
  min-height: 100dvh; overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-color); text-decoration: none; }
button { cursor: pointer; }
input, select, textarea { font-family: var(--font-body); }

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--light-bg); }
::-webkit-scrollbar-thumb { background: var(--indigo-md); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--indigo); }
::selection { background: var(--indigo-glow2); color: var(--txt0); }


/* ═══════════════════════════════════════════════════════════════════════════
   SPLASH
   ═══════════════════════════════════════════════════════════════════════════ */
.splash {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: var(--light-bg);
  animation: splashOut .5s var(--ease) 1.4s forwards;
}
.splash-ring {
  position: absolute; width: 100px; height: 100px; border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--indigo);
  border-right-color: var(--indigo-md);
  animation: spinRing 1s linear infinite;
}
.splash-inner { text-align: center; }
.splash-logo {
  font-family: var(--font-head); font-size: 2.8rem; font-weight: 800;
  color: var(--indigo); letter-spacing: 2px;
}
.splash-sub {
  font-size: .72rem; color: var(--txt3);
  letter-spacing: .2em; text-transform: uppercase; margin-top: 4px;
}
@keyframes spinRing  { to { transform: rotate(360deg); } }
@keyframes splashOut { to { opacity: 0; pointer-events: none; visibility: hidden; } }


/* ═══════════════════════════════════════════════════════════════════════════
   LOGIN (staff)
   ═══════════════════════════════════════════════════════════════════════════ */
.login-page {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--indigo-lt) 0%, #ffffff 60%);
}
.login-bg  { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.login-particle {
  position: absolute; border-radius: 50%; opacity: 0;
  animation: particleFloat linear infinite;
}
@keyframes particleFloat {
  0%   { opacity: 0; transform: translateY(105vh) scale(.5); }
  8%   { opacity: .35; }
  92%  { opacity: .15; }
  100% { opacity: 0; transform: translateY(-10vh) scale(1.2); }
}
.login-card {
  position: relative; z-index: 2;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 48px 40px;
  width: 100%; max-width: 420px;
  box-shadow: var(--shadow-lg), 0 0 0 3px var(--indigo-glow);
  animation: cardIn .5s var(--ease) .6s both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo-mark {
  font-family: var(--font-head); font-size: 2.4rem; font-weight: 800;
  color: var(--indigo); letter-spacing: 2px;
}
.login-tagline {
  font-size: .72rem; color: var(--txt3);
  letter-spacing: .18em; text-transform: uppercase; margin-top: 5px;
}
.login-hint { font-size: .8rem; color: var(--txt3); text-align: center; margin-bottom: 18px; }
.login-error {
  background: var(--red-lt); border: 1px solid #fecaca;
  border-radius: var(--r); padding: 10px 14px;
  font-size: .85rem; color: #b91c1c;
  margin-bottom: 16px; display: none;
}


/* ═══════════════════════════════════════════════════════════════════════════
   FORM CONTROLS
   ═══════════════════════════════════════════════════════════════════════════ */
.form-group  { margin-bottom: 1.5rem; }
.form-label  {
  display: block; font-size: .75rem; font-weight: 700;
  color: var(--txt2); margin-bottom: 6px;
  letter-spacing: .05em; text-transform: uppercase;
}
.form-control {
  width: 100%; padding: .8rem 1rem;
  background: #ffffff; border: 1px solid var(--border);
  border-radius: var(--r); color: var(--txt0);
  font-size: .9rem; transition: border-color var(--fast), box-shadow var(--fast);
  outline: none;
}
.form-control:focus  { border-color: var(--indigo); box-shadow: 0 0 0 3px var(--indigo-glow); }
.form-control::placeholder { color: #aaa; }
textarea.form-control { resize: vertical; min-height: 88px; line-height: 1.5; }
.form-select {
  appearance: none; width: 100%;
  background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%234338ca' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1px solid var(--border); border-radius: var(--r);
  color: var(--txt0); padding: .8rem 2.2rem .8rem 1rem;
  font-size: .9rem; cursor: pointer; outline: none;
  transition: border-color var(--fast);
}
.form-select:focus { border-color: var(--indigo); box-shadow: 0 0 0 3px var(--indigo-glow); }
.form-row        { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.form-row.col-1  { grid-template-columns: 1fr; }
.form-row.col-3  { grid-template-columns: 1fr 1fr 1fr; }
.form-col        { display: flex; flex-direction: column; gap: 5px; }


/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: .8rem 1.5rem; border-radius: var(--r); border: none;
  font-family: var(--font-body); font-size: .9rem; font-weight: 600;
  transition: background var(--fast), box-shadow var(--fast), transform var(--fast);
  white-space: nowrap; cursor: pointer;
}
.btn-primary {
  background: var(--indigo); color: #ffffff;
  box-shadow: 0 2px 8px rgba(67,56,202,.28);
}
.btn-primary:hover { background: var(--indigo-dk); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(67,56,202,.35); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost {
  background: transparent; color: var(--txt1);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--indigo); color: var(--indigo); background: var(--indigo-lt); }
.btn-danger  { background: #dc2626; color: #ffffff; }
.btn-danger:hover  { background: #b91c1c; }
.btn-success { background: var(--green); color: #ffffff; }
.btn-success:hover { background: #15803d; }
.btn-amber   { background: #d97706; color: #ffffff; }
.btn-amber:hover   { background: var(--amber); }
.btn-sm      { padding: .45rem .9rem; font-size: .8rem; }
.btn-block   { width: 100%; }
.btn-icon    { padding: 8px; border-radius: var(--r); aspect-ratio: 1; }
.btn[disabled], .btn.loading { opacity: .55; pointer-events: none; }
.btn.loading::after {
  content: ''; width: 13px; height: 13px;
  border: 2px solid transparent; border-top-color: currentColor;
  border-radius: 50%; animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }


/* ═══════════════════════════════════════════════════════════════════════════
   APP SHELL
   ═══════════════════════════════════════════════════════════════════════════ */
.app-shell { display: flex; min-height: 100dvh; }

/* ── Sidebar ──────────────────────────────────────────────────────────── */
.sidebar {
  width: 232px; min-width: 232px;
  background: var(--dark-bg);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
  border-right: 3px solid var(--indigo);
  transition: transform var(--med) var(--ease);
  box-shadow: 2px 0 16px rgba(0,0,0,.18);
}
.sidebar-logo {
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.sidebar-logo-mark {
  font-family: var(--font-head); font-size: 1.4rem; font-weight: 800;
  color: var(--exam-accent); letter-spacing: 2px;
}
.sidebar-logo img     { max-height: 36px; max-width: 140px; object-fit: contain; }
.sidebar-logo-ver     { font-size: .6rem; color: #6b7280; letter-spacing: .1em; margin-top: 2px; }
.nav           { flex: 1; padding: 10px 8px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px; border-radius: var(--r);
  font-size: .84rem; font-weight: 500; color: #94a3b8;
  cursor: pointer; transition: all var(--fast);
  margin-bottom: 2px; border: none; background: none; width: 100%; text-align: left;
}
.nav-item .nav-icon { font-size: 1rem; flex-shrink: 0; opacity: .7; }
.nav-item:hover     { background: rgba(255,255,255,.08); color: #ffffff; }
.nav-item:hover .nav-icon { opacity: 1; }
.nav-item.active {
  background: var(--indigo); color: #ffffff;
  border-left: 3px solid #c7d2fe;
}
.nav-item.active .nav-icon { opacity: 1; }
.sidebar-footer {
  padding: 10px 8px 14px;
  border-top: 1px solid rgba(255,255,255,.1); flex-shrink: 0;
}
.user-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--r);
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1);
}
.user-avatar            { flex-shrink: 0; }
.user-avatar img        { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.user-avatar-fallback   {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--indigo);
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 700; color: #fff;
}
.user-info  { flex: 1; min-width: 0; }
.user-name  { font-size: .78rem; font-weight: 600; color: #ffffff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role  { font-size: .67rem; color: #94a3b8; }
.btn-logout {
  padding: 5px; color: #94a3b8; background: none; border: none;
  font-size: .85rem; transition: color var(--fast); border-radius: 4px;
}
.btn-logout:hover { color: #f87171; background: rgba(248,113,113,.12); }

/* ── Main content ─────────────────────────────────────────────────────── */
.main-content   { flex: 1; margin-left: 232px; display: flex; flex-direction: column; min-height: 100dvh; }
.page-content   { padding: 2rem; flex: 1; max-width: 100%; background: var(--light-bg); }
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 99;
}

/* ── Impersonation banner ─────────────────────────────────────────────── */
.impersonation-bar {
  background: #d97706; color: #ffffff; text-align: center;
  padding: 7px 20px; font-size: .82rem; font-weight: 600;
  letter-spacing: .02em; position: sticky; top: 0; z-index: 55;
  box-shadow: 0 2px 8px rgba(217,119,6,.4);
}
.impersonation-bar strong { font-weight: 800; }


/* ═══════════════════════════════════════════════════════════════════════════
   METRIC CARDS
   ═══════════════════════════════════════════════════════════════════════════ */
.metric-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr));
  gap: 1rem; margin-bottom: 1.5rem;
}
.metric-card {
  background: #ffffff; border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 18px 20px;
  position: relative; overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,.05);
  transition: transform var(--fast), box-shadow var(--fast);
}
.metric-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--accent-color, var(--indigo));
}
.metric-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.metric-label {
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--txt3); margin-bottom: 8px;
}
.metric-value { font-family: var(--font-head); font-size: 2.2rem; font-weight: 700; line-height: 1; }
.metric-card.m-total    { --accent-color: var(--indigo); }    .metric-card.m-total    .metric-value { color: var(--indigo); }
.metric-card.m-borrador { --accent-color: #64748b; }          .metric-card.m-borrador .metric-value { color: #64748b; }
.metric-card.m-val      { --accent-color: #1d4ed8; }          .metric-card.m-val      .metric-value { color: #1d4ed8; }
.metric-card.m-firma    { --accent-color: var(--amber); }     .metric-card.m-firma    .metric-value { color: var(--amber); }
.metric-card.m-ejec     { --accent-color: var(--purple); }    .metric-card.m-ejec     .metric-value { color: var(--purple); }
.metric-card.m-cerrado  { --accent-color: var(--green); }     .metric-card.m-cerrado  .metric-value { color: var(--green); }
.metric-card.m-cancel   { --accent-color: var(--red); }       .metric-card.m-cancel   .metric-value { color: var(--red); }
.metric-card.m-activo   { --accent-color: var(--indigo); }    .metric-card.m-activo   .metric-value { color: var(--indigo); }

/* Section header */
.section-hdr {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem; gap: .75rem; flex-wrap: wrap;
}
.section-title {
  font-family: var(--font-head); font-size: 1.05rem; font-weight: 700;
  color: var(--indigo); border-bottom: 2px solid var(--indigo); padding-bottom: .3rem;
}
.section-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }


/* ═══════════════════════════════════════════════════════════════════════════
   TABLE
   ═══════════════════════════════════════════════════════════════════════════ */
.table-wrap {
  background: #ffffff; border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,.05);
}
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 560px; }
thead tr  { background: var(--indigo); }
th {
  padding: .8rem 1rem; text-align: left;
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: #ffffff;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
td {
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: .875rem; color: var(--txt1);
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--fast); }
tbody tr:hover td { background: var(--indigo-lt); color: var(--txt0); }
.td-num { text-align: right; font-variant-numeric: tabular-nums; }


/* ═══════════════════════════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 99px;
  font-size: .68rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  border: 1px solid currentColor;
}
.badge-borrador   { color: #64748b;            background: #f1f5f9; }
.badge-validacion { color: #1d4ed8;            background: #eff6ff; }
.badge-firma      { color: #92400e;            background: var(--amber-lt); }
.badge-ejecucion  { color: #6b21a8;            background: #faf5ff; }
.badge-cerrado    { color: var(--green);       background: var(--green-lt); }
.badge-cancelado  { color: var(--red);         background: var(--red-lt); }
.badge-activo     { color: var(--green);       background: var(--green-lt); }
.badge-proceso    { color: #92400e;            background: var(--amber-lt); }
.badge-completado { color: var(--teal);        background: #f0fdfa; }
.badge-disponible { color: #1d4ed8;            background: #eff6ff; }

/* Action buttons */
.act-btns { display: flex; gap: 5px; flex-wrap: nowrap; }
.act-btn {
  padding: 4px 10px; border-radius: var(--r);
  border: 1px solid var(--border);
  background: #ffffff; color: var(--txt2);
  font-size: .72rem; font-weight: 600; transition: all var(--fast);
}
.act-btn:hover         { border-color: var(--indigo); color: var(--indigo); background: var(--indigo-lt); }
.act-btn.danger:hover  { border-color: var(--red);   color: var(--red);   background: var(--red-lt); }
.act-btn.success:hover { border-color: var(--green); color: var(--green); background: var(--green-lt); }
.act-btn.amber:hover   { border-color: #d97706;      color: #d97706;      background: var(--amber-lt); }


/* ═══════════════════════════════════════════════════════════════════════════
   MODAL / DIALOG
   ═══════════════════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500; padding: 16px;
  background: rgba(15,23,42,.5);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn var(--fast) var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-glass {
  background: #ffffff; border: 1px solid var(--border);
  border-radius: var(--r-xl);
  width: 100%; max-width: 680px; max-height: 92dvh;
  overflow: hidden; display: flex; flex-direction: column;
  position: relative;
  animation: modalIn var(--med) var(--ease);
  box-shadow: var(--shadow-lg);
  border-top: 4px solid var(--indigo);
}
@keyframes modalIn { from { opacity: 0; transform: scale(.96) translateY(10px); } to { opacity: 1; transform: none; } }
.modal-close-btn {
  position: absolute; top: 12px; right: 12px; z-index: 10;
  background: var(--light-bg); border: 1px solid var(--border);
  border-radius: 50%; width: 28px; height: 28px; color: var(--txt2);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--fast);
}
.modal-close-btn:hover { background: var(--red); color: #fff; border-color: var(--red); }
.modal-body  { flex: 1; overflow-y: auto; padding: 24px; }
.modal-hdr   { margin-bottom: 20px; padding-right: 32px; }
.modal-title { font-family: var(--font-head); font-size: 1.15rem; font-weight: 700; color: var(--indigo); }
.modal-subtitle { font-size: .82rem; color: var(--txt3); margin-top: 3px; }
.modal-lg  .modal-glass { max-width: 820px; }
.modal-xl  .modal-glass { max-width: 1020px; max-height: 96dvh; }

/* Confirm */
.confirm-overlay { align-items: center; }
.confirm-glass {
  background: #ffffff; border: 1px solid var(--border);
  border-radius: var(--r-xl); border-top: 4px solid #d97706;
  padding: 32px 28px; max-width: 360px; width: 100%;
  text-align: center; animation: modalIn var(--med) var(--ease);
  box-shadow: var(--shadow-lg);
}
.confirm-icon-wrap { font-size: 2.2rem; margin-bottom: 12px; }
.confirm-msg { font-size: .95rem; color: var(--txt1); margin-bottom: 24px; line-height: 1.5; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; }

/* Tabs (gasto-tabs reutilizado para dashboards) */
.gasto-tabs {
  display: flex; gap: 0; margin-bottom: 14px;
  border-bottom: 2px solid var(--indigo); overflow-x: auto;
}
.gasto-tab {
  padding: 8px 18px; font-size: .8rem; font-weight: 600;
  color: var(--txt3); background: none; border: none;
  border-bottom: 3px solid transparent; cursor: pointer;
  transition: all var(--fast); white-space: nowrap; margin-bottom: -2px;
}
.gasto-tab:hover  { color: var(--indigo); background: var(--indigo-lt); }
.gasto-tab.active { color: var(--indigo); border-bottom-color: var(--indigo); background: var(--indigo-lt); }

/* Glass panel / card */
.glass-panel {
  background: #ffffff; border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: 0 2px 6px rgba(0,0,0,.05);
}
.panel-title {
  font-family: var(--font-head); font-size: 1rem; font-weight: 700;
  color: var(--indigo); border-bottom: 2px solid var(--indigo); padding-bottom: .35rem;
}

/* Charts */
.chart-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-bottom: 1.5rem; }
.chart-card  {
  background: #ffffff; border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 18px; box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.chart-title {
  font-family: var(--font-head); font-size: .9rem; font-weight: 700;
  color: var(--indigo); margin-bottom: 14px;
  border-bottom: 2px solid var(--indigo); padding-bottom: .3rem;
}
.chart-card canvas { width: 100% !important; }

/* Mini bar (ranking) */
.mini-bar {
  display: inline-block; width: 90px; height: 8px;
  background: var(--bg3); border-radius: 99px; overflow: hidden;
  vertical-align: middle; margin-right: 4px;
}
.mini-bar-fill { height: 100%; border-radius: 99px; transition: width var(--med); }


/* ═══════════════════════════════════════════════════════════════════════════
   BATERÍAS — selector de módulos
   ═══════════════════════════════════════════════════════════════════════════ */
.bat-mod-check { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.bat-mod-opt {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 14px; border: 1px solid var(--border);
  border-radius: var(--r); cursor: pointer;
  font-size: .85rem; transition: all var(--fast);
  user-select: none;
}
.bat-mod-opt:hover { border-color: var(--indigo); background: var(--indigo-lt); }
.bat-mod-opt:has(input:checked) {
  background: var(--indigo-lt); border-color: var(--indigo); color: var(--indigo-dk);
}


/* ═══════════════════════════════════════════════════════════════════════════
   REPORTE MODAL
   ═══════════════════════════════════════════════════════════════════════════ */
.report-header {
  background: var(--indigo-lt); border: 1px solid var(--indigo-md);
  border-radius: var(--r-lg); padding: 16px 20px; margin-bottom: 20px;
}
.report-section-title {
  font-family: var(--font-head); font-size: .9rem; font-weight: 700;
  color: var(--indigo); border-bottom: 2px solid var(--indigo-md);
  padding-bottom: .3rem; margin: 18px 0 12px;
}
.report-cog-row {
  display: flex; align-items: center; gap: 24px; margin-bottom: 14px;
}
.report-ci-big {
  font-family: var(--font-head); font-size: 3.4rem; font-weight: 800;
  color: var(--indigo); line-height: 1;
}
.report-crt-row {
  display: flex; align-items: center; gap: 16px; margin-bottom: 8px;
}
.report-flags { margin-left: 1.2rem; font-size: .82rem; color: var(--txt2); }
.report-flags li { margin-bottom: 4px; }

/* Token generado */
.exam-token-display {
  background: var(--dark-bg); border-radius: var(--r-lg);
  padding: 16px 20px; margin: 16px 0; text-align: center;
}
.exam-token-display span {
  font-family: var(--font-mono); font-size: 1.5rem; font-weight: 700;
  color: var(--exam-accent); letter-spacing: .1em;
}


/* ═══════════════════════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════════════════════ */
#toast-container {
  position: fixed; bottom: 20px; right: 20px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: var(--r-lg);
  background: #ffffff; border: 1px solid var(--border);
  font-size: .85rem; color: var(--txt0);
  box-shadow: 0 4px 16px rgba(0,0,0,.1); min-width: 260px; pointer-events: all;
  animation: toastIn .3s var(--ease), toastOut .35s var(--ease) 3.7s forwards;
}
.toast.success { border-left: 4px solid var(--green); }
.toast.error   { border-left: 4px solid var(--red); }
.toast.info    { border-left: 4px solid var(--indigo); }
.toast.warn    { border-left: 4px solid #d97706; }
.toast-icon  { font-size: 1rem; flex-shrink: 0; }
.toast-body  { flex: 1; }
.toast-close { background: none; border: none; color: var(--txt3); font-size: .8rem; padding: 2px 4px; border-radius: 3px; }
.toast-close:hover { color: var(--txt0); background: var(--bg2); }
@keyframes toastIn  { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(12px); pointer-events: none; } }

/* Empty state */
.empty-state { padding: 3.5rem 1.25rem; text-align: center; color: var(--txt3); }
.empty-icon  { font-size: 2.5rem; margin-bottom: 10px; opacity: .45; }
.empty-msg   { font-size: .9rem; color: var(--txt2); }
.empty-sub   { font-size: .8rem; color: var(--txt3); margin-top: 4px; }

/* Idle warning */
.idle-warning {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 9990;
  background: #d97706; color: #ffffff;
  padding: 8px 20px; border-radius: 99px;
  font-size: .83rem; font-weight: 700;
  display: none; white-space: nowrap;
  box-shadow: 0 4px 16px rgba(217,119,6,.35);
}
.idle-warning.show { display: block; animation: toastIn .3s var(--ease); }

/* Skeleton */
.skeleton {
  background: linear-gradient(90deg,#f1f5f9 25%,#f8fafc 50%,#f1f5f9 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 4px;
}
@keyframes shimmer { to { background-position: -200% 0; } }


/* ═══════════════════════════════════════════════════════════════════════════
   EXAM SHELL  — Pantalla inmersiva del candidato (sin sidebar, fondo oscuro)
   ═══════════════════════════════════════════════════════════════════════════ */
.exam-shell {
  min-height: 100dvh;
  background: var(--exam-bg);
  display: flex; align-items: center; justify-content: center;
  padding: 20px 16px;
  font-family: var(--font-body);
}

/* ── Token de acceso ──────────────────────────────────────────────────── */
.exam-token-card {
  background: var(--exam-card-bg); border: 1px solid var(--exam-border);
  border-radius: var(--r-2xl);
  padding: 48px 40px; width: 100%; max-width: 440px;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  animation: cardIn .5s var(--ease) both;
  text-align: center;
}
.exam-logo {
  font-family: var(--font-head); font-size: 2.2rem; font-weight: 800;
  color: var(--exam-accent); letter-spacing: 2px; margin-bottom: 6px;
}
.exam-logo-amp { color: #6366f1; }
.exam-token-title {
  font-size: 1.1rem; font-weight: 600; color: var(--exam-txt);
  margin-bottom: 8px;
}
.exam-token-sub  { font-size: .85rem; color: var(--exam-txt2); margin-bottom: 24px; }
.exam-token-input {
  background: var(--exam-bg); border: 1px solid var(--exam-border);
  color: var(--exam-txt); text-align: center;
  font-family: var(--font-mono); font-size: 1.1rem; letter-spacing: .1em;
  margin-bottom: 16px;
}
.exam-token-input:focus { border-color: var(--exam-accent); box-shadow: 0 0 0 3px rgba(129,140,248,.2); outline: none; }
.exam-error {
  background: rgba(220,38,38,.12); border: 1px solid rgba(220,38,38,.3);
  border-radius: var(--r); padding: 10px 14px;
  font-size: .85rem; color: #fca5a5;
  margin-bottom: 16px; display: none;
}

/* ── Consentimiento ──────────────────────────────────────────────────── */
.exam-consent-shell { align-items: flex-start; padding: 32px 16px; }
.exam-consent-card {
  background: var(--exam-card-bg); border: 1px solid var(--exam-border);
  border-radius: var(--r-xl);
  padding: 40px 36px; width: 100%; max-width: 560px;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  animation: cardIn .5s var(--ease) both;
}
.exam-consent-title { font-size: 1.4rem; font-weight: 700; color: var(--exam-txt); margin: 12px 0 20px; }
.exam-consent-body  { font-size: .9rem; color: var(--exam-txt2); line-height: 1.7; }
.exam-consent-body p { margin-bottom: 12px; }
.exam-consent-modules { margin: 8px 0 16px 1.2rem; color: var(--exam-txt); }
.exam-consent-modules li { margin-bottom: 6px; }
.exam-consent-rules { margin: 8px 0 20px 1.2rem; color: var(--exam-txt2); }
.exam-consent-rules li { margin-bottom: 6px; }
.exam-consent-alert {
  background: rgba(217,119,6,.12); border: 1px solid rgba(217,119,6,.3);
  border-left: 4px solid #d97706;
  border-radius: var(--r); padding: 12px 16px;
  font-size: .85rem; color: #fcd34d; margin-bottom: 16px;
}

/* ── Pantalla activa de evaluación ───────────────────────────────────── */
.exam-active { align-items: flex-start; padding: 0; }
.exam-content { width: 100%; max-width: 720px; padding: 28px 20px; }

/* Barra de progreso */
.exam-progress-bar {
  width: 100%; height: 4px;
  background: rgba(255,255,255,.08); border-radius: 99px;
  margin-bottom: 8px; overflow: hidden;
}
.exam-progress-fill {
  height: 100%; background: var(--exam-accent);
  border-radius: 99px; transition: width var(--med) var(--ease);
}
.exam-counter {
  font-size: .75rem; color: var(--exam-txt2);
  text-align: right; margin-bottom: 16px;
}
.exam-modulo-badge {
  display: inline-block; padding: 3px 12px;
  background: rgba(129,140,248,.15); border: 1px solid rgba(129,140,248,.3);
  border-radius: 99px; font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--exam-accent); margin-bottom: 16px;
}

/* Card de ítem */
.exam-card {
  background: var(--exam-card-bg); border: 1px solid var(--exam-border);
  border-radius: var(--r-xl); padding: 32px 28px;
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
}
.exam-svg { text-align: center; margin-bottom: 20px; }
.exam-svg svg { max-width: 100%; height: auto; }
.exam-enunciado {
  font-size: 1.05rem; font-weight: 500; color: var(--exam-txt);
  line-height: 1.7; margin-bottom: 28px;
}

/* Opciones de respuesta (opción múltiple) */
.exam-options {
  display: flex; flex-direction: column; gap: 10px;
  transition: opacity var(--fast);
}
.exam-options.disabled { opacity: .55; pointer-events: none; }
.exam-option {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; border-radius: var(--r-lg);
  border: 1.5px solid var(--exam-border);
  background: rgba(255,255,255,.04);
  cursor: pointer; transition: all var(--fast);
  color: var(--exam-txt);
}
.exam-option:hover     { border-color: var(--exam-accent); background: rgba(129,140,248,.1); }
.exam-option.selected  { border-color: var(--exam-accent); background: rgba(129,140,248,.18); }
.exam-opt-key {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  border: 1.5px solid rgba(129,140,248,.4);
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; color: var(--exam-accent);
}
.exam-option.selected .exam-opt-key { background: var(--exam-accent); color: var(--exam-bg); border-color: var(--exam-accent); }
.exam-opt-text { font-size: .95rem; line-height: 1.5; }

/* Opciones Likert */
.exam-likert {
  display: flex; gap: 8px; justify-content: stretch; flex-wrap: wrap;
}
.exam-likert-opt {
  flex: 1; min-width: 80px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 8px; border-radius: var(--r-lg);
  border: 1.5px solid var(--exam-border);
  cursor: pointer; transition: all var(--fast);
  color: var(--exam-txt2); text-align: center;
}
.exam-likert-opt:hover  { border-color: var(--exam-accent); background: rgba(129,140,248,.1); color: var(--exam-txt); }
.exam-likert-opt.selected { border-color: var(--exam-accent); background: rgba(129,140,248,.18); color: var(--exam-txt); }
.exam-likert-num {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1.5px solid currentColor;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 700;
}
.exam-likert-label { font-size: .68rem; line-height: 1.3; }

/* Respuesta libre */
.exam-textarea {
  width: 100%; background: var(--exam-bg);
  border: 1.5px solid var(--exam-border);
  border-radius: var(--r-lg); color: var(--exam-txt);
  padding: 14px 16px; font-size: .95rem; line-height: 1.6;
  resize: vertical; min-height: 120px; outline: none;
  transition: border-color var(--fast);
  margin-bottom: 16px;
}
.exam-textarea:focus { border-color: var(--exam-accent); box-shadow: 0 0 0 3px rgba(129,140,248,.15); }

/* Loading / error del examen */
.exam-loading {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 60px 20px; gap: 20px;
  color: var(--exam-txt2); text-align: center;
}
.exam-spinner {
  width: 44px; height: 44px; border-radius: 50%;
  border: 3px solid rgba(129,140,248,.2);
  border-top-color: var(--exam-accent);
  animation: spin .8s linear infinite;
}
.exam-error {
  background: rgba(220,38,38,.08); border: 1px solid rgba(220,38,38,.3);
  border-radius: var(--r-xl); padding: 28px 24px;
  text-align: center; color: #fca5a5;
}

/* Fin de evaluación */
.exam-fin-shell { background: var(--exam-bg); }
.exam-fin-card  {
  background: var(--exam-card-bg); border: 1px solid var(--exam-border);
  border-radius: var(--r-2xl); padding: 60px 48px;
  max-width: 440px; width: 100%; text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  animation: cardIn .5s var(--ease) both;
}
.exam-fin-icon {
  width: 72px; height: 72px; border-radius: 50%;
  background: rgba(74,222,128,.15); border: 2px solid #4ade80;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; color: #4ade80;
  margin: 0 auto 24px;
}
.exam-fin-card h2 { font-size: 1.5rem; font-weight: 700; color: var(--exam-txt); margin-bottom: 12px; }
.exam-fin-card p  { font-size: .9rem; color: var(--exam-txt2); line-height: 1.6; }


/* ═══════════════════════════════════════════════════════════════════════════
   BITÁCORA
   ═══════════════════════════════════════════════════════════════════════════ */
.bitacora-timeline   { display: flex; flex-direction: column; gap: 0; }
.bitacora-item       { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.bitacora-item:last-child { border-bottom: none; }
.bitacora-dot {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; margin-top: 2px;
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; color: #fff; font-weight: 700;
}
.bitacora-dot.insert  { background: var(--indigo); }
.bitacora-dot.estado  { background: var(--green); }
.bitacora-dot.update  { background: var(--teal); }
.bitacora-dot.alerta  { background: #d97706; }
.bitacora-dot.cancel  { background: var(--red); }
.bitacora-body  { flex: 1; }
.bitacora-op    { font-size: .82rem; font-weight: 600; color: var(--txt0); }
.bitacora-meta  { font-size: .72rem; color: var(--txt2); margin-top: 2px; }
.bitacora-ts    { font-size: .68rem; color: var(--txt3); }


/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .chart-grid { grid-template-columns: 1fr; }
  .form-row.col-3 { grid-template-columns: 1fr 1fr; }
  .report-cog-row { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 768px) {
  .sidebar             { transform: translateX(-100%); }
  .sidebar.open        { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .main-content        { margin-left: 0; }
  .page-content        { padding: 1rem; }
  .metric-grid         { grid-template-columns: repeat(2,1fr); }
  .form-row,
  .form-row.col-3      { grid-template-columns: 1fr; }
  .modal-overlay       { align-items: flex-end; padding: 0; }
  .modal-glass         { max-width: 100% !important; max-height: 96dvh !important; border-radius: var(--r-lg) var(--r-lg) 0 0 !important; }
  .chart-grid          { grid-template-columns: 1fr; }
  .exam-likert         { gap: 5px; }
  .exam-likert-label   { display: none; }
  .exam-card           { padding: 22px 16px; }
  .login-card          { padding: 36px 24px; }
  .exam-token-card     { padding: 36px 24px; }
  .bat-mod-check       { gap: 6px; }
}

@media (max-width: 480px) {
  .metric-grid  { grid-template-columns: 1fr 1fr; gap: .625rem; }
  .act-btns     { flex-wrap: wrap; }
  .exam-content { padding: 20px 12px; }
  .report-ci-big { font-size: 2.4rem; }
}