/* ADN Monitor — design tokens + layout */
:root {
  color-scheme: light;
  --bg: #f4f5f2;
  --surface-1: #fcfcfb;
  --surface-2: #f0f1ed;
  --surface-3: #e6e8e2;
  --border: rgba(11, 11, 11, .09);
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #6f6d68;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --accent: #2a78d6;
  --accent-ink: #1c5cab;
  --accent-soft: rgba(42, 120, 214, .10);
  --brand-1: #0d366b;
  --brand-2: #2a78d6;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --good-ink: #006300; --critical-ink: #b02a2a; --serious-ink: #a8481f; --warning-ink: #7a5300;
  --good-soft: rgba(12, 163, 12, .10); --warning-soft: rgba(250, 178, 25, .16);
  --serious-soft: rgba(236, 131, 90, .14); --critical-soft: rgba(208, 59, 59, .10);
  --info-soft: rgba(42, 120, 214, .09);
  --shadow-sm: 0 1px 2px rgba(15, 20, 10, .05), 0 1px 1px rgba(15, 20, 10, .03);
  --shadow-md: 0 6px 24px -8px rgba(15, 25, 40, .14);
  --radius: 14px;
  --sidebar-w: 248px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d0d0d; --surface-1: #1a1a19; --surface-2: #222220; --surface-3: #2c2c2a;
    --border: rgba(255, 255, 255, .09);
    --text-primary: #f0efec; --text-secondary: #c3c2b7; --text-muted: #9a988f;
    --grid: #2c2c2a; --axis: #383835;
    --accent: #3987e5; --accent-ink: #86b6ef; --accent-soft: rgba(57, 135, 229, .16);
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --good-ink: #3fcf3f; --critical-ink: #f07a7a; --serious-ink: #f3a07e; --warning-ink: #fbc85a;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow-md: 0 8px 28px -10px rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0d0d; --surface-1: #1a1a19; --surface-2: #222220; --surface-3: #2c2c2a;
  --border: rgba(255, 255, 255, .09);
  --text-primary: #f0efec; --text-secondary: #c3c2b7; --text-muted: #9a988f;
  --grid: #2c2c2a; --axis: #383835;
  --accent: #3987e5; --accent-ink: #86b6ef; --accent-soft: rgba(57, 135, 229, .16);
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --good-ink: #3fcf3f; --critical-ink: #f07a7a; --serious-ink: #f3a07e; --warning-ink: #fbc85a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow-md: 0 8px 28px -10px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text-primary);
  font-family: var(--font); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-ink); }
.mono, code { font-family: var(--mono); font-size: .92em; }
.num { font-variant-numeric: tabular-nums; }
::selection { background: var(--accent-soft); }

/* ------------------------------------------------ shell */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: linear-gradient(180deg, #0b1f3a 0%, #0d2a50 55%, #0f3566 100%);
  color: #dbe6f5; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; z-index: 1040; transition: transform .25s ease;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, #3987e5, #1baf7a); color: #fff; font-size: 19px;
  box-shadow: 0 6px 18px -6px rgba(57, 135, 229, .7);
}
.brand-name { font-weight: 800; letter-spacing: -.02em; font-size: 16px; color: #fff; }
.brand-sub { font-size: 11.5px; color: #9fb4d3; }
.nav-group { padding: 6px 12px; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: #7f97b9; padding: 12px 10px 6px; font-weight: 600; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px;
  color: #c9d7ea; text-decoration: none; font-weight: 500; font-size: 13.5px; cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-item i { font-size: 16px; width: 18px; text-align: center; opacity: .9; }
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item.active { background: rgba(57, 135, 229, .28); color: #fff; box-shadow: inset 3px 0 0 #6da7ec; }
.nav-item .count { margin-left: auto; background: rgba(208, 59, 59, .9); color: #fff; font-size: 10.5px; padding: 1px 7px; border-radius: 20px; font-weight: 700; }
.sidebar-foot { margin-top: auto; padding: 14px 18px; font-size: 11.5px; color: #8aa2c4; border-top: 1px solid rgba(255, 255, 255, .07); }
.sidebar-foot .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; background: #898781; }
.sidebar-foot .dot.ok { background: #0ca30c; box-shadow: 0 0 0 3px rgba(12, 163, 12, .25); }
.sidebar-foot .dot.run { background: #fab219; animation: pulse 1.2s infinite; }
.sidebar-foot .dot.err { background: #d03b3b; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(250, 178, 25, .0); opacity: .6; } }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 1030; display: flex; align-items: center; gap: 12px;
  padding: 12px 28px; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 19px; font-weight: 750; margin: 0; letter-spacing: -.02em; }
.topbar .crumb { font-size: 12px; color: var(--text-muted); }
.topbar .spacer { flex: 1; }
.period {
  display: flex; align-items: center; gap: 6px; background: var(--surface-1); border: 1px solid var(--border);
  padding: 4px 6px 4px 12px; border-radius: 12px; box-shadow: var(--shadow-sm);
}
.period select { border: 0; background: transparent; color: var(--text-primary); font-weight: 600; font-size: 13px; padding: 4px 2px; outline: none; }
.period .sep { color: var(--text-muted); }
.period-presets { display: flex; gap: 2px; margin-left: 6px; }
.period-presets button { border: 0; background: transparent; color: var(--text-secondary); padding: 4px 9px; border-radius: 8px; font-size: 12px; font-weight: 600; }
.period-presets button:hover { background: var(--surface-2); }
.period-presets button.on { background: var(--accent-soft); color: var(--accent-ink); }
.icon-btn {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; border: 1px solid var(--border);
  background: var(--surface-1); color: var(--text-secondary); cursor: pointer; box-shadow: var(--shadow-sm);
}
.icon-btn:hover { color: var(--text-primary); background: var(--surface-2); }
.search-global { position: relative; width: 300px; }
.search-global input {
  width: 100%; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-1);
  color: var(--text-primary); padding: 8px 12px 8px 36px; font-size: 13px; outline: none; box-shadow: var(--shadow-sm);
}
.search-global input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search-global > i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-md); max-height: 380px; overflow: auto; display: none; z-index: 2000;
}
.search-results .it { padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--border); }
.search-results .it:hover { background: var(--surface-2); }
.search-results .it small { color: var(--text-muted); font-family: var(--mono); }

.content { padding: 24px 28px 60px; max-width: 1680px; width: 100%; }
.view { display: none; animation: fadein .3s ease; }
.view.active { display: block; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------ cards */
.card-x {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 18px 20px; position: relative; min-width: 0;
}
.card-x + .card-x { margin-top: 0; }
.card-title { font-size: 14px; font-weight: 700; margin: 0 0 2px; display: flex; align-items: center; gap: 8px; }
.card-sub { color: var(--text-muted); font-size: 12px; margin-bottom: 12px; }
.card-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.card-head .tools { margin-left: auto; display: flex; gap: 6px; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.c-4 { grid-column: span 4; } .c-5 { grid-column: span 5; } .c-6 { grid-column: span 6; }
.c-7 { grid-column: span 7; } .c-8 { grid-column: span 8; } .c-12 { grid-column: span 12; }
.mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }

/* hero */
.hero {
  border-radius: 20px; padding: 26px 28px; color: #fff; position: relative; overflow: hidden;
  background: radial-gradient(1200px 300px at 85% -40%, rgba(27, 175, 122, .45), transparent 60%),
              radial-gradient(800px 300px at -10% 120%, rgba(98, 80, 214, .45), transparent 60%),
              linear-gradient(120deg, #0b1f3a, #0f3566 60%, #134685);
  box-shadow: var(--shadow-md);
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .18;
  background-image: linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px);
  background-size: 28px 28px; mask-image: linear-gradient(90deg, transparent, #000 60%);
}
.hero-row { display: flex; gap: 32px; align-items: flex-end; flex-wrap: wrap; position: relative; z-index: 1; }
.hero-label { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: #a9c3e6; font-weight: 600; }
.hero-value { font-size: 44px; font-weight: 800; letter-spacing: -.03em; line-height: 1.05; margin-top: 4px; }
.hero-note { color: #c9d9ef; font-size: 13px; margin-top: 6px; max-width: 520px; }
.hero-stats { display: flex; gap: 28px; flex-wrap: wrap; margin-left: auto; }
.hero-stat .v { font-size: 22px; font-weight: 750; }
.hero-stat .l { font-size: 11.5px; color: #a9c3e6; text-transform: uppercase; letter-spacing: .06em; }
.hero-actions { display: flex; gap: 8px; margin-top: 16px; position: relative; z-index: 1; flex-wrap: wrap; }
.btn-glass { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.18); border-radius: 10px; padding: 7px 14px; font-weight: 600; font-size: 13px; backdrop-filter: blur(6px); }
.btn-glass:hover { background: rgba(255,255,255,.2); color: #fff; }

/* kpis */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.kpi {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden; transition: transform .2s, box-shadow .2s;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi .k-label { font-size: 11.5px; color: var(--text-secondary); font-weight: 600; display: flex; gap: 6px; align-items: center; text-transform: uppercase; letter-spacing: .04em; }
.kpi .k-value { font-size: 23px; font-weight: 780; letter-spacing: -.02em; margin: 6px 0 2px; line-height: 1.15; word-break: break-word; }
.kpi .k-sub { font-size: 12px; color: var(--text-muted); }
.kpi .k-ico { position: absolute; right: 14px; top: 14px; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-secondary); font-size: 16px; }
.kpi[data-tone]::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.kpi[data-tone="critical"]::before { background: var(--critical); }
.kpi[data-tone="serious"]::before { background: var(--serious); }
.kpi[data-tone="warning"]::before { background: var(--warning); }
.kpi[data-tone="good"]::before { background: var(--good); }
.kpi[data-tone="info"]::before { background: var(--accent); }
.kpi[data-tone="critical"] .k-ico { background: var(--critical-soft); color: var(--critical-ink); }
.kpi[data-tone="serious"] .k-ico { background: var(--serious-soft); color: var(--serious-ink); }
.kpi[data-tone="warning"] .k-ico { background: var(--warning-soft); color: var(--warning-ink); }
.kpi[data-tone="good"] .k-ico { background: var(--good-soft); color: var(--good-ink); }
.kpi[data-tone="info"] .k-ico { background: var(--info-soft); color: var(--accent-ink); }
.help-tip { color: var(--text-muted); cursor: help; }

/* sections */
.section { margin-top: 28px; }
.section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.section-head h2 { font-size: 17px; font-weight: 750; margin: 0; letter-spacing: -.01em; }
.badge-x { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; padding: 3px 9px; border-radius: 20px; background: var(--accent-soft); color: var(--accent-ink); }
.section-desc { color: var(--text-secondary); font-size: 13px; margin: 2px 0 14px; max-width: 980px; }

.chart { width: 100%; height: 320px; }
.chart.tall { height: 440px; }

/* alerts */
.alert-x { border-radius: 12px; padding: 12px 16px; margin: 0 0 14px; display: flex; gap: 10px; align-items: flex-start; font-size: 13px; border: 1px solid var(--border); }
.alert-x i { font-size: 17px; margin-top: 1px; }
.alert-x[data-tone="critical"] { background: var(--critical-soft); } .alert-x[data-tone="critical"] i { color: var(--critical-ink); }
.alert-x[data-tone="serious"] { background: var(--serious-soft); } .alert-x[data-tone="serious"] i { color: var(--serious-ink); }
.alert-x[data-tone="warning"] { background: var(--warning-soft); } .alert-x[data-tone="warning"] i { color: var(--warning-ink); }
.alert-x[data-tone="good"] { background: var(--good-soft); } .alert-x[data-tone="good"] i { color: var(--good-ink); }
.alert-x[data-tone="info"] { background: var(--info-soft); } .alert-x[data-tone="info"] i { color: var(--accent-ink); }

/* severity / status pills */
.sev { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 20px; white-space: nowrap; }
.sev i { font-size: 11px; }
.sev-4 { background: var(--critical-soft); color: var(--critical-ink); }
.sev-3 { background: var(--serious-soft); color: var(--serious-ink); }
.sev-2 { background: var(--warning-soft); color: var(--warning-ink); }
.sev-1 { background: var(--surface-2); color: var(--text-secondary); }
.st { font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 20px; border: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); color: var(--text-secondary); }
.st-em_analise { background: var(--info-soft); color: var(--accent-ink); }
.st-notificado { background: var(--warning-soft); color: var(--warning-ink); }
.st-autuado { background: var(--critical-soft); color: var(--critical-ink); }
.st-regularizado { background: var(--good-soft); color: var(--good-ink); }
.st-descartado { opacity: .65; text-decoration: line-through; }
.tag-x { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 8px; background: var(--surface-2); color: var(--text-secondary); white-space: nowrap; }
.cls-fuga { background: var(--critical-soft); color: var(--critical-ink); }
.cls-retido_st { background: var(--good-soft); color: var(--good-ink); }
.cls-origem, .cls-proprio { background: var(--info-soft); color: var(--accent-ink); }
.doc-link { font-family: var(--mono); font-size: 12px; color: var(--accent-ink); cursor: pointer; text-decoration: none; border-bottom: 1px dashed currentColor; }

/* tables */
table.dataTable, .tbl { width: 100% !important; font-size: 12.8px; color: var(--text-primary); }
.tbl { border-collapse: collapse; }
.tbl th, table.dataTable thead th {
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary) !important; font-weight: 700;
  background: var(--surface-2) !important; border-bottom: 1px solid var(--border) !important; white-space: nowrap; padding: 9px 10px !important;
}
.tbl td, table.dataTable tbody td { padding: 8px 10px !important; border-bottom: 1px solid var(--border) !important; vertical-align: middle; background: transparent !important; color: var(--text-primary); }
table.dataTable tbody tr:hover td, .tbl tbody tr:hover td { background: var(--surface-2) !important; }
table.dataTable > tbody > tr { background: transparent; }
td.r, th.r { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dt-container { color: var(--text-secondary); font-size: 12.5px; }
.dt-container .dt-search input, .dt-container .dt-length select, .form-control, .form-select {
  background-color: var(--surface-1) !important; color: var(--text-primary) !important; border-color: var(--border) !important; border-radius: 9px !important;
}
.form-control:focus, .form-select:focus { box-shadow: 0 0 0 4px var(--accent-soft) !important; border-color: var(--accent) !important; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.form-text { color: var(--text-muted) !important; font-size: 11.5px; }
.dt-container .pagination .page-link { background: var(--surface-1); border-color: var(--border); color: var(--text-secondary); font-size: 12px; }
.dt-container .pagination .active .page-link { background: var(--accent); border-color: var(--accent); color: #fff; }
.dt-container .pagination .disabled .page-link { background: var(--surface-2); color: var(--text-muted); }
.tbl-scroll { overflow-x: auto; }
div.dt-processing > div:last-child > div { background: var(--accent) !important; }
div.dt-processing { background: var(--surface-1) !important; color: var(--text-primary); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-md); }

/* buttons */
.btn { border-radius: 10px; font-weight: 600; font-size: 13px; }
.btn-primary { background: var(--accent); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-soft { background: var(--surface-2); border: 1px solid var(--border); color: var(--text-primary); }
.btn-soft:hover { background: var(--surface-3); color: var(--text-primary); }
.btn-xs { padding: 3px 9px; font-size: 12px; border-radius: 8px; }

/* chips / filters */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters .f { min-width: 150px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--border); background: var(--surface-1); color: var(--text-secondary); padding: 5px 11px; border-radius: 20px; font-size: 12px; font-weight: 600; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.chip:hover { background: var(--surface-2); }
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip .n { font-weight: 700; opacity: .8; }

/* worklist tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.tile { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 14px; cursor: pointer; transition: all .18s; position: relative; }
.tile:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.tile.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tile .t-title { font-weight: 700; font-size: 13px; }
.tile .t-val { font-size: 19px; font-weight: 780; margin-top: 6px; }
.tile .t-sub { color: var(--text-muted); font-size: 12px; }
.tile .sev { position: absolute; right: 12px; top: 12px; }

/* bars (inline) */
.mini-bar { height: 6px; background: var(--surface-2); border-radius: 4px; overflow: hidden; min-width: 60px; }
.mini-bar > span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }

/* tree */
.tree { font-family: var(--mono); font-size: 13px; line-height: 1.9; }
.tree .node { display: flex; justify-content: space-between; gap: 18px; border-bottom: 1px dashed var(--border); }
.tree .lvl1 { padding-left: 22px; } .tree .lvl2 { padding-left: 46px; color: var(--text-secondary); }
.tree .root { font-weight: 800; color: var(--critical-ink); }

/* progress */
.sync-progress { height: 8px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.sync-progress > span { display: block; height: 100%; width: 40%; background: linear-gradient(90deg, var(--s1), var(--s3)); animation: indet 1.4s infinite ease-in-out; border-radius: 6px; }
@keyframes indet { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }
.log-box { background: #0b1220; color: #cfe3ff; font-family: var(--mono); font-size: 12px; border-radius: 12px; padding: 12px 14px; height: 260px; overflow: auto; white-space: pre-wrap; }

/* config */
.cfg-nav .nav-link { color: var(--text-secondary); font-weight: 600; font-size: 13px; border-radius: 10px; padding: 8px 12px; display: flex; gap: 8px; align-items: center; }
.cfg-nav .nav-link.active { background: var(--accent-soft); color: var(--accent-ink); }
.cfg-pane { display: none; } .cfg-pane.active { display: block; }
.secret-wrap { position: relative; }
.secret-wrap button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--text-muted); }
.weekday { display: flex; gap: 6px; flex-wrap: wrap; }
.weekday label { cursor: pointer; }
.weekday input { display: none; }
.weekday span { display: inline-block; padding: 6px 12px; border-radius: 9px; border: 1px solid var(--border); font-weight: 600; font-size: 12px; background: var(--surface-1); }
.weekday input:checked + span { background: var(--accent); color: #fff; border-color: var(--accent); }

/* offcanvas / modal theming */
.offcanvas, .modal-content { background: var(--bg); color: var(--text-primary); border-color: var(--border); }
.offcanvas-header, .modal-header { border-bottom: 1px solid var(--border); background: var(--surface-1); }
.offcanvas.offcanvas-end.wide { width: min(1180px, 96vw); }
.btn-close { filter: var(--btn-close-filter, none); }
:root[data-theme="dark"] .btn-close { filter: invert(1); }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--text-muted); font-weight: 600; font-size: 12px; }
.kv dd { margin: 0; word-break: break-word; }

/* empty / loading */
.empty { text-align: center; padding: 70px 20px; color: var(--text-muted); }
.empty i { font-size: 46px; display: block; margin-bottom: 10px; opacity: .6; }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; border-radius: 12px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.loading-overlay { position: fixed; inset: 0; display: none; place-items: center; background: color-mix(in srgb, var(--bg) 70%, transparent); z-index: 3000; backdrop-filter: blur(4px); }
.loading-overlay.show { display: grid; }
.spinner-ring { width: 54px; height: 54px; border-radius: 50%; border: 4px solid var(--surface-3); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.legend-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }

/* responsive */
.menu-toggle { display: none; }
@media (max-width: 1200px) {
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .c-4, .c-5, .c-7, .c-8 { grid-column: span 12; }
  .c-6 { grid-column: span 12; }
  .search-global { width: 220px; }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: 0 0 60px rgba(0,0,0,.4); }
  .menu-toggle { display: grid; }
  .g-2, .g-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .content { padding: 16px; }
  .topbar { padding: 10px 16px; flex-wrap: wrap; }
  .search-global { order: 9; width: 100%; }
  .period-presets { display: none; }
  .hero-value { font-size: 32px; }
  .kv { grid-template-columns: 1fr; }
}
@media print {
  .sidebar, .topbar, .hero-actions, .tools { display: none !important; }
  .view { display: block !important; }
  body { background: #fff; }
}
