/* ==========================================================================
   NAMAN MIS – styles.css   (Material Design 3 principles, government palette)
   ========================================================================== */
:root {
  color-scheme: light;
  --navy: #123B66; --gov: #1565C0; --blue: #1976D2; --sky: #EAF3FC;
  --forest: #2E7D32; --teal: #00897B; --mint: #E8F5E9;
  --success: #2E7D32; --warning: #F9A825; --critical: #D32F2F; --info: #1976D2;
  --bg: #F5F7FA; --surface: #FFFFFF; --surface-2: #F7F9FC; --border: #E5EAF0; --border-strong: #D2DBE5;
  --text: #17283A; --text-2: #415367; --text-3: #5F7186; --heading: #123B66;
  --hover: #F0F5FB; --active-bg: #E3EFFC; --active-fg: #1257A8; --focus: rgba(21, 101, 192, .45);
  --c-success-bg: #E8F5E9; --c-success-fg: #1B5E20;
  --c-warning-bg: #FFF4D6; --c-warning-fg: #6F4700;
  --c-critical-bg: #FDECEA; --c-critical-fg: #B3261E;
  --c-info-bg: #E3F0FC; --c-info-fg: #0B4A93;
  --c-neutral-bg: #EDF1F5; --c-neutral-fg: #46586B;
  --c-teal-bg: #E0F2F1; --c-teal-fg: #00695C;
  --chart-grid: #E9EEF4; --chart-text: #5B6B7F; --shade: rgba(25, 118, 210, .08);
  --map-bg1: #F4F8FC; --map-bg2: #E8F0F8; --map-grid: #DAE4EE; --map-label: #5B6F86; --map-ctx: #9AABBD;
  --basin: rgba(46, 125, 50, .07); --basin-stroke: rgba(46, 125, 50, .32); --river: #1E88E5; --river-halo: #BBDEFB; --trib: #64B5F6;
  --shadow-1: 0 1px 2px rgba(18, 59, 102, .05), 0 2px 6px rgba(18, 59, 102, .05);
  --shadow-2: 0 6px 18px rgba(18, 59, 102, .11);
  --shadow-3: 0 18px 48px rgba(18, 59, 102, .22);
  --r-lg: 16px; --r-md: 12px; --r-sm: 8px;
  --topbar-h: 64px; --sidebar-w: 272px; --sidebar-wc: 76px;
  --font: 'Inter', 'Roboto', system-ui, -apple-system, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --sky: #15304D; --mint: #163322;
    --bg: #0E1621; --surface: #15202D; --surface-2: #1A2635; --border: #253548; --border-strong: #31455C;
    --text: #E3EBF4; --text-2: #B3C1D0; --text-3: #8E9FB2; --heading: #D5E6F8;
    --hover: #1C2B3C; --active-bg: #173452; --active-fg: #93C6FF; --focus: rgba(144, 202, 249, .55);
    --c-success-bg: #173A22; --c-success-fg: #A5D6A7; --c-warning-bg: #3B3014; --c-warning-fg: #FFD67A;
    --c-critical-bg: #44191B; --c-critical-fg: #FFABA4; --c-info-bg: #15314F; --c-info-fg: #9ECBFF;
    --c-neutral-bg: #233243; --c-neutral-fg: #B5C3D2; --c-teal-bg: #12332F; --c-teal-fg: #80CBC4;
    --chart-grid: #223244; --chart-text: #9FB0C2; --shade: rgba(144, 202, 249, .1);
    --map-bg1: #132131; --map-bg2: #0F1A27; --map-grid: #1F3147; --map-label: #93A9C1; --map-ctx: #5E7287;
    --basin: rgba(102, 187, 106, .08); --basin-stroke: rgba(102, 187, 106, .32); --river: #42A5F5; --river-halo: #1D3E5F; --trib: #3D7FB8;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .35); --shadow-2: 0 8px 22px rgba(0, 0, 0, .45); --shadow-3: 0 18px 48px rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --sky: #15304D; --mint: #163322;
  --bg: #0E1621; --surface: #15202D; --surface-2: #1A2635; --border: #253548; --border-strong: #31455C;
  --text: #E3EBF4; --text-2: #B3C1D0; --text-3: #8E9FB2; --heading: #D5E6F8;
  --hover: #1C2B3C; --active-bg: #173452; --active-fg: #93C6FF; --focus: rgba(144, 202, 249, .55);
  --c-success-bg: #173A22; --c-success-fg: #A5D6A7; --c-warning-bg: #3B3014; --c-warning-fg: #FFD67A;
  --c-critical-bg: #44191B; --c-critical-fg: #FFABA4; --c-info-bg: #15314F; --c-info-fg: #9ECBFF;
  --c-neutral-bg: #233243; --c-neutral-fg: #B5C3D2; --c-teal-bg: #12332F; --c-teal-fg: #80CBC4;
  --chart-grid: #223244; --chart-text: #9FB0C2; --shade: rgba(144, 202, 249, .1);
  --map-bg1: #132131; --map-bg2: #0F1A27; --map-grid: #1F3147; --map-label: #93A9C1; --map-ctx: #5E7287;
  --basin: rgba(102, 187, 106, .08); --basin-stroke: rgba(102, 187, 106, .32); --river: #42A5F5; --river-halo: #1D3E5F; --trib: #3D7FB8;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .35); --shadow-2: 0 8px 22px rgba(0, 0, 0, .45); --shadow-3: 0 18px 48px rgba(0, 0, 0, .6);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
:root { box-sizing: border-box; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
html { scroll-padding-top: calc(env(safe-area-inset-top, 0px) + var(--topbar-h) + 8px); -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; font-feature-settings: 'cv11', 'ss01'; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 1600; background: var(--surface); }
h1, h2, h3, h4 { margin: 0; color: var(--heading); font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--gov); }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { max-width: 100%; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 3000; background: var(--gov); color: #fff; padding: 10px 14px; border-radius: 8px; text-decoration: none; font-weight: 600; }
.skip-link:focus { top: calc(env(safe-area-inset-top, 0px) + 10px); }
.muted { color: var(--text-3); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.ms { font-family: 'Material Symbols Rounded'; font-weight: normal; font-style: normal; font-size: 20px; line-height: 1; letter-spacing: normal; text-transform: none; display: inline-block; white-space: nowrap; direction: ltr; font-feature-settings: 'liga'; -webkit-font-feature-settings: 'liga'; -webkit-font-smoothing: antialiased; font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24; user-select: none; flex-shrink: 0; width: 1em; overflow: hidden; }
.no-icons .ms { visibility: hidden; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: 20px; border: 1px solid transparent; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; transition: background-color .15s, box-shadow .15s, border-color .15s; text-decoration: none; }
.btn .ms { font-size: 19px; }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13px; }
.btn-primary { background: var(--gov); color: #fff; }
.btn-primary:hover { background: #0F58AE; box-shadow: var(--shadow-1); }
.btn-tonal { background: var(--active-bg); color: var(--active-fg); }
.btn-tonal:hover { filter: brightness(0.97); }
.btn-outline { background: var(--surface); border-color: var(--border-strong); color: var(--text-2); }
.btn-outline:hover { background: var(--hover); color: var(--text); }
.btn-text { background: transparent; color: var(--gov); padding: 0 12px; }
.btn-text:hover { background: var(--hover); }
.btn-danger { background: var(--critical); color: #fff; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--text-2); cursor: pointer; position: relative; transition: background-color .15s; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.sm .ms { font-size: 18px; }
.icon-btn[disabled] { opacity: .4; cursor: default; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 1500; height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 20px 0 12px; background: var(--surface); border-bottom: 1px solid var(--border); }
.tb-left, .tb-right { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; min-width: 0; }
.brand svg { flex-shrink: 0; width: 40px; height: 40px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-gov { font-size: 11px; color: var(--text-3); font-weight: 500; }
.brand-name { font-size: 16px; font-weight: 700; color: var(--heading); letter-spacing: -0.01em; }
.brand-sub { font-size: 11.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.demo-flag { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 6px; border: 1px solid #E0A400; background: var(--c-warning-bg); color: var(--c-warning-fg); font-size: 11px; font-weight: 700; letter-spacing: .04em; white-space: nowrap; }
.demo-flag .ms { font-size: 16px; }
.period { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 6px 0 12px; border: 1px solid var(--border-strong); border-radius: 20px; background: var(--surface); color: var(--text-2); }
.period select { border: 0; background: transparent; height: 38px; padding-right: 6px; font-weight: 600; font-size: 13px; color: var(--text); cursor: pointer; max-width: 270px; }
.period select:focus-visible { outline: none; }
.period:focus-within { box-shadow: 0 0 0 3px var(--focus); }
.nbadge { position: absolute; top: 5px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--critical); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--surface); }
.nbadge:empty { display: none; }
.profile { display: flex; align-items: center; gap: 10px; padding-left: 12px; border-left: 1px solid var(--border); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #123B66, #00897B); color: #fff; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.pf-text { display: flex; flex-direction: column; line-height: 1.25; }
.pf-text strong { font-size: 13px; color: var(--text); font-weight: 600; }
.pf-text span { font-size: 11.5px; color: var(--text-3); }

/* ---------- layout + sidebar ---------- */
.layout { display: flex; min-height: calc(100dvh - var(--topbar-h)); }
.sidebar { position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--topbar-h)); flex: 0 0 var(--sidebar-w); width: var(--sidebar-w); height: calc(100dvh - var(--topbar-h) - env(safe-area-inset-top, 0px)); overflow-y: auto; overflow-x: hidden; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; transition: width .2s ease, flex-basis .2s ease; z-index: 1200; }
.nav { padding: 12px 0 8px; flex: 1; }
.nav-sec { margin-bottom: 8px; }
.nav-sec-t { padding: 12px 24px 6px; font-size: 11.5px; font-weight: 600; color: var(--text-3); white-space: nowrap; }
.nav-item { position: relative; display: flex; align-items: center; gap: 14px; min-height: 44px; margin: 2px 12px; padding: 8px 14px; border-radius: 12px; color: var(--text-2); text-decoration: none; font-weight: 500; font-size: 13.5px; line-height: 1.3; transition: background-color .15s, color .15s; }
.nav-item .ms { font-size: 21px; }
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active { background: var(--active-bg); color: var(--active-fg); font-weight: 650; }
.nav-item.active .ms { font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24; }
.nav-item.active::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: var(--gov); }
.sb-foot { border-top: 1px solid var(--border); padding: 14px 20px 16px; font-size: 12px; color: var(--text-3); }
.sb-foot strong { color: var(--text-2); font-weight: 600; }
.sb-collapse { margin-top: 10px; display: flex; align-items: center; gap: 8px; width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--text-2); cursor: pointer; font-size: 12.5px; font-weight: 600; }
.sb-collapse:hover { background: var(--hover); }
.collapsed .sidebar { flex-basis: var(--sidebar-wc); width: var(--sidebar-wc); }
.collapsed .nav-sec-t, .collapsed .nav-label, .collapsed .sb-info, .collapsed .sb-collapse span:not(.ms) { display: none; }
.collapsed .nav-sec { border-top: 1px solid var(--border); padding-top: 6px; }
.collapsed .nav-sec:first-child { border-top: 0; }
.collapsed .nav-item { justify-content: center; padding: 8px; }
.collapsed .sb-foot { padding: 12px; }
.collapsed .sb-collapse { justify-content: center; padding: 0; }
.collapsed .sb-collapse .ms { transform: rotate(180deg); }
.scrim { display: none; }

main { flex: 1; min-width: 0; padding: 24px 28px 48px; }
main:focus { outline: none; }

/* ---------- page head + filters ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; }
.crumbs { display: flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--text-3); margin-bottom: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--text-3); text-decoration: none; }
.crumbs a:hover { color: var(--gov); text-decoration: underline; }
.crumbs .ms { font-size: 16px; }
.page-head h1 { font-size: 26px; line-height: 1.2; font-weight: 700; }
.page-desc { margin-top: 6px; max-width: 760px; color: var(--text-2); font-size: 14px; }
.ph-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.meta-chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); }
.meta-chip .ms { font-size: 17px; color: var(--text-3); }
.meta-chip strong { color: var(--text); font-weight: 600; }
.filters { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; padding: 14px 16px; margin-bottom: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.filters-lead { display: flex; align-items: center; gap: 8px; height: 38px; color: var(--text-2); font-weight: 600; font-size: 13px; padding-right: 4px; }
.filters-lead .ms { color: var(--gov); }
.filters-hint { margin-left: auto; align-self: center; font-size: 12px; color: var(--text-3); max-width: 340px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 170px; }
.field label { font-size: 11.5px; font-weight: 600; color: var(--text-3); }
.field select, .field input, .field textarea, .fld { height: 38px; padding: 0 34px 0 12px; border: 1px solid var(--border-strong); border-radius: 10px; background-color: var(--surface); color: var(--text); font-size: 13.5px; }
.field select, select.fld { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 17px) 16px, calc(100% - 12px) 16px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; cursor: pointer; max-width: 320px; }
.field input, .field textarea { padding: 0 12px; }
.field textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.field select:hover, .field input:hover, .field textarea:hover { border-color: var(--text-3); }
.field select:focus-visible, .field input:focus-visible, .field textarea:focus-visible { outline: none; border-color: var(--gov); box-shadow: 0 0 0 3px var(--focus); }
.field .err { color: var(--c-critical-fg); font-size: 12px; }
.field.wide { grid-column: 1 / -1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .field { min-width: 0; }
.form-grid .field select { max-width: none; }

/* ---------- grid + cards ---------- */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px; }
.span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; } .span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-12 { grid-column: 1 / -1; }
.grid > * { min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.mod-body > * + * { margin-top: 20px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-1); padding: 18px 20px; height: 100%; min-width: 0; }
.card-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.card-ht { min-width: 0; }
.card-h h3 { font-size: 16px; font-weight: 650; display: flex; align-items: center; gap: 6px; }
.card-sub { margin-top: 3px; font-size: 12.5px; color: var(--text-3); }
.card-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.card-note { margin-top: 10px; font-size: 12px; color: var(--text-3); }
.chart-box { position: relative; width: 100%; }
.chart-fallback, .empty { height: 100%; min-height: 140px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; color: var(--text-3); padding: 16px; font-size: 13px; }
.chart-fallback .ms, .empty .ms { font-size: 32px; color: var(--border-strong); }
.empty p, .chart-fallback p { max-width: 380px; }

/* ---------- KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi-grid.auto { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.kpi { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 16px 18px 15px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-1); overflow: hidden; min-width: 0; }
.kpi::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--kc); opacity: .9; }
.kpi[data-link] { cursor: pointer; transition: box-shadow .15s, border-color .15s; }
.kpi[data-link]:hover { box-shadow: var(--shadow-2); border-color: var(--border-strong); }
.kpi-navy { --kc: #123B66; --kbg: var(--sky); --kfg: var(--heading); }
.kpi-blue { --kc: #1976D2; --kbg: var(--c-info-bg); --kfg: var(--c-info-fg); }
.kpi-green { --kc: #2E7D32; --kbg: var(--c-success-bg); --kfg: var(--c-success-fg); }
.kpi-teal { --kc: #00897B; --kbg: var(--c-teal-bg); --kfg: var(--c-teal-fg); }
.kpi-red { --kc: #D32F2F; --kbg: var(--c-critical-bg); --kfg: var(--c-critical-fg); }
.kpi-amber { --kc: #F9A825; --kbg: var(--c-warning-bg); --kfg: var(--c-warning-fg); }
.kpi-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.kpi-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--kbg); color: var(--kfg); flex-shrink: 0; }
.kpi-icon .ms { font-size: 20px; }
.kpi-label { font-size: 13.5px; font-weight: 600; color: var(--text-2); line-height: 1.3; }
.kpi-value { font-size: 30px; font-weight: 700; line-height: 1.15; color: var(--heading); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 4px; }
.kpi-unit { font-size: 15px; font-weight: 600; color: var(--text-3); margin-left: 5px; letter-spacing: 0; }
.kpi-sub { font-size: 12.5px; color: var(--text-3); line-height: 1.4; }
.kpi-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; font-size: 12px; color: var(--text-3); }

/* ---------- chips / progress / info ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px 0 7px; border-radius: 12px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1; }
.chip .ms { font-size: 15px; }
.c-success { background: var(--c-success-bg); color: var(--c-success-fg); }
.c-warning { background: var(--c-warning-bg); color: var(--c-warning-fg); }
.c-critical { background: var(--c-critical-bg); color: var(--c-critical-fg); }
.c-info { background: var(--c-info-bg); color: var(--c-info-fg); }
.c-neutral { background: var(--c-neutral-bg); color: var(--c-neutral-fg); }
.c-teal { background: var(--c-teal-bg); color: var(--c-teal-fg); }
.pbar { height: 8px; border-radius: 4px; background: var(--c-neutral-bg); overflow: hidden; flex: 1; min-width: 60px; }
.pbar-fill { display: block; height: 100%; border-radius: 4px; transition: width .5s ease; }
.t-primary { background: var(--gov); } .t-teal { background: var(--teal); } .t-success { background: var(--success); } .t-warning { background: var(--warning); } .t-critical { background: var(--critical); } .t-neutral { background: #90A4AE; }
.pcell { display: flex; align-items: center; gap: 10px; min-width: 120px; }
.pcell-v { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--text-2); width: 38px; text-align: right; }
.info-tip { position: relative; display: inline-grid; place-items: center; color: var(--text-3); cursor: help; border-radius: 50%; }
.info-tip .ms { font-size: 17px; }
.info-tip::after { content: attr(data-tip); position: absolute; left: 50%; top: calc(100% + 8px); transform: translateX(-50%); width: max-content; max-width: 280px; padding: 9px 11px; border-radius: 8px; background: #0E2E50; color: #fff; font-size: 12px; font-weight: 500; line-height: 1.45; white-space: normal; box-shadow: var(--shadow-2); opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 50; text-align: left; }
.info-tip:hover::after, .info-tip:focus::after { opacity: 1; }
.kpi .info-tip::after { left: auto; right: -8px; transform: none; }

/* ---------- tables ---------- */
.dt-bar { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.dt-title h3 { font-size: 16px; font-weight: 650; }
.dt-title p { font-size: 12.5px; color: var(--text-3); margin-top: 3px; }
.dt-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 18px; background: var(--surface); min-width: 220px; }
.search .ms { font-size: 19px; color: var(--text-3); }
.search input { border: 0; outline: 0; background: transparent; height: 34px; width: 100%; font-size: 13.5px; }
.search:focus-within { border-color: var(--gov); box-shadow: 0 0 0 3px var(--focus); }
.table-wrap { overflow: auto; max-height: 560px; border: 1px solid var(--border); border-radius: var(--r-md); }
.table-wrap.tall { max-height: none; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.tbl th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3); padding: 0 12px; height: 42px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl th.num { text-align: right; }
.th-sort { display: inline-flex; align-items: center; gap: 2px; border: 0; background: transparent; padding: 4px 2px; font-size: 12px; font-weight: 600; color: var(--text-3); cursor: pointer; border-radius: 6px; }
.th-sort .ms { font-size: 15px; opacity: .55; }
.th-sort:hover, .th-sort.on { color: var(--text); }
.th-sort.on .ms { opacity: 1; color: var(--gov); }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tr.clickable { cursor: pointer; }
.tbl tbody tr:hover td { background: var(--hover); }
.tbl tr.total td { font-weight: 700; background: var(--surface-2); }
.tbl.compact td { padding: 7px 10px; font-size: 12.5px; }
.tbl.compact th { height: 36px; padding: 0 10px; }
.td-main { font-weight: 600; color: var(--text); }
.td-sub { display: block; font-size: 12px; color: var(--text-3); margin-top: 2px; }
.td-wrap { min-width: 240px; max-width: 420px; white-space: normal; }
.mono { font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 12.5px; white-space: nowrap; }
.val-bad { display: inline-flex; align-items: center; gap: 2px; color: var(--c-critical-fg); font-weight: 700; }
.val-bad .ms { font-size: 15px; }
.row-acts { display: flex; gap: 2px; justify-content: flex-end; }
.dt-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding-top: 12px; font-size: 12.5px; color: var(--text-3); }
.pager { display: flex; align-items: center; gap: 2px; }
.pg { min-width: 32px; height: 32px; border-radius: 16px; border: 0; background: transparent; cursor: pointer; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.pg:hover { background: var(--hover); }
.pg.on { background: var(--gov); color: #fff; font-weight: 600; }
table.mini { width: 100%; border-collapse: collapse; font-size: 13px; }
table.mini th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3); padding: 0 8px 8px; border-bottom: 1px solid var(--border); }
table.mini td { padding: 10px 8px; border-bottom: 1px solid var(--border); }
table.mini tr[data-dept] { cursor: pointer; }
table.mini tr[data-dept]:hover td { background: var(--hover); }
table.mini tr:last-child td { border-bottom: 0; }

/* ---------- overlays ---------- */
.modal-scrim, .drawer-scrim { position: fixed; inset: 0; z-index: 2100; background: rgba(9, 25, 45, .42); opacity: 0; transition: opacity .18s; }
.modal-scrim { display: grid; place-items: center; padding: 16px; }
.modal-scrim.open, .drawer-scrim.open { opacity: 1; }
.modal { width: min(620px, 100%); max-height: min(88vh, 900px); display: flex; flex-direction: column; background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-3); transform: translateY(10px) scale(.98); transition: transform .18s; }
.modal.lg { width: min(820px, 100%); }
.modal-scrim.open .modal { transform: none; }
.modal-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 16px 6px 24px; }
.modal-h h2 { font-size: 19px; }
.modal-b { padding: 10px 24px 18px; overflow: auto; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; border-top: 1px solid var(--border); }
.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(580px, 100vw); background: var(--surface); box-shadow: var(--shadow-3); display: flex; flex-direction: column; transform: translateX(100%); transition: transform .22s ease; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
.drawer-scrim.open .drawer { transform: none; }
.drawer-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 16px 14px 24px; border-bottom: 1px solid var(--border); }
.drawer-h h2 { font-size: 18px; line-height: 1.3; }
.drawer-h p { font-size: 12.5px; color: var(--text-3); margin-top: 4px; }
.drawer-b { padding: 18px 24px 32px; overflow-y: auto; flex: 1; }
.drawer-b > * + * { margin-top: 16px; }
.d-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lead { color: var(--text-2); font-size: 14px; line-height: 1.55; }
.dsec { font-size: 14px; font-weight: 650; padding-top: 6px; display: flex; align-items: baseline; gap: 8px; }
.dsec .muted { font-weight: 500; font-size: 12.5px; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; margin: 0; }
.kv div { min-width: 0; }
.kv dt { font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.kv dd { margin: 2px 0 0; font-size: 13.5px; color: var(--text); overflow-wrap: anywhere; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 10px; }
.tile { padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); min-width: 0; }
.tile span { display: block; font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.tile strong { display: block; font-size: 17px; color: var(--heading); margin-top: 3px; font-variant-numeric: tabular-nums; }
.tile small { display: block; font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.tile.bad { border-color: rgba(211, 47, 47, .35); background: var(--c-critical-bg); }
.tile.bad strong, .tile.bad small { color: var(--c-critical-fg); }
.prog-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.prog-pair > div > span { display: block; font-size: 12px; color: var(--text-3); font-weight: 600; margin-bottom: 6px; }
.notice { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; font-size: 13px; line-height: 1.5; }
.notice .ms { font-size: 20px; }
.notice.c-warning { border: 1px solid rgba(249, 168, 37, .5); }
.notice.c-critical { border: 1px solid rgba(211, 47, 47, .3); }
.notice.c-info { border: 1px solid rgba(25, 118, 210, .25); }
.d-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 18px; overflow: hidden; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; height: 32px; padding: 0 12px; font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: pointer; border-right: 1px solid var(--border); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--active-bg); color: var(--active-fg); }
.stepper { list-style: none; margin: 0; padding: 0; }
.stepper li { position: relative; display: flex; gap: 14px; padding-bottom: 16px; }
.stepper li:last-child { padding-bottom: 0; }
.stepper li::before { content: ""; position: absolute; left: 13px; top: 30px; bottom: 2px; width: 2px; background: var(--border); }
.stepper li:last-child::before { display: none; }
.stepper li.st-done::before { background: var(--success); }
.st-dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; background: var(--c-neutral-bg); color: var(--text-3); border: 2px solid var(--border-strong); }
.st-dot .ms { font-size: 16px; }
.st-done .st-dot { background: var(--success); border-color: var(--success); color: #fff; }
.st-current .st-dot { background: var(--surface); border-color: var(--gov); color: var(--gov); box-shadow: 0 0 0 4px var(--active-bg); }
.st-late .st-dot { border-color: var(--critical); color: var(--critical); box-shadow: 0 0 0 4px var(--c-critical-bg); }
.stepper strong { display: block; font-size: 13.5px; color: var(--text); font-weight: 600; }
.stepper li > div span { font-size: 12.5px; color: var(--text-3); }
.st-late li > div span, .stepper .late { color: var(--c-critical-fg); font-weight: 600; }

#toast-root { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 2600; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 12px; background: #13263B; color: #fff; font-size: 13.5px; box-shadow: var(--shadow-3); opacity: 0; transform: translateY(10px); transition: all .25s; max-width: min(520px, 92vw); }
.toast.show { opacity: 1; transform: none; }
.toast.t-success .ms { color: #81C784; } .toast.t-warning .ms { color: #FFD54F; } .toast.t-critical .ms { color: #EF9A9A; } .toast.t-info .ms { color: #90CAF9; }

.notif-panel { position: fixed; top: calc(env(safe-area-inset-top, 0px) + var(--topbar-h) + 8px); right: 16px; width: min(420px, calc(100vw - 24px)); max-height: calc(100dvh - var(--topbar-h) - 32px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-3); z-index: 1700; }
.notif-panel[hidden] { display: none; }
.np-h { display: flex; justify-content: space-between; align-items: center; padding: 16px 12px 10px 20px; border-bottom: 1px solid var(--border); }
.np-h h2 { font-size: 16px; }
.np-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }

/* ---------- alerts + timeline ---------- */
.alert-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.alert { display: grid; grid-template-columns: 36px 1fr; gap: 12px; width: 100%; text-align: left; padding: 11px 10px; border: 0; border-radius: 12px; background: transparent; cursor: pointer; color: inherit; }
.alert:hover { background: var(--hover); }
.alert.unread { background: var(--surface-2); }
.alert-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; }
.alert-ic .ms { font-size: 20px; }
.alert-t { display: block; font-size: 13.5px; font-weight: 600; color: var(--text); line-height: 1.35; }
.alert-d { display: block; font-size: 12.5px; color: var(--text-2); margin-top: 2px; line-height: 1.4; }
.alert-m { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; color: var(--text-3); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; display: grid; grid-template-columns: 32px 1fr auto; gap: 12px; padding: 0 0 14px; }
.timeline li::before { content: ""; position: absolute; left: 15px; top: 32px; bottom: 0; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.tl-ic { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; }
.tl-ic .ms { font-size: 17px; }
.tl-t { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.35; }
.tl-m { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.tl-d { font-size: 12px; color: var(--text-3); white-space: nowrap; padding-top: 1px; }
.mission-line { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 20px 24px; border-radius: var(--r-lg); background: #123B66; color: #DCE9F7; }
.mission-line strong { display: block; color: #fff; font-size: 17px; font-weight: 650; letter-spacing: -0.01em; }
.mission-line span { font-size: 13.5px; }
.mission-line .ml-note { font-size: 12px; color: #A9C3DF; max-width: 420px; }

/* ---------- map ---------- */
.map-shell { display: flex; flex-direction: column; gap: 10px; }
.map-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.map-legend { display: flex; flex-wrap: wrap; gap: 6px; }
.layer-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 15px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.layer-chip:hover { background: var(--hover); }
.layer-chip[aria-pressed="false"] { opacity: .5; text-decoration: line-through; }
.layer-chip .lg-ic rect, .layer-chip .lg-ic circle, .layer-chip .lg-ic path { stroke: #fff; stroke-width: 1.5; }
.lc-n { font-variant-numeric: tabular-nums; color: var(--text-3); font-weight: 500; }
.map-canvas { position: relative; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--border); isolation: isolate; background: var(--map-bg2); }
.map-stage, .map-stage .lf { width: 100%; height: 100%; }
.map-stage svg.schem { display: block; width: 100%; height: 100%; }
.map-note { position: absolute; left: 10px; bottom: 8px; margin: 0; padding: 3px 8px; border-radius: 6px; background: color-mix(in srgb, var(--surface) 85%, transparent); color: var(--text-3); font-size: 11px; pointer-events: none; z-index: 500; }
.schem .grat { stroke: var(--map-grid); stroke-width: 1; }
.schem .grat-t { fill: var(--map-ctx); font-size: 10px; }
.schem .basin { fill: var(--basin); stroke: var(--basin-stroke); stroke-width: 1.2; stroke-dasharray: 5 4; }
.schem .basin-t { fill: var(--forest); font-size: 11px; font-weight: 600; opacity: .75; }
.schem .range { fill: var(--map-ctx); font-size: 12px; font-style: italic; letter-spacing: .12em; }
.schem .hl { fill: var(--active-bg); stroke: var(--gov); stroke-width: 1.5; stroke-dasharray: 5 4; opacity: .85; }
.schem .trib { fill: none; stroke: var(--trib); stroke-width: 1.6; opacity: .75; }
.schem .trib-t { fill: var(--trib); font-size: 10px; font-style: italic; }
.schem .river-halo { fill: none; stroke: var(--river-halo); stroke-width: 11; stroke-linecap: round; opacity: .8; }
.schem .river { fill: none; stroke: var(--river); stroke-width: 4.2; stroke-linecap: round; }
.schem .river-flow { fill: none; stroke: #fff; stroke-width: 1.3; stroke-dasharray: 2 14; stroke-linecap: round; opacity: .85; animation: flow 3.2s linear infinite; }
@keyframes flow { to { stroke-dashoffset: 32; } }
.schem .river-t { fill: var(--river); font-size: 14px; font-weight: 700; font-style: italic; letter-spacing: .08em; }
.schem .src { fill: var(--river); stroke: #fff; stroke-width: 2; }
.schem .src-t { fill: var(--map-label); font-size: 10.5px; font-weight: 600; }
.schem .flow-arrow { fill: none; stroke: var(--river); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.schem .ctx-t { fill: var(--map-ctx); font-size: 10.5px; }
.schem .dist-t { fill: var(--map-label); font-size: 12.5px; font-weight: 650; }
.schem .dist-t.on { fill: var(--gov); font-size: 14px; }
.schem .mk { cursor: pointer; outline: none; }
.schem .mk-in { transition: transform .12s; }
.schem .mk-in > * { stroke: #fff; stroke-width: 2; }
.schem .mk:hover .mk-in, .schem .mk:focus-visible .mk-in { transform: scale(1.45); }
.schem .mk:focus-visible .mk-in > * { stroke: var(--navy); stroke-width: 2.5; }
.schem .compass circle { fill: var(--surface); stroke: var(--border-strong); }
.schem .compass path { fill: var(--navy); }
.schem .compass text, .schem .scale text { fill: var(--map-label); font-size: 10.5px; font-weight: 600; }
.schem .scale path { fill: none; stroke: var(--map-label); stroke-width: 1.5; }
.map-popup { position: absolute; z-index: 600; width: 280px; max-width: calc(100% - 12px); padding: 14px 14px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-3); }
.pop-x { position: absolute; top: 6px; right: 6px; }
.pop-t { font-weight: 650; font-size: 13.5px; color: var(--heading); padding-right: 26px; line-height: 1.35; }
.pop-s { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.pop-b { margin-top: 8px; }
.pop dl { margin: 10px 0 0; display: grid; gap: 4px; }
.pop dl div { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; }
.pop dt { color: var(--text-3); }
.pop dd { margin: 0; font-weight: 600; color: var(--text); text-align: right; }
.pop .btn { margin-top: 12px; width: 100%; }
.lf-mk svg { overflow: visible; }
.lf-mk svg > * { stroke: #fff; stroke-width: 2; }
.leaflet-container { font-family: var(--font); background: var(--map-bg2); }
.leaflet-popup-content-wrapper { border-radius: 14px; }
.leaflet-popup-content { margin: 14px 16px; }

/* ---------- reports ---------- */
.rtypes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.rtype { display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; color: inherit; box-shadow: var(--shadow-1); transition: border-color .15s, background-color .15s; }
.rtype:hover { border-color: var(--border-strong); background: var(--hover); }
.rtype[aria-pressed="true"] { border-color: var(--gov); background: var(--active-bg); box-shadow: 0 0 0 1px var(--gov) inset; }
.rtype .ms { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--sky); color: var(--gov); font-size: 20px; }
.rtype strong { display: block; font-size: 13.5px; color: var(--text); line-height: 1.3; }
.rtype small { display: block; font-size: 12px; color: var(--text-3); margin-top: 3px; line-height: 1.4; }
.param-stack { display: flex; flex-direction: column; gap: 14px; }
.param-stack .field select { max-width: none; width: 100%; }
.param-stack .btn { width: 100%; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.report-doc { background: var(--surface); color: var(--text); }
.rd-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding-bottom: 14px; border-bottom: 2px solid var(--navy); }
.rd-brand { display: flex; align-items: center; gap: 10px; }
.rd-brand strong { display: block; font-size: 13.5px; color: var(--heading); }
.rd-brand span { display: block; font-size: 12px; color: var(--text-3); }
.rd-flag { font-size: 11px; font-weight: 700; color: var(--c-warning-fg); background: var(--c-warning-bg); border: 1px solid #E0A400; padding: 4px 9px; border-radius: 6px; }
.rd-title { font-size: 22px; margin-top: 18px; }
.rd-ref { font-size: 12.5px; color: var(--text-3); margin-top: 4px; }
.rd-scope { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 14px 0 0; padding: 12px 14px; background: var(--surface-2); border-radius: 10px; border: 1px solid var(--border); }
.rd-scope dt { font-size: 11px; color: var(--text-3); font-weight: 600; }
.rd-scope dd { margin: 0; font-size: 13px; font-weight: 600; }
.rd-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 16px; }
.rd-sum div { padding: 12px; border: 1px solid var(--border); border-radius: 10px; }
.rd-sum span { display: block; font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.rd-sum strong { display: block; font-size: 16px; color: var(--heading); margin-top: 3px; font-variant-numeric: tabular-nums; }
.rd-chart, .rd-table, .rd-notes { margin-top: 20px; }
.rd-chart h3, .rd-table h3, .rd-notes h3 { font-size: 14.5px; margin-bottom: 10px; }
.rd-notes ul { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--text-2); }
.rd-notes li + li { margin-top: 4px; }
.print-chart { width: 100%; height: auto; }
#print-root { display: none; }

/* ---------- data management ---------- */
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 26px 16px; border: 2px dashed var(--border-strong); border-radius: 14px; background: var(--surface-2); text-align: center; color: var(--text-2); transition: border-color .15s, background-color .15s; }
.dropzone.drag { border-color: var(--gov); background: var(--active-bg); }
.dropzone .ms { font-size: 34px; color: var(--gov); }
.dropzone p { font-size: 13px; }
.steps { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.val-sum { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 14px 0 10px; }
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.checks li { display: flex; gap: 10px; font-size: 13px; line-height: 1.45; color: var(--text-2); }
.checks .ms { font-size: 20px; }
.checks .ok { color: var(--success); } .checks .bad { color: var(--critical); }
.proto-tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; background: var(--c-warning-bg); color: var(--c-warning-fg); }

/* ---------- misc ---------- */
.skeleton { border-radius: 10px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--hover) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; }
.sk-line { height: 14px; margin-bottom: 10px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.thresholds { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.thresholds .chip { font-weight: 500; }
.page-foot { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--text-3); }

/* ---------- responsive ---------- */
@media (max-width: 1360px) {
  .brand-sub { max-width: 260px; }
  .rtypes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-3, .span-4, .span-5, .span-6, .span-7 { grid-column: span 6; }
  .span-8 { grid-column: 1 / -1; }
  .ov-alerts { grid-column: 1 / -1; }
  .pf-text { display: none; }
  .profile { border-left: 0; padding-left: 0; }
}
@media (max-width: 1024px) {
  .sidebar { position: fixed; left: 0; top: calc(env(safe-area-inset-top, 0px) + var(--topbar-h)); height: calc(100dvh - var(--topbar-h) - env(safe-area-inset-top, 0px)); transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-3); }
  .collapsed .sidebar { flex-basis: var(--sidebar-w); width: var(--sidebar-w); }
  .collapsed .nav-sec-t, .collapsed .nav-label, .collapsed .sb-info { display: block; }
  .collapsed .nav-item { justify-content: flex-start; padding: 8px 14px; }
  .sb-collapse { display: none !important; }
  .nav-open .sidebar { transform: none; }
  .nav-open .scrim { display: block; position: fixed; inset: 0; top: var(--topbar-h); background: rgba(9, 25, 45, .35); z-index: 1100; }
  .brand-sub { display: none; }
  main { padding: 20px 18px 40px; }
}
@media (max-width: 900px) {
  .span-3, .span-4, .span-5, .span-6, .span-7, .span-8 { grid-column: 1 / -1; }
  .demo-flag .lbl-long { display: none; }
  .tb-dl .lbl { display: none; }
  .tb-dl { width: 40px; padding: 0; }
  .filters-hint { margin-left: 0; max-width: none; flex-basis: 100%; }
}
@media (max-width: 640px) {
  :root { --topbar-h: 58px; }
  .topbar { padding: 0 8px 0 4px; gap: 6px; }
  .tb-left, .tb-right { gap: 6px; }
  .brand svg { width: 34px; height: 34px; }
  .brand-gov { display: none; }
  .brand-name { font-size: 14.5px; }
  .demo-flag { padding: 3px 6px; font-size: 10px; }
  .demo-flag .ms { display: none; }
  .period { padding: 0 2px 0 8px; }
  .period > .ms { display: none; }
  .period select { max-width: 112px; font-size: 12px; }
  .profile { display: none; }
  main { padding: 16px 12px 36px; }
  .page-head h1 { font-size: 22px; }
  .kpi-grid, .kpi-grid.auto { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 12px 12px 12px 14px; }
  .kpi-value { font-size: 24px; }
  .kpi-icon { width: 30px; height: 30px; }
  .kpi-label { font-size: 12.5px; }
  .filters { padding: 12px; gap: 10px; }
  .field { min-width: 0; flex: 1 1 140px; }
  .field select { max-width: none; width: 100%; }
  .card { padding: 14px; }
  .grid { gap: 14px; }
  .rtypes { grid-template-columns: 1fr; }
  .form-grid, .kv, .prog-pair { grid-template-columns: 1fr; }
  .search { min-width: 0; flex: 1; }
  .timeline li { grid-template-columns: 32px 1fr; }
  .tl-d { grid-column: 2; }
  .drawer-b { padding: 16px 16px 28px; }
  .modal-b { padding: 10px 16px 16px; }
}
@media (max-width: 380px) { .kpi-grid, .kpi-grid.auto { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .schem .river-flow { display: none; }
}

/* ---------- print ---------- */
@media print {
  @page { size: A4; margin: 14mm; }
  :root { padding: 0; }
  body { background: #fff; color: #000; }
  body::before { display: none; }
  .topbar, .sidebar, .scrim, .filters, .notif-panel, #toast-root, .ph-meta .btn, .dt-tools, .pager, .map-toolbar, .skip-link, .modal-scrim, .drawer-scrim { display: none !important; }
  main { padding: 0; }
  .card, .kpi { box-shadow: none; break-inside: avoid; }
  .grid { display: block; } .grid > * { margin-bottom: 12px; }
  .table-wrap { max-height: none; overflow: visible; }
  body.printing > *:not(#print-root) { display: none !important; }
  body.printing #print-root { display: block; }
  body.printing .chart-box { height: auto !important; }
  .report-doc .tbl th { position: static; }
  .report-doc tr { break-inside: avoid; }
}

/* ---------- refinements after visual review ---------- */
.pf-text strong, .pf-text span { white-space: nowrap; }
@media (max-width: 1500px) { .pf-text { display: none; } .profile { border-left: 0; padding-left: 0; } }
.schem .grat-t { font-size: calc(10px * var(--k, 1)); }
.schem .basin-t { font-size: calc(11px * var(--k, 1)); }
.schem .range { font-size: calc(12px * var(--k, 1)); }
.schem .trib { stroke-width: calc(1.5px * var(--k, 1)); }
.schem .trib-t { font-size: calc(10px * var(--k, 1)); }
.schem .river-halo { stroke-width: calc(10px * var(--k, 1)); }
.schem .river { stroke-width: calc(4px * var(--k, 1)); }
.schem .river-flow { stroke-width: calc(1.2px * var(--k, 1)); stroke-dasharray: calc(2px * var(--k, 1)) calc(14px * var(--k, 1)); }
.schem .river-t { font-size: calc(13px * var(--k, 1)); }
.schem .src { stroke-width: calc(2px * var(--k, 1)); }
.schem .src-t { font-size: calc(10.5px * var(--k, 1)); }
.schem .flow-arrow { stroke-width: calc(2px * var(--k, 1)); }
.schem .ctx-t { font-size: calc(10.5px * var(--k, 1)); }
.schem .dist-t { font-size: calc(12px * var(--k, 1)); }
.schem .dist-t.on { font-size: calc(13.5px * var(--k, 1)); }
.schem .mk-in > * { stroke-width: calc(1.8px * var(--k, 1)); }
.schem .mk:focus-visible .mk-in > * { stroke-width: calc(2.5px * var(--k, 1)); }
.schem .scale text { font-size: calc(10.5px * var(--k, 1)); }
.schem .scale path { stroke-width: calc(1.5px * var(--k, 1)); }
.schem .grat { stroke-width: calc(1px * var(--k, 1)); }
.schem .hl { stroke-width: calc(1.5px * var(--k, 1)); }
.schem .basin { stroke-width: calc(1.2px * var(--k, 1)); stroke-dasharray: calc(5px * var(--k, 1)) calc(4px * var(--k, 1)); }
@keyframes flow { to { stroke-dashoffset: -64; } }
.alerts-card .alert-d { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (min-width: 1201px) {
  .ov-alerts { contain: size; }
  .ov-alerts .card { display: flex; flex-direction: column; }
  .ov-alerts .alert-list { flex: 1; min-height: 0; overflow-y: auto; margin-right: -8px; padding-right: 4px; }
  .kpi-grid.n5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .kpi-grid.n6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-grid.n7 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .kpi-grid.n7 > :nth-child(-n+4) { grid-column: span 3; }
  .kpi-grid.n7 > :nth-child(n+5) { grid-column: span 4; }
}
@media (min-width: 1560px) { .kpi-grid.n6 { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.period select { max-width: 240px; }
.mini-wrap { overflow-x: auto; }
.mini-wrap table.mini { min-width: 420px; }
@media (max-width: 640px) {
  .brand-text { display: none; }
  .period select { max-width: 104px; }
  .demo-flag { letter-spacing: .02em; }
}
@media (max-width: 480px) {
  .tb-dl { display: none; }
  .ph-meta .meta-chip:nth-child(2) { display: none; }
}
.map-note { top: 8px; bottom: auto; }
.filters[hidden] { display: none; }
.kpi-foot .chip { white-space: normal; height: auto; min-height: 24px; padding-top: 3px; padding-bottom: 3px; line-height: 1.25; max-width: 100%; }
@media (max-width: 640px) { .period select { max-width: 132px; } }
