/* GrantIQ — hoja de estilo propia, sin build.
   Tipos: Public Sans (interfaz y cifras) + Source Serif 4 (solo texto citado de la fuente oficial). */

:root {
  --paper: #f2f4f3;
  --surface: #ffffff;
  --surface-2: #f7f9f8;
  --ink: #13232b;
  --ink-2: #2c3c43;
  --muted: #5a6a71;
  --faint: #8a979c;
  --rule: #d6dddd;
  --rule-strong: #b9c4c5;
  --accent: #0b5f59;
  --accent-ink: #ffffff;
  --accent-soft: #e2efed;
  --oficial: #13232b;
  --calc: #2c54a3;
  --calc-soft: #e7edf8;
  --sug: #7a3e8e;
  --sug-soft: #f3eaf6;
  --red: #b42318;
  --red-soft: #fdecea;
  --amber: #9a5800;
  --amber-soft: #fdf2df;
  --ok: #1d7a46;
  --ok-soft: #e4f3ea;
  --focus: #2c54a3;
  --shadow: 0 1px 0 rgba(19, 35, 43, .04), 0 8px 24px -16px rgba(19, 35, 43, .25);
  --c1: #0b5f59; --c2: #2c54a3; --c3: #c07a12; --c4: #7a3e8e; --c5: #4f7d2c; --c6: #a8452e;
  --map-0: #eef3f1; --map-1: #c6dfd9; --map-2: #8fc0b5; --map-3: #4f9a8d; --map-4: #1f6f66; --map-5: #0b4743;
  --font: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --r-lg: 10px;
  --r-sm: 5px;
  --wrap: 1240px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0d1416; --surface: #131d20; --surface-2: #172326; --ink: #e2e9e9; --ink-2: #c6d1d2;
    --muted: #94a4a7; --faint: #6c7c80; --rule: #243236; --rule-strong: #34464b;
    --accent: #5cc4b4; --accent-ink: #062a27; --accent-soft: #15332f;
    --oficial: #e2e9e9; --calc: #93adf0; --calc-soft: #1a2640; --sug: #cfa2e3; --sug-soft: #2a1c31;
    --red: #ff8a7a; --red-soft: #3a1714; --amber: #f2b552; --amber-soft: #352510; --ok: #6fd39a; --ok-soft: #12301f;
    --focus: #93adf0; --shadow: 0 1px 0 rgba(0,0,0,.3), 0 10px 30px -18px rgba(0,0,0,.8);
    --c1: #5cc4b4; --c2: #93adf0; --c3: #f2b552; --c4: #cfa2e3; --c5: #9fd27a; --c6: #f2957c;
    --map-0: #1a2629; --map-1: #1d4a45; --map-2: #227066; --map-3: #2f9888; --map-4: #59c2b1; --map-5: #a8ebdf;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0d1416; --surface: #131d20; --surface-2: #172326; --ink: #e2e9e9; --ink-2: #c6d1d2;
  --muted: #94a4a7; --faint: #6c7c80; --rule: #243236; --rule-strong: #34464b;
  --accent: #5cc4b4; --accent-ink: #062a27; --accent-soft: #15332f;
  --oficial: #e2e9e9; --calc: #93adf0; --calc-soft: #1a2640; --sug: #cfa2e3; --sug-soft: #2a1c31;
  --red: #ff8a7a; --red-soft: #3a1714; --amber: #f2b552; --amber-soft: #352510; --ok: #6fd39a; --ok-soft: #12301f;
  --focus: #93adf0; --shadow: 0 1px 0 rgba(0,0,0,.3), 0 10px 30px -18px rgba(0,0,0,.8);
  --c1: #5cc4b4; --c2: #93adf0; --c3: #f2b552; --c4: #cfa2e3; --c5: #9fd27a; --c6: #f2957c;
  --map-0: #1a2629; --map-1: #1d4a45; --map-2: #227066; --map-3: #2f9888; --map-4: #59c2b1; --map-5: #a8ebdf;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font); font-size: 15px; line-height: 1.5;
  font-feature-settings: "tnum" 1, "lnum" 1;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 650; letter-spacing: -0.012em; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.15rem); letter-spacing: -0.022em; font-weight: 700; }
h2 { font-size: 1.12rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75em; }
small, .small { font-size: .84rem; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
@media (max-width: 640px) { .wrap { padding: 0 16px; } body { font-size: 15px; } }

/* --- Cabecera ----------------------------------------------------------- */
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }
.top { background: var(--ink); color: var(--paper); }
:root[data-theme="dark"] .top { background: #0a1012; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .top { background: #0a1012; } }
.top .wrap { display: flex; align-items: center; gap: 28px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; flex-shrink: 0; }
.brand-mark { width: 26px; height: 26px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.brand-mark i { background: #6fc7b8; border-radius: 1.5px; opacity: .35; }
.brand-mark i:nth-child(3n) { opacity: .65; }
.brand-mark i:nth-child(7), .brand-mark i:nth-child(5) { opacity: 1; background: #f2b552; }
.brand-name { font-weight: 800; font-size: 1.12rem; letter-spacing: -0.02em; color: #f4f7f6; }
.brand-sub { display: block; font-size: .74rem; color: #a9babb; font-weight: 450; letter-spacing: 0; margin-top: 1px; }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; margin-left: auto; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  color: #c8d4d4; text-decoration: none; padding: 7px 11px; border-radius: 6px; font-size: .9rem; white-space: nowrap;
}
.nav a:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav a[aria-current="page"] { color: #fff; background: rgba(111,199,184,.16); box-shadow: inset 0 -2px 0 #6fc7b8; }
.theme-btn {
  background: transparent; border: 1px solid rgba(255,255,255,.18); color: #c8d4d4; border-radius: 6px;
  width: 34px; height: 32px; cursor: pointer; display: grid; place-items: center; flex-shrink: 0;
}
.theme-btn:hover { color: #fff; border-color: rgba(255,255,255,.4); }
.theme-btn svg { width: 16px; height: 16px; }
@media (max-width: 980px) {
  .top .wrap { flex-wrap: wrap; gap: 6px 16px; padding-top: 10px; }
  .nav { order: 3; width: 100%; margin: 0 -8px; padding-bottom: 6px; }
  .theme-btn { margin-left: auto; }
}

/* --- Página ------------------------------------------------------------- */
main { padding: 28px 0 56px; min-height: 60vh; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 22px; }
.page-head p { color: var(--muted); margin: 6px 0 0; max-width: 68ch; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 10px; }
.crumbs a { color: var(--muted); }

.panel {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-lg);
  padding: 20px 22px; box-shadow: var(--shadow);
}
.panel + .panel { margin-top: 18px; }
.grid > .panel + .panel, .grid > .panel + aside, .grid > div + aside { margin-top: 0; }
.panel-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 12px; margin-bottom: 14px; }
.panel-head h2 { margin-right: auto; }
.panel-head .hint { color: var(--muted); font-size: .86rem; width: 100%; margin-top: 2px; }
.src { margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--rule); color: var(--faint); font-size: .8rem; }
.src a { color: var(--muted); }
@media (max-width: 640px) { .panel { padding: 16px; border-radius: 8px; } }

.grid { display: grid; gap: 18px; }
.g-2 { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.g-2e { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-side { grid-template-columns: 270px minmax(0, 1fr); align-items: start; }
.g-detail { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
@media (max-width: 1020px) { .g-2, .g-detail, .g-3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 880px) { .g-side, .g-2e { grid-template-columns: minmax(0, 1fr); } }
.stack > * + * { margin-top: 18px; }

/* --- Botones / campos ----------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: .88rem; font-weight: 550;
  padding: 7px 12px; border-radius: 6px; border: 1px solid var(--rule-strong); background: var(--surface);
  color: var(--ink); text-decoration: none; cursor: pointer; line-height: 1.2;
}
.btn:hover { border-color: var(--ink-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }
label.f { display: block; font-size: .82rem; font-weight: 600; color: var(--ink-2); margin: 0 0 5px; }
.field { margin-bottom: 14px; }
input[type=search], input[type=text], input[type=date], select {
  width: 100%; font: inherit; font-size: .92rem; color: var(--ink); background: var(--surface);
  border: 1px solid var(--rule-strong); border-radius: 6px; padding: 8px 10px; min-height: 38px;
}
input:focus, select:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: .9rem; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; }
.search-big { position: relative; }
.search-big input { padding-left: 38px; min-height: 44px; font-size: 1rem; }
.search-big svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }

/* --- Insignias de nivel ----------------------------------------------------- */
.lvl {
  position: relative; display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 600;
  padding: 2px 8px 2px 7px; border-radius: 999px; border: 1px solid; line-height: 1.35; cursor: help;
  white-space: nowrap; vertical-align: middle;
}
.lvl::before { content: ""; width: 7px; height: 7px; flex-shrink: 0; }
.lvl-oficial { color: var(--oficial); border-color: var(--rule-strong); background: var(--surface); }
.lvl-oficial::before { background: var(--oficial); border-radius: 1px; }
.lvl-calc { color: var(--calc); border-color: color-mix(in srgb, var(--calc) 40%, transparent); background: var(--calc-soft); }
.lvl-calc::before { border-radius: 50%; background: var(--calc); }
.lvl-sug { color: var(--sug); border-color: color-mix(in srgb, var(--sug) 55%, transparent); border-style: dashed; background: var(--sug-soft); }
.lvl-sug::before { border: 1.5px solid var(--sug); border-radius: 50%; width: 6px; height: 6px; }
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; z-index: 30; left: 0; top: calc(100% + 6px);
  width: max-content; max-width: min(300px, 80vw); white-space: normal; text-align: left;
  background: var(--ink); color: var(--paper); font-size: .8rem; font-weight: 450; line-height: 1.4;
  padding: 8px 10px; border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.25); pointer-events: none;
}
.tip-right[data-tip]:hover::after, .tip-right[data-tip]:focus-visible::after { left: auto; right: 0; }

/* --- Estado / chips ------------------------------------------------------------ */
.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600; padding: 2px 9px;
  border-radius: 4px; white-space: nowrap; line-height: 1.5;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-abierta { background: var(--ok-soft); color: var(--ok); }
.st-pronostico { background: var(--calc-soft); color: var(--calc); }
.st-pronostico::before { background: transparent; border: 1.5px solid currentColor; width: 5px; height: 5px; }
.st-vencida, .st-cerrada, .st-archivada, .st-otro { background: var(--surface-2); color: var(--muted); border: 1px solid var(--rule); }
.days { font-size: .8rem; font-weight: 650; white-space: nowrap; padding: 2px 8px; border-radius: 4px; }
.days-rojo { background: var(--red-soft); color: var(--red); }
.days-ambar { background: var(--amber-soft); color: var(--amber); }
.days-neutro { color: var(--muted); background: var(--surface-2); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  font-size: .78rem; padding: 2px 8px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--rule);
  color: var(--ink-2); white-space: nowrap; text-decoration: none;
}
a.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip-no { color: var(--faint); text-decoration: line-through; text-decoration-color: var(--rule-strong); }
.chip-rev { border-style: dashed; color: var(--amber); }
.won { font-size: .78rem; color: var(--calc); font-weight: 600; white-space: nowrap; }
.won::before { content: "●"; font-size: .6rem; margin-right: 4px; vertical-align: 1px; }

.nd { color: var(--faint); font-style: italic; font-size: .92em; }

/* --- KPI strip -------------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.kpi { padding: 16px 20px 18px; text-decoration: none; color: inherit; display: block; }
.kpi + .kpi { border-left: 1px solid var(--rule); }
a.kpi:hover { background: var(--surface-2); }
.kpi-n { font-size: clamp(1.8rem, 1.4rem + 1.2vw, 2.5rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; }
.kpi-l { color: var(--muted); font-size: .88rem; margin-top: 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.kpi-n.alert { color: var(--amber); }
@media (max-width: 760px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(3) { border-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--rule); }
}

/* --- Calendario de cierres (pieza central de Panorama) ------------------------ */
.rail { display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); gap: 6px; align-items: end; }
.rail-col { display: flex; flex-direction: column; justify-content: flex-end; min-height: 150px; }
.rail-cells { display: flex; flex-wrap: wrap-reverse; gap: 3px; align-content: flex-start; }
.rail-cell {
  width: calc((100% - 6px) / 3); aspect-ratio: 1; border-radius: 2px; background: var(--rule-strong);
  display: block; transition: transform .08s;
}
.rail-cell.t-rojo { background: var(--red); }
.rail-cell.t-ambar { background: var(--amber); }
.rail-cell.t-neutro { background: var(--accent); opacity: .75; }
.rail-cell:hover, .rail-cell:focus-visible { transform: scale(1.35); opacity: 1; z-index: 2; position: relative; }
.rail-axis { display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); gap: 6px; margin-top: 8px; border-top: 1px solid var(--rule-strong); padding-top: 6px; }
.rail-axis span { font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; }
.rail-axis b { display: block; font-weight: 650; color: var(--ink-2); font-size: .8rem; }
.rail-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .8rem; color: var(--muted); margin-top: 12px; }
.rail-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.rail-more { font-size: .72rem; color: var(--muted); margin-top: 3px; text-align: center; }
@media (max-width: 760px) {
  .rail-scroll { overflow-x: auto; margin: 0 -16px; padding: 0 16px 6px; }
  .rail, .rail-axis { min-width: 640px; }
}

/* --- Listas de oportunidades --------------------------------------------------- */
.opp-list { list-style: none; margin: 0; padding: 0; }
.opp {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 20px; padding: 14px 0;
  border-top: 1px solid var(--rule);
}
.opp:first-child { border-top: 0; }
.opp-title { font-weight: 600; font-size: 1rem; line-height: 1.35; color: var(--ink); text-decoration: none; }
.opp-title:hover { color: var(--accent); text-decoration: underline; }
.opp-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .84rem; color: var(--muted); margin-top: 3px; }
.opp-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.opp-side { text-align: right; min-width: 128px; }
.opp-side .amt { font-weight: 650; font-size: 1rem; }
.opp-side .lbl { font-size: .76rem; color: var(--muted); }
.opp .chips { margin-top: 8px; }
@media (max-width: 640px) {
  .opp { grid-template-columns: minmax(0, 1fr); }
  .opp-side { text-align: left; display: flex; gap: 16px; align-items: baseline; }
}
.compact .opp { padding: 10px 0; }
.compact .opp-title { font-size: .94rem; }

.results-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; justify-content: space-between; margin-bottom: 6px; }
.results-head .count { font-weight: 650; }
.htmx-request .results-body { opacity: .5; transition: opacity .15s; }
.filters summary { display: none; }
@media (max-width: 880px) {
  .filters summary { display: flex; justify-content: space-between; cursor: pointer; font-weight: 650; list-style: none; }
  .filters summary::-webkit-details-marker { display: none; }
  .filters:not([open]) .filters-body { display: none; }
  .filters[open] summary { margin-bottom: 14px; }
}
@media (min-width: 881px) { .filters-body { display: block !important; } .filters { position: sticky; top: 14px; } }

.pager { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: space-between; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--rule); font-size: .88rem; }

/* --- Tablas ----------------------------------------------------------------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
table.t { width: 100%; border-collapse: collapse; font-size: .9rem; }
.t th { text-align: left; font-weight: 600; font-size: .8rem; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--rule-strong); white-space: nowrap; vertical-align: bottom; }
.t td { padding: 9px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.t tr:last-child td { border-bottom: 0; }
.t .r { text-align: right; }
.t tbody tr:hover { background: var(--surface-2); }
.t td.title { min-width: 220px; }
@media (max-width: 640px) { .t th, .t td { padding: 8px 6px; } }

/* --- Barras simples ------------------------------------------------------------ */
.bars { display: grid; gap: 9px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 4px 10px; align-items: center; font-size: .88rem; }
.bar-row .lab { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 8px; }
.bar-track { height: 8px; background: var(--surface-2); border-radius: 2px; overflow: hidden; grid-column: 1; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 2px; }
.bar-row .n { font-weight: 650; text-align: right; }

/* --- Comparativa / ratio ------------------------------------------------------------ */
.ratio { font-weight: 650; white-space: nowrap; }
.ratio.low { color: var(--red); }
.ratio.mid { color: var(--amber); }
.ratio.high { color: var(--ok); }
.gauge { position: relative; height: 6px; background: var(--surface-2); border-radius: 3px; min-width: 90px; margin-top: 6px; }
.gauge i { position: absolute; top: -3px; width: 2px; height: 12px; background: var(--ink-2); }
.gauge b { position: absolute; top: 0; left: 0; height: 100%; background: var(--calc); border-radius: 3px; }

/* --- Detalle --------------------------------------------------------------------- */
.detail-title { font-size: clamp(1.4rem, 1.1rem + 1.1vw, 1.9rem); max-width: 34ch; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.fact { padding: 12px 14px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin: 0 -1px -1px 0; }
.fact dt { font-size: .78rem; color: var(--muted); margin-bottom: 3px; }
.fact dd { margin: 0; font-weight: 600; }
.fact dd .nd { font-weight: 400; }
dl.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 18px; margin: 0; font-size: .92rem; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }
@media (max-width: 520px) { dl.kv { grid-template-columns: minmax(0, 1fr); gap: 2px; } dl.kv dd { margin-bottom: 8px; } }
.official {
  font-family: var(--serif); font-size: 1.02rem; line-height: 1.65; color: var(--ink-2);
  border-left: 3px solid var(--rule-strong); padding: 2px 0 2px 16px; max-width: 72ch; white-space: pre-line;
}
.official.clamp { max-height: 15em; overflow: hidden; position: relative; }
.official.clamp::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3em; background: linear-gradient(transparent, var(--surface)); }
.more-btn { margin-top: 8px; }
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline li { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 10px; padding-bottom: 12px; position: relative; }
.timeline li::before { content: ""; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--rule-strong); background: var(--surface); margin-top: 5px; z-index: 1; }
.timeline li.on::before { border-color: var(--accent); background: var(--accent); }
.timeline li.fc::before { border-color: var(--calc); border-style: dashed; }
.timeline li:not(:last-child)::after { content: ""; position: absolute; left: 5.5px; top: 16px; bottom: 0; width: 2px; background: var(--rule); }
.timeline .t-l { font-size: .8rem; color: var(--muted); }
.timeline .t-v { font-weight: 600; }
.missing { columns: 2 220px; column-gap: 24px; padding-left: 18px; margin: 0; font-size: .9rem; color: var(--ink-2); }
.missing li { margin-bottom: 4px; break-inside: avoid; }
.sug-card { border: 1px dashed color-mix(in srgb, var(--sug) 45%, transparent); background: var(--sug-soft); border-radius: 8px; padding: 12px 14px; }
.sug-card + .sug-card { margin-top: 8px; }
.sug-card .why { font-size: .86rem; color: var(--ink-2); margin-top: 4px; }
.sub-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 18px 0 8px; }
.sub-h:first-child { margin-top: 0; }
.sub-h h3 { font-size: .95rem; }
.cta-src { display: flex; flex-direction: column; gap: 8px; }
.attach { list-style: none; padding: 0; margin: 0; }
.attach li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--rule); font-size: .9rem; }
.attach li:first-child { border-top: 0; }
.attach a { word-break: break-all; }

.chart { width: 100%; height: 260px; }
.chart-sm { height: 150px; }

/* --- Estados vacíos ---------------------------------------------------------- */
.empty { border: 1px dashed var(--rule-strong); border-radius: 8px; padding: 22px; text-align: left; color: var(--muted); background: var(--surface-2); }
.empty strong { display: block; color: var(--ink-2); margin-bottom: 4px; font-weight: 650; }
.empty p { margin: 0; max-width: 62ch; font-size: .92rem; }

/* --- Sectores --------------------------------------------------------------- */
.sector-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.sector { display: flex; flex-direction: column; }
.sector h2 a { color: var(--ink); text-decoration: none; }
.sector h2 a:hover { color: var(--accent); }
.sector .desc { color: var(--muted); font-size: .86rem; margin: 4px 0 12px; }
.sector .nums { display: flex; gap: 18px; margin-bottom: 10px; }
.sector .nums b { font-size: 1.5rem; display: block; letter-spacing: -0.02em; line-height: 1.1; }
.sector .nums span { font-size: .78rem; color: var(--muted); }
.sector .compact { margin-top: auto; }
.sector.na { opacity: .8; }

/* --- Mapa -------------------------------------------------------------------- */
.map { height: 460px; border-radius: 8px; border: 1px solid var(--rule); background: var(--surface-2); z-index: 0; }
@media (max-width: 640px) { .map { height: 300px; } }
.legend { display: flex; align-items: center; gap: 0; margin-top: 10px; font-size: .78rem; color: var(--muted); flex-wrap: wrap; }
.legend .sw { width: 34px; height: 10px; }
.legend .ends { display: flex; justify-content: space-between; width: 100%; max-width: 204px; margin-top: 3px; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--rule-strong); border-radius: 7px; overflow: hidden; }
.seg a, .seg button { font: inherit; font-size: .84rem; padding: 6px 11px; color: var(--ink-2); text-decoration: none; background: var(--surface); border: 0; cursor: pointer; }
.seg a + a, .seg button + button { border-left: 1px solid var(--rule); }
.seg [aria-pressed="true"], .seg [aria-current="true"] { background: var(--ink); color: var(--paper); }
.leaflet-container { font-family: var(--font); background: var(--surface-2); }
.leaflet-tooltip.muni-tip { background: var(--ink); color: var(--paper); border: 0; border-radius: 6px; font-size: .82rem; box-shadow: 0 6px 18px rgba(0,0,0,.25); padding: 6px 9px; }
.leaflet-tooltip.muni-tip::before { display: none; }
.leaflet-control-attribution { font-size: 10px; }

/* --- Fuentes ---------------------------------------------------------------- */
.health { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 650; }
.health::before { content: ""; width: 9px; height: 9px; border-radius: 50%; }
.h-ok { color: var(--ok); } .h-ok::before { background: var(--ok); }
.h-stale, .h-partial { color: var(--amber); } .h-stale::before, .h-partial::before { background: var(--amber); }
.h-error { color: var(--red); } .h-error::before { background: var(--red); }
.h-none { color: var(--muted); } .h-none::before { border: 1.5px solid var(--muted); width: 7px; height: 7px; }
.gloss { display: grid; gap: 14px; }
.gloss > div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; align-items: start; }
@media (max-width: 520px) { .gloss > div { grid-template-columns: minmax(0, 1fr); gap: 4px; } }
.prose { max-width: 72ch; }
.prose h3 { margin: 18px 0 6px; }
.prose ul { padding-left: 18px; }
.prose li { margin-bottom: 4px; }

/* --- Pie ---------------------------------------------------------------------- */
.foot { border-top: 1px solid var(--rule); padding: 22px 0 30px; font-size: .84rem; color: var(--muted); }
.foot .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
.foot b { color: var(--ink-2); font-weight: 700; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print { .top, .foot, .filters, .theme-btn { display: none; } .panel { box-shadow: none; } }

/* Ajustes tras revisión visual */
.fact dd { overflow-wrap: anywhere; }
aside .opp, .sector .opp { grid-template-columns: minmax(0, 1fr); }
aside .opp-side { text-align: left; display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: baseline; min-width: 0; }
aside .opp-side .amt { font-size: .92rem; }
.legend { display: block; }
.legend .ends { margin-top: 4px; font-variant-numeric: tabular-nums; }
.sector-grid > .panel + .panel { margin-top: 0; }
.official, .opp-title, .chip, dl.kv dd, .t td { overflow-wrap: anywhere; }
.chip { white-space: normal; }
@media (max-width: 880px) {
  .filters summary::after { content: "Mostrar"; color: var(--accent); font-weight: 550; font-size: .88rem; margin-left: auto; }
  .filters[open] summary::after { content: "Ocultar"; }
  .filters summary .muted { margin-left: 8px; margin-right: 12px; }
}
.health { white-space: nowrap; }
.t .r [data-tip]:hover::after, .t .r [data-tip]:focus-visible::after { left: auto; right: 0; }
@media (max-width: 640px) { .facts { grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); } .fact { padding: 10px 12px; } }

.rail-c3 .rail-cell { width: calc((100% - 6px) / 3); }
.rail-c4 .rail-cell { width: calc((100% - 9px) / 4); }
.rail-c5 .rail-cell { width: calc((100% - 12px) / 5); }
.rail-c6 .rail-cell { width: calc((100% - 15px) / 6); }
.rail-c7 .rail-cell { width: calc((100% - 18px) / 7); }
.rail-c8 .rail-cell { width: calc((100% - 21px) / 8); }

/* --- Antecedentes ------------------------------------------------------------------ */
.notice { border-left: 3px solid var(--amber); background: var(--amber-soft); color: var(--ink-2); padding: 10px 14px; border-radius: 0 6px 6px 0; font-size: .9rem; margin: 0 0 14px; }
.notice strong { display: block; color: var(--ink); }
.relleno-note { color: var(--amber); font-weight: 550; }
.opp-side .relleno-note { font-size: .74rem; }

.ante { margin-top: 18px; padding: 0; overflow: hidden; }
.ante-head { padding: 22px 22px 18px; border-bottom: 1px solid var(--rule); background: linear-gradient(90deg, var(--accent-soft), transparent 70%); }
.ante-head h2 { font-size: 1.45rem; letter-spacing: -0.02em; }
.ante-head p { margin: 4px 0 0; color: var(--ink-2); max-width: 68ch; }
.ante-aln { padding: 4px 22px 22px; }
.ante-aln + .ante-aln { border-top: 6px solid var(--paper); }
.ante-aln-h { margin: 16px 0 0; padding: 8px 0; font-weight: 650; display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline; border-bottom: 2px solid var(--ink); }
.ante-aln-h a { color: var(--ink); }
.ante-aln-h span { color: var(--muted); font-weight: 500; }
.ante .sub-h { margin-top: 26px; }
.ante .sub-h h3 { font-size: 1.08rem; }
.ante .sub-h h4 { font-size: .94rem; margin: 0; }
.ante-lead { margin: -2px 0 12px; max-width: 74ch; }
@media (max-width: 640px) { .ante-head, .ante-aln { padding-left: 16px; padding-right: 16px; } }

/* Rondas: línea de tiempo con el año como ancla */
.rounds { list-style: none; margin: 0; padding: 0; }
.round { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 0 18px; position: relative; }
.round + .round .round-body { border-top: 1px solid var(--rule); }
.round-when { padding: 14px 14px 14px 0; border-right: 2px solid var(--rule-strong); display: flex; flex-direction: column; gap: 1px; font-size: .78rem; color: var(--muted); position: relative; }
.round-when::after { content: ""; position: absolute; right: -6px; top: 20px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.round-when b { font-size: 1.3rem; color: var(--ink); letter-spacing: -0.02em; line-height: 1.1; }
.round-body { padding: 12px 0 14px; min-width: 0; }
.round-no { font-weight: 650; }
.round-title { font-weight: 550; line-height: 1.35; margin: 2px 0 6px; }
.round-amts { display: flex; flex-wrap: wrap; gap: 4px 22px; margin: 0 0 8px; font-size: .84rem; }
.round-amts dt { color: var(--muted); font-size: .74rem; }
.round-amts dd { margin: 0; font-weight: 600; }
.docs { list-style: none; padding: 0; margin: 0 0 6px; display: grid; gap: 4px; font-size: .86rem; }
.docs li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.docs a { overflow-wrap: anywhere; }
.docs-none { margin: 0 0 6px; }
.doc-k { font-size: .72rem; font-weight: 650; padding: 1px 7px; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--rule); color: var(--ink-2); white-space: nowrap; }
.doc-nofo { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); color: var(--accent); }
.doc-formulario, .doc-checklist { background: var(--calc-soft); border-color: color-mix(in srgb, var(--calc) 35%, transparent); color: var(--calc); }
.doc-enmienda { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 35%, transparent); color: var(--amber); }
@media (max-width: 640px) {
  .round { grid-template-columns: 64px minmax(0, 1fr); gap: 0 12px; }
  .round-when span { display: none; }
  .round-when b { font-size: 1.05rem; }
}

/* Matriz de papeles que se repiten */
table.ledger { border-collapse: separate; border-spacing: 0; font-size: .86rem; min-width: 100%; }
.ledger th, .ledger td { padding: 7px 8px; border-bottom: 1px solid var(--rule); text-align: center; white-space: nowrap; }
.ledger thead th { font-size: .74rem; font-weight: 600; color: var(--muted); vertical-align: bottom; border-bottom: 1px solid var(--rule-strong); }
.ledger thead th a { color: var(--ink-2); display: block; }
.ledger thead th span { display: block; font-weight: 450; }
.ledger th[scope=row], .ledger thead th:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; font-weight: 550; color: var(--ink); min-width: 160px; white-space: normal; }
.ledger .r { text-align: right; color: var(--muted); }
.ledger .r b { color: var(--ink); }
.ledger tr.rep th[scope=row] { box-shadow: inset 3px 0 0 var(--accent); padding-left: 11px; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--rule-strong); vertical-align: middle; }
.dot.on { background: var(--accent); border-color: var(--accent); }

/* Mapa de mosaicos por estado */
.tm-head { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-bottom: 10px; }
.tm-desc { margin: 0; flex: 1 1 260px; }
.tilemap { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-rows: repeat(8, auto); gap: 3px; max-width: 760px; }
.tile { aspect-ratio: 1.15; border: 0; border-radius: 3px; background: var(--map-0); color: var(--ink-2); font: inherit; padding: 2px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; line-height: 1.1; }
.tile b { font-size: .78rem; font-weight: 700; }
.tile .tv { font-size: .62rem; opacity: .85; white-space: nowrap; overflow: hidden; max-width: 100%; }
.tilemap[data-metric="a"] .tv-c, .tilemap[data-metric="c"] .tv-a { display: none; }
.tilemap[data-metric="a"] .tile[data-qa="1"], .tilemap[data-metric="c"] .tile[data-qc="1"] { background: var(--map-1); }
.tilemap[data-metric="a"] .tile[data-qa="2"], .tilemap[data-metric="c"] .tile[data-qc="2"] { background: var(--map-2); }
.tilemap[data-metric="a"] .tile[data-qa="3"], .tilemap[data-metric="c"] .tile[data-qc="3"] { background: var(--map-3); color: #fff; }
.tilemap[data-metric="a"] .tile[data-qa="4"], .tilemap[data-metric="c"] .tile[data-qc="4"] { background: var(--map-4); color: #fff; }
.tilemap[data-metric="a"] .tile[data-qa="5"], .tilemap[data-metric="c"] .tile[data-qc="5"] { background: var(--map-5); color: #fff; }
:root[data-theme="dark"] .tilemap[data-metric="a"] .tile[data-qa="5"], :root[data-theme="dark"] .tilemap[data-metric="c"] .tile[data-qc="5"],
:root[data-theme="dark"] .tilemap[data-metric="a"] .tile[data-qa="4"], :root[data-theme="dark"] .tilemap[data-metric="c"] .tile[data-qc="4"] { color: #062a27; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tilemap[data-metric="a"] .tile[data-qa="5"], :root:not([data-theme="light"]) .tilemap[data-metric="c"] .tile[data-qc="5"],
  :root:not([data-theme="light"]) .tilemap[data-metric="a"] .tile[data-qa="4"], :root:not([data-theme="light"]) .tilemap[data-metric="c"] .tile[data-qc="4"] { color: #062a27; }
}
.tile.is-pr { outline: 2.5px solid var(--red); outline-offset: 1px; z-index: 1; }
.tile:hover { filter: brightness(.94); }
.tile[aria-pressed="true"] { outline: 2.5px solid var(--ink); outline-offset: 1px; z-index: 2; }
.tm-legend { margin: 8px 0 4px; }
.sw-row { display: inline-flex; vertical-align: -1px; margin-right: 6px; }
.sw-row i { width: 18px; height: 10px; display: block; }
.sw-row .q1 { background: var(--map-1); } .sw-row .q2 { background: var(--map-2); } .sw-row .q3 { background: var(--map-3); }
.sw-row .q4 { background: var(--map-4); } .sw-row .q5 { background: var(--map-5); }
@media (max-width: 640px) { .tilemap { gap: 2px; } .tile .tv { display: none !important; } .tile b { font-size: .62rem; } }

.aw-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 16px 0 8px; }
.seg button span { opacity: .7; margin-left: 3px; }
.aw-table tr.is-pr td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.aw-table tr[hidden] { display: none; }
.aw-desc { max-width: 46ch; color: var(--ink-2); }
.req-code { display: inline-block; min-width: 1.5em; font-weight: 750; color: var(--calc); }
.req-bars .bar-fill { background: var(--calc); }

.nopub { margin: 0; padding: 18px 22px 22px; background: var(--surface-2); border-top: 1px solid var(--rule); }
.nopub h3 { font-size: 1rem; margin-bottom: 6px; }
.nopub p { max-width: 74ch; font-size: .92rem; color: var(--ink-2); }
.nopub p:last-child { margin: 0; }
@media (max-width: 640px) { .nopub { padding: 16px; } }
.round { grid-template-columns: 132px minmax(0, 1fr); }
.round-when span { font-size: .74rem; }
.more-rounds > summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: .9rem; padding: 10px 0; border-top: 1px solid var(--rule); }
.more-rounds[open] > summary { margin-bottom: 0; }
@media (max-width: 640px) { .round { grid-template-columns: 64px minmax(0, 1fr); } }
.req-bars { max-width: 820px; }
@media (max-width: 640px) { .ledger th[scope=row], .ledger thead th:first-child { min-width: 118px; font-size: .8rem; } .ledger th, .ledger td { padding: 6px 5px; } }
.awards .seg { display: flex; flex-wrap: wrap; }
.awards .seg button { flex: 1 1 auto; }
@media (max-width: 640px) { .awards .seg button + button { border-left: 1px solid var(--rule); } .aw-desc { max-width: none; min-width: 200px; } }

/* --- Sincronización (encabezado y pie) ------------------------------------------------ */
.sync { display: inline-flex; align-items: center; gap: 7px; color: #a9babb; text-decoration: none; font-size: .78rem;
  white-space: nowrap; padding: 5px 9px; border-radius: 6px; flex-shrink: 0; }
.sync:hover { color: #fff; background: rgba(255,255,255,.07); }
.sync i, .foot-sync i { width: 7px; height: 7px; border-radius: 50%; background: #8a979c; flex-shrink: 0; display: inline-block; }
.sync-ok i { background: #6fd39a; box-shadow: 0 0 0 3px rgba(111,211,154,.16); }
.sync-stale i { background: #f2b552; }
.sync-error i { background: #ff8a7a; }
.sync-error span, .sync-stale span { color: #f4d6a0; }
.foot-sync { width: 100%; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.foot-sync.sync-ok i { background: var(--ok); box-shadow: none; }
.foot-sync.sync-stale i { background: var(--amber); }
.foot-sync.sync-error i { background: var(--red); }
.foot-sync.sync-error { color: var(--red); }
@media (max-width: 980px) { .sync { margin-left: auto; } .sync + .theme-btn { margin-left: 0; } }
@media (min-width: 981px) {
  .top .wrap { gap: 18px; }
  .nav a { padding: 7px 9px; }
  .sync-w { display: none; }
}
@media (min-width: 981px) and (max-width: 1180px) { .brand-sub { display: none; } }
@media (max-width: 420px) { .brand-sub { display: none; } }

/* --- Eventos (Novedades y Últimas 24 horas) --------------------------------------------- */
.ev-nueva { --ev: var(--accent); }
.ev-abrio { --ev: var(--ok); }
.ev-cierre { --ev: var(--amber); }
.ev-monto { --ev: var(--calc); }
.ev-cerro { --ev: var(--faint); }
.h24-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 22px; align-items: start; }
.h24-counts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0;
  border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.h24-counts li + li { border-left: 1px solid var(--rule); }
.h24-counts a { display: flex; flex-direction: column; gap: 2px; padding: 12px 10px 11px; text-decoration: none; color: var(--ink-2);
  box-shadow: inset 0 3px 0 var(--ev); height: 100%; }
.h24-counts a:hover { background: var(--surface-2); }
.h24-counts b { font-size: 1.55rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; color: var(--ink); }
.h24-counts span { font-size: .78rem; color: var(--muted); line-height: 1.25; }
.h24-counts .zero b { color: var(--faint); font-weight: 500; }
.h24-counts .zero a { box-shadow: inset 0 3px 0 var(--rule); }
@media (max-width: 1020px) { .h24-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) {
  .h24-counts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .h24-counts li:nth-child(4) { border-left: 0; }
  .h24-counts li:nth-child(n+4) { border-top: 1px solid var(--rule); }
}
.ev-list { list-style: none; margin: 0; padding: 0; }
.ev { display: grid; grid-template-columns: 148px minmax(0, 1fr) auto; gap: 4px 14px; padding: 11px 0; border-top: 1px solid var(--rule); align-items: baseline; }
.ev:first-child { border-top: 0; }
.ev-tag { font-size: .76rem; font-weight: 650; color: var(--ev); display: flex; gap: 7px; align-items: baseline; line-height: 1.3; }
.ev-tag::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--ev); flex-shrink: 0; transform: translateY(-1px); }
.ev-cerro .ev-tag { color: var(--muted); }
.ev-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ev-title { font-weight: 600; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.ev-title:hover { text-decoration: underline; }
.ev-what { font-size: .88rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.ev-meta { font-size: .8rem; color: var(--muted); }
.ev-time { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.ev-main .chips { margin-top: 4px; }
.ev-list.compact .ev { grid-template-columns: minmax(0, 1fr) auto; padding: 9px 0; }
.ev-list.compact .ev-tag { grid-column: 1; }
.ev-list.compact .ev-time { grid-column: 2; grid-row: 1; }
.ev-list.compact .ev-title, .ev-list.compact .ev-what { grid-column: 1 / -1; }
.ev-list.compact .ev-title { font-size: .92rem; }
@media (max-width: 640px) {
  .ev { grid-template-columns: minmax(0, 1fr) auto; }
  .ev-tag { grid-column: 1; }
  .ev-time { grid-column: 2; grid-row: 1; }
  .ev-main { grid-column: 1 / -1; }
}
.ev-day + .ev-day { margin-top: 22px; }
.ev-day-h { font-size: 1rem; font-weight: 700; margin: 18px 0 2px; padding-bottom: 8px; border-bottom: 1px solid var(--rule-strong);
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.ev-day-h .muted { font-weight: 450; font-size: .86rem; }
.ev-day-n { margin-left: auto; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .78rem; font-weight: 500; color: var(--muted); }
.ev-day-n i { display: inline-block; width: 7px; height: 7px; border-radius: 2px; background: var(--ev); margin-right: 5px; }
.nov-filters { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: flex-end; }
.nov-kinds { border: 1px solid var(--rule-strong); margin: 0; padding: 0; min-width: 0; }
.nov-kinds label { display: inline-flex; align-items: center; gap: 6px; font-size: .86rem; padding: 7px 12px; cursor: pointer;
  background: var(--surface); color: var(--ink-2); position: relative; }
.nov-kinds label + label { border-left: 1px solid var(--rule); }
.nov-kinds input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.nov-kinds label i { width: 8px; height: 8px; border-radius: 2px; background: var(--ev); }
.nov-kinds label b { font-weight: 650; color: var(--muted); margin-left: 2px; }
.nov-kinds label:has(input:checked) { background: var(--ink); color: var(--paper); }
.nov-kinds label:has(input:checked) b { color: inherit; opacity: .75; }
.nov-kinds label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: -2px; }
.nov-clase { min-width: 220px; }
@media (max-width: 900px) {
  .nov-kinds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--rule); width: 100%; }
  .nov-kinds label + label { border-left: 0; }
}
@media (max-width: 640px) {
  .nov-kinds { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nov-clase { width: 100%; }
}
@media (max-width: 520px) { .sync-w { display: none; } }

/* --- Calendario de cierres y aperturas (13 semanas / 12 / 24 meses) ------------------- */
.tl-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin: -2px 0 18px; }
.tl-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: .86rem; color: var(--ink-2); cursor: pointer; }
.tl-toggle input { accent-color: var(--calc); width: 16px; height: 16px; margin: 0; }
/* pronósticos: cuadro hueco con contorno azul */
.rail-cell.fc { background: transparent; box-shadow: inset 0 0 0 1.5px var(--calc); opacity: .9; }
.tl.no-fc .fc, .tl.no-fc .fc-n, .tl.no-fc .fc-link { display: none !important; }
.fc-n { font-style: normal; color: var(--calc); font-weight: 600; font-size: .7rem; display: block; min-height: 1em; }
.rail-col.ys { box-shadow: -4px 0 0 -3px var(--rule-strong); }
.tl-plot { display: grid; gap: 4px; height: 210px; align-items: end; position: relative; }
.tl-col { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; text-decoration: none; color: inherit;
  border-radius: 4px 4px 0 0; position: relative; padding-top: 30px; outline-offset: 2px; }
.tl-col.ys::before { content: ""; position: absolute; left: -3px; top: 0; bottom: 0; border-left: 1px dashed var(--rule-strong); }
.tl-bar { display: flex; flex-direction: column; gap: 2px; justify-content: flex-end; height: var(--ha); min-height: 0; position: relative; }
.tl.no-fc .tl-bar { height: var(--ho); }
.tl-lab { position: absolute; bottom: 100%; left: -2px; right: -2px; text-align: center; padding-bottom: 3px; line-height: 1.1; }
.tl-lab b { font-size: .78rem; font-weight: 650; color: var(--ink-2); }
.tl-s { display: block; min-height: 2px; flex-basis: 0; border-radius: 2px; }
.tl-s.t-rojo { background: var(--red); }
.tl-s.t-ambar { background: var(--amber); }
.tl-s.t-neutro { background: var(--accent); opacity: .75; }
.tl-s.fc { background: color-mix(in srgb, var(--calc) 10%, transparent); box-shadow: inset 0 0 0 1.5px var(--calc); min-height: 4px; }
.tl-col:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.tl-col.sel { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.tl-col.sel .tl-lab b { color: var(--ink); }
.tl-col.sel::after { content: ""; position: absolute; left: 20%; right: 20%; bottom: -7px; height: 3px; border-radius: 2px; background: var(--ink); }
.tl-axis, .tl-years { display: grid; gap: 4px; }
.tl-axis { margin-top: 8px; border-top: 1px solid var(--rule-strong); padding-top: 7px; }
.tl-axis span { font-size: .72rem; color: var(--muted); text-align: center; white-space: nowrap; overflow: hidden; }
.tl-years { margin-top: 6px; }
.tl-years span { font-size: .8rem; font-weight: 700; color: var(--ink-2); letter-spacing: -0.01em; border-top: 2px solid var(--ink-2);
  padding-top: 4px; margin-right: 6px; white-space: nowrap; overflow: hidden; }
.tl-years span:last-child { margin-right: 0; }
.rail ~ .tl-years { gap: 6px; }
@media (max-width: 760px) { .rail ~ .tl-years { min-width: 640px; } }
.tl-detail { margin-top: 18px; border: 1px solid var(--rule); border-radius: 8px; padding: 14px 16px; background: var(--surface-2); }
.tl-detail-head strong { font-size: 1rem; }
.tl-detail-body { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 12px 24px; margin-top: 8px; }
.tl-dd { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; align-content: flex-start; }
.tl-dd-n { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.tl-dd-fc .tl-dd-n { color: var(--calc); }
.tl-dd-l { color: var(--ink-2); font-size: .9rem; }
.tl-dd-mix { width: 100%; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .8rem; color: var(--muted); }
.tl-dd-mix b { color: var(--ink-2); font-weight: 650; margin-right: 3px; }
.tl-dd .btn { margin-top: 6px; }
.tl-dd.empty-dd .btn { display: none; }
.sw { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.sw.t-rojo { background: var(--red); } .sw.t-ambar { background: var(--amber); } .sw.t-neutro { background: var(--accent); opacity: .75; }
.lg-fc { background: transparent !important; box-shadow: inset 0 0 0 1.5px var(--calc); }
.tl-out { list-style: none; margin: 14px 0 0; padding: 0; font-size: .86rem; color: var(--ink-2); display: grid; gap: 4px; }
.tl-out li { padding-left: 14px; position: relative; }
.tl-out li::before { content: ""; position: absolute; left: 0; top: .65em; width: 6px; height: 1px; background: var(--faint); }
.tl-meta { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--rule); }
@media (max-width: 760px) {
  .tl-plot.tl-24, .tl-plot.tl-24 ~ .tl-axis, .tl-plot.tl-24 ~ .tl-years { min-width: 680px; }
  .tl-plot { height: 180px; }
  .tl-detail-body { grid-template-columns: minmax(0, 1fr); }
}

/* --- Filtros de fecha en Oportunidades -------------------------------------------------- */
fieldset.date-range { border: 0; padding: 0; margin: 0 0 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 6px; align-items: center; min-width: 0; }
fieldset.date-range legend { display: block; font-size: .82rem; font-weight: 600; color: var(--ink-2); margin: 0 0 5px; padding: 0; }
fieldset.date-range input[type=date] { padding: 7px 6px; font-size: .86rem; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px; }
.fchip { display: inline-flex; align-items: center; gap: 8px; font-size: .82rem; padding: 4px 6px 4px 10px; border-radius: 999px;
  background: var(--calc-soft); color: var(--calc); text-decoration: none; border: 1px solid color-mix(in srgb, var(--calc) 30%, transparent); }
.fchip span[aria-hidden] { font-size: 1rem; line-height: 1; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; }
.fchip:hover span[aria-hidden] { background: color-mix(in srgb, var(--calc) 18%, transparent); }
.fact dd { overflow-wrap: anywhere; min-width: 0; }

/* ===========================================================================
   Fase 2: ediciones, cuenta, entrada, Mi edición
   =========================================================================== */

/* --- Edición San Juan: azul y oro del escudo municipal (docs/sanjuan-marca.md) --- */
:root[data-edition="sanjuan"] {
  --accent: #33457a; --accent-ink: #ffffff; --accent-soft: #e7ebf5; --focus: #33457a;
  --gold: #8a7637; --gold-line: #b49f5c; --c1: #33457a;
}
@media (prefers-color-scheme: dark) {
  :root[data-edition="sanjuan"]:not([data-theme="light"]) {
    --accent: #9fb2e6; --accent-ink: #0f1830; --accent-soft: #1b2440; --focus: #9fb2e6; --gold: #d8c58a; --gold-line: #b49f5c; --c1: #9fb2e6;
  }
}
:root[data-edition="sanjuan"][data-theme="dark"] {
  --accent: #9fb2e6; --accent-ink: #0f1830; --accent-soft: #1b2440; --focus: #9fb2e6; --gold: #d8c58a; --gold-line: #b49f5c; --c1: #9fb2e6;
}
:root[data-edition="sanjuan"] .top { background: #1c2747; box-shadow: inset 0 -3px 0 #b49f5c; }
:root[data-edition="sanjuan"] .nav a[aria-current="page"] { background: rgba(180,159,92,.16); box-shadow: inset 0 -2px 0 #d8c58a; }
.brand-ed .brand-logo { width: 26px; height: 32px; object-fit: contain; flex-shrink: 0; filter: drop-shadow(0 1px 0 rgba(0,0,0,.35)); }
.brand-ed .brand-name b { font-weight: 800; color: #e7d9a6; }

/* --- Cuenta en la cabecera --- */
.acct { display: inline-flex; align-items: center; gap: 8px; color: #c8d4d4; text-decoration: none; font-size: .88rem; flex-shrink: 0;
  border-radius: 6px; padding: 3px 8px 3px 3px; }
.acct:hover, .acct[aria-current="page"] { color: #fff; background: rgba(255,255,255,.07); }
.acct-i { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .8rem;
  background: #6fc7b8; color: #062a27; }
:root[data-edition="sanjuan"] .acct-i { background: #d8c58a; color: #1c2747; }
.acct-in { border: 1px solid rgba(255,255,255,.25); padding: 6px 12px; }
@media (max-width: 980px) { .acct { margin-left: auto; } .acct + .theme-btn { margin-left: 0; } }
@media (max-width: 520px) { .acct-t { display: none; } }

/* --- Formularios / mensajes --- */
input[type=email], input[type=time] {
  width: 100%; font: inherit; font-size: .92rem; color: var(--ink); background: var(--surface);
  border: 1px solid var(--rule-strong); border-radius: 6px; padding: 8px 10px; min-height: 38px;
}
input[type=time] { width: auto; }
input[aria-invalid="true"] { border-color: var(--red); }
.btn-wide { width: 100%; justify-content: center; padding: 10px 14px; font-size: .95rem; margin-top: 4px; }
.form-err { color: var(--red); font-size: .86rem; margin: -6px 0 12px; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.toast { background: var(--ok-soft); color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent);
  border-radius: 8px; padding: 10px 14px; margin: 0 0 18px; font-weight: 550; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list > li { padding: 9px 0; border-top: 1px solid var(--rule); }
.plain-list > li:first-child { border-top: 0; }
.dev { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.d-b { display: block; }
.inline-f { display: flex; gap: 6px; align-items: center; }
.inline-f select { min-height: 32px; padding: 4px 8px; width: auto; }
tr.is-off td { opacity: .6; }

/* --- Entrar --- */
.auth { display: grid; place-items: start center; padding: 4vh 0 0; }
.auth-card { width: 100%; max-width: 420px; padding: 28px 30px 24px; }
.auth-card h1 { font-size: 1.6rem; margin: 18px 0 6px; }
.auth-brand { display: flex; align-items: center; gap: 12px; font-weight: 700; color: var(--ink-2); }
.auth-brand img { width: 40px; height: 50px; object-fit: contain; }
.brand-mark.big { width: 34px; height: 34px; }
.brand-mark.big i { background: var(--accent); }
.auth-form { margin-top: 18px; }
.auth-form input, .auth-form select { margin-bottom: 14px; }
.code-in { font-size: 1.7rem !important; letter-spacing: .32em; text-align: center; font-weight: 650; min-height: 54px !important; }
.auth-alt { margin-top: 14px; font-size: .88rem; }
.auth-foot { margin: 16px 0 0; }
.auth-card .notice { margin: 12px 0 0; }
:root[data-edition="sanjuan"] .auth-card { border-top: 3px solid var(--gold-line); }
@media (max-width: 640px) { .auth { padding-top: 0; } .auth-card { padding: 22px 18px 18px; } }

/* --- Seguir --- */
.seguir-f { display: inline; margin: 0; }
.btn-seguir.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* --- Razones de relevancia --- */
.why-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; font-size: .86rem; color: var(--ink-2); }
.why-list li { display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: 7px; align-items: baseline; line-height: 1.4; }
.why-dot { width: 7px; height: 7px; display: inline-block; transform: translateY(-1px); }
.why-oficial .why-dot { background: var(--oficial); border-radius: 1px; }
.why-calculado .why-dot { background: var(--calc); border-radius: 50%; }
.why-sugerido .why-dot { border: 1.5px solid var(--sug); border-radius: 50%; width: 6px; height: 6px; }
.why-calculado { color: var(--ink); font-weight: 520; }
.why-panel.is-rel { border-left: 4px solid var(--accent); }
.why-panel .why-list { font-size: .92rem; gap: 7px; margin-top: 0; }

/* --- Mi edición --- */
.ed-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: center; margin: 2px 0 22px; }
.ed-head:not(:has(img)) { grid-template-columns: minmax(0, 1fr); }
.ed-escudo { width: 64px; height: 80px; object-fit: contain; }
.ed-head h1 { font-size: clamp(1.7rem, 1.25rem + 1.6vw, 2.45rem); letter-spacing: -0.028em; }
.ed-lede { color: var(--ink-2); margin: 8px 0 0; max-width: 70ch; font-size: 1.02rem; }
.ed-lede b { color: var(--accent); }
@media (max-width: 640px) { .ed-head { gap: 14px; } .ed-escudo { width: 46px; height: 58px; } }

.ledger-panel { margin-bottom: 18px; }
.ledger { list-style: none; margin: 0; padding: 0; }
.ledger-i { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 16px; align-items: center;
  padding: 12px 0; border-top: 1px solid var(--rule); }
.ledger-i:first-child { border-top: 0; }
.ledger-date { display: flex; flex-direction: column; line-height: 1; padding-left: 12px; border-left: 3px solid var(--rule-strong); }
.ld-d { font-size: 1.9rem; font-weight: 750; letter-spacing: -0.03em; }
.ld-m { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.tone-rojo .ledger-date { border-left-color: var(--red); }
.tone-rojo .ld-d { color: var(--red); }
.tone-ambar .ledger-date { border-left-color: var(--amber); }
:root[data-edition="sanjuan"] .tone-neutro .ledger-date { border-left-color: var(--gold-line); }
.ledger-t { font-weight: 620; line-height: 1.3; }
.ledger-days { text-align: right; font-weight: 650; display: flex; flex-direction: column; gap: 2px; white-space: nowrap; }
.ledger-days a { font-weight: 450; }
@media (max-width: 640px) {
  .ledger-i { grid-template-columns: 64px minmax(0, 1fr); gap: 12px; }
  .ledger-days { grid-column: 2; text-align: left; flex-direction: row; gap: 10px; }
  .ld-d { font-size: 1.5rem; }
}

.ed-grid { margin-top: 18px; }
.units-nav { position: sticky; top: 14px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 14px 10px 12px; }
.units-h { font-size: .9rem; color: var(--muted); font-weight: 650; margin: 0 8px 8px; }
.units-nav ul { list-style: none; margin: 0 0 10px; padding: 0; }
.units-nav a { display: flex; justify-content: space-between; gap: 10px; padding: 6px 8px; border-radius: 6px; color: var(--ink); text-decoration: none; font-size: .88rem; line-height: 1.3; }
.units-nav a:hover { background: var(--surface-2); }
.units-n { font-weight: 700; color: var(--accent); }
.units-n.is-zero { color: var(--faint); font-weight: 500; }
.units-nav > p { margin: 0 8px; }
@media (max-width: 880px) {
  .units-nav { position: static; }
  .units-nav ul { display: flex; flex-wrap: wrap; gap: 6px; }
  .units-nav a { border: 1px solid var(--rule); }
}
.unit { scroll-margin-top: 16px; }
.unit-count { font-size: .84rem; color: var(--muted); }
.uei { display: inline-block; font-size: .78rem; padding: 0 6px; border: 1px solid var(--rule-strong); border-radius: 4px; margin-left: 4px; }
.more { margin-top: 6px; }
.more > summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: .9rem; padding: 8px 0; }
.idle-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px 18px; }
.idle-list li { display: flex; flex-direction: column; gap: 2px; scroll-margin-top: 16px; }

.audits { list-style: none; margin: 0; padding: 0; }
.audit { padding: 12px 0; border-top: 1px solid var(--rule); }
.audit:first-child { border-top: 0; }
.audit-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 3px; }
.audit-y { font-weight: 750; font-size: 1.05rem; }
.audit-n { font-weight: 600; }
.audit.has-f .audit-y { color: var(--red); }
.findings { margin: 8px 0 0; padding-left: 18px; font-size: .88rem; display: grid; gap: 5px; }
.flag { display: inline-block; font-size: .74rem; font-weight: 650; padding: 1px 7px; border-radius: 4px; background: var(--amber-soft); color: var(--amber); margin-left: 4px; }
.flag-r { background: var(--red-soft); color: var(--red); }
.ok-t { color: var(--ok); margin-top: 4px; }

.ed-card-h { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.ed-card-h img { width: 34px; height: 42px; object-fit: contain; }

/* --- Mi cuenta: alertas --- */
.rules fieldset { border: 0; margin: 0; padding: 12px 0; border-top: 1px solid var(--rule); display: grid; gap: 8px; min-width: 0; }
.rules fieldset:first-of-type { border-top: 0; padding-top: 0; }
.rule.is-off .rule-opts { opacity: .55; }
.rule-opts { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; padding-left: 24px; font-size: .9rem; }
.rule-opts select { width: auto; min-height: 32px; padding: 4px 8px; }
.rule-opts label.inline { display: inline-flex; gap: 8px; align-items: center; }
.chans { display: inline-flex; gap: 14px; }
.days-pick { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.dchip { position: relative; }
.dchip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.dchip span { display: inline-block; padding: 3px 10px; border: 1px solid var(--rule-strong); border-radius: 999px; font-size: .82rem; }
.dchip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.dchip input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.rules-foot { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; padding-top: 14px; border-top: 1px solid var(--rule); }
.rules-foot .small { flex: 1 1 260px; }
.qr { display: block; width: 180px; height: 180px; margin: 6px 0 12px; border-radius: 6px; border: 1px solid var(--rule); background: #fff; }
.prose-panel { max-width: 76ch; }
.prose-panel h2 { margin: 18px 0 6px; }
.prose-panel h2:first-child { margin-top: 0; }
