/* Glosa SAMA: capa de diseño sobre Bootstrap 5.
   La vista de cada persona (tema, tamaño, letra, espaciado, acento, notas) se aplica con atributos data-*
   en <html>; aquí solo se mueven variables. Nada de CSS por usuario en línea. */

/* ---------------------------------------------------------------- Tokens: tema claro (por defecto) */
:root,
[data-tema="cla"] {
  --fondo: #fff;
  --papel: #fff;
  --texto: #23262a;
  --suave: #63666a;
  --borde: #c8c9c7;
  --realce: #c8d8eb;
  --zebra: #f3f6fa;
  --titulo: #004b87;
  --brand: #004b87;
  --on-brand: #fff;
  --brand-hover: #003a6a;
  --brand-fil: #69b3e7;
  --foco: #004b87;
  --sel-bg: #c8d8eb;
  --sel-tx: #23262a;
  --nota-bg: #f3f6fa;
  --pill-bg: #fff;
  --pill-tx: #004b87;
  --pill-bor-tx: #63666a;
  --amb-bg: #fbebc8;
  --amb-tx: #7a4b00;
  --rojo: #b42318;
  --rojo-bg: #fef3f2;
  --rojo-pill: #b42318;
  --tono-neutro: var(--titulo);
  --tono-ambar: #7a4b00;
  --tono-rojo: #b42318;
  --dis-bg: #e6e7e5;
  --dis-tx: #63666a;
  --b-val: #004b87;
  --b-env: #69b3e7;
  --b-cor: #c8d8eb;
  --b-obs: #c98a12;
  --b-dev: #b42318;
  --b-bor: #97999b;
  --mark-bg: #c8d8eb;
  --mark-tx: #23262a;
}

[data-tema="osc"] {
  --fondo: #0e1318;
  --papel: #171d24;
  --texto: #e9ecef;
  --suave: #c8c9c7;
  --borde: #3d4650;
  --realce: #274561;
  --zebra: #1c242d;
  --titulo: #69b3e7;
  --brand: #004b87;
  --on-brand: #fff;
  --brand-hover: #0a5ea3;
  --brand-fil: #69b3e7;
  --foco: #69b3e7;
  --sel-bg: #69b3e7;
  --sel-tx: #0b1f33;
  --nota-bg: #1c242d;
  --tono-ambar: #f2c265;
  --tono-rojo: #ff9c92;
  --rojo: #ff9c92;
  --dis-bg: #2a323b;
  --dis-tx: #aeb2b7;
  --b-val: #69b3e7;
  --b-env: #3f82b8;
  --b-cor: #8fa9c4;
  --b-obs: #e0a93b;
  --b-dev: #ff9c92;
  --b-bor: #97999b;
  --mark-bg: #2f5a80;
  --mark-tx: #fff;
}

[data-tema="alc"] {
  --fondo: #000;
  --papel: #000;
  --texto: #fff;
  --suave: #e3e4e2;
  --borde: #fff;
  --realce: #0b3a63;
  --zebra: #111;
  --titulo: #69b3e7;
  --brand: #004b87;
  --on-brand: #fff;
  --brand-hover: #0a5ea3;
  --brand-fil: #69b3e7;
  --foco: #fff;
  --sel-bg: #fff;
  --sel-tx: #000;
  --nota-bg: #111;
  --pill-bor-tx: #3f4246;
  --amb-bg: #ffe7a3;
  --amb-tx: #3f2700;
  --rojo: #ff9c92;
  --rojo-pill: #8a1a10;
  --tono-ambar: #ffd77a;
  --tono-rojo: #ffb3ab;
  --dis-bg: #222;
  --dis-tx: #e3e4e2;
  --b-val: #69b3e7;
  --b-env: #3f82b8;
  --b-cor: #8fa9c4;
  --b-obs: #ffd77a;
  --b-dev: #ff9c92;
  --b-bor: #c8c9c7;
  --mark-bg: #fff;
  --mark-tx: #000;
}

/* Acento: gris (claro) */
[data-tema="cla"][data-acento="gr"] {
  --titulo: #63666a;
  --brand: #63666a;
  --brand-hover: #4a4d51;
  --brand-fil: #c8c9c7;
  --foco: #63666a;
  --tono-neutro: #63666a;
}

[data-tema="osc"][data-acento="gr"] {
  --titulo: #c8c9c7;
  --brand: #63666a;
  --brand-hover: #797d81;
  --brand-fil: #97999b;
}

[data-tema="osc"][data-acento="ci"] {
  --titulo: #69b3e7;
  --brand: #69b3e7;
  --on-brand: #0b1f33;
  --brand-hover: #8cc5f0;
  --brand-fil: #c8d8eb;
}

[data-tema="alc"][data-acento="gr"] {
  --titulo: #c8c9c7;
  --brand: #c8c9c7;
  --on-brand: #000;
  --brand-hover: #fff;
  --brand-fil: #fff;
}

[data-tema="alc"][data-acento="ci"] {
  --titulo: #69b3e7;
  --brand: #69b3e7;
  --on-brand: #000;
  --brand-hover: #8cc5f0;
  --brand-fil: #fff;
}

/* ---------------------------------------------------------------- Tamaño, letra y espaciado */
[data-texto="nor"] { font-size: 16px; }
[data-texto="gra"] { font-size: 18px; }
[data-texto="mgr"] { font-size: 20px; }

:root,
[data-tipo="pub"] {
  --fuente: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

[data-tipo="lec"] {
  --fuente: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

:root,
[data-densidad="com"] {
  --gap-lista: 0.875em;
  --pad-cuerpo: 0.625em;
  --pad-pie: 0.75em;
  --fila: 0.125em;
  --cab-arriba: 1.625em;
  --cab-abajo: 1.375em;
  --celda: 0.75em;
}

[data-densidad="cop"] {
  --gap-lista: 0.5em;
  --pad-cuerpo: 0.375em;
  --pad-pie: 0.5em;
  --fila: 0;
  --cab-arriba: 1em;
  --cab-abajo: 0.875em;
  --celda: 0.4em;
}

/* ---------------------------------------------------------------- Bootstrap: variables */
:root {
  --bs-body-font-family: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-bg: #fff;
  --bs-body-color: #23262a;
  --bs-primary: #004b87;
  --bs-primary-rgb: 0, 75, 135;
  --bs-link-color: #004b87;
  --bs-link-hover-color: #003a6a;
  --bs-border-color: #c8c9c7;
  --bs-border-radius: 4px;
  --bs-border-radius-sm: 4px;
  --bs-border-radius-lg: 4px;
  --bs-danger: #b42318;
  --bs-danger-rgb: 180, 35, 24;
  --bs-focus-ring-color: transparent;
}

html {
  scroll-padding-top: 1rem;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--fuente);
  background: var(--fondo);
  color: var(--texto);
  line-height: 1.45;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  scrollbar-color: var(--suave) var(--fondo);
  caret-color: var(--titulo);
  accent-color: var(--brand);
}

body > main { flex: 1; }

::selection { background: var(--sel-bg); color: var(--sel-tx); }

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--fondo); }
::-webkit-scrollbar-thumb { background: var(--suave); border: 3px solid var(--fondo); border-radius: 8px; }

a { color: var(--titulo); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { color: var(--titulo); text-decoration-thickness: 2px; }

h1, h2, h3, h4, h5 { text-wrap: balance; }

:focus-visible {
  outline: 3px solid var(--foco);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Cifras alineadas */
.num, table, .folio, .ea, .contador, .cifra-valor, .dias {
  font-variant-numeric: tabular-nums lining-nums;
}

.visually-hidden-focusable:focus { outline-offset: 0; }

.salto {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--brand);
  color: var(--on-brand);
  padding: 0.75rem 1rem;
  z-index: 2000;
  border-radius: 4px;
}
.salto:focus { top: 0.5rem; color: var(--on-brand); }

.contenedor {
  width: 100%;
  max-width: calc(1180px + 2 * clamp(1rem, 4vw, 3rem));
  margin: 0 auto;
  padding-left: clamp(1rem, 4vw, 3rem);
  padding-right: clamp(1rem, 4vw, 3rem);
}

/* ---------------------------------------------------------------- Barra superior */
.barra {
  background: var(--papel);
  border-top: 4px solid var(--brand);
  border-bottom: 1px solid var(--borde);
}

.barra-in {
  display: flex;
  align-items: stretch;
  min-height: 64px;
  gap: 0.75rem;
}

.marca {
  display: flex;
  align-items: center;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  color: var(--titulo);
  text-decoration: none;
  margin-right: 1rem;
  white-space: nowrap;
}
.marca:hover { text-decoration: none; }

.barra-menu { flex: 1; }

.barra-cuerpo {
  display: flex;
  align-items: stretch;
  gap: 2rem;
  padding: 0;
}

.nav-rol { display: flex; gap: 2rem; }

.nav-rol a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding-top: 3px;
  font-weight: 500;
  color: var(--suave);
  text-decoration: none;
  border-bottom: 3px solid transparent;
}
.nav-rol a:hover { color: var(--titulo); border-bottom-color: var(--borde); }
.nav-rol a[aria-current="page"] { color: var(--titulo); font-weight: 600; border-bottom-color: var(--titulo); }

.contador {
  display: inline-block;
  min-width: 1.5rem;
  padding: 0 0.4rem;
  border-radius: 12px;
  background: var(--amb-bg);
  color: var(--amb-tx);
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.375rem;
  text-align: center;
}

.zona-usuario {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.menu-usuario { position: relative; }
.menu-usuario summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 44px;
  padding: 0 0.5rem;
  cursor: pointer;
  list-style: none;
  font-weight: 500;
  border-radius: 4px;
}
.menu-usuario summary::-webkit-details-marker { display: none; }
.menu-usuario summary:hover { background: var(--zebra); }
.menu-usuario .quien { display: flex; flex-direction: column; line-height: 1.2; }
.menu-usuario .quien small { color: var(--suave); font-weight: 400; font-size: 0.8125rem; }

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--realce);
  color: var(--titulo);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.875rem;
  flex: none;
}
[data-tema="osc"] .avatar, [data-tema="alc"] .avatar { color: var(--texto); }

.menu-usuario .panel {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 14rem;
  background: var(--papel);
  border: 1px solid var(--borde);
  border-radius: 4px;
  padding: 0.25rem;
  z-index: 1030;
  box-shadow: 0 8px 24px rgb(0 0 0 / 16%);
}
.menu-usuario .panel a {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-height: 44px;
  padding: 0 0.75rem;
  color: var(--texto);
  text-decoration: none;
  border-radius: 4px;
}
.menu-usuario .panel a:hover { background: var(--zebra); color: var(--titulo); }

.icono-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  min-width: 44px;
  min-height: 44px;
  padding: 0 0.625rem;
  color: var(--suave);
  text-decoration: none;
  border-radius: 4px;
  background: transparent;
  border: 0;
  font-weight: 500;
}
.icono-btn:hover { background: var(--zebra); color: var(--titulo); text-decoration: none; }
.icono-btn .contador { position: absolute; top: 2px; right: 0; min-width: 1.25rem; line-height: 1.125rem; font-size: 0.75rem; }
.icono-btn i { font-size: 1.25rem; }

.barra .offcanvas-lg { background: var(--papel); color: var(--texto); }
.barra .offcanvas-header { border-bottom: 1px solid var(--borde); }
.barra .btn-close { filter: none; }
[data-tema="osc"] .barra .btn-close, [data-tema="alc"] .barra .btn-close { filter: invert(1); }

@media (max-width: 991.98px) {
  .barra-in { align-items: center; }
  .barra .toggler-zona { margin-left: auto; display: flex; align-items: center; gap: 0.25rem; }
  .barra .offcanvas-lg { max-width: 22rem; }
  .barra-cuerpo { flex-direction: column; gap: 1rem; padding: 1rem; }
  .nav-rol { flex-direction: column; gap: 0; }
  .nav-rol a { border-bottom: 1px solid var(--borde); border-left: 0; padding: 0 0.25rem; min-height: 52px; }
  .nav-rol a[aria-current="page"] { border-bottom-color: var(--titulo); box-shadow: inset 0 -2px 0 var(--titulo); }
  .zona-usuario { margin-left: 0; flex-direction: column; align-items: stretch; }
  .menu-usuario .panel { position: static; box-shadow: none; margin-top: 0.25rem; }
  .menu-usuario summary { padding: 0 0.25rem; }
  .barra .barra-campana { display: none; }
}

@media (min-width: 992px) {
  .barra .toggler-zona { display: none; }
  .barra .barra-menu .offcanvas-header { display: none; }
  .barra .barra-cuerpo { flex: 1; }
  .barra-in { min-height: 64px; }
}

/* ---------------------------------------------------------------- Avisos (mensajes de Django) */
.avisos { padding-top: 1rem; display: grid; gap: 0.5rem; }

.aviso {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0.75rem 0.75rem 1rem;
  border: 1px solid var(--borde);
  border-radius: 4px;
  background: var(--papel);
  color: var(--texto);
}
.aviso i { font-size: 1.125rem; line-height: 1.45; flex: none; }
.aviso p { margin: 0; flex: 1; }
.aviso-success { background: var(--realce); border-color: var(--brand); }
.aviso-error { background: var(--rojo-bg); border-color: var(--rojo-pill); color: #7a1a12; }
.aviso-error i { color: #b42318; }
.aviso-warning { background: var(--amb-bg); border-color: var(--amb-tx); color: var(--amb-tx); }
[data-tema="osc"] .aviso-success { color: var(--texto); }
[data-tema="alc"] .aviso-success { color: #fff; }
.aviso .cerrar {
  flex: none;
  width: 36px;
  height: 36px;
  margin: -0.25rem 0;
  border: 0;
  background: transparent;
  color: inherit;
  border-radius: 4px;
}
.aviso .cerrar:hover { background: rgb(0 0 0 / 8%); }

/* ---------------------------------------------------------------- Botones */
.btn {
  --bs-btn-border-radius: 4px;
  --bs-btn-font-weight: 600;
  --bs-btn-padding-x: 1.25rem;
  --bs-btn-padding-y: 0.5rem;
  --bs-btn-disabled-opacity: 1;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
}
.btn i { font-size: 1.125em; }

.btn-primary {
  --bs-btn-color: var(--on-brand);
  --bs-btn-bg: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-color: var(--on-brand);
  --bs-btn-hover-bg: var(--brand-hover);
  --bs-btn-hover-border-color: var(--brand-hover);
  --bs-btn-active-color: var(--on-brand);
  --bs-btn-active-bg: var(--brand-hover);
  --bs-btn-active-border-color: var(--brand-hover);
  --bs-btn-disabled-color: var(--dis-tx);
  --bs-btn-disabled-bg: var(--dis-bg);
  --bs-btn-disabled-border-color: var(--dis-bg);
}
.btn-primary:active { transform: translateY(1px); }
[data-tema="alc"] .btn-primary { --bs-btn-border-color: #fff; --bs-btn-hover-border-color: #fff; }

.btn-secundario {
  --bs-btn-color: var(--titulo);
  --bs-btn-bg: transparent;
  --bs-btn-border-color: var(--titulo);
  --bs-btn-hover-color: var(--titulo);
  --bs-btn-hover-bg: var(--realce);
  --bs-btn-hover-border-color: var(--titulo);
  --bs-btn-active-color: var(--titulo);
  --bs-btn-active-bg: var(--realce);
  --bs-btn-active-border-color: var(--titulo);
  --bs-btn-disabled-color: var(--dis-tx);
  --bs-btn-disabled-bg: transparent;
  --bs-btn-disabled-border-color: var(--borde);
}

.btn-peligro {
  --bs-btn-color: var(--rojo);
  --bs-btn-bg: transparent;
  --bs-btn-border-color: var(--rojo);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #b42318;
  --bs-btn-hover-border-color: #b42318;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #8a1a10;
  --bs-btn-active-border-color: #8a1a10;
}

.btn-sm-glosa { min-height: 36px; --bs-btn-padding-x: 0.875rem; font-size: 0.9375rem; }
@media (max-width: 767.98px) { .btn-sm-glosa { min-height: 44px; } }

.btn:disabled, .btn.disabled { cursor: not-allowed; }

@media (prefers-reduced-motion: no-preference) {
  .btn, .icono-btn, .nav-rol a, .menu-usuario summary { transition: background-color 0.15s ease-out, color 0.15s ease-out, border-color 0.15s ease-out; }
  html { scroll-behavior: smooth; }
}

/* ---------------------------------------------------------------- Encabezado de página */
.cabecera {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding-top: var(--cab-arriba);
  padding-bottom: var(--cab-abajo);
}
.cabecera h1 {
  font-size: 2rem;
  line-height: 1.15;
  font-weight: 700;
  color: var(--tono-neutro, var(--titulo));
  letter-spacing: -0.02em;
  margin: 0;
  max-width: 50ch;
}
.cabecera .sub { color: var(--suave); margin: 0.5rem 0 0; max-width: 70ch; }
.cabecera .sub b { color: var(--texto); font-weight: 600; }
.cabecera .acciones { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.cabecera.tono-ambar h1 { color: var(--tono-ambar); }
.cabecera.tono-rojo h1 { color: var(--tono-rojo); }

@media (max-width: 575.98px) {
  .cabecera h1 { font-size: 1.625rem; }
  .cabecera .acciones, .cabecera .acciones .btn { width: 100%; }
}

.migas { padding-top: 1rem; font-size: 0.9375rem; }
.migas a { color: var(--suave); }

/* ---------------------------------------------------------------- Tarjeta informativa (todo en em) */
.fichas { container: fichas / inline-size; }

.lista-tarjetas { display: flex; flex-direction: column; gap: var(--gap-lista); padding-bottom: 3rem; list-style: none; margin: 0; padding-left: 0; }

.ficha-row {
  border: 1px solid var(--borde);
  border-radius: 4px;
  background: var(--papel);
}

.tarjeta { background: var(--papel); border-radius: 4px; overflow: hidden; }

.tarjeta .hd {
  background: var(--brand);
  color: var(--on-brand);
  min-height: 2.125em;
  border-bottom: 3px solid var(--brand-fil);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  padding: 0.25em 1em;
  gap: 0.25em 1.75em;
}
.fmt { font-size: 0.8125em; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
.folio { font-size: 0.8125em; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 600; color: var(--on-brand); opacity: 0.88; }
.folio b { font-weight: 700; margin-left: 0.4em; letter-spacing: 0.08em; opacity: 1; }
.tarjeta .hd .dir { font-size: 0.8125em; letter-spacing: 0.04em; opacity: 0.88; }

.st {
  margin-left: auto;
  font-size: 0.875em;
  font-weight: 700;
  background: var(--pill-bg);
  color: var(--pill-tx);
  padding: 0.0625em 0.75em;
  border: 1px solid transparent;
  border-radius: 12px;
  line-height: 1.4286;
  white-space: nowrap;
}
.st-bor { color: var(--pill-bor-tx); }
.st-obs { background: var(--amb-bg); color: var(--amb-tx); }
.st-dev { background: var(--rojo-bg); color: var(--rojo-pill); }
.tabla-fichas .st { margin-left: 0; border-color: var(--borde); }

.tarjeta .bd {
  padding: var(--pad-cuerpo) 1em var(--pad-pie);
  display: grid;
  grid-template-columns: 8.75em minmax(0, 1fr);
  row-gap: var(--fila);
  column-gap: 0.5em;
  align-items: baseline;
}
.lb { font-size: 0.8125em; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--suave); }
.as { font-size: 1.375em; font-weight: 600; color: var(--titulo); line-height: 1.3; letter-spacing: -0.01em; }
.as a { color: inherit; text-decoration: none; }
.as a:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.ea { font-size: 1.0625em; color: var(--texto); }
.ea b { font-weight: 700; }
.ea .falta { color: var(--suave); }
mark { background: var(--mark-bg); color: var(--mark-tx); padding: 0 0.25em; }

/* Notas al margen: dentro de la tarjeta por defecto; al margen cuando hay ancho y la persona lo elige */
.notas { margin: 0; display: flex; flex-direction: column; }

.nota {
  position: relative;
  padding: 0.75em 1em;
  border-top: 1px solid var(--borde);
  background: var(--nota-bg);
  color: var(--texto);
  font-size: 1em;
}
.nota:last-child { border-radius: 0 0 3px 3px; }
.nota p { margin: 0; font-weight: 500; line-height: 1.4; padding-left: 1.125em; position: relative; }
.nota p::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5em;
  width: 0.5625em;
  height: 0.5625em;
  border-radius: 50%;
  background: var(--titulo);
}
.nota .pie { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5em 0.75em; margin-top: 0.5em; padding-left: 1.125em; }
.nota small { font-size: 0.875em; color: var(--suave); }

@container fichas (min-width: 760px) {
  [data-notas="mar"] .ficha-row.con-notas {
    display: grid;
    grid-template-columns: minmax(0, 780px) minmax(0, 1fr);
    border: 0;
    border-radius: 0;
    background: transparent;
    align-items: start;
  }
  [data-notas="mar"] .ficha-row.con-notas .tarjeta { border: 1px solid var(--borde); }
  [data-notas="mar"] .ficha-row.con-notas .notas { margin-top: 2.25em; margin-left: 3.25em; gap: 1em; }
  [data-notas="mar"] .ficha-row.con-notas .nota {
    padding: 0 0 0 1em;
    border: 0;
    border-left: 1px solid var(--titulo);
    background: transparent;
    min-height: 3.5em;
    --cy: 1em;
  }
  [data-notas="mar"] .ficha-row.con-notas .nota:first-child { --cy: 3.25em; }
  [data-notas="mar"] .ficha-row.con-notas .nota p { color: var(--titulo); padding-left: 0; }
  [data-notas="mar"] .ficha-row.con-notas .nota p::before { content: none; }
  [data-notas="mar"] .ficha-row.con-notas .nota .pie { padding-left: 0; }
  [data-notas="mar"] .ficha-row.con-notas .nota::before {
    content: "";
    position: absolute;
    left: -3.25em;
    top: var(--cy);
    width: 3.25em;
    height: 1px;
    background: var(--titulo);
  }
  [data-notas="mar"] .ficha-row.con-notas .nota::after {
    content: "";
    position: absolute;
    left: -3.5em;
    top: calc(var(--cy) - 0.25em);
    width: 0.5625em;
    height: 0.5625em;
    border-radius: 50%;
    background: var(--titulo);
  }
}

@container fichas (max-width: 520px) {
  .tarjeta .bd { grid-template-columns: minmax(0, 1fr); }
  .tarjeta .bd .lb { margin-top: 0.375em; }
}

.vacio {
  border: 1px solid var(--borde);
  border-radius: 4px;
  padding: 2.5rem 1.5rem;
  max-width: 46rem;
  background: var(--papel);
}
.vacio h2 { font-size: 1.375rem; font-weight: 600; color: var(--titulo); margin: 0 0 0.5rem; }
.vacio p { color: var(--suave); max-width: 55ch; }

/* ---------------------------------------------------------------- Lista en tabla compacta */
.tabla-fichas { width: 100%; border-collapse: collapse; background: var(--papel); }
.tabla-fichas caption { position: absolute; left: -9999px; }
.tabla-fichas th {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--suave);
  text-align: left;
  padding: var(--celda) 0.75rem;
  border-bottom: 2px solid var(--brand);
  white-space: nowrap;
}
.tabla-fichas td { padding: var(--celda) 0.75rem; border-bottom: 1px solid var(--borde); vertical-align: middle; }
.tabla-fichas tbody tr:nth-child(even) { background: var(--zebra); }
.tabla-fichas tbody tr:hover { background: var(--realce); }
.tabla-fichas .t-folio { font-weight: 700; white-space: nowrap; color: var(--titulo); }
.tabla-fichas .t-asunto a { font-weight: 600; color: var(--titulo); }
.tabla-fichas .t-pend { white-space: nowrap; }

/* ---------------------------------------------------------------- Formularios (crispy + Bootstrap) */
.form-label { font-weight: 600; margin-bottom: 0.25rem; }
.form-control, .form-select {
  background-color: var(--papel);
  color: var(--texto);
  border: 1px solid var(--suave);
  border-radius: 4px;
  min-height: 44px;
  font-family: inherit;
}
[data-tema="alc"] .form-control, [data-tema="alc"] .form-select { border-color: #fff; border-width: 2px; }
.form-control:hover, .form-select:hover { border-color: var(--titulo); }
.form-control:focus, .form-select:focus {
  background-color: var(--papel);
  color: var(--texto);
  border-color: var(--titulo);
  box-shadow: none;
  outline: 3px solid var(--foco);
  outline-offset: 1px;
}
.form-control:disabled, .form-select:disabled { background: var(--dis-bg); color: var(--dis-tx); cursor: not-allowed; }
.form-control::placeholder { color: var(--suave); opacity: 0.8; }
.form-text { color: var(--suave); font-size: 0.9375rem; }
.is-invalid, .form-control.is-invalid, .form-select.is-invalid { border-color: var(--rojo); border-width: 2px; background-image: none; padding-right: 0.75rem; }
.invalid-feedback, .text-danger { color: var(--rojo) !important; font-size: 0.9375rem; font-weight: 500; }
.form-check-input { width: 1.25em; height: 1.25em; margin-top: 0.15em; border-color: var(--suave); background-color: var(--papel); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-check-input:focus { box-shadow: none; outline: 3px solid var(--foco); outline-offset: 2px; }
.form-check-label { padding-left: 0.25rem; }
.form-check { min-height: 2rem; padding-top: 0.125rem; }
select[multiple].form-select { min-height: 8rem; }
.asteriskField { display: none; }
.form-group, .mb-3 { margin-bottom: 1.25rem !important; }
.controls { max-width: 70ch; }

.tarjeta-form {
  border: 1px solid var(--borde);
  border-radius: 4px;
  background: var(--papel);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.tarjeta-form h2, .tarjeta-form h3 { font-size: 1.0625rem; font-weight: 600; color: var(--titulo); margin: 0 0 1rem; }

/* Formulario inline (devolver, no aplica) con <details> */
.inline-form { display: inline-block; }
.inline-form > summary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0 1.25rem;
  border: 1px solid var(--titulo);
  border-radius: 4px;
  color: var(--titulo);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.inline-form > summary::-webkit-details-marker { display: none; }
.inline-form > summary:hover { background: var(--realce); }
.inline-form.peligro > summary { border-color: var(--rojo); color: var(--rojo); }
.inline-form[open] > summary { background: var(--realce); }
.inline-form .cuerpo {
  display: block;
  margin-top: 0.5rem;
  padding: 1rem;
  border: 1px solid var(--borde);
  border-radius: 4px;
  background: var(--papel);
  min-width: min(100%, 22rem);
  max-width: 34rem;
}
.inline-form.pequeno > summary { min-height: 36px; padding: 0 0.875rem; font-size: 0.9375rem; }
@media (max-width: 767.98px) { .inline-form.pequeno > summary { min-height: 44px; } }

/* ---------------------------------------------------------------- Editor guiado */
.pasos { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0; margin: 0 0 1.5rem; list-style: none; }
.pasos li { flex: 1 1 9rem; }
.pasos a {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-height: 52px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--borde);
  box-shadow: inset 0 -3px 0 var(--borde);
  border-radius: 4px;
  color: var(--suave);
  text-decoration: none;
  font-weight: 500;
  line-height: 1.2;
  background: var(--papel);
}
.pasos a:hover { box-shadow: inset 0 -3px 0 var(--titulo); color: var(--titulo); }
.pasos a[aria-current="step"] { box-shadow: inset 0 -3px 0 var(--titulo); color: var(--titulo); font-weight: 700; background: var(--realce); }
.pasos .n {
  flex: none;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  border: 1px solid currentcolor;
  display: grid;
  place-items: center;
  font-size: 0.875rem;
  font-weight: 700;
}
.pasos a[aria-current="step"] .n { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }

.editor { max-width: 52rem; padding-bottom: 3rem; }
.editor-acciones {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  padding: 0.875rem 0;
  background: var(--fondo);
  border-top: 1px solid var(--borde);
  margin-top: 1.5rem;
}
.ayuda-paso { color: var(--suave); max-width: 60ch; margin: 0.5rem 0 0; }

/* ---------------------------------------------------------------- Detalle de la ficha */
.etapas { display: flex; flex-wrap: wrap; gap: 0; list-style: none; padding: 0; margin: 0 0 1.5rem; counter-reset: etapa; }
.etapas li {
  flex: 1 1 8rem;
  padding: 0.625rem 0.75rem;
  border-top: 4px solid var(--borde);
  color: var(--suave);
  font-weight: 500;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.etapas li small { font-size: 0.8125rem; letter-spacing: 0.08em; text-transform: uppercase; }
.etapas .hecha { border-top-color: var(--titulo); color: var(--texto); }
.etapas .actual { border-top-color: var(--titulo); border-top-width: 6px; color: var(--titulo); font-weight: 700; }
.etapas .actual.dev { border-top-color: var(--rojo); color: var(--rojo); }

.detalle-grid { display: grid; gap: 2rem; grid-template-columns: minmax(0, 1fr); padding-bottom: 3rem; }
@media (min-width: 992px) { .detalle-grid { grid-template-columns: minmax(0, 780px) minmax(0, 1fr); } }

.documento { border: 1px solid var(--borde); border-radius: 4px; background: var(--papel); }
.documento .tarjeta { border-radius: 4px 4px 0 0; }
.documento .cuerpo-doc { padding: 1.25rem 1.5rem 1.5rem; }
.documento section { padding: 1rem 0; border-top: 1px solid var(--borde); }
.documento section:first-child { border-top: 0; padding-top: 0; }
.documento h2 { font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--suave); margin: 0 0 0.5rem; }
.documento p { max-width: 70ch; white-space: pre-line; margin-bottom: 0.5rem; }
.documento .vacio-seccion { color: var(--suave); font-style: normal; }
.cifras-lista { list-style: none; padding: 0; margin: 0.75rem 0 0; display: grid; gap: 0.5rem; }
.cifras-lista li { border: 1px solid var(--borde); border-radius: 4px; padding: 0.625rem 0.875rem; background: var(--nota-bg); }
.cifras-lista .cifra-valor { font-weight: 700; font-size: 1.125rem; color: var(--titulo); }
.cifras-lista small { display: block; color: var(--suave); font-size: 0.875rem; }
.pregunta { padding: 0.75rem 0; border-top: 1px solid var(--borde); }
.pregunta:first-of-type { border-top: 0; }
.pregunta .p { font-weight: 600; margin: 0; }
.pregunta .tipo, .foco .tipo { font-size: 0.8125rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--suave); font-weight: 600; }
.foco { padding: 0.75rem 0; border-top: 1px solid var(--borde); }
.foco:first-of-type { border-top: 0; }
.foco h3 { font-size: 1.0625rem; font-weight: 600; margin: 0.125rem 0; }
.riesgo {
  display: inline-block;
  padding: 0 0.625rem;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.5rem;
  background: var(--realce);
  color: var(--texto);
  border: 1px solid var(--borde);
}
.riesgo-alto { background: var(--rojo-bg); color: var(--rojo-pill); border-color: var(--rojo-pill); }
.riesgo-medio { background: var(--amb-bg); color: var(--amb-tx); border-color: var(--amb-tx); }

.lateral > * + * { margin-top: 1.5rem; }
.lateral h2 { font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--suave); margin: 0 0 0.75rem; }
.lateral .notas .nota { border: 1px solid var(--borde); border-radius: 4px; margin-bottom: 0.5rem; }
.panel-acciones { display: grid; gap: 0.75rem; justify-items: start; }
.panel-acciones .explica { margin: 0; color: var(--suave); max-width: 38ch; font-size: 0.9375rem; }
.panel-acciones .explica a { font-weight: 600; }
.historial { list-style: none; padding: 0; margin: 0; }
.historial li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.5rem 0; border-top: 1px solid var(--borde); font-size: 0.9375rem; }
.historial li:first-child { border-top: 0; }

/* ---------------------------------------------------------------- Pendientes */
.grupo-pendientes { margin-bottom: 2rem; }
.grupo-pendientes > h2 { font-size: 1.375rem; font-weight: 600; color: var(--titulo); margin: 0 0 0.75rem; display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; }
.grupo-pendientes > h2 .folio-grupo { font-size: 0.8125rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--suave); font-weight: 600; }
.pendiente { border: 1px solid var(--borde); border-radius: 4px; background: var(--papel); padding: 1rem 1.25rem; margin-bottom: 0.625rem; max-width: 60rem; }
.pendiente p.msg { font-weight: 500; margin: 0 0 0.25rem; }
.pendiente small { color: var(--suave); }
.pendiente .acciones-pend { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-start; margin-top: 0.75rem; }

/* ---------------------------------------------------------------- Avance (sábana) */
.tabla-scroll { overflow-x: auto; border: 1px solid var(--borde); border-radius: 4px; background: var(--papel); }
.sabana { width: 100%; border-collapse: collapse; min-width: 52rem; }
.sabana th, .sabana td { padding: 0 0.75rem; border-bottom: 1px solid var(--borde); height: 3rem; }
.sabana thead th {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--suave);
  text-align: right;
  border-bottom: 2px solid var(--brand);
  white-space: nowrap;
}
.sabana thead th:first-child, .sabana tbody th { text-align: left; }
.sabana tbody th { font-weight: 600; color: var(--titulo); min-width: 13rem; position: sticky; left: 0; background: var(--papel); }
.sabana td { text-align: right; padding: 0; }
.sabana td a, .sabana td span.cero { display: block; padding: 0 0.75rem; line-height: 3rem; font-weight: 600; text-decoration: none; }
.sabana td span.cero { color: var(--suave); font-weight: 400; }
.sabana td a:hover { background: var(--realce); text-decoration: underline; }
.sabana td.total, .sabana tfoot td { font-weight: 700; }
.sabana td.total { padding: 0 0.75rem; }
.sabana tfoot th, .sabana tfoot td { border-top: 2px solid var(--brand); border-bottom: 0; background: var(--zebra); }
.sabana tfoot td { padding: 0 0.75rem; }
.sabana td.prop { min-width: 12rem; padding: 0 0.75rem; }
.barra-prop { display: block; width: 100%; height: 0.875rem; border-radius: 2px; background: var(--borde); }
.barra-prop rect { stroke: var(--papel); stroke-width: 2px; vector-effect: non-scaling-stroke; }
.b-VAL { background: var(--b-val); fill: var(--b-val); }
.b-ENV { background: var(--b-env); fill: var(--b-env); }
.b-COR { background: var(--b-cor); fill: var(--b-cor); }
.b-OBS { background: var(--b-obs); fill: var(--b-obs); }
.b-DEV { background: var(--b-dev); fill: var(--b-dev); }
.b-BOR { background: var(--b-bor); fill: var(--b-bor); }
.leyenda { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; list-style: none; padding: 0; margin: 1rem 0 3rem; color: var(--suave); font-size: 0.9375rem; }
.leyenda li { display: flex; align-items: center; gap: 0.5rem; }
.leyenda i { width: 0.875rem; height: 0.875rem; border-radius: 2px; display: inline-block; }

/* ---------------------------------------------------------------- Filtros y paginación */
.filtros { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; margin-bottom: 1.25rem; }
.filtros .campo { display: flex; flex-direction: column; gap: 0.25rem; min-width: 12rem; flex: 1 1 12rem; max-width: 22rem; }
.filtros label { font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--suave); }
.paginacion { display: flex; gap: 0.75rem; align-items: center; padding-bottom: 3rem; color: var(--suave); }

/* ---------------------------------------------------------------- Vista del Secretario */
.sec { font-size: 1rem; }
[data-texto="nor"] .sec { font-size: 1.125rem; }

.sec-buscador { padding: 1.5rem 0 1rem; }
.sec-buscador form { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.sec-buscador .campo-grande { flex: 1 1 18rem; position: relative; }
.sec-buscador .campo-grande i { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--suave); font-size: 1.25rem; pointer-events: none; }
.sec-buscador input[type="search"] {
  width: 100%;
  min-height: 3.5rem;
  padding: 0 1rem 0 3rem;
  font-size: 1.25em;
  background: var(--papel);
  color: var(--texto);
  border: 2px solid var(--suave);
  border-radius: 4px;
  font-family: inherit;
}
.sec-buscador input[type="search"]:hover { border-color: var(--titulo); }
.sec-buscador input[type="search"]:focus { border-color: var(--titulo); outline: 3px solid var(--foco); outline-offset: 1px; }
.sec-buscador .btn { min-height: 3.5rem; font-size: 1.0625em; }
.sec-meta { color: var(--suave); margin: 0 0 1rem; }

.sec-lista { display: grid; gap: 1rem; padding-bottom: 3rem; }
.sec-tarjeta { border: 1px solid var(--borde); border-radius: 4px; background: var(--papel); font-size: 1em; overflow: hidden; }
.sec-tarjeta .hd { background: var(--brand); color: var(--on-brand); border-bottom: 3px solid var(--brand-fil); padding: 0.5em 1.25em; display: flex; flex-wrap: wrap; gap: 0.25em 1.5em; align-items: center; }
.sec-tarjeta .cuerpo { padding: 1.25em 1.5em 1.5em; display: grid; gap: 1.25em; }
.sec-tarjeta h2 { font-size: 1.75em; font-weight: 700; color: var(--titulo); line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
.sec-dato { font-size: 1.5em; font-weight: 700; margin: 0; line-height: 1.25; }
.sec-resp { font-size: 1.125em; margin: 0; max-width: 62ch; white-space: pre-line; }
.sec-rotulo { font-size: 0.75em; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--suave); margin: 0 0 0.375em; }
.sec-cifras { display: grid; grid-template-columns: repeat(auto-fit, minmax(13em, 1fr)); gap: 0.75em; list-style: none; padding: 0; margin: 0; }
.sec-cifras li { border: 1px solid var(--borde); border-radius: 4px; padding: 0.625em 0.875em; background: var(--nota-bg); }
.sec-cifras .cifra-valor { display: block; font-size: 1.5em; font-weight: 700; color: var(--titulo); line-height: 1.15; }
.sec-cifras small { color: var(--suave); font-size: 0.8125em; display: block; }
.sec-focos { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5em; }
.sec-focos li { display: flex; gap: 0.75em; align-items: baseline; flex-wrap: wrap; }
.sec-ninguno { padding: 2rem 0; color: var(--suave); }

@media (max-width: 767.98px) {
  html:has(.sec-pagina) { scroll-snap-type: y mandatory; }
  .sec-pagina .sec-buscador, .sec-pagina .sec-tarjeta { scroll-snap-align: start; }
  .sec-pagina .sec-tarjeta { min-height: calc(100dvh - 1rem); }
  .sec-lista { gap: 0.75rem; }
}

/* Presentación: pantalla completa, una ficha por vista, letra muy grande */
html:has(.presentacion) { font-size: 20px; scroll-snap-type: y mandatory; }
.presentacion .sec { font-size: 1rem; }
.presentacion .barra-pres {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1040;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 1rem;
  background: var(--papel);
  border-bottom: 1px solid var(--borde);
}
.presentacion .sec-lista { gap: 0; padding: 0; }
.presentacion .sec-tarjeta {
  min-height: 100dvh;
  border-radius: 0;
  border: 0;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  padding-top: 3.5rem;
}
.presentacion .sec-tarjeta .cuerpo { flex: 1; align-content: center; max-width: 64rem; margin: 0 auto; width: 100%; }
.presentacion .sec-tarjeta h2 { font-size: 2.25em; }

/* ---------------------------------------------------------------- Mi vista */
.mi-vista { display: grid; gap: 2rem; padding-bottom: 3rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 992px) { .mi-vista { grid-template-columns: minmax(0, 28rem) minmax(0, 1fr); align-items: start; } }
.vista-previa-col { position: sticky; top: 1rem; }
.vista-previa {
  border: 1px solid var(--borde);
  border-radius: 4px;
  padding: 1rem;
  background: var(--fondo);
  color: var(--texto);
  font-family: var(--fuente);
  line-height: 1.45;
}
.vista-previa h2 { font-size: 0.8125em; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--suave); margin: 0 0 0.75em; }
.vista-previa a { color: var(--titulo); }
.vista-previa .prev-tabla { display: none; }
.vista-previa[data-lista="tab"] .prev-tarjeta { display: none; }
.vista-previa[data-lista="tab"] .prev-tabla { display: block; }
.vista-previa .tabla-fichas td, .vista-previa .tabla-fichas th { padding-top: var(--celda); padding-bottom: var(--celda); }
.mi-vista fieldset { border: 0; padding: 0; margin: 0 0 1.5rem; }
.mi-vista .opciones-vista { max-width: 30rem; }

/* ---------------------------------------------------------------- Entrar (login) */
.entrar { max-width: 28rem; margin: 0 auto; padding: 4rem 0 3rem; text-align: left; }
.entrar .marca-grande { display: block; font-size: 1.75rem; font-weight: 700; color: var(--titulo); letter-spacing: -0.02em; margin-bottom: 0.5rem; }
.entrar p { color: var(--suave); margin-bottom: 1.5rem; }
.entrar .btn { width: 100%; min-height: 52px; }
.entrar details { margin-top: 2.5rem; font-size: 0.9375rem; color: var(--suave); }
.entrar details summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.entrar .franja { height: 4px; background: var(--brand); margin-bottom: 2rem; }

/* Ayuda */
.ayuda-pasos { max-width: 46rem; padding-bottom: 3rem; }
.ayuda-pasos ol { padding-left: 1.25rem; }
.ayuda-pasos li { margin-bottom: 0.75rem; }
.ayuda-pasos h2 { font-size: 1.25rem; font-weight: 600; color: var(--titulo); margin: 2rem 0 0.75rem; }

/* Bandeja de notificaciones */
.bandeja { list-style: none; padding: 0; margin: 0 0 3rem; max-width: 46rem; }
.bandeja li { padding: 0.875rem 1rem; border: 1px solid var(--borde); border-radius: 4px; background: var(--papel); margin-bottom: 0.5rem; }
.bandeja li.nueva { background: var(--realce); }
.bandeja li b { display: block; }
.bandeja li small { color: var(--suave); }
[data-tema="osc"] .bandeja li small, [data-tema="alc"] .bandeja li small { color: var(--suave); }

.pie-pagina { border-top: 1px solid var(--borde); padding: 1rem 0; color: var(--suave); font-size: 0.875rem; }

@media print {
  .barra, .editor-acciones, .acciones { display: none !important; }
}

.documento p.as, .documento p.ea { white-space: normal; }
.icono-btn .bi-list { font-size: 1.75rem; }
.vista-previa .lista-tarjetas { padding-bottom: 0; }

/* ---------------------------------------------------------------- Simulador */
.st-sim { margin-left: 0; border-color: var(--borde); background: var(--realce); color: var(--texto); }
.sim-lista { list-style: none; padding: 0; margin: 0 0 3rem; max-width: 52rem; display: grid; gap: 0.625rem; }
.sim-item { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; border: 1px solid var(--borde); border-radius: 4px; background: var(--papel); padding: 1rem 1.25rem; }
.sim-item h2 { font-size: 1.25rem; font-weight: 600; margin: 0 0 0.25rem; }
.sim-item p { margin: 0; color: var(--suave); display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

.orden-dia { max-width: 60rem; padding-bottom: 3rem; }
.bloque { margin-bottom: 1.5rem; }
.bloque h2 { font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--suave); margin: 0 0 0.5rem; padding-bottom: 0.375rem; border-bottom: 2px solid var(--brand); }
.turnos { list-style: none; padding: 0; margin: 0; }
.turno { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; padding: 0.75rem 0; border-bottom: 1px solid var(--borde); }
.turno-resumen { display: flex; gap: 0.875rem; flex: 1 1 22rem; }
.turno-n { flex: none; width: 1.75rem; color: var(--suave); font-weight: 700; }
.turno-pregunta { font-weight: 600; margin: 0; }
.turno-meta { margin: 0.125rem 0 0; color: var(--suave); font-size: 0.9375rem; }
.turno .inline-form .cuerpo { position: relative; }
.receso { margin: 1.25rem 0; padding: 0.625rem 1rem; background: var(--amb-bg); color: var(--amb-tx); font-weight: 600; border-radius: 4px; }

.resultados { display: grid; gap: 2rem; padding-bottom: 3rem; max-width: 60rem; }
.resultados h2 { font-size: 1.25rem; font-weight: 600; color: var(--titulo); margin: 0 0 0.75rem; }
.sim-excedidas { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.sim-excedidas li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.5rem 0; border-bottom: 1px solid var(--borde); }
.historial-sim { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.historial-sim li { display: grid; grid-template-columns: minmax(8rem, 14rem) 6rem minmax(6rem, 1fr) 3rem; gap: 0.75rem; align-items: center; }
.historial-sim li[aria-current] .h-nombre { font-weight: 700; color: var(--titulo); }
.historial-sim .h-fecha { color: var(--suave); font-size: 0.9375rem; }
.h-barra { width: 100%; height: 0.875rem; background: var(--borde); border-radius: 2px; }
.h-barra rect { fill: var(--b-val); }
.h-valor { font-weight: 700; text-align: right; }
@media (max-width: 575.98px) { .historial-sim li { grid-template-columns: 1fr 3rem; } .historial-sim .h-fecha, .historial-sim .h-barra { grid-column: 1 / -1; } }

/* Sala de ensayo */
.sala { padding-bottom: 2rem; }
.sala-cab { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 1.25rem 0 1rem; }
.sala-punto { font-size: 1.375rem; font-weight: 700; color: var(--titulo); margin: 0; }
.sala-herramientas { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.sala-cuerpo { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 992px) { .sala-cuerpo { grid-template-columns: minmax(0, 1fr) 22rem; align-items: start; } .sala[data-apoyo="oculto"] .sala-cuerpo { grid-template-columns: minmax(0, 1fr); } }
.sala[data-apoyo="oculto"] .sala-apoyo { display: none; }
.cronometro { text-align: center; padding: 0.5rem 0 0; --c: var(--titulo); }
.cronometro[data-nivel="ambar"] { --c: var(--tono-ambar); }
.cronometro[data-nivel="rojo"] { --c: var(--tono-rojo); }
.crono { display: block; font-size: clamp(5rem, 22vw, 10rem); font-weight: 700; line-height: 1; letter-spacing: -0.03em; color: var(--c); font-variant-numeric: tabular-nums lining-nums; }
.crono-nota { display: block; margin-top: 0.25rem; font-size: 1.125rem; font-weight: 600; color: var(--c); }
.barra-tiempo { height: 0.875rem; background: var(--borde); border-radius: 2px; overflow: hidden; margin: 0.75rem 0 1.5rem; }
.barra-tiempo svg { display: block; width: 100%; height: 100%; }
.barra-tiempo rect { fill: var(--b-val); }
.barra-tiempo[data-nivel="ambar"] rect { fill: var(--b-obs); }
.barra-tiempo[data-nivel="rojo"] rect { fill: var(--b-dev); }
@media (prefers-reduced-motion: no-preference) { .barra-tiempo rect { transition: width 0.2s linear; } }
.sala-pregunta { margin: 0 0 1.5rem; padding: 0; }
.sala-pregunta p { font-size: clamp(1.5rem, 3.2vw, 2.25rem); font-weight: 600; line-height: 1.25; color: var(--texto); margin: 0 0 0.5rem; max-width: 40ch; text-wrap: balance; }
.sala-pregunta footer { color: var(--suave); font-size: 1.125rem; }
.sala-controles { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.btn-sala { min-height: 3.5rem; font-size: 1.125rem; padding-left: 1.5rem; padding-right: 1.5rem; }
.btn-sala:disabled { cursor: not-allowed; }
.sala-atajos { color: var(--suave); font-size: 0.9375rem; margin: 0.75rem 0 0; }
.sala-red { min-height: 1.5rem; color: var(--tono-ambar); font-weight: 600; margin: 0.5rem 0; }
.evaluacion { margin-top: 1rem; padding: 1.25rem; border: 1px solid var(--borde); border-radius: 4px; background: var(--papel); max-width: 40rem; }
.evaluacion[hidden] { display: none; }
.evaluacion h2 { font-size: 1.0625rem; font-weight: 600; color: var(--titulo); margin: 0 0 1rem; }
.escala-grupo { border: 0; padding: 0; margin: 0 0 1rem; }
.escala-grupo legend { font-size: 0.9375rem; font-weight: 600; margin-bottom: 0.375rem; float: none; width: auto; }
.escala { display: flex; gap: 0.5rem; }
.escala input { position: absolute; opacity: 0; pointer-events: none; }
.escala label { flex: 1 1 0; min-width: 3.5rem; min-height: 3.5rem; display: grid; place-items: center; border: 1px solid var(--suave); border-radius: 4px; font-size: 1.25rem; font-weight: 700; cursor: pointer; background: var(--papel); color: var(--texto); }
.escala label:hover { border-color: var(--titulo); background: var(--realce); }
.escala input:checked + label { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.escala input:focus-visible + label { outline: 3px solid var(--foco); outline-offset: 2px; }
.sala-apoyo .tarjeta { border: 1px solid var(--borde); }
.apoyo-cuerpo { padding: 0.75rem 1rem 1rem; display: grid; gap: 0.25rem; }
.apoyo-cuerpo .lb { margin: 0.5rem 0 0; }
.apoyo-cuerpo p { margin: 0; }
.apoyo-dato { font-size: 1.25rem; font-weight: 600; }
.apoyo-texto { font-size: 1.0625rem; white-space: pre-line; }
.en-sala .sala-apoyo .cifras-lista li { background: var(--nota-bg); }
