/* ==========================================================================
   Observatorio de Vulnerabilidad Social — sistema visual
   Concepto: cuaderno de campo cartográfico (papel, tinta, curvas de nivel)
   ========================================================================== */

@font-face { font-family: "Fraunces"; src: url("../fonts/fraunces-latin-wght-normal.woff2") format("woff2"); font-weight: 300 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("../fonts/fraunces-latin-wght-italic.woff2") format("woff2"); font-weight: 300 900; font-style: italic; font-display: swap; }
@font-face { font-family: "Plex"; src: url("../fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex"; src: url("../fonts/ibm-plex-sans-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Plex"; src: url("../fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Plex"; src: url("../fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "PlexMono"; src: url("../fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "PlexMono"; src: url("../fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); font-weight: 500 700; font-display: swap; }

:root {
  --paper: #f5f1e8;
  --surface: #fffdf8;
  --surface-2: #faf6ed;
  --ink: #1d2b2f;
  --ink-2: #435259;
  --muted: #66737a;
  --line: #e6dfd0;
  --line-2: #d5cab3;
  --pine: #12343b;
  --pine-2: #1b4850;
  --pine-3: #2a5e66;
  --teal: #009683;
  --terra: #e35b2c;
  --terra-ink: #b8441b;
  --ochre: #c99400;
  --blue: #3366e0;
  --plum: #b54790;
  --olive: #5a9e22;
  --risk-bajo: #d99a2b;
  --risk-medio: #cf5a26;
  --risk-alto: #962a2a;
  --ok: #2e7d4f;
  --warn: #a86a00;
  --err: #b3261e;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 0 rgba(29, 43, 47, .04), 0 10px 30px -18px rgba(18, 52, 59, .35);
  --shadow-lg: 0 30px 80px -30px rgba(18, 52, 59, .55);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Plex", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "PlexMono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --rail: 268px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--sans); font-size: 15px; line-height: 1.55; color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
img, svg, canvas { display: block; max-width: 100%; }
a { color: var(--pine-2); text-underline-offset: 3px; }
a:hover { color: var(--terra-ink); }
h1, h2, h3 { font-family: var(--serif); font-weight: 560; letter-spacing: -.01em; margin: 0; color: var(--ink); font-variation-settings: "opsz" 72, "SOFT" 30; }
p { margin: 0 0 .8em; }
.mono { font-family: var(--mono); font-feature-settings: "zero" 1; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
:focus-visible { outline: 2.5px solid var(--terra); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--pine); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 12px; }
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 4px; }
.eyebrow--light { color: rgba(245, 241, 232, .7); }
.ic { width: 18px; height: 18px; flex: none; }

/* ---------- Botones e inputs ---------- */
.btn { --b: var(--pine); display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 500 14px/1 var(--sans); padding: 11px 16px; border-radius: 999px; border: 1px solid transparent; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .08s, box-shadow .15s; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn .ic { width: 16px; height: 16px; }
.btn--primary { background: var(--pine); color: #fffdf8; }
.btn--primary:hover { background: var(--pine-2); color: #fff; }
.btn--accent { background: var(--terra-ink); color: #fff; }
.btn--accent:hover { background: #a03b16; color: #fff; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn--ghost:hover { background: var(--surface-2); border-color: var(--ink-2); color: var(--ink); }
.btn--danger { background: var(--err); color: #fff; }
.btn--sm { padding: 8px 12px; font-size: 13px; }
.btn--lg { padding: 15px 22px; font-size: 15px; }
.btn--block { width: 100%; }
.btn[disabled], .btn.is-busy { opacity: .55; pointer-events: none; }
.iconbtn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: inherit; cursor: pointer; }
.iconbtn:hover { background: rgba(0, 0, 0, .06); }

.input { width: 100%; font: 400 15px/1.4 var(--sans); color: var(--ink); background: #fff; border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 11px 13px; transition: border-color .15s, box-shadow .15s; }
.input:hover { border-color: #b9ac92; }
.input:focus { outline: none; border-color: var(--pine-3); box-shadow: 0 0 0 4px rgba(42, 94, 102, .14); }
.input[disabled] { background: var(--surface-2); color: var(--ink-2); }
.input--area { resize: vertical; min-height: 90px; }
.input--short { max-width: 120px; }
.input--tiny { width: 70px; padding: 6px 8px; text-align: right; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field--inline { margin: 0; min-width: 150px; }
.field__label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field__help { font-size: 12.5px; color: var(--muted); }
.field__error, .q__error { color: var(--err); font-size: 13px; min-height: 0; margin: 0; }
.field__error:empty, .q__error:empty { display: none; }
.is-invalid .input, .input.is-invalid { border-color: var(--err); box-shadow: 0 0 0 3px rgba(179, 38, 30, .1); }
.pwd { position: relative; display: flex; gap: 8px; align-items: center; }
.pwd .input { flex: 1; }
.pwd__toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; padding: 8px; color: var(--muted); cursor: pointer; border-radius: 8px; }
.pwd__toggle:hover { color: var(--ink); }
.meter { height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--err); transition: width .2s, background .2s; }
.form__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.switch { display: inline-flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; user-select: none; margin: 4px 0; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch span { width: 36px; height: 21px; border-radius: 99px; background: var(--line-2); position: relative; transition: background .15s; flex: none; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 15px; height: 15px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s; }
.switch input:checked + span { background: var(--pine-3); }
.switch input:checked + span::after { transform: translateX(15px); }
.switch input:focus-visible + span { outline: 2.5px solid var(--terra); outline-offset: 2px; }

.notice { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 14px; border: 1px solid var(--line-2); background: var(--surface-2); margin-bottom: 16px; }
.notice--info { background: #eef4f3; border-color: #c9dcd8; }
.notice--warn { background: #fbf1dc; border-color: #ecd29c; }
.notice--error { background: #fbe9e6; border-color: #efbdb5; color: #7c1d16; }
.notice--ok { background: #e8f3ec; border-color: #b9dbc5; }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 5px 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.badge .ic { width: 14px; height: 14px; }
.pill { display: inline-block; font-size: 11.5px; font-weight: 500; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); }
.pill--ok { background: #e8f3ec; border-color: #b9dbc5; color: #1f5a37; }
.pill--off { background: #f1ede6; color: var(--muted); }
.pill--warn { background: #fbf1dc; border-color: #ecd29c; color: #7a4d00; }
.role { display: inline-block; font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; background: rgba(0, 0, 0, .06); }
.role--admin { background: #f6dcd2; color: #7d2c0f; }
.role--profesor { background: #d7ebe7; color: #0d4a42; }
.role--encuestado { background: #e8e1f2; color: #4a2c74; }
.lvl { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: 13px; }
.lvl::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: currentColor; }
.lvl--Bajo { color: #9a6a12; }
.lvl--Medio { color: #b4471b; }
.lvl--Alto { color: var(--risk-alto); }
.lvl--Bajo::before { background: var(--risk-bajo); }
.lvl--Medio::before { background: var(--risk-medio); }
.lvl--Alto::before { background: var(--risk-alto); }

/* ---------- Estructura de la aplicación ---------- */
.rail { position: fixed; inset: 0 auto 0 0; width: var(--rail); background: var(--pine); color: #e8eeec; display: flex; flex-direction: column; z-index: 40; overflow: hidden; }
.rail::before { content: ""; position: absolute; inset: 0; background: url("../img/contours-light.svg") center/cover no-repeat; opacity: .16; pointer-events: none; }
.rail > * { position: relative; }
.rail__brand { padding: 22px 20px 14px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand__mark { width: 40px; height: 40px; border-radius: 11px; background: rgba(255, 253, 248, .08); border: 1px solid rgba(255, 253, 248, .14); display: grid; place-items: center; flex: none; }
.brand__mark svg { width: 30px; height: 30px; fill: none; stroke: #f5f1e8; stroke-width: 2.2; stroke-linecap: round; }
.brand__mark svg path:nth-child(2) { opacity: .7; }
.brand__mark svg path:nth-child(3) { opacity: .45; }
.brand__mark svg circle { fill: var(--terra); stroke: none; }
.brand__text { display: flex; flex-direction: column; line-height: 1.2; }
.brand__text b { font-family: var(--serif); font-size: 19px; font-weight: 600; color: #fffdf8; letter-spacing: -.01em; }
.brand__text span { font-size: 11.5px; color: rgba(232, 238, 236, .7); }
.brand--dark { color: var(--ink); }
.brand--dark .brand__mark { background: var(--pine); border-color: var(--pine); }
.brand--dark .brand__text b { color: var(--ink); }
.brand--dark .brand__text span { color: var(--muted); }
.brand--sm .brand__mark { width: 34px; height: 34px; }
.brand--sm .brand__text b { font-size: 16px; }
.rail__nav { flex: 1; overflow-y: auto; padding: 6px 12px 16px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .2) transparent; }
.rail__group { font-family: var(--mono); font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: rgba(232, 238, 236, .5); margin: 18px 10px 6px; }
.rail__nav ul { list-style: none; margin: 0; padding: 0; }
.rail__nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 10px; color: rgba(240, 244, 242, .86); text-decoration: none; font-size: 14px; position: relative; transition: background .12s, color .12s; }
.rail__nav a .ic { opacity: .75; }
.rail__nav a:hover { background: rgba(255, 253, 248, .07); color: #fff; }
.rail__nav a.is-active { background: #fffdf8; color: var(--pine); font-weight: 500; }
.rail__nav a.is-active .ic { opacity: 1; color: var(--terra-ink); }
.rail__foot { border-top: 1px solid rgba(255, 255, 255, .1); padding: 14px 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who__avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--terra); color: #fff; display: grid; place-items: center; font-family: var(--serif); font-weight: 600; flex: none; }
.who__meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; gap: 3px; }
.who__meta b { font-size: 13px; font-weight: 500; color: #fffdf8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who .role { background: rgba(255, 255, 255, .12); color: #e8eeec; align-self: flex-start; }
.rail__actions { display: flex; gap: 2px; }
.rail__actions form { margin: 0; }
.rail__actions .iconbtn { color: #e8eeec; }
.rail__actions .iconbtn:hover { background: rgba(255, 255, 255, .1); }

.shell { margin-left: var(--rail); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 16px 32px; background: rgba(245, 241, 232, .9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar__menu { display: none; }
.topbar__title { flex: 1; min-width: 0; }
.topbar h1 { font-size: 27px; line-height: 1.15; }
.topbar__right { display: flex; gap: 10px; align-items: center; }
.badge--ro { background: #fff; }
.main { flex: 1; padding: 24px 32px 40px; outline: none; }
.foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 14px 32px 22px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }

/* ---------- Tarjetas y rejillas ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); margin-bottom: 20px; min-width: 0; }
.card__head { margin-bottom: 16px; }
.card__head h2 { font-size: 19px; line-height: 1.25; }
.card__head p { color: var(--muted); font-size: 13.5px; margin: 5px 0 0; }
.card__head--row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 20px; }
.grid > .card { margin-bottom: 0; }
.grid + .card, .card + .grid, .grid + .grid { margin-top: 20px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--2-1 { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.grid--tight { gap: 12px; }
.page { max-width: 1400px; }
.page--narrow { max-width: 560px; }

.chart { position: relative; width: 100%; }
.chart--md { height: 300px; }
.chart--lg { height: 420px; }
.chart--sm { height: 220px; }

/* ---------- Filtros ---------- */
.filters { position: sticky; top: 77px; z-index: 20; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); margin-bottom: 22px; display: grid; gap: 12px; }
.filters--inline { position: static; box-shadow: none; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 0 0 16px; border: 0; background: none; }
.filters__search { position: relative; }
.filters__search .ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input--search { padding-left: 40px; border-radius: 999px; background: var(--surface-2); }
.filters__row { display: flex; flex-wrap: wrap; gap: 8px; }
.fsel { position: relative; }
.fsel select { font: 500 13px/1 var(--sans); color: var(--ink-2); padding: 8px 30px 8px 12px; border-radius: 999px; border: 1px solid var(--line-2); background-color: #fff; min-width: 120px; max-width: 230px; }
.fsel.is-on select { background-color: var(--pine); color: #fff; border-color: var(--pine); background-image: linear-gradient(45deg, transparent 50%, #fff 50%), linear-gradient(135deg, #fff 50%, transparent 50%); }
.filters__meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filters__count { flex: 1; font-size: 13px; color: var(--ink-2); }
.filters__count b { font-family: var(--serif); font-size: 18px; color: var(--ink); font-weight: 600; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpis--sm { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 14px; position: relative; overflow: hidden; box-shadow: var(--shadow); }
.kpi::after { content: ""; position: absolute; right: -40px; top: -40px; width: 130px; height: 130px; background: url("../img/contours-dark.svg") center/220% no-repeat; opacity: .5; pointer-events: none; }
.kpi__label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; margin: 0 0 8px; position: relative; }
.kpi__value { font-family: var(--serif); font-size: 38px; line-height: 1; font-weight: 560; letter-spacing: -.02em; font-variation-settings: "opsz" 144; color: var(--ink); }
.kpi__value small { font-size: 19px; font-weight: 500; margin-left: 2px; color: var(--ink-2); }
.kpi__sub { margin: 9px 0 0; font-size: 12px; color: var(--muted); font-family: var(--mono); }
.kpi--alert { background: linear-gradient(180deg, #fff 0%, #fdf2ee 100%); border-color: #f0cfc2; }
.kpi--alert .kpi__value { color: var(--risk-alto); }
.kpi--dark { background: var(--pine); border-color: var(--pine); }
.kpi--dark .kpi__label, .kpi--dark .kpi__sub { color: rgba(240, 244, 242, .75); }
.kpi--dark .kpi__value, .kpi--dark .kpi__value small { color: #fffdf8; }
.kpi--dark::after { background-image: url("../img/contours-light.svg"); opacity: .25; }

/* Barra segmentada de niveles */
.levelbar { margin-bottom: 18px; }
.levelbar__track { display: flex; gap: 3px; height: 42px; border-radius: 10px; overflow: hidden; }
.levelbar__seg { display: flex; align-items: center; padding: 0 12px; color: #fff; font-weight: 600; font-size: 13.5px; min-width: 0; white-space: nowrap; transition: flex-grow .4s ease; }
.levelbar__seg--Bajo { background: var(--risk-bajo); color: #2b1c02; }
.levelbar__seg--Medio { background: var(--risk-medio); }
.levelbar__seg--Alto { background: var(--risk-alto); }
.levelbar__legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; font-size: 13px; color: var(--ink-2); }
.levelbar__legend span.mono { color: var(--muted); font-size: 12px; }

/* Hallazgos */
.findings { list-style: none; counter-reset: f; padding: 0; margin: 0; display: grid; gap: 14px; }
.findings li { counter-increment: f; display: grid; grid-template-columns: 30px 1fr; gap: 10px; font-size: 14px; line-height: 1.5; }
.findings li::before { content: counter(f, decimal-leading-zero); font-family: var(--mono); font-size: 12px; color: var(--terra-ink); padding-top: 2px; }
.findings b { font-weight: 600; }
.card--findings { background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%); }

/* ---------- Tablas ---------- */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.tbl, .dt { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td, .dt th, .dt td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tbl thead th, .dt thead th { background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--ink-2); position: sticky; top: 0; z-index: 1; white-space: nowrap; }
.tbl tbody tr:hover, .dt tbody tr:hover { background: #fbf7ef; }
.tbl--compact th, .tbl--compact td { padding: 6px 10px; }
.tbl tbody th { font-weight: 500; color: var(--ink-2); width: 46%; }
.card > .tbl, .card > div > .tbl { border: 1px solid var(--line); border-radius: var(--radius-sm); }
.dt tbody tr { cursor: pointer; }
.dt tbody tr.is-annulled { opacity: .55; text-decoration: line-through; text-decoration-color: rgba(0, 0, 0, .3); }
.dt th[data-sort] { cursor: pointer; user-select: none; }
.dt th[data-sort]::after { content: " ↕"; color: var(--line-2); }
.dt th.sort-asc::after { content: " ↑"; color: var(--terra-ink); }
.dt th.sort-desc::after { content: " ↓"; color: var(--terra-ink); }
.dt td.code { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
mark { background: #ffe7a3; color: inherit; border-radius: 3px; padding: 0 2px; }
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding-top: 14px; flex-wrap: wrap; }
.pager .muted { margin-right: auto; font-size: 13px; }
.ci { display: inline-block; position: relative; width: 120px; height: 14px; vertical-align: middle; }
.ci__track { position: absolute; left: 0; right: 0; top: 6px; height: 2px; background: var(--line); }
.ci__range { position: absolute; top: 3px; height: 8px; background: rgba(0, 150, 131, .28); border-radius: 4px; }
.ci__dot { position: absolute; top: 2px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 2px var(--surface); }
.cv { font-family: var(--mono); font-size: 11.5px; padding: 2px 7px; border-radius: 6px; white-space: nowrap; }
.cv--a { background: #e3f0e8; color: #1f5a37; }
.cv--b { background: #eef4f3; color: #0d4a42; }
.cv--c { background: #fbf1dc; color: #7a4d00; }
.cv--d { background: #fbe9e6; color: #7c1d16; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 10px; margin-top: 14px; }
.stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
.stat b { display: block; font-family: var(--serif); font-size: 21px; font-weight: 560; }
.stat span { font-size: 11.5px; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(0, 0, 0, .12); }
.bars { display: grid; gap: 7px; }
.bars__row { display: grid; grid-template-columns: minmax(120px, 1.2fr) 2fr 56px; gap: 10px; align-items: center; font-size: 13px; }
.bars__track { height: 10px; background: var(--line); border-radius: 6px; overflow: hidden; }
.bars__fill { height: 100%; background: var(--teal); border-radius: 6px; }
.bars__fill--warn { background: var(--risk-medio); }

/* Segmentado */
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; padding: 3px; background: #fff; gap: 2px; flex-wrap: wrap; }
.seg__btn { font: 500 12.5px/1 var(--sans); border: 0; background: transparent; padding: 7px 12px; border-radius: 999px; color: var(--ink-2); cursor: pointer; }
.seg__btn.is-on { background: var(--pine); color: #fff; }
.crossctl { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.crossctl select { min-width: 260px; }
.testbox { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 14px 0; }
.testbox .stat b { font-size: 19px; }

/* Mapa */
.card--map { padding-bottom: 16px; }
.map { height: 560px; border-radius: var(--radius-sm); border: 1px solid var(--line); overflow: hidden; background: #e9e4d8; }
.leaflet-container { font-family: var(--sans); }
.leaflet-popup-content { font-size: 13px; line-height: 1.45; }
.leaflet-popup-content b { font-family: var(--serif); font-size: 15px; }

/* Vistas */
.view { animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.loading { display: flex; align-items: center; gap: 12px; padding: 40px; justify-content: center; color: var(--muted); }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--line-2); border-top-color: var(--terra); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.prose { max-width: 980px; }
.prose h2 { font-size: 21px; margin: 26px 0 10px; }
.prose h2:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 20px; margin: 0 0 12px; }
.prose li { margin-bottom: 7px; }
.prose .tbl { max-width: 560px; margin: 8px 0 14px; }
.refs { font-size: 13.5px; }
.refs li { padding-left: 4px; }
.card--doc .tbl th { width: 34%; }

/* Cajón de detalle */
.drawer { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.drawer__scrim { position: absolute; inset: 0; background: rgba(18, 52, 59, .35); opacity: 0; transition: opacity .2s; }
.drawer__panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(720px, 100%); background: var(--surface); box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform .28s cubic-bezier(.2, .8, .2, 1); display: flex; flex-direction: column; }
.drawer.is-open { pointer-events: auto; }
.drawer.is-open .drawer__scrim { opacity: 1; }
.drawer.is-open .drawer__panel { transform: none; }
.drawer__head { display: flex; justify-content: space-between; gap: 12px; padding: 20px 24px 12px; border-bottom: 1px solid var(--line); }
.drawer__head h2 { font-size: 24px; }
.drawer__actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 24px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.drawer__body { overflow-y: auto; padding: 18px 24px 40px; }
.drawer__body h3 { font-size: 16px; margin: 22px 0 8px; display: flex; gap: 8px; align-items: baseline; }
.drawer__body h3 .mono { font-size: 11px; color: var(--terra-ink); }
.kv { display: grid; grid-template-columns: minmax(180px, 44%) 1fr; border-top: 1px solid var(--line); font-size: 13.5px; }
.kv > div { padding: 7px 0; border-bottom: 1px solid var(--line); }
.kv > div:nth-child(odd) { color: var(--ink-2); padding-right: 12px; }
.kv .empty { color: var(--muted); font-style: italic; }
.scorecard { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.scorecard .stat b { font-size: 26px; }
.flags { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.flags li { font-size: 13px; padding: 8px 10px; background: #fbf1dc; border-radius: 8px; border: 1px solid #ecd29c; }
.flags code { font-family: var(--mono); font-size: 11.5px; }
.hist { display: grid; gap: 10px; }
.hist__item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.hist__item header { display: flex; justify-content: space-between; gap: 8px; color: var(--ink-2); margin-bottom: 4px; }
.diff { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px; }
.diff th, .diff td { padding: 4px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.diff__old { color: #7c1d16; background: #fdf0ee; }
.diff__new { color: #1f5a37; background: #eef7f1; }
.tbl--audit td { font-size: 13px; }
.tbl--audit details summary { cursor: pointer; color: var(--pine-2); }
.act { font-family: var(--mono); font-size: 11.5px; padding: 3px 7px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap; }
.act--editar_registro, .act--anular_registro, .act--editar_matriz_ivs, .act--editar_ficha_tecnica { background: #fbf1dc; border-color: #ecd29c; }
.act--login_fallido, .act--login_bloqueado, .act--acceso_denegado { background: #fbe9e6; border-color: #efbdb5; }
.act--crear_registro, .act--restaurar_registro, .act--login { background: #e8f3ec; border-color: #b9dbc5; }
.hash { color: var(--muted); }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; pointer-events: none; opacity: 0; transition: opacity .15s; padding: 16px; }
.modal.is-open { pointer-events: auto; opacity: 1; }
.modal__scrim { position: absolute; inset: 0; background: rgba(18, 52, 59, .45); }
.modal__box { position: relative; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 24px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; }
.modal__box h2 { font-size: 21px; margin-bottom: 14px; }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 90; max-width: calc(100% - 32px); box-shadow: var(--shadow-lg); }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast--error { background: var(--err); }
.toast--ok { background: #1f5a37; }

/* ---------- Ingreso ---------- */
.login { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(420px, .9fr); min-height: 100vh; }
.login__art { position: relative; background: var(--pine); color: #f5f1e8; overflow: hidden; display: flex; align-items: flex-end; padding: 56px; }
.login__contours { position: absolute; inset: -5%; background: url("../img/contours-light.svg") center/cover no-repeat; opacity: .9; animation: drift 60s ease-in-out infinite alternate; }
@keyframes drift { from { transform: scale(1.02) translate(0, 0); } to { transform: scale(1.08) translate(-1.5%, 1%); } }
@media (prefers-reduced-motion: reduce) { .login__contours, .view { animation: none; } }
.login__art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(18, 52, 59, .1) 0%, rgba(18, 52, 59, .55) 60%, rgba(18, 52, 59, .92) 100%); }
.login__art-copy { position: relative; z-index: 1; max-width: 560px; }
.login__quote { font-family: var(--serif); font-size: clamp(34px, 4vw, 54px); line-height: 1.05; font-weight: 450; letter-spacing: -.02em; margin: 14px 0 34px; font-variation-settings: "opsz" 144, "SOFT" 60; }
.login__quote em { font-style: italic; color: #ffb48f; }
.login__facts { display: grid; grid-template-columns: repeat(3, auto); gap: 28px; margin: 0; border-top: 1px solid rgba(245, 241, 232, .25); padding-top: 18px; }
.login__facts dt { font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: rgba(245, 241, 232, .6); }
.login__facts dd { margin: 4px 0 0; font-size: 14px; }
.login__panel { display: grid; place-items: center; padding: 48px 32px; background: var(--paper); }
.login__box { width: min(400px, 100%); }
.login__title { font-size: 36px; margin: 38px 0 8px; }
.login__lead { color: var(--ink-2); font-size: 14.5px; margin-bottom: 26px; }
.login__legal { font-size: 12px; color: var(--muted); margin-top: 22px; }

/* ---------- Encuesta ---------- */
.is-survey { background: var(--paper); }
.survey__top { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 32px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 20; }
.survey__who { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); }
.survey__who form { margin: 0; }
.survey__body { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 36px; max-width: 1240px; margin: 0 auto; padding: 34px 32px 60px; }
.survey--vista .survey__body, .survey--edicion .survey__body { padding: 0; max-width: none; margin: 0; }
.trail { position: sticky; top: 100px; align-self: start; }
.survey--vista .trail, .survey--edicion .trail { top: 96px; }
.trail__title { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.trail__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; position: relative; }
.trail__list::before { content: ""; position: absolute; left: 15px; top: 14px; bottom: 14px; width: 1.5px; background: repeating-linear-gradient(var(--line-2) 0 4px, transparent 4px 8px); }
.trail__list li { display: flex; align-items: center; gap: 12px; padding: 7px 8px 7px 0; font-size: 13.5px; color: var(--ink-2); cursor: pointer; border-radius: 10px; position: relative; }
.trail__list li:hover { color: var(--ink); }
.trail__dot { width: 31px; height: 31px; border-radius: 50%; background: var(--surface); border: 1.5px solid var(--line-2); display: grid; place-items: center; font-size: 12px; flex: none; transition: all .2s; }
.trail__list li.is-done .trail__dot { background: var(--pine-3); border-color: var(--pine-3); color: #fff; }
.trail__list li.is-current { color: var(--ink); font-weight: 500; }
.trail__list li.is-current .trail__dot { background: var(--terra); border-color: var(--terra); color: #fff; box-shadow: 0 0 0 5px rgba(227, 91, 44, .16); }
.trail__list li.has-error .trail__dot { border-color: var(--err); color: var(--err); }
.trail__meter { margin-top: 22px; position: relative; }
.trail__meter svg { width: 100%; height: 52px; }
.trail__ridge { fill: none; stroke: var(--line-2); stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.trail__ridge-fill { fill: none; stroke: var(--terra); stroke-width: 2.5; stroke-linejoin: round; stroke-dasharray: 160; stroke-dashoffset: 160; transition: stroke-dashoffset .5s ease; vector-effect: non-scaling-stroke; }
.trail__pct { position: absolute; right: 0; top: -6px; font-size: 12px; color: var(--terra-ink); }
.survey__form { min-width: 0; }
.survey--captura .step { display: none; }
.survey--captura .step.is-current { display: block; animation: rise .3s ease both; }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 30px 34px; box-shadow: var(--shadow); margin-bottom: 20px; }
.step__head { margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px dashed var(--line-2); }
.step__num { font-size: 12px; color: var(--terra-ink); margin: 0 0 6px; letter-spacing: .1em; }
.step__head h2 { font-size: 30px; line-height: 1.12; }
.step__intro { color: var(--ink-2); margin: 8px 0 0; font-size: 14.5px; }
.step__fields { display: grid; gap: 26px; }
.step--audit { border-color: #ecd29c; background: #fffaf0; }
.q__label { display: block; font-weight: 500; font-size: 15.5px; color: var(--ink); margin-bottom: 4px; padding: 0; }
.q__set { border: 0; margin: 0; padding: 0; min-width: 0; }
.q__req { color: var(--terra-ink); }
.q__tag { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; padding: 2px 6px; border-radius: 5px; background: #e8e1f2; color: #4a2c74; vertical-align: 2px; margin-left: 4px; }
.q__tag--sens { background: #fbe9e6; color: #7c1d16; }
.q__help { font-size: 13px; color: var(--muted); margin: 0 0 10px; }
.q__hint { font-size: 12.5px; color: var(--muted); margin: -2px 0 10px; font-style: italic; }
.q .input { margin-top: 6px; }
.q.is-hidden { display: none; }
.q.is-invalid .choice__box { border-color: #e9b1a8; }
.q__row { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.q__rowtext { min-width: 0; }
.q__row .q__help, .q__row .q__hint { margin-bottom: 0; }
.q__decline { display: inline-flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); margin-top: 8px; cursor: pointer; }
/* Calificación 1–5 (ficha estructural) */
.q--rating { padding: 12px 0; border-bottom: 1px dashed var(--line); }
.q--rating:last-of-type { border-bottom: 0; }
.q__set--rating { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.q__set--rating .q__label { margin: 0; float: none; }
.rating { display: inline-flex; gap: 6px; }
.rating__opt { position: relative; cursor: pointer; }
.rating__opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rating__opt span { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 11px; border: 1.5px solid var(--line-2); background: #fff; font: 500 15px/1 var(--mono); color: var(--ink-2); transition: all .12s; position: relative; overflow: hidden; }
.rating__opt span::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--c, var(--line-2)); }
.rating__opt--1 span { --c: #962a2a; } .rating__opt--2 span { --c: #cf5a26; } .rating__opt--3 span { --c: #d99a2b; } .rating__opt--4 span { --c: #5a9e22; } .rating__opt--5 span { --c: #009683; }
.rating__opt--0 span { width: 52px; font-size: 12px; }
.rating__opt:hover span { border-color: #b9ac92; }
.rating__opt input:checked + span { background: var(--pine); border-color: var(--pine); color: #fff; }
.rating__opt input:focus-visible + span { outline: 2.5px solid var(--terra); outline-offset: 2px; }
.rating__opt input:disabled + span { cursor: default; }
.q.is-invalid .rating__opt span { border-color: #e9b1a8; }
.avgbox { border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 14px 16px; }
.avgbox__label { margin: 0; font-size: 12.5px; color: var(--muted); }
.avgbox__value { margin: 2px 0 6px; font-size: 26px; color: var(--pine); }
.avgbox__note { margin: 0; font-size: 12.5px; color: var(--ink-2); line-height: 1.7; }
.avgbox__note .lvl { margin-left: 6px; }
.avgbox--inline { display: flex; justify-content: space-between; align-items: center; }
.avgbox--inline span { font-size: 13px; color: var(--ink-2); }
.avgbox--inline b { font-size: 20px; color: var(--pine); }
.q__link { font-size: 12.5px; margin: 8px 0 0; color: var(--muted); }
.q__link.is-ok { color: #1f5a37; }
.q__link.is-warn { color: #7a4d00; }
mark.hl { background: #fde7a6; color: inherit; padding: 0 1px; border-radius: 2px; }
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin-top: 8px; }
.choices--pair { grid-template-columns: repeat(2, minmax(0, 200px)); }
.choices--grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.choice { position: relative; cursor: pointer; display: block; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice__box { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1.5px solid var(--line-2); border-radius: 12px; background: #fff; min-height: 50px; transition: border-color .12s, background .12s, box-shadow .12s; font-size: 14.5px; line-height: 1.3; }
.choice:hover .choice__box { border-color: #b9ac92; background: #fffcf5; }
.choice input:checked + .choice__box { border-color: var(--pine-3); background: #eef5f3; box-shadow: inset 0 0 0 1px var(--pine-3); }
.choice input:focus-visible + .choice__box { outline: 2.5px solid var(--terra); outline-offset: 2px; }
.choice input:disabled + .choice__box { cursor: default; background: var(--surface-2); }
.choice__key { width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--line-2); display: grid; place-items: center; font-size: 11px; color: var(--muted); flex: none; }
.choice__key:empty { display: none; }
.choice input:checked + .choice__box .choice__key { background: var(--pine-3); color: #fff; border-color: var(--pine-3); }
.choice__tick { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--line-2); flex: none; position: relative; background: #fff; }
.choice input:checked + .choice__box .choice__tick { background: var(--pine-3); border-color: var(--pine-3); }
.choice input:checked + .choice__box .choice__tick::after { content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.choice--consent { margin-top: 18px; }
.choice--consent .choice__box { padding: 16px; }
.consent { font-size: 14.5px; }
.consent ul { padding-left: 20px; }
.consent li { margin-bottom: 8px; }
.stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--line-2); border-radius: 14px; background: #fff; overflow: hidden; flex: none; }
.stepper__btn { width: 46px; height: 48px; border: 0; background: transparent; font-size: 22px; color: var(--ink-2); cursor: pointer; }
.stepper__btn:hover { background: var(--surface-2); color: var(--ink); }
.stepper__input { width: 64px; height: 48px; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); text-align: center; font-size: 20px; color: var(--ink); background: transparent; -moz-appearance: textfield; appearance: textfield; }
.stepper__input::-webkit-outer-spin-button, .stepper__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper__input:focus { outline: none; background: #f4f8f7; }
.stepper.is-open-max .stepper__input { color: var(--terra-ink); }
.geo { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; margin-top: 8px; }
.geo__f span { font-size: 12.5px; color: var(--muted); }
.geo__status { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; }
.duration { display: flex; gap: 12px; margin-top: 8px; }
.duration label { display: flex; align-items: center; gap: 8px; }
.duration .input { width: 110px; margin: 0; }
.survey__nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; position: sticky; bottom: 0; padding: 14px 0; background: linear-gradient(180deg, rgba(245, 241, 232, 0) 0%, var(--paper) 30%); z-index: 5; }
.survey--vista .survey__nav { display: none; }
.survey--edicion .survey__nav { justify-content: flex-end; }
.survey__count { font-size: 12.5px; color: var(--muted); }
.review { display: grid; gap: 18px; }
.review section { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.review header { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.review header h3 { font-size: 15.5px; }
.review dl { margin: 0; display: grid; grid-template-columns: minmax(200px, 45%) 1fr; font-size: 13.5px; }
.review dt, .review dd { margin: 0; padding: 7px 14px; border-bottom: 1px solid var(--line); }
.review dt { color: var(--ink-2); }
.review dd.empty { color: var(--muted); font-style: italic; }
.thanks, .errorpage { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--paper) url("../img/contours-dark.svg") center/cover no-repeat; }
.thanks__card, .errorpage__card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 44px 40px; max-width: 520px; text-align: center; }
.thanks__card h1, .errorpage__card h1 { font-size: 34px; margin-bottom: 12px; }
.thanks__seal { width: 64px; height: 64px; border-radius: 50%; background: var(--pine); color: #fff; display: grid; place-items: center; margin: 0 auto 18px; }
.thanks__seal .ic { width: 32px; height: 32px; }
.thanks__code { font-size: 26px; letter-spacing: .06em; background: var(--surface-2); border: 1px dashed var(--line-2); border-radius: 12px; padding: 14px; margin: 18px 0 24px; color: var(--pine); }
.thanks__actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.thanks__actions form { margin: 0; }
.errorpage__code { font-size: 64px; color: var(--terra-ink); margin: 0; line-height: 1; }
.errorpage__card .btn { margin-top: 10px; }

/* ---------- Adaptabilidad ---------- */
@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--2-1 { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) {
  .rail { transform: translateX(-100%); transition: transform .25s; box-shadow: var(--shadow-lg); }
  .rail.is-open { transform: none; }
  .shell { margin-left: 0; }
  .topbar__menu { display: inline-grid; }
  .grid--2 { grid-template-columns: 1fr; }
  .survey__body { grid-template-columns: 1fr; }
  .trail { position: static; }
  .trail__list { display: flex; overflow-x: auto; gap: 6px; padding-bottom: 6px; }
  .trail__list::before { display: none; }
  .trail__list li span:last-child { display: none; }
  .trail__list li.is-current span:last-child { display: inline; white-space: nowrap; }
  .trail__meter { display: none; }
  .login { grid-template-columns: 1fr; }
  .login__art { min-height: 260px; padding: 32px; }
  .login__quote { font-size: 32px; margin-bottom: 18px; }
  .login__facts { display: none; }
}
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .main, .topbar, .foot { padding-left: 16px; padding-right: 16px; }
  .topbar h1 { font-size: 22px; }
  .kpis, .kpis--sm { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi__value { font-size: 30px; }
  .card { padding: 18px 16px; }
  .step { padding: 22px 18px; }
  .step__head h2 { font-size: 24px; }
  .survey__body { padding: 20px 14px 40px; }
  .survey__top { padding: 12px 14px; }
  .survey__who .mono { display: none; }
  .q__row { flex-direction: column; align-items: flex-start; }
  .geo { grid-template-columns: 1fr; }
  .choices--pair { grid-template-columns: 1fr 1fr; }
  .filters { top: 64px; }
  .kv, .review dl { grid-template-columns: 1fr; }
  .kv > div:nth-child(odd) { border-bottom: 0; padding-bottom: 0; font-size: 12px; }
  .scorecard { grid-template-columns: 1fr; }
}
@media print {
  .rail, .topbar, .filters, .foot, .survey__nav, .drawer, .toast { display: none !important; }
  .shell { margin: 0; }
  .card { box-shadow: none; break-inside: avoid; }
  .view[hidden] { display: block !important; }
}

/* ---------- Tablero integrado: prioridad, matrices y ficha de vivienda ---------- */
.levelbar__seg[data-ink="dark"] { color: #2b1c02; }
.levelbar__legend .sw, .minibar i { display: inline-block; }
.levelbar__legend .sw { width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: 0; }
.prio { display: inline-block; font: 600 11.5px/1 var(--mono); letter-spacing: .04em; padding: 4px 7px; border-radius: 6px; color: #fff; white-space: nowrap; }
.prio--1 { background: #7a1f1f; }
.prio--2 { background: #c4462a; }
.prio--3 { background: #e0a33a; color: #2b1c02; }
.prio--4 { background: #9fb3ae; color: #14302d; }
.pmx { display: grid; grid-template-columns: minmax(110px, auto) repeat(3, minmax(84px, 1fr)) 64px; gap: 4px; align-items: stretch; }
.pmx__corner { display: flex; flex-direction: column; justify-content: flex-end; font: 500 11px/1.3 var(--mono); color: var(--muted); padding: 6px 4px; }
.pmx__colh, .pmx__rowh { display: flex; align-items: center; justify-content: center; padding: 8px 6px; font-size: 13px; }
.pmx__rowh { justify-content: flex-start; }
.pmx__tot { display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--ink-2); background: var(--surface-2); border-radius: 8px; }
.pmx__cell { border: 0; border-radius: 10px; padding: 14px 8px 10px; min-height: 92px; cursor: pointer; display: grid; place-content: center; text-align: center; gap: 2px; font-family: var(--sans); transition: transform .12s ease, box-shadow .12s ease; }
.pmx__cell:hover, .pmx__cell:focus-visible { transform: translateY(-1px); box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--pine); outline: none; }
.pmx__cell b { font-family: var(--serif); font-size: 30px; font-weight: 560; line-height: 1; }
.pmx__cell span { font-size: 12px; opacity: .9; }
.pmx__cell em { font: 600 10.5px/1 var(--mono); font-style: normal; letter-spacing: .06em; opacity: .85; margin-top: 4px; }
.minibar { display: flex; width: 140px; height: 10px; gap: 2px; border-radius: 5px; overflow: hidden; background: var(--line); }
.minibar i { height: 100%; }
.freqgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px 24px; margin-top: 16px; }
.freq { min-width: 0; }
.freq__title { font: 600 14px/1.3 var(--sans); margin: 0 0 6px; }
.freq__note { margin: 6px 0 0; }
.tbl--matrix th, .tbl--matrix td { text-align: center; }
.tbl--matrix th:first-child { text-align: left; }
.tbl--matrix .is-diag { background: #eef4f3; font-weight: 600; }
.tbl--matrix .is-total th, .tbl--matrix .is-total td { background: var(--surface-2); }
.tbl--click tbody tr { cursor: pointer; }
.tbl--click tbody tr:focus-visible { outline: 2px solid var(--pine); outline-offset: -2px; }
.fsel select { font: 500 12.5px/1.2 var(--sans); }
.fsel.is-on select { border-color: var(--pine); background-color: #eef4f3; }
.vsum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 6px; }
.vsum > div { display: grid; gap: 4px; align-content: start; }
.vsum .eyebrow { margin: 0; }
.dsec { border-top: 2px solid var(--pine); margin-top: 26px; padding-top: 6px; }
.dsec__title { font-family: var(--serif); font-size: 20px; font-weight: 560; margin: 8px 0 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.orig { margin-top: 16px; font-size: 13px; }
.orig summary { cursor: pointer; color: var(--pine-2); font-weight: 500; padding: 6px 0; }
.rate { display: inline-block; min-width: 22px; text-align: center; font: 600 12px/20px var(--mono); border-radius: 5px; color: #fff; }
.rate--1 { background: #962a2a; } .rate--2 { background: #cf5a26; } .rate--3 { background: #d99a2b; color: #2b1c02; } .rate--4 { background: #5a9e22; } .rate--5 { background: #009683; }
.kv--doc { grid-template-columns: minmax(200px, 32%) 1fr; }
.notice.small { font-size: 13px; }
@media (max-width: 720px) { .pmx { grid-template-columns: 80px repeat(3, 1fr); } .pmx__tot { display: none; } .vsum { grid-template-columns: 1fr; } }
.pmx__cell[data-prio="1"], .pmx__cell[data-prio="2"] { color: #fff; }
.pmx__cell[data-prio="3"] { color: #2b1c02; }
.pmx__cell[data-prio="4"] { color: #14302d; }
.freqgrid { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.freq td.mono.small { white-space: nowrap; font-size: 11.5px; }
.vsum .prio, .vsum .lvl { justify-self: start; }
