/* ============================================================
   app.css — Estilos globales de la aplicación
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; color-scheme: light; }
html, body { margin: 0; padding: 0; }

:root {
  --bg: #FBFDF9;
  --surface: #F1F7EF;
  --surface-2: #E4EFDF;
  --surface-3: #DDEED6;
  --text: #1F3A2C;
  --text-2: #2D4A38;
  --muted: #5C7461;
  --hint: #8FA593;
  --border: #D0DFCC;
  --border-strong: #B5CCB1;
  --accent: #2F6E4A;
  --accent-dark: #235539;
  --ok: #2F8F4F;
  --err: #B83B3B;
  --warn: #B57A1A;
  --ok-bg: #E0F0DD;
  --err-bg: #F8E3E3;
  --warn-bg: #FBEFD8;
  --radius: 10px;
  --radius-lg: 14px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(241, 247, 239, 0.92);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 var(--border), 0 4px 14px -8px rgba(31, 58, 44, 0.08);
}
.fade-in { animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.brand-mini {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 14px; color: var(--text);
  transition: transform .2s ease;
}
.brand-mini:hover { transform: scale(1.03); }
.user-toolbar { display:flex; justify-content:space-between; align-items:center; gap:16px; flex-wrap:wrap; margin-bottom:16px; }
.user-tabs { display:flex; gap:6px; flex-wrap:wrap; }
.user-tab { padding:9px 16px; border:1px solid var(--border); background:var(--surface); color:var(--muted); border-radius:999px; font-size:13px; font-weight:600; cursor:pointer; transition:all .15s; }
.user-tab:hover { color:var(--text); }
.user-tab.active { background:var(--accent); color:#fff; border-color:var(--accent); }
.user-tab-count { opacity:.75; font-weight:500; margin-left:2px; }
.user-tab.active .user-tab-count { opacity:.9; }
.user-search input { min-width:240px; padding:9px 14px; border:1px solid var(--border); border-radius:999px; font-size:13px; background:var(--bg); }
@media (max-width:600px){ .user-search input{ min-width:100%; } .user-toolbar{ flex-direction:column; align-items:stretch; } }
.logo-img { height: 30px; width: auto; display: block; }
.logo-img-lg { height: 58px; width: auto; display: block; margin-bottom: 10px; }
@media (max-width:600px){ .logo-img{ height:24px; } .logo-img-lg{ height:46px; } }
.brand-mini .logo {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--accent); color: var(--bg);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), box-shadow .2s;
}
.brand-mini:hover .logo {
  transform: rotate(-6deg) scale(1.05);
  box-shadow: 0 4px 12px -2px rgba(47, 110, 74, 0.4);
}

.nav { display: flex; gap: 4px; flex: 1 1 200px; flex-wrap: wrap; }
.nav a {
  padding: 7px 14px; color: var(--muted);
  font-size: 13px; cursor: pointer;
  border-radius: 7px; white-space: nowrap;
  position: relative;
  transition: color .2s ease, background .2s ease, transform .15s ease;
}
.nav a::after {
  content: ""; position: absolute;
  left: 50%; bottom: -2px;
  width: 0; height: 2px;
  background: var(--accent);
  border-radius: 999px;
  transition: width .25s ease, left .25s ease;
}
.nav a:hover { color: var(--accent); background: var(--surface-2); }
.nav a:hover::after { width: 60%; left: 20%; }
.nav a.active {
  color: var(--accent); background: var(--surface-3); font-weight: 600;
  animation: pop .25s ease;
}
.nav a.active::after { width: 60%; left: 20%; }
@keyframes pop { 0% { transform: scale(.94); } 60% { transform: scale(1.04); } 100% { transform: scale(1); } }

.user-info {
  font-size: 12px; color: var(--muted);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  animation: fadeIn .35s ease;
}
.user-info em { font-style: normal; color: var(--accent); font-weight: 600; }
.user-info .btn { transition: all .15s ease; }
.user-info .btn:hover { transform: translateY(-1px); }

.container { flex: 1; max-width: 1100px; margin: 0 auto; padding: 32px 24px; width: 100%; }
.footer { text-align: center; padding: 14px; color: var(--hint); font-size: 10.5px; letter-spacing: 0.3px; opacity: 0.65; border-top: 1px solid var(--border); background: var(--surface); }

.page-title { color: var(--text); font-size: 26px; font-weight: 700; margin: 0 0 6px; letter-spacing: -0.5px; }
.page-sub { color: var(--muted); font-size: 14px; margin-bottom: 28px; }
h1 { font-size: 22px; margin: 0 0 16px; font-weight: 600; color: var(--text); }
h2 { font-size: 15px; margin: 0 0 14px; font-weight: 600; color: var(--text); }
.lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; font-weight: 600; }

.section { border-top: 1px solid var(--border); padding: 28px 0; }
.section:first-of-type { border-top: none; padding-top: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; gap: 16px; flex-wrap: wrap; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 32px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat-card .num { font-size: 26px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -0.5px; color: var(--text); }

.form-row { margin-bottom: 12px; }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
label { display: block; font-size: 12px; color: var(--text); margin-bottom: 8px; font-weight: 600; }
.field-label { font-size: 12px; color: var(--text); margin-bottom: 8px; font-weight: 600; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; height: 44px;
  padding: 0 14px; font-size: 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg); color: var(--text);
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--surface-3); }
input::placeholder { color: var(--hint); }
textarea { height: auto; min-height: 48px; padding: 10px 14px; resize: vertical; line-height: 1.5; }
select { cursor: pointer; }
input[type=checkbox], input[type=radio] { width: auto; height: auto; margin-right: 6px; accent-color: var(--accent); }

.input-wrap { position: relative; width: 100%; }
.input-wrap .lead-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; display: flex; align-items: center; justify-content: center; }
.input-wrap .lead-icon svg { width: 18px; height: 18px; display: block; }
.input-wrap input { padding-left: 44px; }
.input-wrap:has(.pass-toggle) input { padding-right: 44px; }
.pass-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border: none; background: transparent; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; border-radius: 7px; padding: 0; transition: color .15s, background .15s; }
.pass-toggle:hover { color: var(--accent); background: var(--surface-2); }
.pass-toggle svg { width: 18px; height: 18px; display: block; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; font-size: 13px; font-weight: 500;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; font-family: inherit;
  transition: all .15s; line-height: 1.2;
  text-decoration: none;
}
.btn:hover { border-color: var(--accent); background: var(--surface); text-decoration: none; }
.btn-primary { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-ghost { border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); border-color: var(--border); background: var(--surface); }
.btn-danger { color: var(--err); border-color: var(--border); background: transparent; }
.btn-danger:hover { color: #fff; background: var(--err); border-color: var(--err); }

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(31, 58, 44, 0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; padding: 20px;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.modal-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 440px; width: 100%;
  box-shadow: 0 20px 50px rgba(31, 58, 44, 0.15);
  animation: slideUp .2s ease;
  overflow: hidden;
}
.modal-icon {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--err-bg);
  color: var(--err);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.modal-icon.modal-icon-primary { background: var(--surface-3); color: var(--accent); }
.modal-icon svg { width: 24px; height: 24px; }
.modal-body { padding: 28px 24px 20px; text-align: center; }
.modal-title { font-size: 17px; font-weight: 700; color: var(--text); margin: 0 0 8px; }
.modal-msg { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.55; }
.modal-msg strong { color: var(--text); font-weight: 600; }
.modal-actions {
  display: flex; gap: 8px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.modal-actions .btn { flex: 1; justify-content: center; height: 40px; }
.modal-actions .btn-danger { background: var(--err); color: #fff; border-color: var(--err); }
.modal-actions .btn-danger:hover { background: #9c3030; border-color: #9c3030; }
.modal-actions .btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.modal-actions .btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; height: 44px; font-size: 14px; font-weight: 600; }
.btn-block svg { width: 14px; height: 14px; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; color: var(--text); min-width: 400px; }
.table th, .table td { padding: 12px 10px 12px 0; text-align: left; border-bottom: 1px solid var(--border); }
.table th { font-weight: 600; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.table tr:last-child td { border-bottom: none; }
.table .right { text-align: right; }
.table td small { color: var(--muted); }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text); padding: 3px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: #B5DCB0; }
.badge.ok::before { background: var(--ok); }
.badge.err { background: var(--err-bg); color: var(--err); border-color: #E8C5C5; }
.badge.err::before { background: var(--err); }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: #E8D4A8; }
.badge.warn::before { background: var(--warn); }

.alert { padding: 11px 14px; margin-bottom: 18px; font-size: 13px; border-radius: var(--radius); border: 1px solid; }
.alert.err { background: var(--err-bg); color: var(--err); border-color: #E8C5C5; }
.alert.ok { background: var(--ok-bg); color: var(--ok); border-color: #B5DCB0; }
.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 100000; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 40px)); pointer-events: none; }
.toast { pointer-events: auto; padding: 13px 16px; border-radius: var(--radius); border: 1px solid; font-size: 13px; line-height: 1.45; box-shadow: 0 10px 30px -8px rgba(31,58,44,.28); display: flex; align-items: flex-start; gap: 10px; background: var(--bg); opacity: 0; transform: translateY(12px) scale(.98); transition: opacity .25s ease, transform .25s ease; }
.toast.show { opacity: 1; transform: translateY(0) scale(1); }
.toast.hide { opacity: 0; transform: translateY(12px) scale(.98); }
.toast.ok { background: var(--ok-bg); color: var(--ok); border-color: #B5DCB0; }
.toast.err { background: var(--err-bg); color: var(--err); border-color: #E8C5C5; }
.toast.warn { background: #FBF3D9; color: #8A6D1A; border-color: #ECD79A; }
.toast .toast-ico { flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; }
.toast .toast-ico svg { width: 18px; height: 18px; display: block; }
.toast .toast-close { margin-left: auto; background: none; border: none; color: inherit; opacity: .55; cursor: pointer; font-size: 16px; line-height: 1; padding: 0 0 0 6px; }
.toast .toast-close:hover { opacity: 1; }
@media (max-width: 600px) { .toast-stack { right: 12px; left: 12px; bottom: 12px; max-width: none; } }
.det-scroll { max-height: 60vh; overflow-y: auto; padding-right: 4px; }
.det-q { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; background: var(--bg); }
.det-q-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.det-q-num { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; font-weight: 700; }
.det-q-text { font-size: 14px; font-weight: 600; margin-bottom: 10px; line-height: 1.4; }
.det-opts { display: flex; flex-direction: column; gap: 6px; }
.det-opt { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }
.det-opt .det-letra { width: 22px; height: 22px; flex-shrink: 0; border-radius: 6px; background: var(--surface-3); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 11px; }
.det-opt .det-txt { flex: 1; }
.det-opt .det-marca { font-weight: 700; }
.det-opt.det-correcta { background: var(--ok-bg); border-color: #B5DCB0; color: var(--ok); }
.det-opt.det-correcta .det-letra { background: var(--ok); color: #fff; }
.det-opt.det-mala { background: var(--err-bg); border-color: #E8C5C5; color: var(--err); }
.det-opt.det-mala .det-letra { background: var(--err); color: #fff; }

.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; background: var(--bg); }
.login-shell { display: flex; align-items: stretch; gap: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--bg); width: 100%; max-width: 760px; }
.login-side { flex: 0 0 38%; padding: 36px 28px; background: var(--surface-2); border-right: 1px solid var(--border); display: flex; flex-direction: column; justify-content: space-between; min-height: 540px; }
.login-side .brand-big { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.login-side .brand-big .logo { width: 44px; height: 44px; border-radius: 12px; background: var(--accent); color: var(--bg); display: inline-flex; align-items: center; justify-content: center; font-size: 19px; font-weight: 700; }
.login-side .brand-big .name { font-weight: 700; font-size: 15px; color: var(--text); }
.login-side .brand-big .tag { font-size: 11px; color: var(--muted); margin-top: 2px; }
.login-side .pitch { margin-top: 48px; }
.login-side .pitch h2 { font-size: 21px; font-weight: 700; margin: 0 0 12px; letter-spacing: -0.3px; line-height: 1.3; }
.login-side .pitch p { font-size: 13px; color: var(--muted); margin: 0 0 18px; line-height: 1.55; }
.login-side .feat-list { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.login-side .pitch-label { font-size: 11px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.6px; font-weight: 700; margin-top: 22px; }
.login-side .pitch-close { font-size: 12px; color: var(--muted); margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); line-height: 1.5; }
.login-side .feat { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-2); }
.login-side .feat-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: var(--bg); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.login-side .feat-dot svg { width: 10px; height: 10px; }
.login-side .foot { font-size: 10.5px; color: var(--hint); opacity: 0.65; letter-spacing: 0.3px; text-align: center; margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--border); }

.login-main { flex: 1; padding: 0; display: flex; flex-direction: column; justify-content: center; }
.login-main .login-inner { padding: 48px 44px; max-width: 380px; width: 100%; margin: 0 auto; }
.login-main h1 { font-size: 22px; font-weight: 700; margin: 0 0 8px; letter-spacing: -0.3px; color: var(--text); text-align: center; }
.login-main .sub { color: var(--muted); font-size: 13px; margin-bottom: 32px; line-height: 1.5; text-align: center; }
.login-form .form-row { margin-bottom: 16px; }
.login-form .field-label { font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 7px; letter-spacing: 0.1px; }
.login-form input[type=text], .login-form input[type=password] { height: 46px; border: 1px solid var(--border); background: var(--bg); border-radius: 10px; font-size: 14px; padding: 0 14px; transition: border-color .15s, box-shadow .15s, background .15s; }
.login-form input::placeholder { color: var(--hint); letter-spacing: 0.2px; }
.login-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--surface-3); background: var(--bg); }
.login-form .input-wrap .pass-toggle { right: 6px; }
.login-form .input-wrap:has(.pass-toggle) input { padding-right: 44px; padding-left: 14px; }
.login-form .btn-block { height: 46px; font-size: 14px; font-weight: 600; border-radius: 10px; letter-spacing: 0.1px; box-shadow: none; }
.login-form .btn-block:hover { filter: brightness(0.96); }

.divider { display: flex; align-items: center; gap: 14px; margin: 28px 0 18px; color: var(--hint); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.8px; font-weight: 600; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }


.exam-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 18px 22px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 24px; color: var(--text); }
.exam-bar .col-l { text-align: left; }
.exam-bar .col-c { text-align: center; }
.exam-bar .col-r { text-align: right; }
.timer { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); margin-top: 4px; }
.timer.warn { color: var(--warn); }
.timer.danger { color: var(--err); }

/* Estado de conexión / guardado */
.sync-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--border); background: #fff; color: var(--muted); margin-top: 6px; }
.sync-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; }
.sync-chip.ok       { color: var(--ok);   background: var(--ok-bg);   border-color: var(--ok); }
.sync-chip.warn     { color: var(--warn); background: var(--warn-bg); border-color: var(--warn); }
.sync-chip.err      { color: var(--err);  background: var(--err-bg);  border-color: var(--err); }
.sync-chip.ok   .dot { background: var(--ok); }
.sync-chip.warn .dot { background: var(--warn); animation: pulse 1.2s infinite; }
.sync-chip.err  .dot { background: var(--err); }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.35} }

/* Banner de reanudación */
.resume-banner { background: var(--warn-bg); border: 1px solid var(--warn); color: var(--text); padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.resume-banner .txt { font-size: 13px; }
.resume-banner strong { color: var(--warn); }

.progress-bar {
  width: 100%; height: 6px;
  background: var(--surface-3); border-radius: 999px;
  overflow: hidden; margin-top: 2px;
}
.progress-fill {
  height: 100%; background: var(--accent);
  border-radius: 999px;
  transition: width .2s ease;
}

.q-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.q-pill {
  width: 100%; aspect-ratio: 1;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--bg); color: var(--text);
  font-size: 13px; font-weight: 600;
  font-family: inherit; cursor: pointer;
  transition: all .15s;
  display: inline-flex; align-items: center; justify-content: center;
}
.q-pill:hover { border-color: var(--accent); color: var(--accent); }
.q-pill.answered { background: var(--surface-3); border-color: var(--accent); color: var(--accent); }
.q-pill.current { background: var(--accent); border-color: var(--accent); color: var(--bg); }

.exam-layout {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 20px;
  align-items: start;
}
.exam-main { min-width: 0; }
.exam-side {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  position: sticky;
  top: 16px;
}
.exam-side-title {
  font-size: 11px; font-weight: 700;
  color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.6px;
  margin-bottom: 12px;
}
.exam-side-legend {
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 6px;
}
.leg-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--muted);
}
.leg-dot {
  width: 12px; height: 12px; border-radius: 4px;
  border: 1px solid var(--border-strong);
  flex-shrink: 0;
}
.leg-dot.current { background: var(--accent); border-color: var(--accent); }
.leg-dot.answered { background: var(--surface-3); border-color: var(--accent); }
.leg-dot.pending { background: var(--bg); }

.exam-nav {
  display: flex; align-items: center; gap: 12px;
  margin-top: 20px; padding-top: 20px;
  border-top: 1px solid var(--border);
}
.exam-nav .muted { flex: 1; text-align: center; font-weight: 600; }
.exam-nav .btn { height: 40px; min-width: 120px; }

@media (max-width: 720px) {
  .exam-layout { grid-template-columns: 1fr; }
  .exam-side { position: static; order: -1; }
  .q-grid { grid-template-columns: repeat(8, 1fr); }
  .exam-side-legend { flex-direction: row; flex-wrap: wrap; gap: 12px; }
}

.question { padding: 22px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); margin-bottom: 12px; }
.q-num { font-size: 11px; color: var(--accent); text-transform: uppercase; letter-spacing: 0.6px; font-weight: 700; }
.q-text { font-size: 15px; margin: 10px 0 16px; line-height: 1.5; color: var(--text); }
.options { display: flex; flex-direction: column; gap: 8px; }
.option { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; font-size: 14px; background: var(--bg); color: var(--text); transition: all .15s; }
.option:hover { border-color: var(--border-strong); background: var(--surface); }
.option.selected { border-color: var(--accent); background: var(--surface-3); }
.option .letter { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; background: var(--surface-2); color: var(--accent); font-weight: 700; font-size: 12px; flex-shrink: 0; }
.option.selected .letter { background: var(--accent); color: var(--bg); }
.option input[type=radio] { display: none; }

.result-hero { text-align: center; padding: 44px 24px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; }
.result-hero .examen { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; font-weight: 600; }
.result-hero .score { font-size: 60px; font-weight: 700; margin: 14px 0 8px; font-variant-numeric: tabular-nums; letter-spacing: -1.5px; color: var(--accent); }
.result-hero .score .pct { font-size: 24px; color: var(--muted); font-weight: 500; }
.result-hero .verdict { font-size: 14px; font-weight: 700; }
.result-hero .verdict.ok { color: var(--ok); }
.result-hero .verdict.err { color: var(--err); }
.result-hero .meta { font-size: 11px; color: var(--muted); margin-top: 12px; }

.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.right { margin-left: auto; }
.muted { color: var(--muted); font-size: 12px; }
.text-center { text-align: center; }
.hidden { display: none !important; }
.empty { text-align: center; padding: 48px 0; color: var(--muted); font-size: 13px; }
.mb-0 { margin-bottom: 0; }

.cat-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.cat-acc {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  overflow: hidden;
}
.cat-acc[open] { border-color: var(--border-strong); }
.cat-sum {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  background: var(--surface);
  transition: background .15s;
}
.cat-sum::-webkit-details-marker { display: none; }
.cat-sum:hover { background: var(--surface-2); }
.cat-acc[open] .cat-sum { background: var(--surface-2); border-bottom: 1px solid var(--border); }
.cat-chev-wrap {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  color: var(--accent);
  flex-shrink: 0;
}
.cat-chev {
  width: 14px; height: 14px;
  transition: transform .2s ease;
}
.cat-acc[open] .cat-chev { transform: rotate(90deg); }
.cat-name { flex: 1; font-weight: 600; font-size: 14px; color: var(--text); }
.cat-count {
  font-size: 12px; font-weight: 600;
  padding: 2px 10px; border-radius: 999px;
  background: var(--surface-3); color: var(--accent);
}
.cat-body { padding: 8px 16px 12px; }
.preg-tbl th, .preg-tbl td { white-space: nowrap; }
.preg-tbl .col-flex { width: 100%; white-space: normal; }

.cat-config { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }

.exa-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.exa-col {
  display: flex; flex-direction: column;
  min-width: 0;
}
.col-title {
  font-size: 13px; font-weight: 700;
  color: var(--accent);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.col-title-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.col-title-row .col-title {
  margin: 0; padding: 0; border: none;
}

@media (max-width: 880px) {
  .exa-form-grid { grid-template-columns: 1fr; gap: 18px; }
}

.exam-config-header {
  text-align: center;
  padding: 8px 0 20px;
  margin-bottom: 8px;
  animation: fadeIn .3s ease;
}
.exam-config-title {
  font-size: 22px; font-weight: 700;
  color: var(--text);
  letter-spacing: 1.5px;
  margin: 0;
}
.exam-config-sub {
  font-size: 13px; color: var(--muted);
  margin-top: 6px;
}
.exam-config-sub strong { color: var(--accent); font-weight: 600; }

.label-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px; gap: 8px;
}
.mini-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--muted);
  margin: 0; cursor: pointer;
  text-transform: none; letter-spacing: 0; font-weight: 500;
}
.mini-toggle input {
  width: 14px; height: 14px; margin: 0;
  cursor: pointer; accent-color: var(--accent);
}
.mini-toggle:hover { color: var(--accent); }

input[type=number]:disabled {
  background: var(--surface-2);
  color: var(--hint);
  cursor: not-allowed;
}

.total-preview {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; margin-top: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  transition: background .15s, border-color .15s;
}
.total-preview.ok   { background: var(--ok-bg);   border-color: var(--ok); }
.total-preview.warn { background: var(--warn-bg); border-color: var(--warn); }
.total-preview.err  { background: var(--err-bg);  border-color: var(--err); }
.total-preview.ok   .total-num { color: var(--ok); }
.total-preview.warn .total-num { color: var(--warn); }
.total-preview.err  .total-num { color: var(--err); }
.total-msg-ok   { color: var(--ok); }
.total-msg-warn { color: var(--warn); }
.total-msg-err  { color: var(--err); }
.total-preview .total-num {
  font-size: 22px; font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.toggle-row {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text);
  font-weight: 500; cursor: pointer;
  text-transform: none; letter-spacing: 0;
  margin: 0;
}
.toggle-row input { margin: 0; }
.cat-pick {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  margin-bottom: 6px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  text-transform: none; letter-spacing: 0;
  font-weight: 400; color: var(--text);
}
.cat-pick:hover { border-color: var(--border-strong); }
.cat-pick.on { border-color: var(--accent); background: var(--surface); }
.cat-pick input[type=checkbox] { margin: 0; width: 18px; height: 18px; cursor: pointer; flex-shrink: 0; }
.cat-pick-name { flex: 1; font-weight: 500; font-size: 14px; color: var(--text); }
.cat-pick-count {
  font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px;
  background: var(--surface-3); color: var(--accent);
  flex-shrink: 0;
}
.cat-pick-input {
  display: none; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted);
  flex-shrink: 0;
}
.cat-pick.on .cat-pick-input { display: inline-flex; }
.cat-pick-input input[type=number] {
  width: 64px; height: 32px;
  padding: 0 8px; font-size: 13px;
  font-weight: 600; color: var(--accent);
  text-align: center;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg);
}
@media (max-width: 560px) {
  .cat-pick { flex-wrap: wrap; }
  .cat-pick.on .cat-pick-input { width: 100%; padding-left: 30px; margin-top: 4px; }
}

.stu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}
.stu-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  transition: all .15s;
  text-transform: none; letter-spacing: 0;
  margin: 0; font-weight: 400; color: var(--text);
}
.stu-card:hover { border-color: var(--border-strong); }
.stu-card.on { border-color: var(--accent); background: var(--surface); }
.stu-card input { margin: 0; width: 18px; height: 18px; cursor: pointer; flex-shrink: 0; }
.stu-info { flex: 1; min-width: 0; }
.stu-name { font-weight: 600; font-size: 13px; color: var(--text); }
.stu-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }

.asig-list { display: flex; flex-direction: column; gap: 6px; }
.asig-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.asig-avatar {
  width: 36px; height: 36px; border-radius: 9px;
  background: var(--surface-3); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.asig-info { flex: 1; min-width: 0; }
.asig-name { font-weight: 600; font-size: 13px; color: var(--text); }
.asig-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.asig-status { flex-shrink: 0; }

/* Botón hamburguesa: oculto en escritorio, visible en móvil */
.nav-toggle { display: none; background: transparent; border: 1px solid var(--border); color: var(--text); width: 38px; height: 38px; border-radius: 9px; cursor: pointer; align-items: center; justify-content: center; padding: 0; transition: background .15s; }
.nav-toggle:hover { background: var(--surface-2); }
.nav-toggle svg { width: 20px; height: 20px; display: block; }
.nav-close { display: none; background: transparent; border: none; color: var(--muted); cursor: pointer; width: 32px; height: 32px; border-radius: 8px; align-items: center; justify-content: center; padding: 0; }
.nav-close:hover { color: var(--text); background: var(--surface-2); }
.nav-close svg { width: 18px; height: 18px; }
.nav-head { display: none; }
.nav-backdrop { display: none; }

@media (max-width: 720px) {
  .topbar { padding: 12px 16px; flex-wrap: nowrap; backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); }
  .container { padding: 24px 16px; }
  .nav-toggle { display: inline-flex; }
  .brand-mini { flex: 1; justify-content: center; }
  /* Drawer lateral: oculto fuera de pantalla, se desliza con .nav-open */
  .nav {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 78%; max-width: 320px;
    background: var(--bg);
    border-right: 1px solid var(--border);
    box-shadow: 4px 0 24px -8px rgba(31,58,44,.18);
    flex-direction: column; gap: 4px;
    padding: 14px 14px 22px;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    z-index: 200;
    overflow-y: auto;
    flex-wrap: nowrap;
  }
  body.nav-open .nav { transform: translateX(0); }
  .nav-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 14px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
  .nav-head .logo-img { height: 28px; }
  .nav-close { display: inline-flex; }
  .nav a { padding: 12px 14px; border-radius: 9px; font-size: 14px; font-weight: 500; }
  .nav a::after { display: none; }
  .nav a.active { background: var(--surface-3); }

  .nav-backdrop {
    display: block; position: fixed; inset: 0;
    background: rgba(20,40,30,.45);
    opacity: 0; pointer-events: none;
    transition: opacity .25s ease;
    z-index: 150;
  }
  body.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }

  .user-info { margin-left: auto; }
  .user-info span { display: none; }

  .login-shell { flex-direction: column; max-width: 100%; }
  .login-side { flex: none; border-right: none; border-bottom: 1px solid var(--border); min-height: auto; padding: 24px 20px; }
  .login-side .pitch { margin-top: 24px; }
  .login-side .pitch h2 { font-size: 17px; }
  .login-side .feat-list { display: none; }
  .login-side .foot { display: none; }
  .login-main { padding: 24px 20px; }
  .page-title { font-size: 20px; }
  .result-hero .score { font-size: 48px; }
  .exam-bar { grid-template-columns: 1fr; gap: 12px; padding: 16px; }
  .exam-bar .col-l, .exam-bar .col-c, .exam-bar .col-r { text-align: left; }
  .timer { font-size: 22px; }
}

@media (max-width: 420px) {
  .login-main { padding: 20px 16px; }
  .login-main h1 { font-size: 22px; }
  .stat-card .num { font-size: 22px; }
}


/* ============================================================
   Splash screen (pantalla de carga inicial)
   ============================================================ */

    position:relative;
    display:flex;flex-direction:column;align-items:center;
    padding:46px 54px 40px;
    border-radius:24px;
    background:rgba(255,255,255,.04);
    border:1px solid rgba(61,140,95,.28);
    box-shadow:0 24px 70px rgba(0,0,0,.55),inset 0 1px 0 rgba(255,255,255,.06);
    backdrop-filter:blur(14px);
    animation:splashIn .7s cubic-bezier(.2,.8,.2,1) both;
    overflow:hidden;
  }
  #splash .splash-glow{
    position:absolute;top:-60%;left:50%;transform:translateX(-50%);
    width:140%;height:160%;
    background:radial-gradient(closest-side,rgba(61,140,95,.30),transparent 70%);
    pointer-events:none;
  }
  #splash .splash-logo{
    position:relative;
    max-width:min(62vw,360px);width:100%;height:auto;
    filter:drop-shadow(0 6px 22px rgba(0,0,0,.45));
    animation:logoPulse 2.6s ease-in-out infinite;
  }
  #splash .splash-bar{
    position:relative;margin-top:38px;
    width:min(58vw,300px);height:7px;border-radius:99px;
    background:rgba(255,255,255,.10);overflow:hidden;
  }
  #splash .splash-bar-fill{
    height:100%;width:0;border-radius:99px;
    background:linear-gradient(90deg,#2F6E4A,#3d8c5f 45%,#5fd398);
    box-shadow:0 0 14px rgba(95,211,152,.6);
    transition:width 3s cubic-bezier(.4,0,.2,1);
    position:relative;
  }
  #splash .splash-bar-fill::after{
    content:'';position:absolute;inset:0;border-radius:99px;
    background:linear-gradient(90deg,transparent,rgba(255,255,255,.45),transparent);
    transform:translateX(-100%);
    animation:shimmer 1.4s linear infinite;
  }
  #splash .splash-text{
    display:flex;align-items:center;gap:10px;
    margin-top:18px;color:#b9d4c4;
    font:600 13px system-ui,sans-serif;letter-spacing:.4px;
  }
  #splash .splash-spinner{
    width:15px;height:15px;border-radius:50%;
    border:2px solid rgba(95,211,152,.25);
    border-top-color:#5fd398;
    display:inline-block;animation:spin .8s linear infinite;
  }
  @keyframes splashIn{from{opacity:0;transform:scale(.92) translateY(10px)}to{opacity:1;transform:scale(1) translateY(0)}}
  @keyframes logoPulse{0%,100%{transform:scale(1)}50%{transform:scale(1.03)}}
  @keyframes shimmer{to{transform:translateX(100%)}}
  @keyframes spin{to{transform:rotate(360deg)}}


/* ============================================================
   CORRECCIONES RESPONSIVE
   Fixes para tablas, modales, dashboards y vistas sin cobertura
   ============================================================ */

/* ── Tablas: scroll horizontal en móvil ─────────────────────── */
@media (max-width: 720px) {
  /* Asegurar que todos los wrappers de tabla permitan scroll */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    /* Indicador visual de scroll */
    background:
      linear-gradient(to right, var(--bg) 30%, rgba(0,0,0,0)),
      linear-gradient(to left,  var(--bg) 30%, rgba(0,0,0,0)) 100% 0,
      linear-gradient(to right, var(--border) 0%, transparent 70%),
      linear-gradient(to left,  var(--border) 0%, transparent 70%) 100% 0;
    background-repeat: no-repeat;
    background-size: 40px 100%, 40px 100%, 10px 100%, 10px 100%;
    background-attachment: local, local, scroll, scroll;
  }

  /* Tabla de preguntas: permitir wrap en col de texto */
  .preg-tbl .col-flex { white-space: normal; min-width: 180px; }

  /* Tabla general: tamaño mínimo razonable para que haga scroll antes de romper */
  .table { min-width: 520px; }
  .table th, .table td { padding: 10px 8px 10px 0; font-size: 12px; }

  /* Ocultar columnas menos importantes en móvil */
  .table .col-hide-sm { display: none; }
}

/* ── Dashboard: tarjetas de estadísticas ────────────────────── */
@media (max-width: 480px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .stat-card { padding: 12px 14px; }
  .stat-card .num { font-size: 20px; }
  .stat-card .label,
  .stat-card small { font-size: 11px; }
}

@media (max-width: 320px) {
  .stats { grid-template-columns: 1fr; }
}

/* ── Modales: ajuste en pantallas muy pequeñas ──────────────── */
@media (max-width: 480px) {
  .modal-overlay { padding: 12px; align-items: flex-end; }
  .modal-card {
    max-width: 100%;
    border-radius: 16px 16px 0 0;  /* sheet estilo bottom-sheet */
    animation: slideUpMobile .25s cubic-bezier(.4,0,.2,1);
  }
  .modal-body { padding: 24px 18px 16px; }
  .modal-actions { padding: 14px 18px 18px; flex-direction: column; }
  .modal-actions .btn { height: 46px; font-size: 14px; }
  /* Input modal */
  .modal-input { padding: 24px 18px 16px; }
}
@keyframes slideUpMobile {
  from { opacity: 0; transform: translateY(100%); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Sección de asignaciones ────────────────────────────────── */
@media (max-width: 720px) {
  .asig-row {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
  }
  .asig-status { width: 100%; display: flex; justify-content: flex-end; }
}

/* ── Historial de intentos / Reportes ───────────────────────── */
@media (max-width: 720px) {
  /* Toolbar de filtros: apilar verticalmente */
  .section-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .section-head .row { flex-wrap: wrap; }
  .section-head .right { margin-left: 0; }

  /* Botones de exportar: ancho completo en móvil */
  .export-actions { display: flex; flex-direction: column; gap: 8px; }
  .export-actions .btn { width: 100%; justify-content: center; }
}

/* ── Formulario de crear/editar usuario ─────────────────────── */
@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* ── Topbar: nombre de usuario recortado en móvil ───────────── */
@media (max-width: 720px) {
  .user-info .user-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* ── Vista de examen: opciones táctiles más grandes ─────────── */
@media (max-width: 600px) {
  .option {
    padding: 14px 12px;
    font-size: 13px;
  }
  .option .letter {
    width: 32px; height: 32px;
    font-size: 13px;
  }
  .question { padding: 16px; }
  .q-text { font-size: 14px; }
  /* Grilla de navegación de preguntas: más compacta */
  .q-grid { grid-template-columns: repeat(10, 1fr); gap: 4px; }
  .q-dot { font-size: 10px; min-height: 28px; }
}

/* ── Resultado del examen ───────────────────────────────────── */
@media (max-width: 480px) {
  .result-hero { padding: 28px 16px; }
  .result-hero .score { font-size: 52px; }
  .result-hero .score .pct { font-size: 20px; }
}

/* ── Página de login: imagen/logo lateral ───────────────────── */
@media (max-width: 360px) {
  .login-main { padding: 16px 12px; }
  .login-main h1 { font-size: 20px; }
  input[type=text], input[type=password] { height: 48px; font-size: 15px; }
  .btn-block { height: 48px; font-size: 15px; }
}

/* ── Títulos de página: tamaño adecuado en móvil ────────────── */
@media (max-width: 600px) {
  .page-title { font-size: 18px; }
  .container { padding: 20px 14px; }
}
