/* =====================================================================
   Admisiones · Gimnasio Comfacasanare
   Paleta azul institucional
   ===================================================================== */
:root {
  --primary: #0A3A82;
  --primary-dark: #072A5E;
  --primary-soft: #EAF1FB;
  --bg: #F3F6FB;
  --card: #FFFFFF;
  --text: #0F1B2D;
  --muted: #4B5A70;
  --border: #D6E0EE;
  --line: #E6ECF5;
  --ok: #15803D;      --ok-soft: #E8F6EC;
  --warn: #B45309;    --warn-soft: #FFF4E5;   --warn-border: #F5C58A;
  --danger: #B91C1C;  --danger-soft: #FDECEC;
  --radius: 14px;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Sora', var(--font);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }
a { color: var(--primary); }
a:hover { color: var(--primary-dark); }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-family: var(--display); font-size: 26px; }
h2 { font-size: 18px; }
code { background: var(--primary-soft); padding: 1px 6px; border-radius: 6px; font-size: .92em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.hidden { display: none !important; }

/* ---------------------------------------------------------- Layout */
.topbar { background: var(--primary); color: #fff; }
.topbar-inner { max-width: 1280px; margin: 0 auto; padding: 0 20px; min-height: 64px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.brand-logo { width: 38px; height: 38px; border-radius: 10px; background: #fff; color: var(--primary); display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 14px; }
.brand-name { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name strong { font-family: var(--display); font-size: 16px; }
.brand-name span { font-size: 12px; opacity: .85; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.nav a { color: #fff; text-decoration: none; padding: 8px 9px; border-radius: 8px; font-weight: 600; font-size: 13.5px; white-space: nowrap; opacity: .85; display: inline-flex; align-items: center; gap: 6px; }
.nav a:hover { background: rgba(255,255,255,.12); opacity: 1; }
.nav a.active { background: rgba(255,255,255,.18); opacity: 1; }
.user-menu { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.user-menu a { color: #fff; }

.container { max-width: 1200px; margin: 0 auto; padding: 28px 20px 60px; }
.container.narrow { max-width: 880px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 800px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }

.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.stat .label { font-size: 13px; color: var(--muted); }
.stat .value { font-family: var(--display); font-size: 30px; font-weight: 700; }

/* ---------------------------------------------------------- Forms */
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
label.inline { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=datetime-local], input[type=date], input[type=time], input[type=tel],
input[type=search], input:not([type]), select, textarea {
  font: inherit; font-weight: 400; color: var(--text); background: #fff;
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; min-height: 44px; width: 100%;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--primary); }
.help { font-size: 12.5px; color: var(--muted); font-weight: 400; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin: 0; }
legend { font-weight: 700; padding: 0 6px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 700; font-size: 14px;
  min-height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--border); background: #fff; color: var(--text);
  text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); color: #fff; }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-icon { min-height: 34px; width: 34px; padding: 0; }

/* ---------------------------------------------------------- Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
tr:hover td { background: #FAFCFF; }

/* ---------------------------------------------------------- Badges / alerts */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: #7A3A06; }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.gray { background: #EEF1F5; color: var(--muted); }

.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; border: 1px solid; }
.alert.ok { background: var(--ok-soft); border-color: #BFE3C9; color: #0F5A2B; }
.alert.error { background: var(--danger-soft); border-color: #F3C2C2; color: #7F1414; }
.alert.warn { background: var(--warn-soft); border-color: var(--warn-border); color: #7A3A06; }
.alert.info { background: var(--primary-soft); border-color: #C6D8F2; color: var(--primary-dark); }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }

/* ---------------------------------------------------------- Auth */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--primary); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 18px; padding: 32px; display: flex; flex-direction: column; gap: 16px; }
.auth-card .brand-logo { background: var(--primary); color: #fff; }
.auth-page { background-color: var(--primary); }
.auth-card { box-shadow: 0 24px 60px rgba(4, 20, 50, .35); }
.auth-marca { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding-bottom: 14px; border-bottom: 1px solid var(--border, #E3E8F0); }
.auth-marca h1 { font-size: 22px; margin: 6px 0 0; }
.auth-marca p { margin: 0; }
.auth-logo { display: block; max-width: 260px; max-height: 90px; width: auto; height: auto; object-fit: contain; }
.identidad-foto { display: grid; grid-template-columns: 220px 1fr; gap: 14px; align-items: start; }
.identidad-foto > img, .identidad-foto-vacia { width: 220px; aspect-ratio: 16/10; border-radius: 10px; object-fit: cover; grid-row: span 2; }
.identidad-foto-vacia { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 10px; text-align: center; font-size: 12px; color: var(--muted, #64748B); background: var(--primary-soft, #EEF3FB); border: 1px dashed var(--border, #CBD5E1); }
.identidad-foto-vacia .ti { font-size: 26px; }
@media (max-width: 640px) { .identidad-foto { grid-template-columns: 1fr; } .identidad-foto > img, .identidad-foto-vacia { width: 100%; grid-row: auto; } .auth-logo { max-width: 210px; max-height: 76px; } }

/* ---------------------------------------------------------- Banco de preguntas */
.q-item { display: flex; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.q-item:last-child { border-bottom: 0; }
.q-body { flex: 1; min-width: 0; }
.q-text { margin: 6px 0; white-space: pre-line; }
.q-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.q-thumb { max-width: 160px; max-height: 110px; border-radius: 8px; border: 1px solid var(--border); object-fit: cover; }
.opt-row { display: grid; grid-template-columns: 34px 1fr 1fr 150px 34px; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.opt-row.no-pareja { grid-template-columns: 34px 1fr 150px 34px; }
.opt-row .opt-letter { font-weight: 700; color: var(--primary); text-align: center; }
.img-preview { max-width: 100%; max-height: 220px; border-radius: 10px; border: 1px solid var(--border); }
@media (max-width: 800px) { .opt-row, .opt-row.no-pareja { grid-template-columns: 1fr; } }

.filters { display: grid; grid-template-columns: 2fr repeat(4, minmax(0, 1fr)) auto; gap: 10px; align-items: end; }
@media (max-width: 900px) { .filters { grid-template-columns: 1fr 1fr; } }

.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 38px; height: 38px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--border); background: #fff; text-decoration: none; font-weight: 600; font-size: 14px; }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------------------------------------------------------- Examen (aspirante) */
.exam-body { background: var(--bg); min-height: 100vh; user-select: none; -webkit-user-select: none; }
.exam-top { position: sticky; top: 0; z-index: 10; background: var(--primary); color: #fff; }
.exam-top-inner { max-width: 1100px; margin: 0 auto; padding: 12px 20px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.exam-title strong { font-family: var(--display); font-size: 17px; display: block; }
.exam-title span { font-size: 13px; opacity: .85; }
.exam-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,.14); padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #4ADE80; }
.dot.off { background: #FBBF24; }
.timer { background: #fff; color: var(--primary); padding: 6px 14px; border-radius: 10px; font-family: var(--display); font-weight: 700; font-size: 20px; min-width: 96px; text-align: center; }
.timer.low { background: #FEE2E2; color: var(--danger); }

.exam-main { max-width: 860px; margin: 0 auto; padding: 24px 20px 120px; }
.q-number { font-size: 14px; font-weight: 600; color: var(--muted); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.q-context { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin: 12px 0; max-height: 340px; overflow: auto; white-space: pre-line; }
.q-context h3 { margin-bottom: 8px; font-size: 16px; }
.q-stem { font-size: 21px; font-weight: 700; line-height: 1.4; margin: 12px 0 18px; white-space: pre-line; }
.q-img { max-width: 100%; max-height: 360px; border-radius: 12px; border: 1px solid var(--border); margin-bottom: 16px; display: block; }
.choices { display: flex; flex-direction: column; gap: 12px; }
.choice { display: flex; flex-direction: row; align-items: center; gap: 14px; padding: 15px 18px; background: #fff; border: 1px solid var(--border); border-radius: 12px; font-size: 17px; font-weight: 500; cursor: pointer; }
.choice:hover { border-color: var(--primary); }
.choice.selected { background: var(--primary-soft); border: 2px solid var(--primary); padding: 14px 17px; font-weight: 600; }
.choice input { flex: none; width: 20px; height: 20px; }
.choice img { max-height: 120px; max-width: 220px; border-radius: 8px; }
.choice .letter { font-weight: 700; color: var(--primary); min-width: 20px; }
.match-row { display: grid; flex-direction: row; grid-template-columns: 1fr 1fr; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); }
@media (max-width: 640px) { .match-row { grid-template-columns: 1fr; } }
.exam-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.save-state { font-size: 13px; color: var(--muted); }
.save-state.err { color: var(--danger); font-weight: 600; }
.q-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 28px; }
.q-grid button { width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--border); background: #fff; font: inherit; font-weight: 700; font-size: 13px; cursor: pointer; color: var(--text); }
.q-grid button.answered { background: var(--primary-soft); border-color: #9DB9E3; color: var(--primary); }
.q-grid button.current { outline: 2px solid var(--primary); outline-offset: 1px; }
.exam-alert { max-width: 860px; margin: 16px auto 0; padding: 0 20px; }

.overlay { position: fixed; inset: 0; background: rgba(7, 26, 56, .72); display: grid; place-items: center; z-index: 50; padding: 20px; }
.overlay .box { background: #fff; border-radius: 18px; padding: 28px; max-width: 460px; width: 100%; display: flex; flex-direction: column; gap: 14px; }

/* ---------------------------------------------------------- Timeline */
.timeline-item { display: grid; grid-template-columns: 90px 14px 1fr; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); align-items: start; }
.timeline-item:last-child { border-bottom: 0; }
.timeline-item .t { font-weight: 700; color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.timeline-item .d { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; background: var(--ok); }
.timeline-item .d.alerta { background: #D97706; }
.timeline-item .d.grave { background: var(--danger); }

@media print { .topbar, .no-print { display: none !important; } body { background: #fff; } .card { border: 0; } }

/* ---------------------------------------------------------- Monitor en vivo */
.barra { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; margin-top: 4px; }
.barra > div { height: 100%; background: var(--primary); border-radius: 4px; transition: width .4s; }
.fila-grave td { background: #FFF8F8; }
.txt-danger { color: var(--danger); }
.badge .dot { width: 7px; height: 7px; background: var(--ok); }
.q-tiempo { font-size: 12px; color: var(--muted); }

/* ---------------------------------------------------------- Informe imprimible */
.informe { background: #fff; max-width: 900px; margin: 0 auto; padding: 36px 40px; border: 1px solid var(--border); border-radius: var(--radius); }
.informe h1 { font-size: 22px; }
.informe h2 { font-size: 15px; margin: 22px 0 8px; text-transform: uppercase; letter-spacing: .05em; color: var(--primary); }
.informe table { font-size: 12.5px; }
.informe th, .informe td { padding: 6px 8px; }
.informe .kv { display: grid; grid-template-columns: 180px 1fr; gap: 4px 12px; font-size: 13.5px; }
.informe .kv dt { color: var(--muted); }
.informe .kv dd { margin: 0; font-weight: 600; }
.firmas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 48px; margin-top: 56px; font-size: 13px; }
.firmas div { border-top: 1px solid var(--text); padding-top: 6px; }
@media print {
  @page { size: letter; margin: 14mm; }
  .informe { border: 0; padding: 0; max-width: none; }
  .informe tr { break-inside: avoid; }
  .container { padding: 0; }
  .alert { display: none; }
}
.q-stem:focus { outline: none; }

/* ---------------------------------------------------------- Preparación con cámara */
.pasos { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.pasos li { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--muted); }
.pasos .barra-paso { height: 6px; border-radius: 3px; background: var(--border); }
.pasos li.hecho { color: var(--primary); font-weight: 600; }
.pasos li.hecho .barra-paso, .pasos li.actual .barra-paso { background: var(--primary); }
.pasos li.actual { color: var(--text); font-weight: 700; }
.texto-legal { white-space: pre-line; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; max-height: 320px; overflow: auto; font-size: 14px; line-height: 1.6; }
.cam-grande { position: relative; background: #1B2A44; border-radius: 14px; overflow: hidden; aspect-ratio: 4 / 3; max-height: 420px; width: 100%; max-width: 560px; margin: 0 auto; }
.cam-grande video, .cam-grande canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.cam-aviso { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 22px; font-weight: 700; text-align: center; padding: 20px; background: rgba(11, 30, 60, .55); }
.cam-aviso[hidden] { display: none; }
.cam-guia.ovalo { position: absolute; left: 50%; top: 50%; width: 42%; height: 72%; transform: translate(-50%, -50%); border: 3px dashed rgba(127, 176, 255, .9); border-radius: 50%; pointer-events: none; }
.cam-chip { position: absolute; top: 12px; right: 12px; font-size: 13px; font-weight: 700; padding: 5px 12px; border-radius: 999px; background: rgba(0,0,0,.5); color: #fff; }
.cam-chip:empty { display: none; }
.cam-chip.ok { background: var(--ok-soft); color: var(--ok); }
.cam-chip.mal { background: var(--warn-soft); color: #7A3A06; }
.checks { display: flex; flex-direction: column; }
.checks[hidden] { display: none; }
.check { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.check > div { display: flex; flex-direction: column; }
.check .ico { width: 30px; height: 30px; flex: none; border-radius: 50%; background: #EEF1F5; display: grid; place-items: center; }
.check .ico::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: #A8B4C6; }
.check.ok .ico { background: var(--ok-soft); }
.check.ok .ico::after { content: '✓'; width: auto; height: auto; background: none; color: var(--ok); font-weight: 800; }
.check.mal .ico { background: var(--warn-soft); }
.check.mal .ico::after { content: '!'; width: auto; height: auto; background: none; color: var(--warn); font-weight: 800; }
.fotos-prev { display: flex; gap: 8px; flex-wrap: wrap; }
.fotos-prev:empty { display: none; }
.fotos-prev img { height: 72px; border-radius: 8px; border: 1px solid var(--border); }

/* ---------------------------------------------------------- Cámara durante el examen */
.cam-mini { position: fixed; right: 20px; bottom: 20px; width: 200px; z-index: 20; display: flex; flex-direction: column; gap: 6px; }
.cam-mini video { width: 200px; height: 150px; object-fit: cover; border-radius: 12px; background: #1B2A44; border: 3px solid var(--ok); transform: scaleX(-1); }
.cam-mini.alerta video { border-color: #F59E0B; }
.cam-mini.mal video { border-color: var(--danger); }
.cam-mini span { font-size: 12px; color: var(--muted); text-align: center; background: rgba(243,246,251,.9); border-radius: 6px; }
@media (max-width: 900px) { .cam-mini { width: 120px; } .cam-mini video { width: 120px; height: 90px; } }

/* ---------------------------------------------------------- Evidencias en el panel */
.galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.galeria figure { margin: 0; }
.galeria img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); cursor: zoom-in; background: #1B2A44; }
.galeria figcaption { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.ev-foto { width: 150px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); cursor: zoom-in; display: block; margin-top: 6px; }
.visor { position: fixed; inset: 0; background: rgba(7, 18, 38, .9); display: grid; place-items: center; z-index: 80; padding: 20px; cursor: zoom-out; }
.visor img { max-width: 100%; max-height: 90vh; border-radius: 10px; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------- Celular como segunda cámara */
.qr-fila { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.qr { background: #fff; padding: 10px; border: 1px solid var(--border); border-radius: 12px; width: 220px; height: 220px; flex: none; }
.qr svg { width: 100%; height: 100%; display: block; }
.estado-celular { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; padding: 10px 14px; border-radius: 10px; background: var(--bg); }
.estado-celular .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); flex: none; }
.estado-celular .dot.off { background: #F59E0B; }
.movil-prev { max-width: 360px; width: 100%; border-radius: 12px; border: 1px solid var(--border); }
.pill-movil { background: rgba(255,255,255,.14); }

/* ---------------------------------------------------------- Portal de familias */
.paso-fila { display: flex; align-items: center; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.paso-fila:last-child { border-bottom: 0; }
.paso-fila:hover { color: inherit; background: #FAFCFF; }
.paso-ico { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: #EEF1F5; color: var(--muted); }
.paso-txt { display: flex; flex-direction: column; }
.paso-txt .small { color: var(--muted); }
.paso-fila.ok .paso-ico { background: var(--ok-soft); color: var(--ok); }
.paso-fila.actual .paso-ico { background: var(--primary); color: #fff; }
.paso-fila.actual .paso-txt strong { color: var(--primary); }
.paso-fila.espera .paso-ico { background: var(--primary-soft); color: var(--primary); }
.paso-fila.alerta .paso-ico { background: var(--danger-soft); color: var(--danger); }
.paso-fila.alerta .small { color: var(--danger); }
.doc-fila { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.doc-fila:last-of-type { border-bottom: 0; }
.franjas { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.franja { flex-direction: row; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; font-weight: 500; }
.franja:has(input:checked) { border: 2px solid var(--primary); background: var(--primary-soft); padding: 11px; }
.franja span { display: flex; flex-direction: column; }

/* =====================================================================
   Adaptación a celulares y tabletas
   ===================================================================== */
.grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.filters-5 { grid-template-columns: 2fr 1fr 1fr 1fr auto; }
.filters-5b { grid-template-columns: 2fr 2fr 1fr 1fr auto; }
.filters-6 { grid-template-columns: 2fr 1fr 1fr 1fr 1.3fr auto; }
.cupo-fila { display: flex; align-items: center; gap: 12px; }
.cupo-grado { width: 110px; flex: none; }
.cupo-txt { width: 250px; text-align: right; }
.nav-toggle { display: none; margin-left: auto; align-items: center; gap: 6px; background: rgba(255,255,255,.14); color: #fff; border: 0; border-radius: 10px; min-height: 40px; padding: 0 14px; font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; }
label.inline > span { min-width: 0; flex: 1; }
code { overflow-wrap: anywhere; }
img, video, svg, canvas { max-width: 100%; }

@media (max-width: 1100px) {
  .grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  /* Menú del panel plegable */
  .nav-toggle { display: inline-flex; }
  .topbar-inner { padding: 10px 16px; min-height: 60px; gap: 10px; }
  .topbar .nav, .topbar .user-menu { display: none; width: 100%; }
  .topbar.menu-abierto .nav { display: flex; flex-direction: column; gap: 2px; padding-top: 6px; border-top: 1px solid rgba(255,255,255,.15); }
  .topbar.menu-abierto .nav a { padding: 12px; font-size: 15px; }
  .topbar.menu-abierto .user-menu { display: flex; justify-content: space-between; padding: 10px 12px 6px; border-top: 1px solid rgba(255,255,255,.15); }
  .filters-5, .filters-5b, .filters-6 { grid-template-columns: 1fr 1fr; }
  .filters-5 > label:first-child, .filters-5b > label:first-child, .filters-6 > label:first-child { grid-column: 1 / -1; }
}

@media (max-width: 800px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4.grid-4 > * { min-width: 0; }
}

@media (max-width: 640px) {
  body { font-size: 15.5px; }
  .container { padding: 18px 14px 48px; }
  h1 { font-size: 23px; }
  .card { padding: 16px; border-radius: 12px; }
  .stat { padding: 14px; }
  .stat .value { font-size: 24px; }
  .grid-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-head { align-items: flex-start; }
  .page-head .row, .page-head > .btn { width: 100%; }
  .page-head .row .btn { flex: 1; }
  .filters, .filters-5, .filters-5b, .filters-6 { grid-template-columns: 1fr; }
  .filters > label:first-child { grid-column: auto; }
  /* Banco de preguntas: texto arriba, imagen y botones debajo */
  .q-item { flex-wrap: wrap; }
  .q-body { flex-basis: 100%; }
  .q-item > .stack { flex-direction: row; flex-wrap: wrap; width: 100%; }
  .q-item > .stack > * { flex: 1 1 auto; }
  .q-thumb { max-width: 100%; }
  /* Filas con acciones: los botones bajan */
  .doc-fila > .row, .doc-fila form.row { width: 100%; }
  .doc-fila input:not([type=file]):not([type=hidden]) { width: 100% !important; flex: 1 1 100%; }
  .cupo-fila { flex-wrap: wrap; gap: 4px 12px; }
  .cupo-grado { width: auto; flex: 1; }
  .cupo-txt { width: 100%; text-align: left; order: 3; }
  .timeline-item { grid-template-columns: 64px 12px 1fr; gap: 8px; }
  .timeline-item .t { font-size: 12px; }
  .galeria { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .ev-foto { width: 120px; }
  table { font-size: 14px; }
  th, td { padding: 9px 8px; }
  .auth-card { padding: 22px 18px; }
  .overlay .box { padding: 20px; }
  .exam-main { padding: 16px 14px 110px; }
  .q-stem { font-size: 19px; }
  .choice { font-size: 16px; padding: 13px 14px; }
  .qr { width: 180px; height: 180px; }
  .fotos-informe { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .informe { padding: 20px 16px; }
  .informe .kv { grid-template-columns: 1fr; gap: 0 0; }
  .informe .kv dd { margin-bottom: 8px; }
  .informe table { display: block; overflow-x: auto; }
  .firmas { grid-template-columns: 1fr; gap: 36px; }
}
body { overflow-wrap: break-word; } label.inline > span { overflow-wrap: anywhere; }
.choice > span:not(.letter) { min-width: 0; flex: 1; } .choice img { max-width: 45%; height: auto; }

/* ---------- Fase 6: agenda de entrevistas, citas y correos ---------- */
.filters-3 { grid-template-columns: 1fr 1fr auto; }
@media (max-width: 640px) { .filters-3 { grid-template-columns: 1fr; } }
.agenda-psico { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.agenda-slot { display: flex; gap: 12px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; border-left: 4px solid var(--line); background: #fff; flex-wrap: wrap; }
.agenda-slot.libre { border-left-color: var(--ok); background: #F4FBF6; }
.agenda-slot.ocupado { border-left-color: var(--primary); background: var(--primary-soft); }
.agenda-hora { display: flex; flex-direction: column; min-width: 74px; font-weight: 700; }
.agenda-hora .small { font-weight: 400; }
.franja .psico { font-size: 12px; color: var(--muted); }
.mail-preview { width: 100%; height: 720px; border: 1px solid var(--line); border-radius: 12px; background: #F3F6FB; }
.cita-box { border: 2px solid var(--primary); border-radius: 14px; padding: 14px 16px; background: var(--primary-soft); }
.cita-box dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 8px 0 0; }
.cita-box dt { color: var(--muted); font-size: 13px; }
.cita-box dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
@media (max-width: 640px) { .cita-box dl { grid-template-columns: 1fr; } .cita-box dt { margin-top: 6px; } .mail-preview { height: 600px; } }
.filters-4c { grid-template-columns: 2fr 1fr 1fr auto; }
@media (max-width: 900px) { .filters-4c { grid-template-columns: 1fr 1fr; } .filters-4c > label:first-child { grid-column: 1 / -1; } }
@media (max-width: 640px) { .filters-4c { grid-template-columns: 1fr; } }
.mensaje-fila { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; border-radius: 10px; }
.mensaje-fila:hover { background: var(--primary-soft); }
.mensaje-fila > .ti { font-size: 22px; color: var(--muted); }
.mensaje-fila.nuevo > .ti { color: var(--primary); }
.mensaje-fila.nuevo strong { color: var(--primary); }
.mensaje-txt { display: flex; flex-direction: column; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.mensaje-marco { display: block; width: 100%; height: 1400px; border: 0; border-radius: 14px; background: #F3F6FB; }

/* ---------- Fase 8: psicoorientación ---------- */
.ficha { background: var(--primary-soft); border-radius: 10px; padding: 10px 14px; font-size: 14px; }
.crit { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.crit-txt { display: flex; flex-direction: column; min-width: 0; }
.crit .peso { font-size: 12px; font-weight: 700; color: var(--primary); }
.esc { display: flex; gap: 6px; }
.esc label { display: block; margin: 0; }
.esc input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.esc span { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--border); background: #fff; font-weight: 700; font-size: 16px; cursor: pointer; }
.esc input:checked + span { background: var(--primary); color: #fff; border-color: var(--primary); }
.esc input:focus-visible + span { outline: 3px solid var(--primary-soft); outline-offset: 2px; }
.esc input:disabled + span { cursor: default; }
.crit .pond { grid-column: 2; text-align: right; }
.bloque-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.peso-b { font-size: 12px; font-weight: 700; color: var(--primary); background: var(--primary-soft); padding: 3px 10px; border-radius: 999px; }
.nota-b { margin-left: auto; font-weight: 800; font-size: 20px; color: var(--primary); }
.resultado { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; background: var(--primary-soft); border-radius: 12px; padding: 14px; }
.resultado > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.resultado strong { font-size: 18px; } .resultado .pct { font-size: 24px; color: var(--primary); }
.resultado .barra, .res-fila .barra { position: relative; height: 12px; background: #fff; border-radius: 999px; margin: 0; }
.resultado .barra > div, .res-fila .barra > div { height: 100%; background: var(--primary); border-radius: 999px; }
.resultado .barra i { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--muted); opacity: .5; }
.badge.inc { background: #F3E8FF; color: #6B21A8; }
.inc-box { border: 1px solid #E9D5FF; background: #FAF5FF; border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.res-fila { display: grid; grid-template-columns: 1.4fr 2fr 70px 170px; gap: 12px; align-items: center; }
.res-fila .barra { background: var(--line); }
.res-fila.sub > span:first-child { color: var(--muted); font-size: 14px; padding-left: 12px; }
.ed-bloque { border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: #fff; }
.ed-bhead { display: grid; grid-template-columns: 1fr 150px auto; gap: 10px; align-items: end; }
.ed-fila { display: grid; grid-template-columns: 1.2fr 1.6fr 80px auto; gap: 8px; align-items: center; }
.pesoin { display: flex; align-items: center; gap: 4px; } .pesoin input { width: 70px; text-align: right; }
.rango-ed { display: grid; grid-template-columns: 160px 1fr 150px auto; gap: 8px; align-items: center; }
.suma-ok { color: var(--ok); font-weight: 700; } .suma-mal { color: var(--danger); font-weight: 700; }
@media (max-width: 640px) {
  .crit { grid-template-columns: 1fr; } .crit .pond { grid-column: 1; text-align: left; }
  .esc span { width: auto; flex: 1; height: 48px; } .esc label { flex: 1; }
  .res-fila { grid-template-columns: 1fr auto; } .res-fila .barra { grid-column: 1 / -1; grid-row: 2; } .res-fila > :last-child { justify-self: end; }
  .ed-bhead, .ed-fila, .rango-ed { grid-template-columns: 1fr 1fr; } .ed-fila > input:first-child, .ed-bhead > label:first-child, .rango-ed > input.nom { grid-column: 1 / -1; }
}
@media print { .bloque-eval { break-inside: avoid; } .card[style*="sticky"] { position: static !important; box-shadow: none !important; } }
.resultado .badge, .res-fila .badge, #psico .badge { white-space: normal; text-align: left; line-height: 1.3; }
@media (max-width: 640px) { #form-eval > section:last-child { position: static !important; box-shadow: none !important; } }

/* ---------- Portada ---------- */
.portada { background: var(--bg); }
.portada-in { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.portada-hero { background: linear-gradient(160deg, var(--primary) 0%, var(--primary-dark) 100%); color: #fff; padding: 28px 0 64px; }
.portada-hero h1 { font-size: 40px; margin: 28px 0 8px; }
.portada-hero p { margin: 0 0 16px; opacity: .9; font-size: 17px; }
.estado-insc { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.14); padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: 14px; }
.estado-insc.on { background: #fff; color: var(--ok); }
.portada-main { display: flex; flex-direction: column; gap: 14px; margin-top: -40px; padding-bottom: 32px; }
.acceso { display: flex; gap: 16px; background: #fff; border: 1px solid var(--border); border-radius: 18px; padding: 22px; box-shadow: 0 8px 24px rgba(10,58,130,.06); }
.acceso-ico { flex: 0 0 52px; height: 52px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-size: 26px; }
.acceso-txt { display: flex; flex-direction: column; gap: 10px; min-width: 0; flex: 1; }
.acceso-txt p { margin: 0; }
.acceso-staff { background: transparent; box-shadow: none; border-style: dashed; }
@media (max-width: 640px) {
  .portada-hero h1 { font-size: 30px; }
  .acceso { flex-direction: column; padding: 18px; }
  .acceso .row .btn { flex: 1 1 100%; justify-content: center; }
}
.aviso-legal { background: #EEF6FF; border-left: 4px solid var(--primary); border-radius: 10px; padding: 12px 14px; font-size: 14px; margin-bottom: 16px; }
.prohibidos { background: #FFF7ED; border: 1px solid var(--warn-border); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.prohibidos ul { margin: 6px 0 0; padding-left: 20px; }
.auth-box { background: #fff; border: 1px solid #E9D5FF; border-radius: 10px; padding: 12px; font-size: 14px; }
.auth-box p { margin: 6px 0 8px; }
.politica { white-space: pre-line; line-height: 1.6; }
.radio-d { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.radio-d:has(input:checked) { border: 2px solid var(--primary); background: var(--primary-soft); padding: 7px 11px; }
.opciones { display: flex; flex-direction: column; gap: 8px; }
.opc { flex-direction: row; align-items: flex-start; gap: 10px; border: 1px solid var(--border); border-radius: 12px; padding: 12px; font-weight: 500; }
.opc > span { display: flex; flex-direction: column; gap: 2px; }
.opc:has(input:checked) { border: 2px solid var(--primary); background: var(--primary-soft); padding: 11px; }

/* ---------------------------------------------------------- Accesibilidad */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.saltar { position: absolute; left: 12px; top: -60px; z-index: 1000; background: #fff; color: var(--primary); padding: 10px 16px; border-radius: 10px; font-weight: 700; box-shadow: 0 4px 16px rgba(0,0,0,.2); }
.saltar:focus { top: 12px; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.topbar :focus-visible, .portada-hero :focus-visible, .rec-head :focus-visible { outline-color: #fff; }
main:focus { outline: none; }
.btn-link { background: none; border: 0; padding: 0; color: var(--primary); text-decoration: underline; cursor: pointer; font: inherit; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }

/* ---------------------------------------------------------- Identidad */
.brand-logo.con-logo { background: #fff; padding: 3px; overflow: hidden; }
.brand-logo.con-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-logo.invertido:not(.con-logo) { background: var(--primary); color: #fff; }
.brand-logo.grande { width: 56px; height: 56px; font-size: 20px; }
.identidad-prev { background: var(--prev); color: #fff; border-radius: 12px; padding: 12px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.identidad-prev .brand-logo { color: var(--prev); }
.identidad-prev > span:nth-child(2) { display: flex; flex-direction: column; line-height: 1.25; }

/* ---------------------------------------------------------- Ingreso y sesión */
.input-codigo { font-size: 28px; letter-spacing: .4em; text-align: center; font-weight: 700; padding: 10px; }
.sesion-aviso { position: fixed; inset: 0; background: rgba(15,27,45,.55); display: grid; place-items: center; z-index: 900; padding: 16px; }
.sesion-aviso-caja { background: #fff; border-radius: 16px; padding: 22px; max-width: 420px; width: 100%; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.sesion-aviso-caja h2 { display: flex; gap: 8px; align-items: center; color: var(--warn); }
.sesion-aviso-caja p { margin: 0; }
#sesion-aviso-s { font-variant-numeric: tabular-nums; font-size: 1.15em; }

/* ---------------------------------------------------------- Embudo de admisión */
.embudo { display: flex; flex-direction: column; gap: 10px; }
.embudo-fila { display: grid; grid-template-columns: minmax(150px, 210px) 1fr 92px; gap: 12px; align-items: center; }
.embudo-et { font-size: 14px; font-weight: 600; display: flex; gap: 8px; align-items: center; }
.embudo-et i { color: var(--primary); font-size: 18px; }
.embudo-barra { height: 28px; background: var(--line); border-radius: 8px; overflow: hidden; }
.embudo-barra span { display: flex; align-items: center; height: 100%; background: var(--primary); border-radius: 8px; min-width: 3px; color: #fff; font-size: 12px; font-weight: 700; padding-left: 8px; white-space: nowrap; }
.embudo-fila.ok .embudo-barra span { background: var(--ok); }
.embudo-fila.sub .embudo-barra span { background: color-mix(in srgb, var(--primary) 55%, #fff); color: var(--text); }
.embudo-num { text-align: right; display: flex; flex-direction: column; line-height: 1.15; }
.embudo-num strong { font-family: var(--display); font-size: 20px; }
.embudo-num span { font-size: 12px; color: var(--muted); }
.cupo-barra { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; min-width: 70px; }
.cupo-barra span { display: block; height: 100%; background: var(--ok); }
.cupo-barra span.lleno { background: var(--warn); }
@media (max-width: 640px) {
  .embudo-fila { grid-template-columns: 1fr 70px; gap: 4px 10px; }
  .embudo-et { grid-column: 1 / -1; }
}

/* ---------------------------------------------------------- Tamaño de letra (examen) */
.letra-ctrl { display: inline-flex; gap: 4px; align-items: center; }
.letra-ctrl button { min-width: 38px; }
.exam-a11y { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
.extra-tiempo { background: var(--ok-soft); color: var(--ok); border-radius: 999px; padding: 3px 10px; font-weight: 700; }
body.letra-1 #pregunta { zoom: 1.15; }
body.letra-2 #pregunta { zoom: 1.3; }
body.letra-3 #pregunta { zoom: 1.5; }
a.stat-link { text-decoration: none; color: inherit; display: block; }
a.stat-link:hover { border-color: var(--primary); box-shadow: 0 4px 14px rgba(10,58,130,.08); }
.pend-fila { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; text-decoration: none; color: var(--text); }
.pend-fila:hover { border-color: var(--primary); background: var(--primary-soft); color: var(--text); }
.pend-fila > i:first-child { color: var(--primary); font-size: 20px; }

/* ---------- Editar / eliminar / anular ---------- */
.btn.rojo { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.rojo:hover { filter: brightness(.92); }
.btn.en-uso { opacity: .5; cursor: help; }
dialog.confirmar { border: 0; border-radius: 16px; padding: 22px; max-width: 440px; width: calc(100% - 32px); box-shadow: 0 20px 60px rgba(4, 20, 50, .3); }
dialog.confirmar::backdrop { background: rgba(10, 30, 70, .45); }
dialog.confirmar h3 { margin: 0 0 8px; font-size: 18px; }
dialog.confirmar p { margin: 0 0 16px; }
.cat-lista { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.cat-item { border-top: 1px solid var(--border); background: #fff; }
.cat-item:first-child { border-top: 0; }
.cat-fila { display: flex; align-items: center; gap: 8px; padding: 9px 12px; flex-wrap: wrap; }
.cat-fila .n { flex: 1; font-weight: 600; min-width: 160px; }
.cat-fila .acciones { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.cat-item.inactivo .n { opacity: .55; }
.cat-fila .uso { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.cat-item.inactivo .n .uso { text-decoration: none; }
.cat-item > details > summary { list-style: none; }
.cat-item > details > summary::-webkit-details-marker { display: none; }
.cat-editar { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; padding: 10px 12px; background: var(--primary-soft); }
.cat-editar input:not([type=checkbox]), .cat-editar select { flex: 1; min-width: 140px; }
.hist-cambios { font-size: 13px; border-left: 3px solid var(--primary-soft); padding-left: 12px; display: flex; flex-direction: column; gap: 8px; }
.hist-cambios s { color: var(--danger); }
.hist-cambios ins { color: var(--ok); text-decoration: none; font-weight: 600; }
fieldset.datos { border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: grid; gap: 12px; grid-template-columns: 1fr 1fr; margin: 0; }
fieldset.datos legend { font-weight: 700; padding: 0 6px; }
@media (max-width: 640px) { fieldset.datos { grid-template-columns: 1fr; } }
.agenda-slot:has(details.franja-editar[open]) > .row { flex-basis: 100%; justify-content: flex-start; }
details.franja-editar[open] { flex-basis: 100%; }
details.franja-editar form { max-width: 520px; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 12px; }

/* ---------- Menú lateral del panel ---------- */
.app-shell { min-height: 100vh; }
.lateral { position: fixed; top: 0; left: 0; bottom: 0; width: 248px; z-index: 30; overflow-y: auto; background: var(--primary); color: #fff; display: flex; flex-direction: column; padding: 16px 12px; gap: 2px; }
.lateral a { color: #fff; text-decoration: none; }
.lateral-marca { display: flex; flex-direction: column; gap: 8px; padding: 4px 8px 14px; }
.lateral-logo { display: block; background: #fff; border-radius: 12px; padding: 8px 10px; }
.lateral-logo img { display: block; width: 100%; max-height: 54px; object-fit: contain; }
.lateral-marca .brand-logo { width: 42px; height: 42px; }
.lateral-nombre { display: flex; flex-direction: column; line-height: 1.25; }
.lateral-nombre strong { font-family: var(--display); font-size: 15px; }
.lateral-nombre span { font-size: 12px; opacity: .8; }
.lateral-nav { display: flex; flex-direction: column; gap: 2px; }
.lateral-grupo { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; opacity: .62; font-weight: 700; padding: 14px 10px 4px; }
.lateral-nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; font-weight: 600; font-size: 13.5px; opacity: .88; }
.lateral-nav a:hover { background: rgba(255,255,255,.1); opacity: 1; }
.lateral-nav a.activo { background: rgba(255,255,255,.18); opacity: 1; }
.lateral-nav a .ti { font-size: 18px; width: 20px; text-align: center; }
.lateral-nav a span:not(.lateral-n) { flex: 1; }
.lateral-n { background: #fff; color: var(--primary); border-radius: 99px; font-size: 11px; font-weight: 800; padding: 1px 8px; }
.lateral-n.aviso { background: #FDBA74; color: #5A2A00; }
.lateral-n.vivo { background: #4ADE80; color: #053B1A; }
.lateral-usuario { margin-top: auto; padding: 14px 10px 4px; border-top: 1px solid rgba(255,255,255,.16); display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.lateral-usuario span { opacity: .75; }
.lateral-usuario a { opacity: .9; font-weight: 600; }
.lateral-usuario a:hover { opacity: 1; text-decoration: underline; }
.lateral :focus-visible { outline-color: #fff; }
.app-main { min-width: 0; margin-left: 248px; }
.con-lateral .container { max-width: 1120px; margin: 0; padding: 28px 32px 60px; }
.topbar-movil { display: none; }
.lateral-velo { display: none; }
@media (max-width: 1023px) {
  .app-shell { display: block; }
  .app-main { margin-left: 0; }
  .lateral { position: fixed; inset: 0 auto 0 0; width: 280px; max-width: 86vw; z-index: 60; transform: translateX(-102%); transition: transform .2s ease; }
  .menu-abierto .lateral { transform: none; box-shadow: 8px 0 30px rgba(4,20,50,.3); }
  .menu-abierto .lateral-velo { display: block; position: fixed; inset: 0; background: rgba(10,30,70,.45); z-index: 55; }
  .topbar-movil { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--primary); color: #fff; padding: 10px 16px; position: sticky; top: 0; z-index: 40; }
  .topbar-movil .nav-toggle { display: inline-flex; margin: 0; }
  .con-lateral .container { padding: 20px 16px 50px; }
}
@media (prefers-reduced-motion: reduce) { .lateral { transition: none; } }

/* ---------- Pestañas ---------- */
.pestanas { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 18px 0 16px; overflow-x: auto; scrollbar-width: thin; }
.pestanas a { padding: 10px 14px; font-weight: 700; font-size: 13.5px; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.pestanas a:hover { color: var(--primary); }
.pestanas a.activo { color: var(--primary); border-bottom-color: var(--primary); }
.pestanas .n { font-size: 11px; background: var(--primary-soft); color: var(--primary); border-radius: 99px; padding: 0 7px; font-weight: 800; }
.pestanas .n.w { background: var(--warn-soft); color: #7A3A06; }
.pestanas-js .panel-pestana:not(.activo) { display: none; }
.panel-pestana > .card + .card, .panel-pestana > section + section, .panel-pestana > form + section, .panel-pestana > section + form { margin-top: 16px; }

/* ---------- Inscripción: pasos, siguiente paso, menú Más ---------- */
.pasos-h { display: flex; padding: 16px 12px 12px; overflow-x: auto; }
.paso-h { flex: 1; min-width: 92px; text-align: center; font-size: 12px; color: var(--muted); position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.paso-h-dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 12.5px; background: #EEF1F5; color: var(--muted); position: relative; z-index: 1; margin-bottom: 4px; }
.paso-h:not(:last-child)::after { content: ""; position: absolute; top: 14px; left: calc(50% + 15px); right: calc(-50% + 15px); height: 2px; background: var(--line); }
.paso-h.ok .paso-h-dot { background: var(--ok-soft); color: var(--ok); }
.paso-h.ok:not(:last-child)::after { background: #9BD3AE; }
.paso-h.now .paso-h-dot { background: var(--primary); color: #fff; }
.paso-h.espera .paso-h-dot { background: var(--primary-soft); color: var(--primary); }
.paso-h.alerta .paso-h-dot { background: var(--danger-soft); color: var(--danger); }
.paso-h.now, .paso-h.alerta { color: var(--text); font-weight: 700; }
.paso-h-t { font-weight: 700; color: var(--text); }
.paso-h-d { font-size: 11px; line-height: 1.3; max-width: 130px; }
.siguiente-paso { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; background: var(--primary-soft); border: 1px solid #C7D7F0; border-radius: 14px; padding: 12px 16px; margin-top: 14px; }
.siguiente-paso strong { color: var(--primary); }
.sp-flecha { font-size: 22px; color: var(--primary); font-weight: 700; }
.acciones-insc { gap: 8px; justify-content: flex-end; }
.menu-mas { position: relative; }
.menu-mas > summary { list-style: none; cursor: pointer; }
.menu-mas > summary::-webkit-details-marker { display: none; }
.menu-mas-lista { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 30px rgba(4,20,50,.16); padding: 6px; min-width: 260px; z-index: 30; display: flex; flex-direction: column; }
.menu-mas-lista a, .menu-mas-lista button { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 8px; text-decoration: none; color: var(--text); font: inherit; font-weight: 600; font-size: 13.5px; background: none; border: 0; cursor: pointer; text-align: left; width: 100%; }
.menu-mas-lista a:hover, .menu-mas-lista button:hover { background: var(--primary-soft); }
.menu-mas-lista .peligro { color: var(--danger); }
.menu-mas-lista form { margin: 0; }
@media (max-width: 640px) { .paso-h-d { display: none; } .paso-h { min-width: 40px; } .paso-h-t { display: none; } .paso-h.now .paso-h-t, .paso-h.alerta .paso-h-t { display: block; position: absolute; top: 34px; white-space: nowrap; font-size: 11px; } .pasos-h { padding-bottom: 26px; overflow: visible; } .acciones-insc { justify-content: flex-start; } .menu-mas-lista { right: auto; left: 0; } }

/* ---------- Pendientes del inicio ---------- */
.pend-fila .pend-btn { margin-left: auto; }
.tarea { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; text-decoration: none; color: var(--text); background: #fff; flex-wrap: wrap; }
.tarea:hover { border-color: var(--primary); background: var(--primary-soft); color: var(--text); }
.tarea-n { font-family: var(--display); font-size: 22px; font-weight: 700; color: var(--primary); min-width: 30px; text-align: center; }
.tarea-t { flex: 1; min-width: 180px; display: flex; flex-direction: column; }
.pestanas-chips { border-bottom: 0; flex-wrap: wrap; gap: 6px; }
.pestanas-chips a { border: 1px solid var(--border); border-radius: 99px; padding: 7px 14px; background: #fff; }
.pestanas-chips a.activo { background: var(--primary); border-color: var(--primary); color: #fff; }
.pestanas-chips a.activo .n { background: #fff; }
.panel-pestana.stack { gap: 16px; }

/* ---------- Portal de la familia ---------- */
.lo-que-sigue { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; margin-top: 16px; }
.lo-que-sigue h2 { margin: 0; font-size: 19px; }
.lqs-et { font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--primary); }
.lo-que-sigue.accion { background: var(--primary-soft); border-color: #C7D7F0; }
.lo-que-sigue.ok { background: var(--ok-soft); border-color: #BFE3C9; }
.lo-que-sigue.ok .lqs-et { color: var(--ok); }
.lo-que-sigue .btn { margin-top: 6px; }
.pestanas-fam .n.rojo { background: var(--danger); color: #fff; }
.pestanas-fam a .ti { font-size: 18px; }
@media (max-width: 640px) {
  .pestanas-fam { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; margin: 0; background: #fff; border-top: 1px solid var(--border); border-bottom: 0;
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; box-shadow: 0 -6px 20px rgba(4,20,50,.08); padding-bottom: env(safe-area-inset-bottom); }
  .pestanas-fam a { flex-direction: column; gap: 2px; padding: 8px 2px 10px; font-size: 11.5px; border-bottom: 0; border-top: 3px solid transparent; justify-content: center; text-align: center; }
  .pestanas-fam a.activo { border-top-color: var(--primary); }
  .pestanas-fam a span { display: inline-flex; gap: 4px; align-items: center; }
  body:has(.pestanas-fam) main { padding-bottom: 90px; }
}
.panel-pestana.stack > .card + .card, .panel-pestana.stack > section + section, .panel-pestana.stack > form + section, .panel-pestana.stack > section + form, .panel-pestana.stack > form + form { margin-top: 0; }
@media (max-width: 640px) { .pestanas-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; } }
.original { color: var(--muted); margin-top: 2px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.original.ok { color: var(--ok); }
.original .btn-link { margin-left: 4px; }
.fila-error td { background: var(--danger-soft); }

/* Barra de acciones fija de la evaluación: una sola línea, no tapa los criterios */
.barra-acciones { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 10px 16px; box-shadow: 0 -6px 18px rgba(10,58,130,.08); }
.ba-total { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ba-total strong { font-size: 18px; }
@media (max-width: 640px) { .barra-acciones { padding: 8px 10px; } .barra-acciones .btn { padding: 0 10px; font-size: 13px; } }
@media print { .barra-acciones { position: static; box-shadow: none; } }
/* Examen: en pantallas medianas la cámara (abajo a la derecha) no debe tapar las opciones */
@media (min-width: 901px) and (max-width: 1340px) { .exam-body .exam-main { padding-right: 240px; } }

/* Botón "volver" (reemplaza los enlaces ← …) */
.volver { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px 6px 10px; border: 1px solid var(--border); border-radius: 999px; background: #fff;
  color: var(--primary); font-weight: 700; font-size: 13px; text-decoration: none; transition: background .15s, border-color .15s; }
.volver:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.volver .ti { font-size: 16px; }
p.muted:has(> .volver) { margin-bottom: 10px !important; }

/* Barras de desplazamiento delgadas y discretas */
* { scrollbar-width: thin; scrollbar-color: #C3CFE2 transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #C3CFE2; border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #9FB2CF; background-clip: content-box; }
.lateral { scrollbar-color: rgba(255,255,255,.25) transparent; }
.lateral::-webkit-scrollbar-thumb { background: rgba(255,255,255,.22); background-clip: content-box; }
.lateral::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.4); background-clip: content-box; }
.filters-4e { display: grid; gap: 12px; align-items: end; grid-template-columns: 1fr 1fr 1fr auto; }
@media (max-width: 760px) { .filters-4e { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .filters-4e { grid-template-columns: 1fr; } }
/* Selección de varios grados (examen) */
.lbl-campo { font-weight: 700; font-size: 14px; display: block; margin-bottom: 6px; }
.chips-grados { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-g { display: inline-flex; cursor: pointer; }
.chip-g input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip-g span { padding: 7px 14px; border: 1px solid var(--border); border-radius: 999px; background: #fff; font-weight: 700; font-size: 13px; color: var(--muted); }
.chip-g input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip-g input:focus-visible + span { outline: 3px solid var(--primary); outline-offset: 2px; }
.seb-box{border:1px solid var(--line);border-radius:12px;padding:14px;background:#F6F9FE}
/* Nota de 1 a 5 y nota final */
#resumen-decision .res-fila { grid-template-columns: 1fr 110px 56px 190px; padding: 8px 0; border-top: 1px solid var(--line); }
#resumen-decision .res-fila.sub { border-top: 0; padding: 2px 0; }
#resumen-decision .res-fila.sub > span:first-child { border-left: 3px solid var(--line); }
.res-nota { font-size: 20px; text-align: right; white-space: nowrap; }
.res-nota small { font-size: 12px; color: var(--muted); font-weight: 600; }
.res-nota.small { font-size: 16px; }
.res-pct { text-align: right; font-weight: 600; }
.nota-final { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: var(--primary); color: #fff; border-radius: 12px; padding: 14px 16px; }
.nota-final .nf-num { font-size: 32px; font-weight: 800; font-family: var(--display); line-height: 1; }
.nota-final .nf-num small { font-size: 14px; opacity: .8; }
.nota-final .nf-txt { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 2px; }
.nota-final .nf-txt span { font-size: 13px; opacity: .85; }
.nota-final .nf-rango { background: #fff; color: var(--primary); font-weight: 700; font-size: 13px; border-radius: 999px; padding: 4px 12px; }
.prueba-aula { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.prueba-aula input { width: 90px; text-align: center; font-weight: 700; font-size: 18px; }
@media (max-width: 640px) {
  #resumen-decision .res-fila { grid-template-columns: 1fr auto auto; }
  #resumen-decision .res-fila > :last-child { grid-column: 1 / -1; justify-self: start; }
  #resumen-decision .res-fila.sub > :last-child { display: none; }
}
.nota-final .nf-rango.danger { color: var(--danger); }
.prueba-aula { justify-content: flex-start; text-align: left; }
.icono-pestana { display: grid; grid-template-columns: 240px 1fr; gap: 16px; align-items: start; }
.pestana-demo { display: flex; align-items: center; gap: 8px; background: #DEE1E6; border-radius: 10px 10px 0 0; padding: 9px 12px; font-size: 13px; color: #202124; align-self: end; }
.pestana-demo img { width: 16px; height: 16px; border-radius: 3px; }
.pestana-demo span { flex: 1; }
@media (max-width: 640px) { .icono-pestana { grid-template-columns: 1fr; } }
/* Venta: jornada, categoría y caja */
.venta-fam { display: grid; gap: 12px; }
.chips-cat { border: 0; padding: 0; margin: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.chips-cat legend { font-weight: 700; font-size: 14px; margin-bottom: 6px; padding: 0; }
.caja-box { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; border: 1px dashed #b9c9e3; border-radius: 12px; padding: 12px; background: var(--primary-soft, #EEF4FC); }
.caja-box[hidden] { display: none; }
@media (max-width: 640px) { .caja-box { grid-template-columns: 1fr; } }
.campo-bloq { background: #F4F6FA; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 500; }
.campo-bloq .ti { color: var(--muted); }
.filters-8 { grid-template-columns: 2fr 1fr 1fr 1fr; }
.filters-8 > button { align-self: end; }
@media (max-width: 900px) { .filters-8 { grid-template-columns: 1fr 1fr; } .filters-8 > label:first-child { grid-column: 1 / -1; } }
@media (max-width: 560px) { .filters-8 { grid-template-columns: 1fr; } }
.btn.ok-btn { background: var(--ok-soft, #E3F4EA); color: var(--ok); border-color: #bfe3cc; }
.btn.danger-out { background: #fff; color: var(--danger); border-color: #f2c4bf; }
details.inline-det { display: inline-block; }
details.inline-det > summary { list-style: none; }
details.inline-det > summary::-webkit-details-marker { display: none; }
.doc-fam { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.doc-fam:first-of-type { border-top: 0; }
.doc-fam .ico { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; flex: none; background: #EEF1F5; color: #4a5568; }
.doc-fam .ico.ok { background: #E3F4EA; color: var(--ok); }
.doc-fam .ico.danger { background: #FDE7E5; color: var(--danger); }
.criterio-sel { background: #FFF4D6; border-left: 4px solid #E7A600; border-radius: 8px; padding: 10px 12px; font-size: 14px; color: #3D2E00; }
.nota-in { width: 72px; text-align: center; font-weight: 700; }
input.nota-in { width: 76px !important; display: inline-block; margin-right: 6px; }
@media (max-width: 560px) {
  .doc-fam { flex-wrap: wrap; }
  .doc-fam > div { flex: 1 1 calc(100% - 44px) !important; }
  .doc-fam > .badge { margin-left: 42px; }
}
.zona-peligro { border-color: #f2c4bf; }
.zona-peligro > summary { cursor: pointer; list-style: none; color: var(--danger); }
.zona-peligro > summary::-webkit-details-marker { display: none; }
.zona-peligro > summary h2 { color: var(--danger); font-size: 17px; }

/* Ranking por grado */
.sub-tabs { display: flex; gap: 6px; margin: 0 0 14px; border-bottom: 1px solid var(--line, #E3E8EF); }
.sub-tabs a { padding: 9px 14px; font-weight: 700; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.sub-tabs a.on { color: var(--primary); border-bottom-color: var(--primary); }
.rk-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.rk-stats .card { padding: 12px 14px; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.rk-stats strong { font-size: 24px; color: var(--primary); }
table.rk tr.rk-sel td { background: var(--ok-soft); }
table.rk tr.rk-linea td { padding: 6px 10px; font-size: 12px; font-weight: 700; text-align: center; }
table.rk tr.rk-linea.cupo td { color: var(--primary); background: var(--primary-soft); border-top: 2px dashed var(--primary); }
table.rk tr.rk-linea.min td { color: var(--danger); background: var(--danger-soft); border-top: 2px solid var(--danger); }
table.rk input[type=checkbox] { width: 18px; height: 18px; }
.rk-acciones { display: flex; flex-wrap: wrap; gap: 8px; }
.rk-filtros { grid-template-columns: 1fr 1fr 1fr auto; align-items: end; }
table.rk .show-sm { display: none; margin-top: 4px; }
.rk-filtros.rk-filtros-2 { grid-template-columns: 1fr 1fr auto; }
.rk-resto { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.rk-resto label { flex: 1 1 220px; }
@media (max-width: 640px) {
  .rk-stats { grid-template-columns: repeat(2, 1fr); }
  table.rk .hide-sm { display: none; }
  table.rk .show-sm { display: block; }
  table.rk-pk { width: 100%; }
  table.rk-pk td .badge { white-space: normal; }
  table.rk-pk .c-chk { width: 34px; } table.rk-pk .c-pos { width: 26px; } table.rk-pk .c-fin { width: 54px; }
  table.rk-pk td { overflow-wrap: anywhere; padding-left: 4px; padding-right: 4px; }
  .rk-filtros, .rk-filtros.rk-filtros-2 { grid-template-columns: 1fr; }
  .rk-resto .btn { flex: 1 1 100%; justify-content: center; }
  .rk-acciones .btn { flex: 1 1 100%; justify-content: center; }
}

table.cupos-j input { width: 72px !important; text-align: right; padding: 6px 8px; }
table.cupos-j td, table.cupos-j th { padding: 6px 8px; }
@media (max-width: 640px) { table.cupos-j input { width: 50px !important; padding: 6px 4px; } table.cupos-j td, table.cupos-j th { padding: 6px 3px; font-size: 12px; } }
