/* SigmaPro — identidad y componentes propios.
   Copyright (C) 2026  Luis Ángel Barrera-Guzmán · GPL-3.0-or-later (ver LICENSE).

   Va después de labg-base.css. Identidad decidida por el autor (30 sep 2026): solo
   el oro y el negro de la marca LABG, con las letras del sistema. */

/* ================= identidad ================= */
:root {
  --primary-rgb: 125, 91, 20; --primary: #7D5B14; --primary-dark: #5E4410;   /* oro oscuro: 6:1 sobre blanco */
  --accent-rgb: 156, 113, 40; --accent: #9C7128;                               /* bronce */
  --bg: #F7F6F3; --bg-soft: #EEEBE4; --border: #E2DDD2; --border-strong: #C3BBAA;
  --text: #17150F; --text-muted: #5B5750;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C0C0D; --bg-soft: #161514; --card-bg: #1A1917; --text: #EEE9DF; --text-muted: #A8A196;
    --border: #2B2925; --border-strong: #423E37; --field-border: #77705F;
    --primary-rgb: 212, 168, 72; --primary: #D4A848; --primary-dark: #E6C470; --on-primary: #111111;
    --accent-rgb: 241, 221, 168; --accent: #F1DDA8;
  }
}
:root[data-theme="dark"] {
  --bg: #0C0C0D; --bg-soft: #161514; --card-bg: #1A1917; --text: #EEE9DF; --text-muted: #A8A196;
  --border: #2B2925; --border-strong: #423E37; --field-border: #77705F;
  --primary-rgb: 212, 168, 72; --primary: #D4A848; --primary-dark: #E6C470; --on-primary: #111111;
  --accent-rgb: 241, 221, 168; --accent: #F1DDA8;
}

body { font-feature-settings: "tnum" 1, "lnum" 1; }
main { max-width: var(--content-max); margin: 0 auto; padding: var(--sp-5) var(--sp-5) var(--sp-12); }
@media (max-width: 700px) { main { padding-inline: var(--sp-4); } }
h1, h2, h3 { letter-spacing: -0.015em; }

/* marca: σ dorada con serifas sobre negro (el mismo dibujo que iconos/sigmapro.svg y la intro) */
.brand-mark {
  width: 28px; height: 28px; display: inline-grid; place-items: center; flex: none; overflow: hidden;
  border-radius: 8px; background: #111; color: #D4A848; border: 1px solid rgba(212, 168, 72, .55);
  line-height: 1; margin-right: 8px;
}
.brand-mark svg { width: 100%; height: 100%; display: block; }
.brand { font-weight: 800; }

/* ================= estructura de cada bloque ================= */
.step-panel { display: none; }
.step-panel.active { display: block; }
.panel-title { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; margin: var(--sp-2) 0 var(--sp-5); }
.panel-title h2 { margin: 0; font-size: var(--fs-2xl); }
.panel-title p { margin: 4px 0 0; color: var(--text-muted); max-width: 72ch; }
.card + .card { margin-top: var(--sp-4); }
.card h3 { margin: 0 0 var(--sp-3); font-size: var(--fs-lg); }
.muted { color: var(--text-muted); }
.small { font-size: var(--fs-sm); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 700;
  padding: 3px 10px; border-radius: var(--r-pill);
  background: var(--btn-oro-suave); color: var(--btn-oro-texto); border: 1px solid rgba(212, 168, 72, .4);
}
.pill.gris { background: var(--bg-soft); color: var(--text-muted); border-color: var(--border); }

/* aviso de bloque aún no construido (el Navegador LABG lo lee como «pendiente») */
.soon-box { border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg); padding: var(--sp-6); background: var(--card-bg); }
.soon-box h3 { margin: 0 0 var(--sp-2); font-size: var(--fs-lg); }
.soon-box p { margin: 0 0 var(--sp-2); color: var(--text-muted); max-width: 72ch; }
.soon-box ul { margin: var(--sp-2) 0 0; padding-left: 1.2em; color: var(--text-muted); }
.soon-box li { margin: 3px 0; }

/* ================= portada ================= */
.hero { padding: var(--sp-8) 0 var(--sp-6); display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: var(--sp-8); align-items: center; }
@media (max-width: 960px) { .hero { grid-template-columns: minmax(0, 1fr); padding-top: var(--sp-4); } }
.hero h1 { font-size: var(--fs-3xl); line-height: 1.08; margin: var(--sp-2) 0 var(--sp-4); font-weight: 800; }
.hero h1 em { color: var(--primary-text); font-style: italic; }
.hero .lead { font-size: var(--fs-lg); color: var(--text-muted); max-width: 54ch; margin: 0 0 var(--sp-5); }
.hero-art { aspect-ratio: 4 / 3; border-radius: var(--r-lg); background: #0E0D0B; overflow: hidden; border: 1px solid rgba(212, 168, 72, .45); }
.hero-art svg { width: 100%; height: 100%; display: block; }
.privacidad { display: inline-flex; gap: 6px; align-items: center; font-size: var(--fs-sm); color: var(--text-muted); margin-top: var(--sp-4); }
.privacidad svg { width: 14px; height: 14px; flex: none; }

.valores { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4); }
@media (max-width: 760px) { .valores { grid-template-columns: minmax(0, 1fr); } }
.valores .card { margin: 0; }
.valores .num { font-size: var(--fs-2xl); font-weight: 800; color: var(--primary-text); }
.valores h3 { font-size: var(--fs-md); margin: 2px 0 6px; }
.valores p { margin: 0; font-size: var(--fs-sm); color: var(--text-muted); }

.hitos { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.hitos li { display: grid; grid-template-columns: 26px 64px minmax(0, 1fr); gap: 8px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
.hitos li:last-child { border-bottom: 0; }
.hitos .marca { font-weight: 800; color: var(--text-muted); text-align: center; }
.hitos .hecho .marca { color: var(--success-text); }
.hitos .actual .marca { color: var(--btn-oro-texto); }
.hitos .id { font-weight: 800; font-variant-numeric: tabular-nums; }

/* ================= tejas de resumen ================= */
.tejas { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-3); }
@media (max-width: 860px) { .tejas { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.teja { border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 14px; background: var(--card-bg); min-width: 0; }
.teja .k { font-size: var(--fs-xs); color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.teja .v { font-size: var(--fs-2xl); font-weight: 800; overflow-wrap: anywhere; }
.teja .v small { font-size: var(--fs-sm); color: var(--text-muted); font-weight: 600; }
.teja .nota { font-size: var(--fs-xs); color: var(--text-muted); }
/* Validación mientras llega su reporte (hito 5.9): el lugar de la tabla, para que lo que va debajo no se mueva a la vista */
#valContenido.val-cargando .tabla-wrap { min-height: 85vh; }
/* la fecha del reporte ocupa su lugar desde el principio (alto de un renglón y el ancho de «Generado el …») */
#valFecha { min-width: 15.5em; text-align: center; }
/* las tejas del resumen, con lugar para una nota de hasta tres renglones (el texto real llega después) */
#valTejas .teja { min-height: 9em; }
#valFecha:empty::before { content: '\00a0'; }

/* ================= cuadros estilo revista (tres líneas) ================= */
/* relative: el texto oculto para lectores de pantalla (posición absoluta) no debe salirse y ensanchar la página */
.tabla-wrap { overflow-x: auto; position: relative; }
table.revista { border-collapse: collapse; width: 100%; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
table.revista caption { text-align: left; font-size: var(--fs-sm); margin-bottom: 8px; color: var(--text); }
table.revista thead th { border-top: 1.5px solid var(--text); border-bottom: 1px solid var(--text); padding: 6px 10px; text-align: right; font-weight: 700; white-space: nowrap; }
table.revista th:first-child, table.revista td:first-child { text-align: left; }
table.revista td { padding: 6px 10px; text-align: right; vertical-align: top; }
table.revista td.izq, table.revista th.izq { text-align: left; }
table.revista .nowrap { white-space: nowrap; }
/* también la primera celda, que es encabezado de fila (th) */
table.revista tbody tr:last-child > td, table.revista tbody tr:last-child > th { border-bottom: 1.5px solid var(--text); }
.pie-cuadro { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 6px; }

.veredicto { display: inline-block; font-size: var(--fs-xs); font-weight: 800; padding: 2px 9px; border-radius: var(--r-pill); white-space: nowrap; }
.veredicto.ok { background: var(--success-soft); color: var(--success-text); }
.veredicto.falla { background: var(--danger-soft); color: var(--danger-text); }

/* ================= validación ================= */
.val-filtros { display: flex; gap: var(--sp-3); flex-wrap: wrap; align-items: center; margin-bottom: var(--sp-3); }
.val-filtros input[type="search"] { font: inherit; font-size: var(--fs-sm); padding: 7px 10px; border-radius: var(--r-sm); border: 1px solid var(--field-border); background: var(--card-bg); color: var(--text); min-width: 0; flex: 1 1 220px; max-width: 360px; }
table.revista tr.grupo td { padding-top: 14px; font-weight: 800; color: var(--text); text-align: left; border-bottom: 1px solid var(--border); }
table.revista button.det { font: inherit; font-size: var(--fs-xs); font-weight: 700; color: var(--btn-oro-texto); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
tr.detalle td { text-align: left; background: var(--bg-soft); padding: 12px 14px; }
tr.detalle pre { margin: 6px 0 0; padding: 10px 12px; border-radius: var(--r-sm); background: #111; color: #EEE9DF; overflow: auto; font-size: var(--fs-xs); line-height: 1.5; white-space: pre; }
tr.detalle dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; margin: 0; font-size: var(--fs-sm); }
tr.detalle dt { color: var(--text-muted); }
tr.detalle dd { margin: 0; overflow-wrap: anywhere; }
.clases { margin: 0; padding-left: 1.1em; font-size: var(--fs-sm); }
.clases li { margin: 4px 0; }

/* ================= pie de la app ================= */
.pie-app { max-width: var(--content-max); margin: 0 auto; padding: var(--sp-6) var(--sp-5) var(--sp-10); color: var(--text-muted); font-size: var(--fs-sm); border-top: 1px solid var(--border); display: flex; gap: var(--sp-4); flex-wrap: wrap; justify-content: space-between; }
.pie-app a { color: var(--primary-text); }

/* ================= ventanas de diálogo y menús (js/interfaz/ui.js) ================= */
dialog.sp-dialogo[open] { display: flex; flex-direction: column; }
.sp-dialogo .dialog-body { flex: 1 1 auto; min-height: 0; }
.sp-dialogo .dialog-body > :first-child { margin-top: 0; }
.sp-dialogo .field { margin-bottom: var(--sp-3); }
.sp-dialogo fieldset { border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-2) var(--sp-3) var(--sp-3); margin: 0 0 var(--sp-3); min-width: 0; }
.sp-dialogo legend { font-weight: 700; font-size: var(--fs-sm); padding: 0 4px; }
.sp-dialogo-pie { padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--border); background: var(--bg-soft); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.sp-dialogo-pie .btn-row { justify-content: flex-end; }
.sp-dialogo-pie .msg { margin: 0 0 var(--sp-3); }
.sp-menu {
  position: absolute; z-index: var(--z-dialog); min-width: 220px; max-width: min(360px, calc(100vw - 16px)); max-height: 70vh; overflow: auto;
  padding: 4px; border-radius: var(--r-md); border: 1px solid var(--border-strong); background: var(--card-bg); box-shadow: var(--shadow-lg);
}
.sp-menu-item {
  display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 2px 6px; width: 100%; text-align: left;
  font: inherit; font-size: var(--fs-sm); color: var(--text); background: none; border: 0; border-radius: var(--r-sm); padding: 7px 10px; cursor: pointer;
}
.sp-menu-item small { grid-column: 2; color: var(--text-muted); font-size: var(--fs-xs); line-height: 1.35; }
.sp-menu-item:hover:not(:disabled), .sp-menu-item:focus-visible { background: var(--btn-oro-suave); outline: none; }
.sp-menu-item:focus-visible { box-shadow: inset 0 0 0 2px var(--primary); }
.sp-menu-item .marca { color: var(--btn-oro-texto); font-weight: 800; }
.sp-menu-sep { height: 1px; background: var(--border); margin: 4px 6px; }
.sp-menu-titulo { font-size: var(--fs-xs); font-weight: 800; color: var(--text-muted); padding: 6px 10px 2px; overflow-wrap: anywhere; }

/* ================= bloque 2 · Datos ================= */
.dat-barra { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); align-items: center; padding: var(--sp-3); margin-bottom: var(--sp-4); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--card-bg); }
.dat-barra > .btn-row + .btn-row { padding-left: var(--sp-4); border-left: 1px solid var(--border); }
@media (max-width: 700px) { .dat-barra > .btn-row + .btn-row { padding-left: 0; border-left: 0; } }

.dat-inicio { border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg); padding: var(--sp-6); background: var(--card-bg); margin-bottom: var(--sp-4); }
.dat-inicio[hidden] { display: none; }
.dat-inicio h3 { margin: 0 0 var(--sp-2); font-size: var(--fs-xl); }
.dat-inicio > p { margin: 0 0 var(--sp-5); color: var(--text-muted); max-width: 72ch; }
.dat-opciones { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3); }
@media (max-width: 860px) { .dat-opciones { grid-template-columns: minmax(0, 1fr); } }
.dat-opcion { display: flex; flex-direction: column; gap: 6px; text-align: left; font: inherit; color: var(--text); background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-4); cursor: pointer; }
.dat-opcion b { font-size: var(--fs-md); color: var(--btn-oro-texto); }
.dat-opcion span { font-size: var(--fs-sm); color: var(--text-muted); }
.dat-opcion:hover { border-color: var(--primary); }

.dat-trabajo { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: var(--sp-4); align-items: start; }
.dat-trabajo[hidden] { display: none; }
@media (max-width: 900px) { .dat-trabajo { grid-template-columns: minmax(0, 1fr); } .dat-centro { order: -1; } }
.dat-lateral { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--card-bg); padding: var(--sp-3); min-width: 0; }
.dat-titulo { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin: 2px 4px var(--sp-2); }
.dat-lista { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow: auto; display: grid; gap: 2px; }
@media (max-width: 900px) { .dat-lista { max-height: 180px; } }
.dat-var { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 8px; width: 100%; text-align: left; font: inherit; color: var(--text); background: none; border: 1px solid transparent; border-radius: var(--r-sm); padding: 6px 8px; cursor: pointer; }
.dat-var .nom { font-weight: 700; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dat-var .tipo { grid-row: 2; font-size: var(--fs-xs); }
.dat-var .falt { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-size: var(--fs-xs); font-weight: 700; color: var(--warning-text); }
.dat-var:hover { background: var(--bg-soft); }
.dat-var.activa { background: var(--btn-oro-suave); border-color: rgba(212, 168, 72, .55); }
.dat-detalle { border-top: 1px solid var(--border); margin-top: var(--sp-3); padding: var(--sp-3) 4px 0; }
.dat-detalle h4 { margin: 0 0 4px; font-size: var(--fs-md); overflow-wrap: anywhere; }
.dat-detalle .field { margin: var(--sp-2) 0; }
.dat-detalle .field select { font-size: var(--fs-sm); padding-block: 5px; }
.dat-razon { margin: 0 0 4px; color: var(--text-muted); border-left: 3px solid var(--primary); padding-left: 8px; }
.dat-kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 12px; margin: var(--sp-2) 0; font-size: var(--fs-sm); }
.dat-kv dt { color: var(--text-muted); }
.dat-kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.dat-niveles { list-style: none; margin: 0 0 var(--sp-2); padding: 0; font-size: var(--fs-sm); max-height: 200px; overflow: auto; }
.dat-niveles li { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; border-bottom: 1px dotted var(--border); }
.dat-niveles li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dat-niveles li span:last-child { color: var(--text-muted); font-variant-numeric: tabular-nums; }

.dat-centro { min-width: 0; }
.dat-filtro { margin: 0 0 var(--sp-3); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.dat-filtro[hidden] { display: none; }
.dat-filtro code { font-size: var(--fs-sm); }
.dat-estado { margin: 8px 2px 0; color: var(--text-muted); }
.dat-ayuda { margin: 2px 2px 0; }
.dat-estructura { margin-top: var(--sp-4); }
.dat-hallazgos { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.dat-hallazgos li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; align-items: start; font-size: var(--fs-sm); }
.dat-hallazgos .ico { width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center; font-size: var(--fs-xs); font-weight: 800; margin-top: 1px; }
.dat-hallazgos .ok .ico { background: var(--success-soft); color: var(--success-text); }
.dat-hallazgos .aviso .ico { background: var(--warning-soft); color: var(--warning-text); }
.dat-hallazgos .info .ico { background: var(--bg-soft); color: var(--text-muted); border: 1px solid var(--border); }

/* tipos de variable: misma etiqueta en la lista, la rejilla y la importación */
.tipo { font-weight: 700; color: var(--text-muted); }
.tipo.t-numerica { color: var(--btn-oro-texto); }
.tipo.t-factor { color: var(--text); }
.tipo.t-id, .tipo.t-texto { font-style: italic; }

/* ================= rejilla (js/interfaz/rejilla.js) ================= */
.rej { position: relative; border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--card-bg); outline: none; overflow: hidden; }
.rej:focus-visible { box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .35); border-color: var(--primary); }
.rej-scroll { position: relative; height: min(62vh, 640px); min-height: 280px; overflow: auto; overscroll-behavior: contain; }
.rej-cab { position: sticky; top: 0; z-index: 3; width: var(--rej-ancho); }
.rej-espacio { position: relative; width: var(--rej-ancho); }
.rej-ventana { position: absolute; top: 0; left: 0; width: var(--rej-ancho); will-change: transform; }
.rej-fila { display: grid; grid-template-columns: var(--rej-columnas); height: 30px; }
.rej-encabezado { height: auto; }
.rej-num, .rej-esquina { position: sticky; left: 0; z-index: 2; background: var(--bg-soft); color: var(--text-muted); font-size: var(--fs-xs); text-align: right; padding: 0 8px; line-height: 29px; border-right: 1px solid var(--border-strong); border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.rej-esquina { z-index: 4; line-height: normal; display: flex; align-items: center; justify-content: flex-end; border-bottom: 1px solid var(--border-strong); }
.rej-col { position: relative; display: flex; flex-direction: column; justify-content: center; gap: 1px; min-width: 0; padding: 6px 26px 6px 8px; background: var(--bg-soft); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border-strong); cursor: pointer; user-select: none; }
.rej-col .nom { font-weight: 700; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rej-col .tipo { font-size: var(--fs-2xs); }
.rej-col.sel { background: color-mix(in srgb, var(--bg-soft), #D4A848 16%); }
.rej-menu { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 22px; height: 26px; border: 0; border-radius: var(--r-sm); background: none; color: var(--text-muted); font-size: 16px; line-height: 1; cursor: pointer; }
.rej-menu:hover, .rej-menu:focus-visible { background: var(--card-bg); color: var(--text); }
.rej-celda { min-width: 0; padding: 0 8px; line-height: 29px; font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); cursor: cell; }
.rej-celda.num { text-align: right; font-variant-numeric: tabular-nums; }
.rej-celda.sel { background: rgba(var(--primary-rgb), .10); }
.rej-celda.act { box-shadow: inset 0 0 0 2px var(--primary); }
.rej-fila.filtrada .rej-celda { color: var(--text-muted); background-image: repeating-linear-gradient(135deg, transparent 0 6px, rgba(var(--primary-rgb), .07) 6px 7px); }
.rej-fila.filtrada .rej-num { text-decoration: line-through; }
.rej-editor { position: absolute; z-index: 5; height: 30px; padding: 0 7px; font: inherit; font-size: var(--fs-sm); color: var(--text); background: var(--card-bg); border: 2px solid var(--primary); border-radius: 0; outline: none; box-sizing: border-box; }
.rej-editor[hidden] { display: none; }
.rej-vacia { margin: 0; padding: var(--sp-6); text-align: center; color: var(--text-muted); }
.rej-vacia[hidden] { display: none; }

/* ================= ventanas del bloque Datos ================= */
.imp-opciones { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--sp-3); align-items: end; margin-bottom: var(--sp-3); }
.imp-opciones .field { margin: 0; }
.imp-check { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); cursor: pointer; }
.imp-check input { width: 16px; height: 16px; accent-color: var(--primary); }
.imp-resumen { margin: 0 0 var(--sp-2); }
.imp-vista { max-height: 46vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--r-md); padding: 0 4px; }
.imp-vista:empty { display: none; }
table.imp-tabla thead th { vertical-align: top; position: sticky; top: 0; background: var(--card-bg); z-index: 1; text-align: left; white-space: normal; }
.imp-tabla th > * { display: block; }
.imp-nom { font-size: var(--fs-sm); margin-bottom: 4px; white-space: nowrap; }
.imp-tabla select { font: inherit; font-size: var(--fs-xs); font-weight: 600; padding: 3px 4px; border-radius: var(--r-sm); border: 1px solid var(--field-border); background: var(--card-bg); color: var(--text); }
.imp-razon { margin-top: 4px; font-size: var(--fs-2xs); font-weight: 500; color: var(--text-muted); max-width: 220px; min-width: 120px; line-height: 1.35; }
.imp-tabla td { white-space: nowrap; }
.imp-falta { color: var(--warning-text); font-style: italic; }
.pegar-area, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: var(--fs-sm); }
.pegar-area { width: 100%; resize: vertical; white-space: pre; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 var(--sp-2); }
.chip-btn { font: inherit; font-size: var(--fs-xs); font-weight: 600; padding: 3px 9px; border-radius: var(--r-pill); border: 1px solid var(--border-strong); background: var(--bg-soft); color: var(--text); cursor: pointer; }
.chip-btn.col { font-family: ui-monospace, Consolas, monospace; }
.chip-btn:hover { border-color: var(--primary); }
.cal-vista, .tr-vista, .fi-vista { margin: var(--sp-3) 0 0; overflow-wrap: anywhere; }
.cal-vista:empty, .tr-vista:empty, .fi-vista:empty { display: none; }
.tr-lista { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 4px var(--sp-3); }
.tr-op { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 8px; align-items: start; padding: 6px 4px; border-radius: var(--r-sm); cursor: pointer; font-size: var(--fs-sm); }
.tr-op input { margin-top: 3px; accent-color: var(--primary); }
.tr-op:hover { background: var(--bg-soft); }
.tr-param { margin-bottom: var(--sp-3); }
.tr-param:empty { display: none; }
.bc-caja { border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-3); background: var(--bg-soft); }
.bc-caja p { margin: 0 0 var(--sp-2); }
.bc-caja .btn-row { margin-bottom: var(--sp-2); }
.bc-lambda { flex-direction: row !important; align-items: center; gap: 8px !important; margin: 0 !important; }
.bc-lambda input { width: 120px; }
.bc-svg { width: 100%; max-width: 560px; height: auto; display: block; margin-top: var(--sp-2); }
.bc-svg .eje { stroke: var(--text-muted); stroke-width: 1; }
.bc-svg .etq { fill: var(--text-muted); font-size: 12px; font-family: inherit; }
.bc-svg .curva { fill: none; stroke: var(--btn-oro-texto); stroke-width: 2.2; }
.bc-svg .corte { stroke: var(--text-muted); stroke-dasharray: 4 4; }
.bc-svg .max { stroke: var(--text); stroke-width: 1.2; }
.bc-svg .ic { stroke: var(--text-muted); stroke-width: 1.2; stroke-dasharray: 2 3; }
.nv-lista { margin: var(--sp-3) 0 0; padding: 0; list-style: none; max-height: 50vh; overflow: auto; }
.nv-lista li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 3px 4px; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
.nv-lista .btn-row { flex-wrap: nowrap; gap: 2px; }

/* ================= bloque 3 · Explorar ================= */
.seg.exp-tipos, .seg.exp-modo, .seg.exp-vistas { flex-wrap: wrap; border-radius: var(--r-md); max-width: 100%; }
.seg.exp-tipos button, .seg.exp-modo button, .seg.exp-vistas button { font-size: var(--fs-sm); letter-spacing: 0; padding: 7px 14px; border-radius: 8px; min-height: 34px; }
.seg.exp-tipos { margin-bottom: var(--sp-4); }
.seg.exp-tipos button { font-size: var(--fs-md); padding: 8px 18px; }
.exp-filtro { margin: 0 0 var(--sp-4); }
.exp-filtro[hidden] { display: none; }
.exp-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: var(--sp-5); align-items: start; }
@media (max-width: 960px) { .exp-grid { grid-template-columns: minmax(0, 1fr); } .exp-resultado { order: -1; } }
.exp-a-opciones { display: none; color: var(--btn-oro-texto); font-weight: 600; }
@media (max-width: 960px) { .exp-a-opciones { display: inline; } }
.exp-opciones { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--card-bg); padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.exp-opciones .field select, .exp-opciones .field input { font-size: var(--fs-sm); padding-block: 6px; min-width: 0; width: 100%; }
.exp-opciones .field > span:first-child { font-size: var(--fs-sm); font-weight: 600; }
.exp-fila { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-3); }
.exp-casillas { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.exp-casillas legend { font-weight: 600; font-size: var(--fs-sm); padding: 0; margin-bottom: 6px; width: 100%; }
.exp-casillas .imp-check { min-height: 28px; }
#acerca .imp-check { min-height: 28px; }
#acerca .imp-check input { margin: 4px; }
.exp-casillas .field-help, .exp-casillas p { width: 100%; margin: 2px 0 0; }
.exp-resultado { min-width: 0; }
.exp-resultado:empty { display: none; }
.exp-cabeza { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-2); }
.exp-cabeza h3 { margin: 0; font-size: var(--fs-lg); }
.exp-conclusion { margin-bottom: var(--sp-4); }
.exp-conclusion p { margin: 0 0 6px; } .exp-conclusion p:last-child { margin-bottom: 0; }
.exp-vistas { margin-bottom: var(--sp-3); }
.exp-acciones { margin: var(--sp-3) 0; }
.exp-extras, .exp-codigo { margin-top: var(--sp-3); border-top: 1px solid var(--border); padding-top: var(--sp-2); }
.exp-extras summary, .exp-codigo summary { cursor: pointer; font-weight: 600; font-size: var(--fs-sm); color: var(--btn-oro-texto); padding: 4px 0; }
.exp-extras .chips { margin-top: var(--sp-2); gap: 4px 14px; }
/* «Cómo leer este cuadro» (hito 5.1): medidores y curvas de LABGuide, dibujados al abrir */
.lg-lectura { margin-top: var(--sp-2); }
.lg-lectura > summary { cursor: pointer; font-weight: 600; font-size: var(--fs-sm); color: var(--btn-oro-texto); padding: 4px 0; }
.lg-cuerpo { padding: var(--sp-2) 0 var(--sp-1); }
.lg-medidores { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); gap: var(--sp-3) var(--sp-5); }
.lg-sub { margin: var(--sp-3) 0 var(--sp-2); font-weight: 600; font-size: var(--fs-sm); }
.lg-curvas { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); gap: var(--sp-3) var(--sp-4); }
.lg-refs { margin-top: var(--sp-3); font-size: var(--fs-xs); }
.lg-refs summary { cursor: pointer; color: var(--btn-oro-texto); font-weight: 600; }
.lg-refs ul { margin: var(--sp-1) 0 0; padding-left: 1.2em; color: var(--text-muted); }
/* la guía del CV por cultivo y variable (hito 5.2) */
.lg-cv-guia { margin: 6px 0 2px; font-size: var(--fs-sm); }
.lg-cv-guia > summary { cursor: pointer; color: var(--btn-oro-texto); font-weight: 600; }
.lg-cv-form { display: grid; gap: var(--sp-2); padding: var(--sp-2) 0 0; max-width: 40rem; }
.lg-cv-propia { display: grid; gap: var(--sp-2); margin: 0; padding: var(--sp-2) var(--sp-3) var(--sp-3); border: 1px solid var(--border); border-radius: var(--r-md); }
.lg-cv-propia legend { padding: 0 4px; font-weight: 600; }
.lg-cv-fila { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); }
.lg-cv-fila .field { flex: 1 1 8rem; min-width: 7rem; margin: 0; }
.lg-cv-garcia summary { cursor: pointer; color: var(--btn-oro-texto); }
.lg-cv-msg:empty { display: none; }
/* nivel de detalle (hito 5.2): Básico oculta los cuadros de Análisis y del reporte y abre «Lectura»; Experto muestra las notas técnicas */
.sp-detalle { margin: 0 0 var(--sp-3); flex-wrap: wrap; max-width: 100%; }
.sp-detalle button { font-size: var(--fs-sm); letter-spacing: 0; padding: 5px 14px; min-height: 32px; }
.sp-detalle-fila { margin-top: var(--sp-3); }
.lg-sum-basico, .sp-basico-aviso { display: none; }
.exp-tecnico { display: none; margin: var(--sp-3) 0; }
.exp-tecnico > summary { cursor: pointer; font-weight: 600; }
.exp-modelo-t { margin: var(--sp-3) 0 0; font-weight: 600; }
.exp-tecnico-dl { max-width: 52rem; }
.exp-tecnico-dl dd { text-align: left; }
:root[data-detalle="experto"] .exp-tecnico { display: block; }
:root[data-detalle="basico"] .sp-basico-aviso { display: block; }
:root[data-detalle="basico"] :is(#anaResultado, #repItems) .lg-sum-basico { display: inline; }
:root[data-detalle="basico"] :is(#anaResultado, #repItems) .lg-sum-std { display: none; }
:root[data-detalle="basico"] :is(#anaResultado, #repItems) :is(.tabla-wrap, .pie-cuadro, .cuadro-acciones, .exp-extras:not(.rep-ajustes)) { display: none; }
:root[data-detalle="basico"] :is(#anaResultado, #repItems, #expResultado) .exp-codigo { display: none; }
.exp-codigo pre { margin: var(--sp-2) 0; padding: 12px 14px; border-radius: var(--r-md); background: #111; color: #EEE9DF; overflow: auto; font-size: var(--fs-xs); line-height: 1.55; white-space: pre; }
table.revista.sp-cuadro caption b { font-weight: 800; }
table.revista.sp-cuadro tbody th { font-weight: 600; padding: 6px 10px; text-align: left; vertical-align: top; }
table.revista.sp-cuadro tr.total th, table.revista.sp-cuadro tr.total td { border-top: 1px solid var(--text); font-weight: 700; }
.pie-cuadro p { margin: 3px 0; }

/* ================= bloque 4 · Análisis ================= */
/* ---- catálogo de análisis (tarjetas, con lo que se puede hacer con los datos) ---- */
.ana-catalogo { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--card-bg); padding: 0; margin-bottom: var(--sp-4); overflow: hidden; }
.cat-barra { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; padding: var(--sp-3) var(--sp-4); background: var(--bg-soft); }
#anaCatalogo:has(#cat-cuerpo:not([hidden])) .cat-barra { border-bottom: 1px solid var(--border); }
.cat-barra-txt { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cat-barra-txt > span { display: flex; flex-direction: column; min-width: 0; }
.cat-barra-eti { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); font-weight: 700; }
.cat-barra-txt b { font-size: var(--fs-md, 1.05rem); overflow-wrap: anywhere; }
.cat-ico { width: 22px; height: 22px; flex: none; color: var(--btn-oro-texto); }
#cat-cuerpo { padding: var(--sp-4); }
.cat-datos { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: var(--sp-4); margin-bottom: var(--sp-4); }
@media (max-width: 860px) { .cat-datos { grid-template-columns: 1fr; } }
.cat-tit { font-size: var(--fs-sm); margin: 0 0 var(--sp-2); }
.cat-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.cat-chips li { font-size: var(--fs-xs); background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--r-pill); padding: 3px 10px; max-width: 100%; overflow-wrap: anywhere; }
.cat-chips li span { color: var(--text-muted); }
.cat-resumen-total { margin: var(--sp-2) 0 0; font-size: var(--fs-sm); }
.cat-perfil-vacio { margin: 0; color: var(--text-muted); font-size: var(--fs-sm); }
.cat-rec { border: 1px solid rgba(212, 168, 72, .55); background: var(--btn-oro-suave); border-radius: var(--r-md, 10px); padding: var(--sp-3); min-width: 0; }
.cat-rec-eti { margin: 0 0 6px; font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--btn-oro-texto); }
.cat-rec-btn { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; font: inherit; color: var(--text); background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--r-md, 10px); padding: 10px 12px; cursor: pointer; }
.cat-rec-btn:hover { border-color: var(--primary); }
.cat-rec-btn > span:not(.cat-rec-ir) { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.cat-rec-btn span span { font-size: var(--fs-xs); color: var(--text-muted); }
.cat-rec-ir { font-size: 1.2rem; color: var(--btn-oro-texto); }
.cat-rec-despues { margin: var(--sp-2) 0 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: var(--fs-xs); }
.cat-mini { font: inherit; font-size: var(--fs-xs); background: var(--card-bg); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-pill); padding: 2px 10px; cursor: pointer; }
.cat-mini:hover { border-color: var(--primary); }
.cat-rec-nota { margin: 6px 0 0; }
.cat-filtros { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); align-items: center; margin-bottom: var(--sp-3); }
.cat-buscar { flex: 1 1 260px; }
.cat-buscar input { width: 100%; font: inherit; font-size: var(--fs-sm); padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--bg); color: var(--text); }
.cat-fam-sel select { font: inherit; font-size: var(--fs-sm); padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--bg); color: var(--text); max-width: 100%; }
.cat-solo { margin: 0; }
.cat-familia { margin-top: var(--sp-4); }
.cat-familia h3 { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); margin: 0 0 var(--sp-2); padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.cat-familia h3 > span:first-of-type { flex: 1; }
.cat-cuenta { font-size: var(--fs-2xs); font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.cat-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 235px), 1fr)); gap: var(--sp-2); }
.cat-tarjeta > button { display: flex; flex-direction: column; align-items: stretch; gap: 4px; width: 100%; height: 100%; text-align: left; font: inherit; color: var(--text);
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--r-md, 10px); padding: 10px 12px; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.cat-tarjeta > button:hover { border-color: var(--primary); box-shadow: 0 2px 10px rgba(0, 0, 0, .06); }
@media (prefers-reduced-motion: no-preference) { .cat-tarjeta > button:hover { transform: translateY(-1px); } }
.cat-tarjeta.activo > button { border-color: rgba(212, 168, 72, .9); background: var(--btn-oro-suave); box-shadow: inset 3px 0 0 var(--primary); }
.cat-nombre { font-weight: 700; font-size: var(--fs-sm); }
.cat-resumen { font-size: var(--fs-xs); color: var(--text-muted); line-height: 1.4; }
.cat-falta { display: block; margin-top: 4px; color: var(--warning-text); }
.cat-estado { align-self: flex-start; font-size: var(--fs-2xs); font-weight: 700; border-radius: var(--r-pill); padding: 1px 8px; }
.cat-estado[data-estado="listo"] { background: var(--success-soft); color: var(--success-text); }
.cat-estado[data-estado="falta"] { background: var(--warning-soft); color: var(--warning-text); }
.cat-estado[data-estado="sinDatos"] { background: var(--bg-soft); color: var(--text-muted); border: 1px solid var(--border); }
.cat-tarjeta.e-falta > button { background: transparent; }
.cat-tarjeta.e-falta .cat-nombre { color: var(--text-muted); }
.cat-nada { color: var(--text-muted); font-size: var(--fs-sm); }
.ana-espacio { min-width: 0; }
.ana-rec { margin: 4px 0 0; padding-left: 1.2em; }
.exp-resultado.calculando > :not(.ana-espera) { opacity: .45; }
.ana-espera { margin: 0 0 var(--sp-2); font-weight: 600; color: var(--btn-oro-texto); }
.ana-rec li { margin: 4px 0; }

/* semáforo: el color nunca va solo, siempre con la palabra (Bien, Revisar, Problema, No aplica) */
.semaforo { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--card-bg); padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-4); }
.semaforo .luz { width: 14px; height: 14px; border-radius: 50%; display: inline-block; flex: none; background: var(--text-muted); box-shadow: 0 0 0 3px var(--bg-soft); }
.semaforo .s-verde .luz, .semaforo.s-verde > .semaforo-global .luz { background: var(--success); }
.semaforo .s-ambar .luz, .semaforo.s-ambar > .semaforo-global .luz { background: var(--warning); }
.semaforo .s-rojo .luz, .semaforo.s-rojo > .semaforo-global .luz { background: var(--danger); }
.semaforo .s-gris .luz { background: transparent; border: 2px solid var(--border-strong); box-shadow: none; }
/* el ícono de cada luz (hito 5.3): blanco sobre verde y rojo, oscuro sobre ámbar */
.semaforo .luz { display: inline-grid; place-items: center; width: 18px; height: 18px; }
.semaforo .luz svg { width: 12px; height: 12px; stroke: #fff; fill: #fff; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
.semaforo .s-ambar .luz svg, .semaforo.s-ambar > .semaforo-global .luz svg { stroke: #2a1f00; fill: #2a1f00; }
.semaforo .s-gris .luz svg { stroke: var(--text-muted); fill: var(--text-muted); width: 10px; height: 10px; }
.semaforo-global .luz { width: 22px; height: 22px; }
.semaforo-global .luz svg { width: 14px; height: 14px; }
/* en pocas palabras y cómo reportarlo (hito 5.4) */
.sp-claro { margin: 0 0 var(--sp-3); padding: var(--sp-2) var(--sp-3); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg-soft); }
.sp-claro-t { margin: 0 0 4px; font-weight: 700; font-size: var(--fs-sm); color: var(--btn-oro-texto); }
.sp-claro ul { margin: 0; padding-left: 1.2em; }
.sp-claro li { margin: 3px 0; }
:root[data-detalle="basico"] :is(#anaResultado, #repItems) .conclusion-tecnica { display: none; }
.sp-reportar { margin: var(--sp-3) 0; }
.sp-reportar > summary { cursor: pointer; font-weight: 600; color: var(--btn-oro-texto); }
.sp-rp-idiomas { margin: var(--sp-2) 0; }
.sp-rp-bloque { margin: var(--sp-2) 0 var(--sp-3); }
.sp-rp-t { margin: 0; font-weight: 600; font-size: var(--fs-sm); }
.sp-rp-p { margin: 4px 0; line-height: 1.6; max-width: 60rem; }
/* las alternativas cuando un supuesto falla (hito 5.3) */
.sp-alternativas { margin: 0 0 var(--sp-4); padding: var(--sp-2) var(--sp-3) var(--sp-3); border: 1px dashed var(--border-strong); border-radius: var(--r-md); }
.sp-alt-t { margin: 0 0 var(--sp-2); }
.sp-alternativas .small.muted:last-child { margin: var(--sp-2) 0 0; }
.semaforo-global { display: flex; align-items: center; gap: 10px; margin: 2px 0 var(--sp-3); font-size: var(--fs-md); }
.semaforo-global .luz { width: 18px; height: 18px; }
.semaforo ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.semaforo li { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 2px 10px; align-items: baseline; padding: 7px 0; border-top: 1px solid var(--border); font-size: var(--fs-sm); }
.semaforo li .texto { grid-column: 2 / -1; }
.semaforo li .luz { align-self: center; }
.semaforo li .nombre { font-weight: 700; }
.semaforo li .estado { font-weight: 700; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .04em; }
.semaforo li.s-verde .estado { color: var(--success-text); }
.semaforo li.s-ambar .estado { color: var(--warning-text); }
.semaforo li.s-rojo .estado { color: var(--danger-text); }
.semaforo li.s-gris .estado, .semaforo li.s-gris .texto { color: var(--text-muted); }

/* gráficas de diagnóstico (js/interfaz/graficas.js) */
.ana-graficas { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--sp-4); margin: var(--sp-2) 0 var(--sp-4); }
.ana-graficas.ana-una { grid-template-columns: minmax(0, 620px); }
.sp-grafica { margin: 0; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--card-bg); padding: 6px 6px 4px; }
.sp-grafica svg { width: 100%; height: auto; display: block; }
.sp-grafica figcaption { font-size: var(--fs-xs); color: var(--text-muted); text-align: center; padding: 2px 4px 4px; }
.gr-fondo { fill: var(--card-bg); }
.gr-rejilla { stroke: var(--border); stroke-width: 1; }
.gr-eje { stroke: var(--text-muted); stroke-width: 1.2; }
/* los colores de los datos y de los textos van en el propio SVG (js/interfaz/graficas.js), con las mismas variables, para
   que el editor ✎ pueda cambiarlos; aquí se quedan grosores, trazos y tipografía */
.gr-etq { font-size: 11px; font-family: inherit; }
.gr-titulo-eje { font-size: 12px; font-family: inherit; }
.gr-banda { stroke-width: 1; }
.gr-ref { stroke-width: 1.2; }
.gr-ref.disc { stroke-dasharray: 5 4; }
.gr-linea { fill: none; stroke-width: 1.4; }
.gr-punto { fill-opacity: .55; }
.gr-punto.marca { fill-opacity: 1; stroke-width: 1; }
.gr-caja { stroke-width: 1.3; }
.gr-mediana { stroke-width: 2.6; }
.gr-bigote { stroke-width: 1.2; }
.gr-media { stroke-width: 1.5; }
.gr-letra { font-size: 13px; font-family: inherit; }
.gr-serie { fill: none; stroke-width: 2; stroke-linejoin: round; }
.gr-marca { stroke-width: 1; }
.gr-marca.gr-s3, .gr-marca.gr-s4 { stroke-width: 1.6; }
.gr-punto-media { stroke-width: 1.5; }
.gr-punto-media.marca { stroke-width: 2.2; }

/* asistente (js/interfaz/asistente.js): preguntas numeradas a la izquierda, recomendación fija a la derecha */
.asis-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 420px); gap: var(--sp-5); align-items: start; }
@media (max-width: 960px) { .asis-grid { grid-template-columns: minmax(0, 1fr); } }
.asis-preguntas { list-style: none; counter-reset: asis; margin: 0; padding: 0; display: grid; gap: var(--sp-3); }
.asis-p { counter-increment: asis; position: relative; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--card-bg); padding: var(--sp-3) var(--sp-4) var(--sp-3) calc(var(--sp-4) + 34px); min-width: 0; }
.asis-p::before { content: counter(asis); position: absolute; left: var(--sp-3); top: var(--sp-3); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: var(--fs-sm); background: var(--btn-oro-suave); color: var(--btn-oro-texto); }
.asis-p fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.asis-q { display: block; font-weight: 700; margin: 2px 0 var(--sp-2); padding: 0; }
.asis-p .select { width: auto; min-width: 220px; max-width: 100%; }
.asis-p .field-help { margin: 6px 0 0; }
.asis-opciones { display: flex; flex-wrap: wrap; gap: 6px; }
.asis-op { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 5px 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg-soft); cursor: pointer; font-size: var(--fs-sm); max-width: 100%; }
.asis-op:hover { border-color: var(--primary); }
.asis-op input { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); flex: none; }
.asis-op:has(input:checked) { background: var(--btn-oro-suave); border-color: rgba(212, 168, 72, .7); color: var(--btn-oro-texto); font-weight: 700; }
.asis-op:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.asis-lado { position: sticky; top: var(--sp-4); min-width: 0; }
@media (max-width: 960px) { .asis-lado { position: static; } }
.asis-reco h3 { margin: var(--sp-2) 0 4px; font-size: var(--fs-xl); }
.asis-reco > p { margin: 0 0 var(--sp-2); }
.asis-metodo { margin: 0 0 var(--sp-2); }
.asis-sub { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 700; margin: var(--sp-3) 0 4px; }
.asis-reco ul { margin: 0; padding-left: 1.2em; font-size: var(--fs-sm); }
.asis-reco li { margin: 3px 0; }
.asis-fallan { margin: var(--sp-3) 0 0; padding: 8px 12px; border-left: 3px solid var(--border-strong); background: var(--bg-soft); border-radius: 0 var(--r-md) var(--r-md) 0; }
.asis-reco .msg { margin: var(--sp-2) 0 0; }
.asis-acciones { margin-top: var(--sp-4); }
.asis-despues { border-top: 1px solid var(--border); margin-top: var(--sp-4); }
.asis-despues ul { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.asis-despues .btn { text-align: left; white-space: normal; height: auto; min-height: 32px; }

/* constructor de modelos (js/interfaz/constructor.js) */
.cons-grid { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: var(--sp-5); align-items: start; }
@media (max-width: 860px) { .cons-grid { grid-template-columns: minmax(0, 1fr); } }
.cons-izq { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--card-bg); padding: var(--sp-3); min-width: 0; }
.cons-titulo { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin: 2px 4px var(--sp-2); }
.cons-pool { display: flex; flex-wrap: wrap; gap: 6px; }
.cons-izq > p { margin: var(--sp-3) 4px 0; }
.cons-chip { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: var(--fs-sm); font-weight: 700; color: var(--text); background: var(--bg-soft); border: 1px solid var(--border-strong); border-radius: var(--r-pill); padding: 4px 12px; max-width: 100%; overflow-wrap: anywhere; text-align: left; }
button.cons-chip { cursor: grab; min-height: 32px; }
button.cons-chip:hover { border-color: var(--primary); }
button.cons-chip:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.cons-chip.usada { background: transparent; border-style: dashed; color: var(--text-muted); }
.cons-tipo { font-weight: 400; font-size: var(--fs-2xs); color: var(--text-muted); }
.cons-zonas { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--sp-3); }
.cons-zona { border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg); background: var(--card-bg); padding: var(--sp-3); min-width: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.cons-zona.llena { border-style: solid; border-color: var(--border-strong); }
.cons-zona.sobre { border-color: var(--primary); background: var(--btn-oro-suave); }
.cons-zona.deshabilitada { opacity: .75; border-style: dotted; }
.cons-zt { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 700; font-size: var(--fs-sm); }
.cons-zt kbd, .cons-izq kbd { font: inherit; font-size: var(--fs-2xs); font-weight: 700; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; padding: 0 6px; color: var(--text-muted); background: var(--bg-soft); }
.cons-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 32px; }
.cons-chip.puesta { background: var(--btn-oro-suave); border-color: rgba(212, 168, 72, .7); color: var(--btn-oro-texto); padding-right: 4px; }
.cons-quitar { font: inherit; font-size: var(--fs-md); line-height: 1; border: 0; background: transparent; color: inherit; cursor: pointer; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; }
.cons-quitar:hover { background: rgba(var(--primary-rgb), .15); }
.cons-x { color: var(--text-muted); font-weight: 700; }
.cons-agregar { font-size: var(--fs-sm); width: 100%; }
.cons-editor { margin: var(--sp-4) 0 var(--sp-2); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--card-bg); }
.cons-editor .cons-formula { margin: 0 0 var(--sp-2); padding: 0; border: 0; background: transparent; }
.cons-editor > p { margin: var(--sp-2) 0; }
.cons-editor .btn-row { margin-top: var(--sp-3); }
.cons-formula { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: var(--sp-4) 0 var(--sp-2); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg-soft); }
.cons-lbl { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 700; }
.cons-formula code { font-family: var(--font-mono, ui-monospace, Consolas, monospace); font-size: var(--fs-md); overflow-wrap: anywhere; flex: 1 1 260px; min-width: 0; }
.cons-formula.editando .cons-lbl { text-transform: none; letter-spacing: 0; font-family: var(--font-mono, ui-monospace, Consolas, monospace); font-size: var(--fs-md); color: var(--text); }
.cons-formula.editando input { flex: 1 1 260px; min-width: 0; font-family: var(--font-mono, ui-monospace, Consolas, monospace); }
.cons-resumen { margin-top: var(--sp-3); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--card-bg); padding: var(--sp-3) var(--sp-4); }
.cons-resumen p { margin: 0 0 var(--sp-2); }
.cons-der > .btn-row, .cons-der > .exp-casillas { margin: var(--sp-2) 0; }
.ml-terminos { margin: var(--sp-2) 0; padding-left: 1.2em; }
.ml-terminos li { margin: 3px 0; }
.ml-terminos b { font-family: var(--font-mono, ui-monospace, Consolas, monospace); font-weight: 700; }
.cons-der > .msg { margin: var(--sp-2) 0; }

/* ================= bloque 5 · Reporte LABG (js/interfaz/reporte.js) ================= */
.exp-reporte { margin-left: auto; }
.rep-cabeza { margin-bottom: var(--sp-4); }
.rep-cabeza .exp-fila { margin-bottom: var(--sp-2); }
@media (max-width: 700px) { .rep-cabeza .exp-fila { grid-template-columns: minmax(0, 1fr); } }
.rep-cabeza > p { margin: 0 0 var(--sp-3); }
.rep-indice { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--card-bg); padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-4); }
.rep-indice ol { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 4px; font-size: var(--fs-sm); }
.rep-indice a { color: var(--btn-oro-texto); font-weight: 600; }
.rep-item { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--card-bg); padding: var(--sp-4) var(--sp-5); margin-bottom: var(--sp-5); min-width: 0; }
@media (max-width: 700px) { .rep-item { padding: var(--sp-3); } }
.rep-item-cabeza { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-2) var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-2); }
.rep-item-cabeza h3 { margin: 0; font-size: var(--fs-xl); min-width: 0; overflow-wrap: anywhere; }
.rep-acciones { gap: 4px; }
.rep-acciones .btn[aria-label] { min-width: 36px; }
.rep-ajustes { margin: 0 0 var(--sp-3); }
.rep-ajustes .field { margin-top: var(--sp-2); }
.rep-item .exp-conclusion { margin: var(--sp-2) 0 var(--sp-4); }
.rep-item .ana-graficas { margin-top: var(--sp-3); }
.rep-sub { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 700; margin: var(--sp-4) 0 var(--sp-2); }
.rep-parrafo { border-left: 3px solid var(--accent); background: var(--bg-soft); border-radius: 0 var(--r-md) var(--r-md) 0; padding: var(--sp-1) var(--sp-4) var(--sp-3); margin: var(--sp-4) 0; }
.rep-parrafo p { margin: 0 0 var(--sp-2); max-width: 80ch; line-height: 1.6; }
.rep-parrafo .btn-row { align-items: center; }
.rep-detalles dd { text-align: left; }

/* ================= bloque 6 · Figuras (js/interfaz/figuras.js) ================= */
.fig-ancho { min-width: 0; flex: 0 1 300px; }
.fig-galeria { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: var(--sp-4); margin-top: var(--sp-3); }
.fig-tarjeta { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--card-bg); padding: var(--sp-3); min-width: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.fig-tarjeta .sp-grafica { border: 0; padding: 0; }
.fig-tarjeta figcaption { text-align: left; font-size: var(--fs-xs); }
.fig-origen { margin: 0; }
.fig-acciones { gap: 4px; margin-top: auto; }

/* ================= bloque 7 · Exportar (js/interfaz/exportar.js) ================= */
.expo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: var(--sp-4); margin: var(--sp-3) 0; }
.expo-tarjeta { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.card.expo-tarjeta + .card.expo-tarjeta { margin-top: 0; }
.expo-tarjeta h3 { margin: 0; }
.expo-tarjeta p { margin: 0; }
.expo-tarjeta .btn-row { margin-top: auto; padding-top: var(--sp-2); }
.expo-estado { min-height: 1.4em; }
.expo-auto-estado { min-height: 1.4em; }
/* guardado automático: el aviso para recuperar el trabajo (Inicio y Datos) */
.rec-caja { margin-bottom: var(--sp-4); }
.rec-aviso { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); }
.rec-aviso p { margin: 0; flex: 1 1 22rem; min-width: 0; }
.rec-aviso .btn-row { margin: 0; }

/* bloque 8 · otras comprobaciones */
.val-otras { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-3); }
.val-otras > li { border-top: 1px solid var(--border); padding-top: var(--sp-3); }
.val-otras > li:first-child { border-top: 0; padding-top: 0; }
.val-otra-cabeza { margin: 0 0 4px; display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: baseline; }
.val-otras p.small { margin: 0; max-width: 90ch; }

/* ================= arranque (hito 5.11) =================
   Mientras la barra común se arma, la página ocupa su lugar pero no se ve (visibility, no display: no se reacomoda al
   aparecer). La pantalla de apertura queda fuera de esta regla. */
html.sp-arranque .topbar, html.sp-arranque main, html.sp-arranque .pie-app { visibility: hidden; }
/* el bloque activo ocupa al menos la pantalla: lo que se dibuja después de la primera pintura (el catálogo de Fundamentos, el
   reporte de Validación, el pie Anterior / Siguiente) no empuja el pie de la app */
.step-panel.active { min-height: 100vh; }
/* el pie Anterior / Siguiente se ve cuando la app terminó de cargar (antes lo empujaría el contenido que se dibuja) */
html:not([data-sp-listo]) .step-footer { visibility: hidden; }

/* ================= temas de las gráficas =================
   <html data-graficas="…"> (lo pone el selector «Tema de las gráficas»; SigmaPro es el de omisión). Cada tema cambia,
   dentro de cada .sp-grafica, las variables con que se dibujan (acento, relleno suave, rejilla, series) y algunos
   trazos y letras. Las descargas resuelven estos colores (js/interfaz/figuras.js) y el Estudio de figuras los toma tal
   cual. En «Cuadrícula» el área de la gráfica (.gr-fondo) es gris. */

/* Minimalista: grises, sin rejilla, ejes finos */
:root[data-graficas="minimalista"] .sp-grafica { --btn-oro-texto: #4d4d4d; --btn-oro-suave: #e9e9e9; --g-s2: #4d4d4d; --g-s5: #4d4d4d; }
:root[data-graficas="minimalista"] .sp-grafica .gr-rejilla { display: none; }
:root[data-graficas="minimalista"] .sp-grafica .gr-eje { stroke-width: .8; }
:root[data-graficas="minimalista"] .sp-grafica .gr-caja, :root[data-graficas="minimalista"] .sp-grafica .gr-serie { stroke-width: 1.2; }

/* Cuadrícula: panel gris con rejilla blanca, sin ejes (como ggplot2) */
:root[data-graficas="cuadricula"] .sp-grafica { --btn-oro-texto: #1f4e79; --btn-oro-suave: #c5d6e8; --g-s2: #1f4e79; --g-s5: #1f4e79; }
:root[data-graficas="cuadricula"] .sp-grafica .gr-fondo { fill: #ebebeb; }
:root[data-graficas="cuadricula"] .sp-grafica .gr-rejilla { stroke: #ffffff; stroke-width: 1.1; }
:root[data-graficas="cuadricula"] .sp-grafica .gr-eje { stroke: transparent; }

/* Revista: blanco y negro, letra con serifas, fondo blanco aun con la app en oscuro */
:root[data-graficas="revista"] .sp-grafica { --text: #000000; --text-muted: #333333; --card-bg: #ffffff; --border: #d0d0d0; --btn-oro-texto: #000000; --btn-oro-suave: #ffffff;
  --g-s2: #000000; --g-s3: #555555; --g-s5: #000000; }
:root[data-graficas="revista"] .sp-grafica svg { background: #ffffff; }
:root[data-graficas="revista"] .sp-grafica text { font-family: 'Times New Roman', Times, serif; }
:root[data-graficas="revista"] .sp-grafica .gr-rejilla { display: none; }
:root[data-graficas="revista"] .sp-grafica .gr-eje { stroke: #000000; stroke-width: 1; }
:root[data-graficas="revista"] .sp-grafica .gr-caja, :root[data-graficas="revista"] .sp-grafica .gr-banda { stroke: #000000; }

/* Daltonismo: la paleta de Okabe e Ito, distinguible con cualquier tipo de daltonismo */
:root[data-graficas="daltonismo"] .sp-grafica { --btn-oro-texto: #d55e00; --btn-oro-suave: rgba(230, 159, 0, .28);
  --g-s1: #0072b2; --g-s2: #e69f00; --g-s3: #009e73; --g-s4: #cc79a7; --g-s5: #56b4e9; }

/* Presentación: letras grandes y trazos gruesos, para proyectar */
:root[data-graficas="presentacion"] .sp-grafica { --btn-oro-texto: #a8740f; --g-s2: #a8740f; --g-s5: #a8740f; }
:root[data-graficas="presentacion"] .sp-grafica .gr-etq { font-size: 15px; }
:root[data-graficas="presentacion"] .sp-grafica .gr-titulo-eje { font-size: 16px; font-weight: 700; }
:root[data-graficas="presentacion"] .sp-grafica .gr-letra { font-size: 17px; }
:root[data-graficas="presentacion"] .sp-grafica .gr-linea, :root[data-graficas="presentacion"] .sp-grafica .gr-serie { stroke-width: 3; }
:root[data-graficas="presentacion"] .sp-grafica .gr-eje { stroke-width: 2; }
:root[data-graficas="presentacion"] .sp-grafica .gr-caja, :root[data-graficas="presentacion"] .sp-grafica .gr-mediana { stroke-width: 2.6; }
:root[data-graficas="presentacion"] .sp-grafica .gr-bigote, :root[data-graficas="presentacion"] .sp-grafica .gr-media, :root[data-graficas="presentacion"] .sp-grafica .gr-ref { stroke-width: 2.2; }

/* en oscuro: los temas de color conservan el contraste con el fondo de la tarjeta */
:root[data-theme="dark"][data-graficas="minimalista"] .sp-grafica { --btn-oro-texto: #bdbdbd; --btn-oro-suave: #333333; --g-s2: #bdbdbd; --g-s5: #bdbdbd; }
:root[data-theme="dark"][data-graficas="cuadricula"] .sp-grafica { --btn-oro-texto: #8cbbe6; --btn-oro-suave: #25384b; --g-s2: #8cbbe6; --g-s5: #8cbbe6; }
:root[data-theme="dark"][data-graficas="cuadricula"] .sp-grafica .gr-fondo { fill: #2a2a2a; }
:root[data-theme="dark"][data-graficas="cuadricula"] .sp-grafica .gr-rejilla { stroke: #444444; }
:root[data-theme="dark"][data-graficas="presentacion"] .sp-grafica { --btn-oro-texto: #e2b552; --g-s2: #e2b552; --g-s5: #e2b552; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"])[data-graficas="minimalista"] .sp-grafica { --btn-oro-texto: #bdbdbd; --btn-oro-suave: #333333; --g-s2: #bdbdbd; --g-s5: #bdbdbd; }
  :root:not([data-theme="light"])[data-graficas="cuadricula"] .sp-grafica { --btn-oro-texto: #8cbbe6; --btn-oro-suave: #25384b; --g-s2: #8cbbe6; --g-s5: #8cbbe6; }
  :root:not([data-theme="light"])[data-graficas="cuadricula"] .sp-grafica .gr-fondo { fill: #2a2a2a; }
  :root:not([data-theme="light"])[data-graficas="cuadricula"] .sp-grafica .gr-rejilla { stroke: #444444; }
  :root:not([data-theme="light"])[data-graficas="presentacion"] .sp-grafica { --btn-oro-texto: #e2b552; --g-s2: #e2b552; --g-s5: #e2b552; }
}

/* el selector de tema, junto a las gráficas */
.graf-tema { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 var(--sp-2); font-size: var(--fs-sm); }
.graf-tema select { font: inherit; font-size: var(--fs-sm); padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--bg); color: var(--text); }

/* ilustraciones de los análisis en el catálogo */
.cat-cab { display: flex; align-items: center; gap: 10px; }
.cat-ilus { width: 58px; height: 36px; flex: none; color: var(--text-muted); background: var(--bg-soft); border-radius: 8px; padding: 2px; }
.cat-tarjeta.activo .cat-ilus { background: var(--card-bg); }
.cat-tarjeta.e-falta .cat-ilus { opacity: .6; }
.cat-rec-btn .cat-ilus { width: 72px; height: 45px; background: var(--btn-oro-suave); }

/* enlace a la ficha de Fundamentos en cada tarjeta del catálogo */
.cat-tarjeta { position: relative; }
.cat-tarjeta .cat-cab { padding-right: 24px; }   /* el nombre no pasa por debajo del ⓘ (.cat-fund) */
.cat-fund { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; text-decoration: none;
  color: var(--text-muted); background: var(--card-bg); border: 1px solid var(--border); font-size: 14px; line-height: 1; }
.cat-fund:hover { color: var(--btn-oro-texto); border-color: var(--btn-oro-texto); }
.cat-fund:focus-visible { outline: 2px solid var(--btn-oro-texto); outline-offset: 2px; }
.exp-ficha { margin-left: auto; }

/* ================= el glosario (hito 5.5, js/interfaz/glosario.js) ================= */
dialog.sp-gl { width: min(980px, calc(100vw - 32px)); height: min(760px, calc(100vh - 48px)); }
dialog.sp-gl[open] { display: flex; flex-direction: column; }
.sp-gl .dialog-head { gap: var(--sp-2); }
.sp-gl-atajo { font-size: var(--fs-xs); color: var(--text-muted); }
.sp-gl-busca { display: flex; flex-wrap: wrap; gap: var(--sp-2); padding: var(--sp-3) var(--sp-5) 0; }
.sp-gl-q { flex: 1 1 260px; }
.sp-gl-q input { width: 100%; }
.sp-gl-grupo { flex: 0 1 280px; }
.sp-gl-grupo select { width: 100%; }
.sp-gl-cuenta { margin: var(--sp-2) var(--sp-5) var(--sp-2); }
.sp-gl-cuerpo { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(220px, 36%) minmax(0, 1fr); border-top: 1px solid var(--border); }
.sp-gl-lista { list-style: none; margin: 0; padding: var(--sp-2); overflow: auto; border-right: 1px solid var(--border); }
.sp-gl-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 8px; width: 100%; text-align: left; padding: 7px 10px; border: 0; border-radius: var(--r-sm); background: none; color: var(--text); font: inherit; cursor: pointer; }
.sp-gl-item:hover { background: var(--bg-soft); }
.sp-gl-item[aria-current="true"] { background: var(--btn-oro-suave); box-shadow: inset 3px 0 0 var(--btn-oro); }
.sp-gl-nom { font-weight: 600; }
.sp-gl-item .sp-gl-sim { justify-self: end; color: var(--btn-oro-texto); font-family: Georgia, 'Times New Roman', serif; font-style: italic; }
.sp-gl-item .sp-gl-gru { grid-column: 1 / -1; font-size: var(--fs-xs); color: var(--text-muted); }
.sp-gl-nada { padding: var(--sp-3); color: var(--text-muted); }
.sp-gl-ficha { padding: var(--sp-4) var(--sp-5); overflow: auto; }
.sp-gl-ficha:focus { outline: none; }
.sp-gl-ficha:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
.sp-gl-tit { margin: 0; font-size: var(--fs-xl); }
.sp-gl-tit .sp-gl-sim { color: var(--btn-oro-texto); font-family: Georgia, 'Times New Roman', serif; font-style: italic; font-weight: 400; margin-left: 6px; }
.sp-gl-ficha > .sp-gl-gru { margin: 2px 0 var(--sp-3); font-size: var(--fs-sm); color: var(--text-muted); }
.sp-gl-que { font-size: var(--fs-base); line-height: var(--lh-base); max-width: 62ch; }
.sp-gl-accion { margin: var(--sp-4) 0; padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg-soft); }
.sp-gl-accion p { margin: var(--sp-2) 0 0; }
.sp-gl-otros { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.sp-gl-donde, .sp-gl-rel { font-size: var(--fs-sm); line-height: 1.7; }
.sp-gl-rel .btn { margin: 0 4px 4px 0; }
.sp-gl-volver { display: none; margin-bottom: var(--sp-2); }
@media (max-width: 720px) {
  dialog.sp-gl { width: calc(100vw - 16px); height: calc(100vh - 16px); max-height: none; }
  .sp-gl-busca { padding: var(--sp-3) var(--sp-3) 0; }
  .sp-gl-cuenta { margin: var(--sp-2) var(--sp-3); }
  .sp-gl-cuerpo { grid-template-columns: minmax(0, 1fr); }
  .sp-gl-lista { border-right: 0; }
  .sp-gl-ficha { display: none; padding: var(--sp-3); }
  .sp-gl.sp-gl-detalle .sp-gl-lista { display: none; }
  .sp-gl.sp-gl-detalle .sp-gl-ficha { display: block; }
  .sp-gl-volver { display: inline-flex; }
}
/* lo que «Ver en acción» señala en el resultado */
.sp-gl-marca { outline: 3px solid var(--btn-oro); outline-offset: -3px; background-color: var(--btn-oro-suave); animation: sp-gl-pulso 1.1s ease-in-out 3; }
tr.sp-gl-marca > th, tr.sp-gl-marca > td { background-color: var(--btn-oro-suave); }
@keyframes sp-gl-pulso { 50% { outline-color: transparent; } }
@media (prefers-reduced-motion: reduce) { .sp-gl-marca { animation: none; } }
.lg-glosario { margin: var(--sp-2) 0 0; }

/* ================= Inicio: tres caminos y lo último que se analizó (hito 5.7) ================= */
.caminos { margin: var(--sp-6) 0 var(--sp-5); }
.caminos-t { font-size: var(--fs-xl); margin: 0 0 var(--sp-3); }
.caminos-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: var(--sp-4); }
.camino { position: relative; display: flex; flex-direction: column; gap: var(--sp-2); padding-top: var(--sp-5); }
.camino h3 { margin: 0; font-size: var(--fs-lg); }
.camino p { margin: 0; color: var(--text-muted); flex: 1 1 auto; }
.camino .btn-row { margin-top: var(--sp-2); }
.camino-num { position: absolute; top: calc(-1 * var(--sp-3)); left: var(--sp-4); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--btn-negro); color: var(--btn-negro-texto); box-shadow: var(--shadow-sm); }
.ini-historial { margin: 0 0 var(--sp-5); }
.ini-hist-cab { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.ini-hist-cab h3 { margin: 0; flex: 1 1 auto; }
.ini-historial > .small { margin: 4px 0 var(--sp-2); }
.ini-hist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.ini-hist-item { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: var(--r-sm); background: none; color: var(--text); font: inherit; cursor: pointer; }
.ini-hist-item:hover { background: var(--bg-soft); }
.ini-hist-nom { font-weight: 600; }
.ini-hist-det { font-size: var(--fs-sm); color: var(--text-muted); overflow-wrap: anywhere; }
.ana-historial { margin-left: var(--sp-2); vertical-align: middle; }
#expVacio .btn-row, #anaVacio .btn-row { justify-content: center; }
#expoResumen .btn { margin-left: 6px; }
.caminos-grid > .card { margin: 0; }

/* ================= el árbol de decisiones (hito 5.7, js/interfaz/arbol.js) ================= */
.fun-arbol-intro { flex: 1 1 320px; margin: 0; color: var(--text-muted); font-size: var(--fs-sm); align-self: center; }
.arb-barra { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); margin: 0 0 var(--sp-3); }
.arb-migas { margin: 0; flex: 1 1 auto; font-size: var(--fs-sm); }
.arb-migas b { margin-right: 4px; }
.arb-cols { position: relative; display: flex; align-items: flex-start; gap: 44px; overflow-x: auto; padding: 4px 4px var(--sp-4); }
.arb-lineas { position: absolute; left: 0; top: 0; max-width: none; pointer-events: none; overflow: visible; }
.arb-linea { fill: none; stroke: var(--btn-oro); stroke-width: 2.5; stroke-linecap: round; }
.arb-col { position: relative; flex: 1 1 220px; min-width: 200px; max-width: 300px; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-3); box-shadow: var(--shadow-sm); }
.arb-col.arb-hoja { flex: 1.4 1 280px; min-width: 250px; max-width: 400px; border-color: var(--btn-oro); }
.arb-q { margin: 0 0 4px; font-size: var(--fs-md); }
.arb-q:focus { outline: none; }
.arb-q:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: 4px; }
.arb-ayuda { margin: 0 0 var(--sp-2); font-size: var(--fs-xs); color: var(--text-muted); }
.arb-ops, .arb-mets { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.arb-op { display: grid; width: 100%; text-align: left; gap: 2px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg); color: var(--text); font: inherit; cursor: pointer; }
.arb-op:hover { border-color: var(--btn-oro); }
.arb-op[aria-pressed="true"] { background: var(--btn-oro-suave); border-color: var(--btn-oro); box-shadow: inset 3px 0 0 var(--btn-oro); }
.arb-op-t { font-weight: 600; }
.arb-op-hoja .arb-op-t::after { content: ' →'; color: var(--btn-oro-texto); }
.arb-op-d { font-size: var(--fs-xs); color: var(--text-muted); }
.arb-met { padding: var(--sp-2) var(--sp-3); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg); }
.arb-met.arb-marca { border-color: var(--btn-oro); box-shadow: 0 0 0 3px var(--btn-oro-suave); }
.arb-met p { margin: 0 0 4px; }
.arb-met-n { font-weight: 700; }
.arb-met-c { font-size: var(--fs-sm); color: var(--btn-oro-texto); }
.arb-met-p { font-size: var(--fs-sm); color: var(--text-muted); }
.arb-met .btn-row { margin-top: 6px; gap: 4px; }
@media (max-width: 720px) {
  .arb-cols { flex-direction: column; align-items: stretch; gap: var(--sp-3); overflow-x: visible; }
  .arb-col, .arb-col.arb-hoja { flex-basis: auto; min-width: 0; max-width: none; }
  .arb-lineas { display: none; }
  .arb-col + .arb-col::before { content: '↓'; position: absolute; top: calc(-1 * var(--sp-3) - 2px); left: 50%; transform: translate(-50%, -50%); color: var(--btn-oro-texto); font-weight: 700; }
}

/* ================= ayudas emergentes y recorridos (hito 5.7) ================= */
.sp-ayuda { position: absolute; z-index: calc(var(--z-dialog) + 5); max-width: 320px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--btn-negro); color: #F3EEE3; font-size: var(--fs-sm); line-height: 1.45; box-shadow: var(--shadow); pointer-events: auto; }
.sp-ayuda-g { display: block; margin-top: 4px; font-size: var(--fs-xs); color: var(--btn-negro-texto); }
.caminos-cab { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--sp-2) var(--sp-3); margin: 0 0 var(--sp-3); }
.caminos-cab .caminos-t { margin: 0; }
.panel-title .sp-recorrido { align-self: flex-end; }
.sp-tour-luz { position: fixed; z-index: calc(var(--z-dialog) + 1); border-radius: var(--r-md); box-shadow: 0 0 0 9999px rgba(10, 14, 24, .45); outline: 3px solid var(--btn-oro); outline-offset: 0; pointer-events: none; transition: all var(--dur) var(--ease); }
.sp-tour { position: fixed; z-index: calc(var(--z-dialog) + 2); width: min(360px, calc(100vw - 24px)); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--btn-oro); border-radius: var(--r-lg); background: var(--card-bg); color: var(--text); box-shadow: var(--shadow-lg); }
.sp-tour-paso { margin: 0 0 4px; font-size: var(--fs-xs); color: var(--btn-oro-texto); font-weight: 700; letter-spacing: .03em; }
.sp-tour-t { margin: 0 0 6px; font-size: var(--fs-lg); }
.sp-tour-t:focus { outline: none; }
.sp-tour-t:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: 4px; }
.sp-tour-x { margin: 0 0 var(--sp-3); line-height: var(--lh-base); }
.sp-tour-botones { align-items: center; gap: 6px; }
.sp-tour-hueco { flex: 1 1 auto; }
@media (prefers-reduced-motion: reduce) { .sp-tour-luz { transition: none; } }

/* ================= errores en palabras y modo presentación (hito 5.7) ================= */
.sp-error p { margin: 0 0 6px; }
.sp-error .sp-error-a { margin-top: 8px; }
.sp-error-d { margin-top: 8px; font-size: var(--fs-sm); }
.sp-error-d pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--fs-xs); margin: 6px 0; padding: 8px; border-radius: var(--r-sm); background: var(--bg-soft); color: var(--text); }
.sp-pres { position: fixed; inset: 0; z-index: calc(var(--z-dialog) + 10); display: flex; flex-direction: column; background: var(--bg); color: var(--text); }
.sp-pres-barra { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-4); border-bottom: 1px solid var(--border); background: var(--card-bg); }
.sp-pres-seccion { flex: 1 1 auto; font-weight: 700; color: var(--btn-oro-texto); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-pres-cuenta { font-size: var(--fs-sm); color: var(--text-muted); margin-right: var(--sp-2); white-space: nowrap; }
.sp-pres-escena { flex: 1 1 auto; overflow: auto; display: flex; align-items: center; justify-content: center; padding: var(--sp-6) var(--sp-8); }
.sp-pres-parte { width: min(1200px, 100%); font-size: clamp(1.1rem, 1.6vw, 1.6rem); }
.sp-pres-parte .sp-claro, .sp-pres-parte .exp-conclusion { font-size: inherit; }
.sp-pres-parte .sp-claro li, .sp-pres-parte .exp-conclusion p { line-height: 1.5; }
.sp-pres-parte table { font-size: inherit; width: 100%; }
.sp-pres-parte figure { margin: 0 auto; }
.sp-pres-parte figcaption { font-size: .8em; }
.sp-pres-parte figure svg { width: 100%; height: auto; max-height: 72vh; }
.sp-pres-parte .pie-cuadro { font-size: .7em; }
.sp-pres-titulo { margin: 0; font-size: clamp(2rem, 4vw, 3.4rem); text-align: center; }
html.sp-presentando { overflow: hidden; }
@media (max-width: 720px) { .sp-pres-escena { padding: var(--sp-3); } }
