/* OnFarmaNet · FarmaGuard — Design System: COMPONENTS ("Clinical Precision").
 * Depende de tokens.css + base.css. Cargar al final. CSP-safe (sin estilos inline en templates). */

/* ── Botones ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  font-size: var(--fs-sm); font-weight: 600; line-height: 1; white-space: nowrap;
  padding: 9px var(--s-4); border-radius: var(--r-sm); border: 1px solid transparent;
  cursor: pointer; text-decoration: none;
  transition: background var(--ease), border-color var(--ease), color var(--ease), box-shadow var(--ease), transform var(--ease);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(0.5px); }
.btn .icon { width: 16px; height: 16px; }
/* Estados COMPLETOS default→hover→active (escalera de superficie; auditoría DS 2026-07-30):
   el primario gana 1px de lift en hover y regresa a plano en active (feedback táctil sobrio). */
.btn--primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-xs); }
.btn--primary:hover { background: var(--brand-strong); color: #fff; box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.btn--primary:active { background: var(--brand-deep); box-shadow: var(--shadow-xs); transform: translateY(0); }
.btn--secondary { background: var(--surface-raised); color: var(--ink); border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.btn--secondary:hover { border-color: var(--brand); color: var(--brand-strong); background: var(--brand-tint); }
.btn--secondary:active { background: var(--brand-soft); }
.btn--ghost { background: transparent; color: var(--ink-muted); }
.btn--ghost:hover { background: var(--surface-sunken); color: var(--ink); }
.btn--ghost:active { background: var(--border); }
.btn--danger { background: var(--danger); color: #fff; box-shadow: var(--shadow-xs); }
/* Variante contenida para el disparador de la ficha: el rojo sólido queda reservado para el botón
   de confirmación del interstitial (donde la decisión realmente se toma). */
.btn--outline-danger { background: transparent; color: var(--danger); border: 1px solid currentColor; }
.btn--outline-danger:hover { background: var(--danger-soft); }
.btn--danger:hover { background: var(--danger-text); color: #fff; }
.btn--danger:active { background: var(--danger-deep); }
.btn--block { display: flex; width: 100%; }
.btn--sm { font-size: var(--fs-xs); padding: 6px var(--s-3); }
.btn--lg { font-size: var(--fs-base); padding: 12px var(--s-5); }
.btn:disabled, .btn[aria-disabled="true"] { background: var(--surface-sunken); color: var(--ink-subtle); border-color: var(--border); cursor: not-allowed; box-shadow: none; }

/* ── Tarjetas ── */
.card {
  background: var(--surface-raised); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: var(--s-5); box-shadow: var(--shadow-sm);
}
.card--pad-lg { padding: var(--s-6); }
.card__title { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-md); font-weight: 600; letter-spacing: -0.01em; margin-bottom: var(--s-2); }
.card__title .icon { color: var(--brand); }
.card + .card { margin-top: var(--s-4); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(264px, 1fr)); gap: var(--s-4); }

/* ── Encabezado de sección + KPI (snapshot de actividad) ── */
.section-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); margin: var(--s-8) 0 var(--s-4); }
.section-head h2 { font-size: var(--fs-xl); letter-spacing: -0.015em; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--s-4); }
.kpi { display: flex; align-items: flex-start; gap: var(--s-4); background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s-5); box-shadow: var(--shadow-sm); }
.kpi__icon { width: 38px; height: 38px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--brand-tint); color: var(--brand); flex: none; margin-top: 2px; }
.kpi--danger .kpi__icon { background: var(--danger-soft); color: var(--danger); }
.kpi__text { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
/* Peso 650 (no bold 700) + tracking apretado: las cifras grandes en bold gritan y pierden
   refinamiento — el énfasis lo da el tamaño, no el peso (craft premium, DS 2026-07-30). */
.kpi__value { font-size: var(--fs-2xl); font-weight: 650; letter-spacing: -0.025em; line-height: 1.05; color: var(--ink); font-variant-numeric: tabular-nums; }
.kpi__label { font-size: var(--fs-sm); font-weight: 550; color: var(--ink-muted); line-height: 1.35; }
.kpi__label a { color: inherit; }
.kpi__label a:hover { color: var(--brand-strong); }
/* Hint de letra pequeña BAJO el label (auditoría visual 2026-07-30): las aclaraciones de
   honestidad convertían el label en un párrafo dentro de la tarjeta — muro de texto. */
.kpi__hint { font-size: var(--fs-2xs); color: var(--ink-muted); line-height: 1.4; } /* AA 4.5:1 (c3) */
/* Valor vacío («—»): discreto, no un guion gigante a tamaño de titular. */
.kpi--vacio .kpi__value { font-size: var(--fs-lg); color: var(--ink-subtle); font-weight: 600; }
/* Tarjeta KPI navegable (§6b.5): el enlace es la TARJETA ENTERA con chevron — jamás una flecha
   «→» de texto muted como único indicio (blanco de toque ≥44px, affordance real). */
.kpi--link { text-decoration: none; color: inherit; transition: border-color var(--ease), box-shadow var(--ease); }
.kpi--link:hover { border-color: var(--brand); box-shadow: var(--shadow-md); }
.kpi--link:active { box-shadow: var(--shadow-xs); }
.kpi__chev { margin-left: auto; align-self: center; color: var(--ink-subtle); flex: none; transition: color var(--ease), transform var(--ease); }
.kpi--link:hover .kpi__chev { color: var(--brand-strong); transform: translateX(2px); }
/* Densidad móvil propia (§6b.8): 2 columnas compactas — no la tarjeta de desktop estirada.
   hint y chevron SIGUEN VISIBLES (crítica 2026-07-30: ocultarlos borraba el periodo de cada
   cifra y TODA la affordance táctil del enlace — hay espacio de sobra en la tarjeta). */
@media (max-width: 680px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: var(--s-3); }
  .kpi { padding: var(--s-4); gap: var(--s-3); }
  .kpi__icon { width: 30px; height: 30px; }
  .kpi__value { font-size: var(--fs-xl); }
  /* El impar final ocupa las 2 columnas: sin tarjeta huérfana con aire muerto (§6b c2). */
  .kpi-grid > .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
/* Filtros en pantallas angostas: cada par label+campo a su fila (el inline no cabe). */
@media (max-width: 640px) {
  .form-inline .form-inline__par { width: 100%; }
  .form-inline .form-inline__par input, .form-inline .form-inline__par .select { flex: 1; }
}
.kpi--link:active { background: var(--brand-tint); }

/* ── Auth (login/2FA): tarjeta con acento de marca y fondo con presencia ── */
.card--auth { position: relative; overflow: hidden; }
.card--auth::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand-strong) 55%, var(--brand-deep) 100%);
}
.pagina-auth .main {
  background:
    radial-gradient(1100px 480px at 50% -12%, var(--brand-soft) 0%, rgba(227, 241, 238, 0) 62%),
    var(--surface);
}

/* ── Formularios ── */
.field { display: block; }
.field + .field { margin-top: var(--s-4); }
.label { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.input, .select, .textarea {
  width: 100%; background: var(--surface-raised); color: var(--ink);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  padding: 9px var(--s-3); font-size: var(--fs-base);
  transition: border-color var(--ease), box-shadow var(--ease);
}
.input::placeholder { color: var(--ink-subtle); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-subtle); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring-glow); }
.input--code { font-family: var(--font-mono); font-size: var(--fs-xl); letter-spacing: 0.4em; text-align: center; padding-left: 0.4em; }
.field__hint { font-size: var(--fs-xs); color: var(--ink-muted); margin-top: 6px; }
.field__hint--error { color: var(--danger-text); font-weight: 500; }
.checkline { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-sm); color: var(--ink); cursor: pointer; }
.checkline input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--brand); flex: none; }
/* Objetivo táctil ≥44px en punteros gruesos (dedo); el checkbox visual sigue en 16px. */
@media (pointer: coarse) {
  .checkline { min-height: 44px; padding: var(--s-2) 0; }
}
.form-actions { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; margin-top: var(--s-5); }
.input-group { display: flex; gap: var(--s-2); align-items: stretch; }
.input-group .input { flex: 1; }
/* Defensa para markup de allauth/Django sin clase */
input[type="text"]:not(.input), input[type="email"]:not(.input),
input[type="password"]:not(.input), input[type="search"]:not(.input) {
  width: 100%; background: var(--surface-raised); color: var(--ink);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  padding: 9px var(--s-3); font-size: var(--fs-base);
}
input[type="text"]:not(.input):focus, input[type="email"]:not(.input):focus,
input[type="password"]:not(.input):focus, input[type="search"]:not(.input):focus {
  outline: none; border-color: var(--brand); box-shadow: var(--ring-glow);
}
/* Defensa para <button>/submit sin clase (markup de gestión de allauth no overrideado) → look secundario.
   No afecta a .btn (más específica). Da consistencia a email/password_change/reauthenticate/etc. */
button:not(.btn), input[type="submit"]:not(.btn), input[type="reset"]:not(.btn) {
  display: inline-flex; align-items: center; gap: var(--s-2); font-size: var(--fs-sm); font-weight: 600;
  line-height: 1; padding: 8px var(--s-4); border-radius: var(--r-sm); cursor: pointer;
  background: var(--surface-raised); color: var(--ink); border: 1px solid var(--border-strong);
  transition: border-color var(--ease), color var(--ease), background var(--ease);
}
button:not(.btn):hover, input[type="submit"]:not(.btn):hover, input[type="reset"]:not(.btn):hover {
  border-color: var(--brand); color: var(--brand-strong); background: var(--brand-tint);
}

/* ── Tablas ── */
/* Sombras de scroll (§6b crítica 2026-07-30): en móvil las columnas cortadas eran INVISIBLES
   (scrollbar fina transparente, borde limpio) y el usuario perdía justo la columna clínica.
   Truco background-attachment:local — la sombra del borde aparece SOLO cuando hay contenido
   oculto en esa dirección; las filas del tbody son transparentes y la dejan ver. */
.table-wrap {
  overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-lg);
  background:
    linear-gradient(90deg, var(--surface-raised) 40%, rgba(255, 255, 255, 0)) left / 36px 100%,
    linear-gradient(270deg, var(--surface-raised) 40%, rgba(255, 255, 255, 0)) right / 36px 100%,
    radial-gradient(farthest-side at 0 50%, rgba(16, 26, 34, 0.16), transparent) left / 12px 100%,
    radial-gradient(farthest-side at 100% 50%, rgba(16, 26, 34, 0.16), transparent) right / 12px 100%,
    var(--surface-raised);
  background-repeat: no-repeat;
  background-attachment: local, local, scroll, scroll;
  box-shadow: var(--shadow-sm);
}
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.table th, .table td { padding: 11px var(--s-4); text-align: left; vertical-align: top; }
.table td.fecha { white-space: nowrap; }
/* Header a 12px (piso de legibilidad en contextos de datos; 11px quedaba corto — DS 2026-07-30). */
.table thead th {
  font-size: var(--fs-xs); font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-muted); background: var(--surface-sunken); border-bottom: 1px solid var(--border);
}
.table tbody tr + tr td { border-top: 1px solid var(--border); }
.table tbody tr { transition: background var(--ease); }
/* Hover NEUTRO: el tinte de marca queda reservado para selección/total (antes hover y fila de
   totales compartían --brand-tint y el hover parecía selección — DS 2026-07-30). */
.table tbody tr:hover td { background: var(--surface); }
.table td.num, .table th.num { text-align: right; }
.table td { color: var(--ink); }
/* Densidad conmutable para listados largos (cola de firma, KB). */
.table--compact th, .table--compact td { padding: 7px var(--s-3); }
/* Tabla de definiciones (glosario): en móvil se APILA término-sobre-definición — la tabla de
   escritorio comprimida a 375px era ilegible (§6b crítica 2026-07-30). */
.table--defs th, .table--defs td { vertical-align: top; }
@media (max-width: 680px) {
  .table--defs thead { display: none; }
  .table--defs, .table--defs tbody, .table--defs tr, .table--defs td { display: block; width: 100%; }
  .table--defs tr { border-top: 1px solid var(--border); padding: var(--s-3) 0; }
  .table--defs td { padding: 2px var(--s-4); border: none; }
  .table--defs td:first-child { font-weight: 650; }
}
/* Ceros con barra en celdas numéricas (0 vs O en códigos clínicos). */
.table td.num, .codes > li { font-feature-settings: "zero" 1; }
@media (min-resolution: 2dppx) {
  .table tbody tr + tr td { border-top-width: 0.5px; }
}
.table .row--total td { font-weight: 700; border-top: 2px solid var(--border); background: var(--brand-tint); }
/* Celda de cobertura marcada como alerta (incompletitud) — trío danger, nunca verde. */
.table td.cell--alerta { color: var(--danger-text); font-weight: 600; background: var(--danger-soft); }

/* ── Badges de severidad (siempre etiqueta + color, nunca color solo) ── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--fs-2xs); font-weight: 650; line-height: 1;
  padding: 4px 9px; border-radius: var(--r-pill);
  border: 1px solid transparent; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap;
}
.badge .icon { width: 12px; height: 12px; stroke-width: 2; }
.badge--critical { background: var(--danger); color: #fff; }
.badge--high { background: var(--danger-soft); color: var(--danger-text); border-color: var(--danger-line); }
.badge--moderate { background: var(--warning-soft); color: var(--warning-text); border-color: var(--warning-line); }
.badge--low { background: var(--caution-soft); color: var(--caution-text); border-color: var(--caution-line); }
.badge--none { background: var(--success-soft); color: var(--success-text); border-color: var(--success-line); }
.badge--neutral { background: var(--surface-sunken); color: var(--ink-muted); border-color: var(--border-strong); }
/* Estado administrativo BORRADOR: borde discontinuo (metáfora de boceto) — distinto de neutral
   sin robarle color a la severidad (§6b crítica 2026-07-30: borrador y publicada eran idénticos). */
.badge--borrador { background: transparent; color: var(--ink-muted); border: 1px dashed var(--border-strong); }

/* ── Callouts ── */
.callout {
  display: flex; gap: var(--s-3); align-items: flex-start;
  border: 1px solid var(--border); border-left-width: 3px;
  border-radius: var(--r-md); padding: var(--s-4); font-size: var(--fs-sm); color: var(--ink-muted);
}
.callout > .icon { flex: none; margin-top: 1px; }
.callout strong, .callout b { color: var(--ink); }
.callout--info { border-color: var(--info-line); border-left-color: var(--info); background: var(--info-soft); }
.callout--info > .icon { color: var(--info); }
.callout--success { border-color: var(--success-line); border-left-color: var(--success); background: var(--success-soft); color: var(--success-text); }
.callout--success > .icon { color: var(--success); }
.callout--warning { border-color: var(--warning-line); border-left-color: var(--warning); background: var(--warning-soft); color: var(--warning-text); }
.callout--warning > .icon { color: var(--warning); }
.callout--danger, .callout--error { border-color: var(--danger-line); border-left-color: var(--danger); background: var(--danger-soft); color: var(--danger-text); }
.callout--danger > .icon, .callout--error > .icon { color: var(--danger); }
.callout--debug { border-left-color: var(--border-strong); background: var(--surface-sunken); }
.callout__title { display: block; font-weight: 650; margin-bottom: 2px; font-size: var(--fs-sm); color: inherit; }
.callout__body { min-width: 0; }
/* Callout ACCIONABLE (§6b.1: la tarea arriba del fold, como enlace completo con chevron). */
.callout--accion { text-decoration: none; align-items: center; margin-bottom: var(--s-5); transition: border-color var(--ease), box-shadow var(--ease); }
.callout--accion:hover { border-left-color: var(--warning-text); box-shadow: var(--shadow-sm); color: var(--warning-text); }
.callout--accion > .icon:last-child { margin-left: auto; }

/* ── Danger zone (confirmar exclusión de alerta clínica) ── */
.danger-zone {
  border: 1px solid var(--danger-line); border-left: 3px solid var(--danger);
  border-radius: var(--r-lg); background: var(--danger-soft); padding: var(--s-6); box-shadow: var(--shadow-sm);
}
.danger-zone h1, .danger-zone h2 { color: var(--danger-text); }
.danger-zone p { color: var(--ink); }

/* ── Listas de contenido ── */
.list { list-style: none; padding: 0; }
.list > li { border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: none; }
.list-link { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); padding: 11px var(--s-3); border-radius: var(--r-sm); transition: background var(--ease); }
.list-link:hover { background: var(--surface-sunken); }
/* Nombre a 2 líneas máximo (combos con composición kilométrica hacían muros de ~30 líneas que
   destruían la escaneabilidad de la lista — §6b crítica 2026-07-30; el detalle completo vive
   en la vista de detalle). */
.list-link .name { display: inline-flex; align-items: center; gap: var(--s-3); font-weight: 550; color: var(--ink); min-width: 0; }
.list-link .name > span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.list-link .name .icon { color: var(--brand); }
.list-link:hover .name { color: var(--brand-strong); }
.list-link .meta { color: var(--ink-muted); font-size: var(--fs-sm); white-space: nowrap; font-variant-numeric: tabular-nums; }
.taglist { display: flex; flex-wrap: wrap; gap: var(--s-2); list-style: none; padding: 0; }
.taglist > li { font-size: var(--fs-sm); background: var(--surface-sunken); border: 1px solid var(--border); padding: 4px var(--s-3); border-radius: var(--r-pill); color: var(--ink-muted); font-weight: 500; }
.codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s-2); list-style: none; padding: 0; }
.codes > li { font-family: var(--font-mono); font-size: var(--fs-md); text-align: center; background: var(--surface-sunken); border: 1px dashed var(--border-strong); border-radius: var(--r-sm); padding: var(--s-3); letter-spacing: 0.1em; color: var(--ink); }

/* ── Estado vacío (anatomía de 3 piezas: ícono en chip + título + siguiente paso) ── */
.empty { display: flex; flex-direction: column; align-items: center; gap: var(--s-2); text-align: center; color: var(--ink-muted); font-size: var(--fs-sm); padding: var(--s-7) var(--s-5); border: 1px dashed var(--border-strong); border-radius: var(--r-lg); background: var(--surface-raised); }
.empty .icon { color: var(--ink-subtle); }
.empty__icon { width: 40px; height: 40px; border-radius: var(--r-pill); display: grid; place-items: center; background: var(--surface-sunken); margin-bottom: var(--s-1); }
.empty__title { font-weight: 600; color: var(--ink); font-size: var(--fs-base); }
.empty--inline { padding: var(--s-4); border: none; background: none; }

/* ── Resumen de severidad (cabecera de interacciones) ── */
.sev-summary { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); align-items: center; margin-bottom: var(--s-5); padding: var(--s-3) var(--s-5); background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-sm); }
.sev-summary__item { display: inline-flex; align-items: center; gap: var(--s-2); }
.sev-summary__n { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); font-size: var(--fs-sm); }

/* ── Interacción (kb_detalle) ── */
.itx { border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s-5); background: var(--surface-raised); box-shadow: var(--shadow-sm); transition: box-shadow var(--ease); }
.itx:hover { box-shadow: var(--shadow-md); }
.itx + .itx { margin-top: var(--s-3); }
.itx__head { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-2); }
.itx__title { display: inline-flex; align-items: center; gap: var(--s-2); font-size: var(--fs-md); font-weight: 600; }
.itx__title .icon { color: var(--ink-subtle); }
.itx__via-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-4); padding-top: var(--s-3); border-top: 1px solid var(--border); }

/* ── Paginación ── */
.pagination { display: flex; justify-content: space-between; gap: var(--s-3); margin-top: var(--s-5); }
.pagination .btn { font-weight: 600; }
.pagination .spacer { flex: 1; }

/* ── QR (setup 2FA) ── */
.qr { background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s-4); width: max-content; box-shadow: var(--shadow-sm); }

/* ── Mensajes de Django ── */
.messages { list-style: none; padding: 0; margin-bottom: var(--s-5); display: grid; gap: var(--s-3); }

/* ── Visualización de datos (SVG server-rendered, CSP-safe) ── */
.viz { background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s-5) var(--s-6); box-shadow: var(--shadow-sm); }
.viz__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3); margin-bottom: var(--s-5); flex-wrap: wrap; }
.viz__title { font-size: var(--fs-2xs); font-weight: 650; color: var(--ink-muted); text-transform: uppercase; letter-spacing: var(--tracking-wide); }
.viz__total { font-size: var(--fs-sm); color: var(--ink-muted); font-variant-numeric: tabular-nums; }
/* Nota metodológica/leyenda del viz (NO cifras): mismo slot visual que viz__total pero semántica
   de texto — viz__total queda reservado para números (auditoría de producto 2026-07-14). */
.viz__note { font-size: var(--fs-xs); color: var(--ink-muted); }
.barrow { display: grid; grid-template-columns: minmax(6rem, max-content) 1fr minmax(2.75rem, max-content); align-items: center; gap: var(--s-3); }
.barrow + .barrow { margin-top: var(--s-3); }
.barrow__track { width: 100%; height: 10px; display: block; }
.barrow__n { text-align: right; font-size: var(--fs-sm); font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
/* Fila de embudo (decisiones.html): etiquetas largas + delta del paso previo. No usa .barrow
   (96px, compartida con analisis.html): la etiqueta necesita más ancho y el delta va bajo el número. */
.funnelrow { display: grid; grid-template-columns: minmax(150px, 220px) 1fr auto; align-items: center; gap: var(--s-3); }
.funnelrow + .funnelrow { margin-top: var(--s-3); }
/* Móvil: etiqueta ARRIBA y barra a todo el ancho — con 3 columnas en 375px la barra colapsaba
   a ~10px y el embudo era ilegible (§6b crítica 2026-07-30). */
@media (max-width: 680px) {
  .funnelrow { grid-template-columns: 1fr auto; }
  .funnelrow__label { grid-column: 1 / -1; }
}
.funnelrow__label { font-size: var(--fs-sm); color: var(--ink); overflow-wrap: break-word; line-height: 1.35; }
.funnelrow__stat { text-align: right; }
.funnelrow__delta { display: block; font-size: var(--fs-xs); color: var(--ink-muted); font-variant-numeric: tabular-nums; }
/* .spark (sparkline pelado) MURIÓ 2026-07-30: todo chart usa la anatomía de viz_area.html;
   .spark__dot sobrevive como el punto final enfatizado de esa anatomía. */
.spark__dot { fill: var(--brand); stroke: var(--surface-raised); stroke-width: 2.5; }
/* Rellenos / trazos SVG (clase, no style= → CSP-safe).
   CRITICAL ≠ HIGH: antes ambos usaban --danger y eran indistinguibles en barras (DS 2026-07-30);
   severidad = dato ORDINAL → rampa de profundidad dentro del rojo. Los rellenos claros llevan
   trazo del tono -text (WCAG 1.4.11: warning/caution/success no llegan a 3:1 contra blanco solos;
   la insignia con texto al lado sigue siendo la codificación primaria). */
.fill-track { fill: var(--surface-sunken); }
.fill-critical { fill: var(--danger-deep); }
.fill-high { fill: var(--danger); }
.fill-moderate { fill: var(--warning); stroke: var(--warning-text); stroke-width: 0.75; }
.fill-low { fill: var(--caution); stroke: var(--caution-text); stroke-width: 0.75; }
.fill-none { fill: var(--success); stroke: var(--success-text); stroke-width: 0.75; }
.fill-neutral { fill: var(--ink-subtle); stroke: var(--ink-muted); stroke-width: 0.75; }
/* Auditoría visual 2026-07-30: esta clase NO existía — los rects del embudo caían al fill SVG
   por defecto (negro). El embudo entero se pintaba fuera del sistema. */
.fill-brand { fill: var(--brand); }
.fill-area { fill: var(--brand-soft); }

/* ── Anatomía de lectura del chart (viz_area.html) — grid recesivo, ejes legibles ── */
/* Scroll propio en pantallas angostas: el viewBox (732u) escala el texto de ejes a ~5px
   ilegibles en 360px de ancho; con min-width el chart conserva legibilidad y la página no
   desborda (el scroll vive en el contenedor, no en el body). */
.chart-scroll {
  overflow-x: auto;
  /* Misma señal de contenido oculto que .table-wrap (el SVG es transparente y la deja ver). */
  background:
    linear-gradient(90deg, var(--surface-raised) 40%, rgba(255, 255, 255, 0)) left / 28px 100%,
    linear-gradient(270deg, var(--surface-raised) 40%, rgba(255, 255, 255, 0)) right / 28px 100%,
    radial-gradient(farthest-side at 0 50%, rgba(16, 26, 34, 0.14), transparent) left / 10px 100%,
    radial-gradient(farthest-side at 100% 50%, rgba(16, 26, 34, 0.14), transparent) right / 10px 100%;
  background-repeat: no-repeat;
  background-attachment: local, local, scroll, scroll;
}
.chart { width: 100%; height: auto; display: block; min-width: 560px; }
/* Blanco de hover ≥18px por marcador (el punto visible de r=2.6 era un blanco de ~5px);
   fill transparent (no `none`): debe seguir siendo hit-testeable para el <title>. */
.chart__target { fill: transparent; }
.chart__grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 4; }
.chart__yval, .chart__tick {
  /* 11px + ink-muted: 10.5px con ink-subtle daba 3.1:1 — bajo el AA de 4.5:1 (DS 2026-07-30). */
  font-family: var(--font-sans); font-size: 11px; font-variant-numeric: tabular-nums;
  fill: var(--ink-muted);
  /* Halo de superficie: el label queda legible aunque la línea/área pase por debajo. */
  paint-order: stroke; stroke: var(--surface-raised); stroke-width: 3px; stroke-linejoin: round;
}
.chart__pt { fill: var(--brand); stroke: var(--surface-raised); stroke-width: 1.5; }
.chart__pt--danger { fill: var(--danger); }
.spark__dot--danger { fill: var(--danger); }
.stroke-brand { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
/* P4 (analítica): serie de alertas graves — misma geometría spark, semántica danger. */
.fill-area--danger { fill: var(--danger); opacity: 0.12; }
.stroke-danger { fill: none; stroke: var(--danger); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }

/* ── Disclosure (detalle progresivo) ── */
.disclosure { margin-top: var(--s-4); }
.disclosure > summary { cursor: pointer; font-size: var(--fs-sm); font-weight: 600; color: var(--brand-strong); padding: var(--s-2) 0; list-style: none; display: inline-flex; align-items: center; gap: var(--s-1); }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary .icon { transition: transform var(--ease); }
.disclosure[open] > summary .icon { transform: rotate(90deg); }

/* ── Utilidades (CSP-safe: el proyecto prohíbe estilos inline) ── */
.text-muted { color: var(--ink-muted); }
.text-center { text-align: center; }
.text-sm { font-size: var(--fs-sm); }
.m-0 { margin: 0; }
.mt-0 { margin-top: 0; }
.mt-3 { margin-top: var(--s-3); }
.mt-4 { margin-top: var(--s-4); }
.mt-5 { margin-top: var(--s-5); }
.mt-6 { margin-top: var(--s-6); }
.mb-4 { margin-bottom: var(--s-4); }
.section-title { font-size: var(--fs-lg); margin-bottom: var(--s-4); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ── Prosa larga (páginas legales): ritmo vertical que el reset * {margin:0} le quita ── */
.container--prose { max-width: var(--container-prose); }
.prose h1 { margin-bottom: var(--s-4); }
.prose h2 { margin: var(--s-6) 0 var(--s-3); }
.prose p, .prose ul, .prose ol { margin-bottom: var(--s-4); color: var(--ink); }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: var(--s-2); }
.prose a { text-decoration: underline; }

/* ── Logo del documento imprimible (tercera instancia del bug clase-sin-definir — 2026-07-30) ── */
.doc-head__logo { border-radius: var(--r-sm); }

/* Scrollbars finos y del sistema en contenedores con overflow propio. */
.table-wrap, .chart-scroll { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

/* Filtro inline de fechas (GET): fila compacta de labels+inputs+acciones.
   Los controles DENTRO de la fila no se estiran (un .input/.select con width:100% rompía la
   fila compacta en Cobertura y Reporte EPS — DS 2026-07-30). */
.form-inline { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); }
.form-inline .field__label { margin: 0; }
.form-inline .input, .form-inline .select, .form-inline select { width: auto; max-width: 100%; }
/* Misma altura que los date inputs de la fila (los selects quedaban ~6px más altos — c3). */
.form-inline .select, .form-inline select { padding-top: 7px; padding-bottom: 7px; font-size: var(--fs-sm); }
/* Par label+control indivisible: al envolver, «HASTA» quedaba huérfano en una línea y su campo
   en la siguiente (§6b crítica 2026-07-30). */
.form-inline__par { display: inline-flex; align-items: center; gap: var(--s-2); white-space: nowrap; }
.form-inline input[type="date"] {
  padding: 7px var(--s-3); border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  font: inherit; font-size: var(--fs-sm); color: var(--ink); background: var(--surface-raised);
  font-variant-numeric: tabular-nums;
}
.form-inline input[type="date"]:focus { outline: none; border-color: var(--ring); box-shadow: var(--ring-glow); }
.form-inline .field__label { color: var(--ink-subtle); font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
