/* ---------- tokens: oscuro cálido por defecto ---------- */
:root {
  color-scheme: dark;
  --bg: #262624; --surface: #30302e; --surface-2: #2b2b29; --sunken: #1f1e1d;
  --ink: #f5f4ee; --ink-2: #cfccc2; --muted: #9c998f; --faint: #6e6c65;
  --line: #3b3a36; --line-2: #4a4944;
  --side: #1f1e1d; --side-ink: #cfccc2; --side-muted: #807d74; --side-hover: #2a2a27; --side-on: #30302e; --side-line: #2e2d2a;
  --accent: #d97757; --accent-ink: #1a1915; --accent-soft: rgba(217,119,87,.14); --accent-strong: #e89a7f;
  --primary: #f0eee6; --primary-ink: #1a1915;
  --series-1: #d97757; --series-ref: #4a4944;
  --good: #8cc59a; --good-bg: rgba(106,168,116,.16); --good-dot: #6aa874;
  --warn: #e6bf6e; --warn-bg: rgba(217,164,65,.16); --warn-dot: #d9a441;
  --serious: #eba37e; --serious-bg: rgba(219,129,86,.16); --serious-dot: #db8156;
  --crit: #ee8a80; --crit-bg: rgba(212,87,75,.18); --crit-dot: #d4574b;
  --info: #b3c0d6; --info-bg: rgba(139,155,180,.18); --info-dot: #8b9bb4;
  --neutral: #c3c0b6; --neutral-bg: rgba(156,153,143,.16); --neutral-dot: #807d74;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.2);
  --shadow: 0 1px 2px rgba(0,0,0,.25), 0 8px 24px -10px rgba(0,0,0,.45);
  --shadow-lg: 0 24px 64px -16px rgba(0,0,0,.65);
  --r: 12px; --r-sm: 8px;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #faf9f5; --surface: #ffffff; --surface-2: #f6f5f0; --sunken: #f0eee6;
  --ink: #1a1915; --ink-2: #3d3b35; --muted: #6f6c63; --faint: #a19e94;
  --line: #e6e3da; --line-2: #d6d2c6;
  --side: #f0eee6; --side-ink: #3d3b35; --side-muted: #8a877d; --side-hover: #e7e4da; --side-on: #ffffff; --side-line: #e0ddd2;
  --accent: #c2603f; --accent-ink: #ffffff; --accent-soft: rgba(194,96,63,.10); --accent-strong: #a14d30;
  --primary: #1a1915; --primary-ink: #faf9f5;
  --series-1: #c2603f; --series-ref: #e0ddd2;
  --good: #2f7a3e; --good-bg: #e6f1e7; --good-dot: #4f9a5d;
  --warn: #8a6110; --warn-bg: #f8eed6; --warn-dot: #d39e2f;
  --serious: #9c4a25; --serious-bg: #f8e6dc; --serious-dot: #d27a4c;
  --crit: #a8322b; --crit-bg: #f7e1de; --crit-dot: #c94b40;
  --info: #3f5677; --info-bg: #e7ebf1; --info-dot: #7d8fac;
  --neutral: #55524b; --neutral-bg: #eeece5; --neutral-dot: #a19e94;
  --shadow-sm: 0 1px 2px rgba(26,25,21,.05);
  --shadow: 0 1px 2px rgba(26,25,21,.04), 0 8px 24px -10px rgba(26,25,21,.12);
  --shadow-lg: 0 24px 64px -16px rgba(26,25,21,.28);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
.num, td.num, .kpi .v { font-variant-numeric: tabular-nums; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
code { background: var(--sunken); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; font-size: 12.5px; }
pre { background: var(--sunken); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; overflow: auto; font-size: 12.5px; white-space: pre-wrap; word-break: break-all; margin: 8px 0; position: relative; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12.5px; } .xs { font-size: 11.5px; }
.nowrap { white-space: nowrap; } .right { text-align: right; } .grow { flex: 1; }
.hide { display: none !important; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 16px 10px; z-index: 30; border-right: 1px solid var(--side-line); }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; }
.brand .logo { width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--line-2); display: grid; place-items: center; color: var(--ink); font: 600 11.5px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: -.3px; background: var(--surface); }
.brand b { color: var(--ink); font-size: 14px; font-weight: 600; display: block; line-height: 1.25; letter-spacing: -.01em; } .brand span { color: var(--side-muted); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav .sec { color: var(--side-muted); font-size: 11.5px; font-weight: 500; padding: 16px 10px 5px; }
.nav a { display: flex; align-items: center; gap: 10px; color: var(--side-ink); padding: 7px 10px; border-radius: 7px; font-weight: 450; font-size: 13.5px; text-decoration: none; }
.nav a svg { color: var(--side-muted); }
.nav a:hover { background: var(--side-hover); color: var(--ink); text-decoration: none; }
.nav a.on { background: var(--side-on); color: var(--ink); font-weight: 550; box-shadow: var(--shadow-sm); }
.nav a.on svg { color: var(--ink); }
.nav a .count { margin-left: auto; color: var(--side-muted); font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }
.nav a .count.crit { color: var(--crit); display: inline-flex; align-items: center; gap: 5px; }
.nav a .count.crit::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--crit-dot); }
.side .foot { margin-top: auto; border-top: 1px solid var(--side-line); padding: 12px 6px 0; display: flex; flex-direction: column; gap: 10px; }
.engine { display: flex; gap: 9px; align-items: flex-start; font-size: 12px; color: var(--side-muted); padding: 0 4px; line-height: 1.45; }
.engine b { color: var(--side-ink); font-weight: 500; display: block; font-size: 12.5px; }
.pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--good-dot); margin-top: 6px; flex: none; }
.pulse.off { background: var(--warn-dot); }
.side .foot .row { display: flex; gap: 4px; }
.side .foot button { background: transparent; border: 0; color: var(--side-muted); font-weight: 500; font-size: 12.5px; padding: 6px 8px; }
.side .foot button:hover { background: var(--side-hover); color: var(--ink); }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 12px 28px; }
.top .burger { display: none; }
.search { position: relative; flex: 1; max-width: 420px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search input { padding-left: 34px; background: var(--surface); }
.search kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font: 600 11px Inter, sans-serif; color: var(--faint); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; background: var(--surface-2); }
.results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 6px; max-height: 360px; overflow: auto; }
.results button { width: 100%; justify-content: flex-start; border: 0; background: none; padding: 8px 10px; font-weight: 500; }
.results button:hover, .results button.hl { background: var(--sunken); }
.content { padding: 24px 28px 64px; max-width: 1440px; width: 100%; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.pagehead h1 { font-family: var(--serif); font-size: 26px; font-weight: 500; letter-spacing: -.01em; }
.pagehead p { margin: 4px 0 0; color: var(--muted); }
.pagehead .acts { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- controls ---------- */
button, .btn { font: inherit; font-weight: 600; font-size: 13.5px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); padding: 7px 12px; border-radius: var(--r-sm); cursor: pointer; display: inline-flex; align-items: center; gap: 7px; text-decoration: none; line-height: 1.35; white-space: nowrap; transition: background .12s, border-color .12s, box-shadow .12s; }
button:hover, .btn:hover { background: var(--surface-2); border-color: var(--faint); text-decoration: none; }
button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.primary { background: var(--primary) !important; border-color: var(--primary) !important; color: var(--primary-ink) !important; }
.primary:hover { filter: brightness(.94); }
.dark { background: var(--primary) !important; border-color: var(--primary) !important; color: var(--primary-ink) !important; }
.danger { color: var(--crit) !important; }
.danger.solid { background: var(--crit-dot) !important; border-color: var(--crit-dot) !important; color: #fff !important; }
.ghost { border-color: transparent !important; background: transparent !important; }
.ghost:hover { background: var(--sunken) !important; }
.sm { padding: 5px 9px; font-size: 12.5px; gap: 5px; }
.icon-btn { padding: 6px; }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea { width: 100%; font: inherit; font-size: 13.5px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 8px 10px; }
input[type=checkbox], input[type=radio] { width: 15px; height: 15px; accent-color: var(--accent); padding: 0; margin: 0; flex: none; cursor: pointer; }
input[type=color] { padding: 2px; height: 36px; width: 56px; }
textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
label.f { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.field { min-width: 0; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form .full { grid-column: 1 / -1; }
.form.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.check { display: flex; align-items: flex-start; gap: 9px; font-weight: 500; cursor: pointer; }
.check small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.switch { position: relative; width: 36px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; inset: 0; margin: 0; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--line-2); border-radius: 99px; transition: .15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.seg { display: inline-flex; background: var(--sunken); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 5px 10px; font-size: 12.5px; font-weight: 600; color: var(--muted); border-radius: 6px; }
.seg button:hover { background: transparent; color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg button .n { color: var(--faint); font-weight: 600; margin-left: 3px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); min-width: 0; }
.card > .hd { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 0; flex-wrap: wrap; }
.card > .hd h3 { font-size: 14px; font-weight: 600; }
.card > .hd .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.card > .bd { padding: 16px 18px 18px; }
.card > .bd.flush { padding: 8px 0 0; }
.grid { display: grid; gap: 16px; }
.g-kpi { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 16px; }

.kpi { padding: 16px 18px; position: relative; overflow: hidden; }
.kpi .l { color: var(--muted); font-size: 12.5px; font-weight: 500; display: flex; align-items: center; gap: 7px; }
.kpi .l .ico { display: none; }
.kpi .v { font-size: 26px; font-weight: 600; letter-spacing: -.02em; margin: 10px 0 2px; line-height: 1.15; }
.kpi .s { color: var(--muted); font-size: 12.5px; }
.kpi .s b { color: var(--ink-2); font-weight: 600; }
.progress { height: 6px; background: var(--sunken); border-radius: 99px; overflow: hidden; margin-top: 12px; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 7px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 18px; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.chip.good { background: var(--good-bg); color: var(--good); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.serious { background: var(--serious-bg); color: var(--serious); }
.chip.crit { background: var(--crit-bg); color: var(--crit); }
.chip.info { background: var(--info-bg); color: var(--info); }
.chip.neutral { background: var(--neutral-bg); color: var(--neutral); }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 0 7px; border-radius: 5px; background: var(--sunken); border: 1px solid var(--line); color: var(--ink-2); line-height: 18px; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
thead th { border-top: 0; font-size: 11.5px; color: var(--muted); font-weight: 600; letter-spacing: .03em; text-transform: uppercase; background: var(--surface-2); white-space: nowrap; }
thead th:first-child { border-top-left-radius: var(--r); } thead th:last-child { border-top-right-radius: var(--r); }
tbody tr { transition: background .1s; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: var(--surface-2); }
tbody tr.sel { background: var(--accent-soft); }
td .t { font-weight: 600; } td .d { color: var(--muted); font-size: 12.5px; margin-top: 1px; }
th.num, td.num { text-align: right; }
.w1 { width: 1%; }
.acts-row { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty .ico { width: 44px; height: 44px; border-radius: 12px; background: var(--sunken); display: grid; place-items: center; margin: 0 auto 12px; color: var(--ink-2); }
.empty b { color: var(--ink); display: block; margin-bottom: 4px; font-size: 14.5px; }

/* month strip */
.strip { display: inline-flex; gap: 3px; }
.strip i { width: 12px; height: 16px; border-radius: 3px; display: block; background: var(--sunken); border: 1px solid var(--line); }
.cell-ok { background: var(--good-dot) !important; border-color: var(--good-dot) !important; }
.cell-rev { background: var(--info-dot) !important; border-color: var(--info-dot) !important; }
.cell-late { background: var(--crit-dot) !important; border-color: var(--crit-dot) !important; }
.cell-due { background: var(--warn-dot) !important; border-color: var(--warn-dot) !important; }
.cell-ex { background: repeating-linear-gradient(135deg, var(--neutral-bg) 0 3px, transparent 3px 6px) !important; }
.cell-na, .cell-fut { background: transparent !important; border-style: dashed !important; }

/* toolbar & bulk */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.toolbar .search { max-width: 280px; }
.toolbar select { width: auto; }
.bulk { position: sticky; bottom: 16px; z-index: 15; margin: 16px auto 0; width: fit-content; max-width: 100%; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--primary); color: var(--primary-ink); padding: 8px 8px 8px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); }
.bulk b { margin-right: 6px; }
.bulk button { background: transparent; color: var(--primary-ink); border-color: color-mix(in srgb, var(--primary-ink) 22%, transparent); }
.bulk button:hover { background: color-mix(in srgb, var(--primary-ink) 10%, transparent); }

/* matrix */
.matrix td, .matrix th { padding: 7px 6px; text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; padding-left: 16px; position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 190px; }
.matrix thead th:first-child { background: var(--surface-2); }
.matrix th.cur { color: var(--accent); }
.mcell { width: 100%; min-width: 46px; height: 32px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface-2); display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; cursor: pointer; padding: 0; }
.mcell:hover { outline: 2px solid var(--ink); outline-offset: 1px; background: var(--surface-2); }
.mcell.cell-na, .mcell.cell-fut { cursor: default; } .mcell.cell-na:hover { outline: 0; }
.mcell.cell-fut { color: var(--faint); } .mcell.cell-fut:hover { outline: 2px dashed var(--line-2); }
.mcell.cell-due { color: #2b2005; }
.mcell.cell-ok { background: var(--good-bg) !important; border-color: color-mix(in srgb, var(--good-dot) 35%, transparent) !important; color: var(--good); }
.matrix tfoot td { font-size: 11.5px; color: var(--muted); font-weight: 600; background: var(--surface-2); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; border: 1px solid var(--line); }

/* lists */
.list { display: flex; flex-direction: column; }
.li { display: flex; gap: 12px; align-items: center; padding: 11px 18px; border-top: 1px solid var(--line); }
.li:first-child { border-top: 0; }
.li .av { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.li .tx { flex: 1; min-width: 0; } .li .tx b { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .tx span { color: var(--muted); font-size: 12.5px; }
.av.crit { background: var(--crit-bg); color: var(--crit); } .av.info { background: var(--info-bg); color: var(--info); }
.av.warn { background: var(--warn-bg); color: var(--warn); } .av.good { background: var(--good-bg); color: var(--good); } .av.neutral { background: var(--neutral-bg); color: var(--neutral); }
.timeline { position: relative; padding: 4px 18px 8px; }
.tl { display: grid; grid-template-columns: 14px minmax(0,1fr) auto; gap: 10px; padding: 8px 0; position: relative; }
.tl::before { content: ""; position: absolute; left: 6px; top: 22px; bottom: -8px; width: 1px; background: var(--line); }
.tl:last-child::before { display: none; }
.tl .dot { width: 9px; height: 9px; border-radius: 50%; margin: 5px 0 0 2px; background: var(--neutral-dot); box-shadow: 0 0 0 3px var(--surface); position: relative; }
.tl .dot.pago { background: var(--good-dot); } .tl .dot.estado { background: var(--info-dot); } .tl .dot.manual, .tl .dot.prorroga { background: var(--warn-dot); } .tl .dot.comprobante { background: var(--accent); }
.tl .when { color: var(--faint); font-size: 12px; white-space: nowrap; }
.tl .what b { font-weight: 600; }
.tl .what div { color: var(--muted); font-size: 12.5px; }
.dayhead { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 18px 4px; }

/* chart */
.chart { position: relative; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: Inter, sans-serif; }
.chart .ref { fill: var(--series-ref); }
.chart .bar { fill: var(--series-1); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover { fill: color-mix(in srgb, var(--ink) 4%, transparent); }
.tip { position: fixed; z-index: 100; pointer-events: none; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 10px 12px; font-size: 12.5px; min-width: 170px; }
.tip b { display: block; margin-bottom: 6px; font-size: 12.5px; }
.tip .row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tip .row span { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); }
.tip i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.stackbar { display: flex; height: 12px; border-radius: 99px; overflow: hidden; gap: 2px; background: var(--surface); margin: 6px 0 16px; }
.stackbar i { display: block; height: 100%; min-width: 4px; }
.statlist { display: flex; flex-direction: column; gap: 2px; }
.statlist button { border: 0; background: transparent; justify-content: space-between; padding: 7px 8px; border-radius: 7px; font-weight: 500; }
.statlist button:hover { background: var(--sunken); }
.statlist .n { font-weight: 700; font-variant-numeric: tabular-nums; }

/* drawer */
.scrim { position: fixed; inset: 0; background: rgba(8,11,16,.45); z-index: 40; animation: fade .15s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100vw); background: var(--bg); z-index: 41; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide .2s cubic-bezier(.2,.8,.2,1); }
.drawer .dh { background: var(--surface); border-bottom: 1px solid var(--line); padding: 18px 22px 0; }
.drawer .dh .row1 { display: flex; gap: 12px; align-items: flex-start; }
.drawer .dh h2 { font-size: 19px; font-weight: 700; }
.drawer .dh .doms { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.drawer .dh .quick { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.drawer .db { overflow: auto; padding: 18px 22px 40px; flex: 1; }
.tabs { display: flex; gap: 2px; overflow-x: auto; }
.tabs button { border: 0; background: none; border-radius: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: 9px 11px; font-weight: 600; }
.tabs button:hover { background: none; color: var(--ink); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--ink); }
.mini { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; margin-bottom: 16px; }
.mini .card { padding: 12px 14px; } .mini .l { color: var(--muted); font-size: 12px; } .mini .v { font-weight: 700; font-size: 17px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: 140px minmax(0,1fr); gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.months { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 6px; }
.months .mcell { height: 44px; flex-direction: column; font-size: 10.5px; line-height: 1.2; display: flex; justify-content: center; align-items: center; color: #fff; }
.months .mcell small { font-weight: 500; opacity: .9; }
.months .mcell.cell-na, .months .mcell.cell-fut { color: var(--faint); }

/* menus, modals, toasts */
.menu { position: fixed; z-index: 90; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; min-width: 220px; padding: 5px; box-shadow: var(--shadow-lg); animation: fade .1s; }
.menu button { width: 100%; justify-content: flex-start; border: 0; background: none; font-weight: 500; padding: 8px 10px; }
.menu button:hover { background: var(--sunken); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.mback { position: fixed; inset: 0; background: rgba(8,11,16,.5); z-index: 60; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 14px; overflow: auto; animation: fade .12s; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; width: 100%; max-width: 560px; box-shadow: var(--shadow-lg); animation: pop .16s cubic-bezier(.2,.8,.2,1); }
.modal.wide { max-width: 880px; }
.modal .mh { padding: 20px 22px 0; } .modal .mh h2 { font-size: 17px; font-weight: 700; } .modal .mh p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.modal .mb { padding: 18px 22px; }
.modal .mf { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; align-items: center; background: var(--surface-2); border-radius: 0 0 16px 16px; }
.err { color: var(--crit); font-size: 13px; margin-right: auto; }
.viewer { width: 100%; height: 56vh; border: 1px solid var(--line); border-radius: 10px; background: var(--sunken); object-fit: contain; display: block; }
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 120; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--primary); color: var(--primary-ink); padding: 10px 14px; border-radius: 10px; font-weight: 600; font-size: 13px; box-shadow: var(--shadow-lg); display: flex; gap: 8px; align-items: center; animation: pop .16s; }
.pchecks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.pcheck { display: flex; gap: 9px; align-items: center; padding: 9px 11px; border: 1px solid var(--line-2); border-radius: 9px; cursor: pointer; font-weight: 500; }
.pcheck:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.pcheck small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; }
.callout { display: flex; gap: 10px; padding: 11px 13px; border-radius: 10px; background: var(--sunken); border: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.callout.warn { background: var(--warn-bg); border-color: transparent; color: var(--warn); }
.callout.info { background: var(--info-bg); border-color: transparent; color: var(--info); }
.callout.crit { background: var(--crit-bg); border-color: transparent; color: var(--crit); }

/* review cards */
.rcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.rcard { overflow: hidden; display: flex; flex-direction: column; }
.rcard .thumb { height: 150px; background: var(--sunken); display: grid; place-items: center; border-bottom: 1px solid var(--line); overflow: hidden; color: var(--muted); }
.rcard .thumb img { width: 100%; height: 100%; object-fit: cover; }
.rcard .body { padding: 14px 16px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.rcard .foot { padding: 0 16px 14px; display: flex; gap: 8px; }

/* settings */
.set { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.subnav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 84px; }
.subnav button { border: 0; background: none; justify-content: flex-start; padding: 8px 10px; font-weight: 500; color: var(--ink-2); }
.subnav button:hover { background: var(--sunken); }
.subnav button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); border: 1px solid var(--line); font-weight: 600; }
.setsec { display: flex; flex-direction: column; gap: 16px; }
.setsec .card .bd { display: flex; flex-direction: column; gap: 16px; }
.row-set { display: flex; gap: 16px; align-items: center; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--line); }
.row-set:first-child { border-top: 0; padding-top: 0; }
.row-set .tx b { font-weight: 600; display: block; } .row-set .tx span { color: var(--muted); font-size: 12.5px; }
.row-set input[type=number] { width: 90px; }
.savebar { position: sticky; bottom: 16px; display: flex; justify-content: flex-end; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow); }
.preview-frame { width: 100%; height: 500px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.vars { display: flex; flex-wrap: wrap; gap: 5px; }
.vars code { cursor: pointer; } .vars code:hover { border-color: var(--accent); color: var(--accent); }
.tool-ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--sunken); border: 1px solid var(--line); color: var(--ink-2); flex: none; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--bg); }
.login .card { width: 100%; max-width: 380px; padding: 30px; box-shadow: var(--shadow); }
.login .brand { padding: 0 0 22px; } .login .brand b { color: var(--ink); } .login .brand span { color: var(--muted); }

@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
@keyframes pop { from { transform: translateY(6px) scale(.985); opacity: 0; } }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .g-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: var(--shadow-lg); }
  .top .burger { display: inline-flex; }
  .top { padding: 10px 16px; }
  .content { padding: 18px 16px 64px; }
  .g-2, .g-3 { grid-template-columns: minmax(0, 1fr); }
  .set { grid-template-columns: minmax(0, 1fr); }
  .subnav { position: static; flex-direction: row; overflow-x: auto; }
  .mini { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .top .hide-sm { display: none; }
}
@media (max-width: 640px) {
  .g-kpi { grid-template-columns: minmax(0, 1fr); }
  .form, .form.three { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; } .kv dd { margin-bottom: 8px; }
  .months { grid-template-columns: repeat(4, minmax(0,1fr)); }
  table.resp thead { display: none; }
  table.resp, table.resp tbody, table.resp tr, table.resp td { display: block; width: 100%; }
  table.resp tr { border-top: 1px solid var(--line); padding: 10px 0; }
  table.resp td { border: 0; padding: 4px 16px; text-align: left !important; }
  table.resp td.w1 { width: 100%; }
  .acts-row { justify-content: flex-start; flex-wrap: wrap; }
  .search kbd { display: none; }
  .pagehead h1 { font-size: 19px; }
  .toolbar .search { max-width: none; flex-basis: 100%; }
}

/* ---------- cargos extra / desglose ---------- */
.charges .li { padding: 10px 18px; }
.charges .amt { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.breakdown { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.breakdown div { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); }
.breakdown div b { color: var(--ink); font-weight: 600; }
.breakdown .tot { border-top: 1px solid var(--line); padding-top: 6px; margin-top: 2px; color: var(--ink); font-weight: 600; }
.sechead { font-size: 12px; font-weight: 600; color: var(--muted); margin: 6px 0 -4px; grid-column: 1 / -1; padding-top: 8px; border-top: 1px solid var(--line); }
