/* ============================================================
   Sherpa Roof Smartlead Cockpit — Sherpa brand
   Dark, near-black canvas · warm gold accents · serif display.
   ============================================================ */
:root {
  /* surfaces */
  --bg: #0b0a08;
  --panel: #131210;
  --panel-2: #1b1814;
  --panel-3: #221f18;
  --line: #2a251d;
  --line-2: #39321f;

  /* text */
  --ink: #f4efe4;
  --muted: #a8a194;
  --faint: #6f6859;

  /* gold */
  --gold: #c9a24b;
  --gold-bright: #e6c879;
  --gold-deep: #9c7d36;
  --on-gold: #17120a;
  --gold-soft: rgba(201, 162, 75, 0.12);
  --gold-soft-2: rgba(201, 162, 75, 0.22);

  /* engines */
  --fit: #7f8ea0;       /* Fit Grade engine (steel) */
  --fit-bright: #a6b3c2;
  --intent: var(--gold); /* Intent / Hazard engine (gold) */

  /* priority */
  --high: #e35d4d;  --high-bg: rgba(227, 93, 77, 0.16);
  --med: #e0a23a;   --med-bg: rgba(224, 162, 58, 0.16);
  --low: #54b27c;   --low-bg: rgba(84, 178, 124, 0.16);

  /* legacy aliases (inline-style refs from JS) */
  --navy-800: var(--panel);
  --teal-500: var(--gold);

  --white: #fff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 30px 70px rgba(0, 0, 0, 0.72);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --mono: "Space Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --t: 0.18s ease;
  --header-h: 62px;
  --kpi-h: 80px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font); color: var(--ink); background: var(--bg);
  font-size: 14px; line-height: 1.45; overflow: hidden;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--gold); text-decoration: none; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

.app { display: flex; flex-direction: column; height: 100vh; }

/* ---------- Header ---------- */
.hdr {
  height: var(--header-h); background: #0a0907; color: var(--ink); display: flex; align-items: center;
  gap: 1.2rem; padding: 0 1.2rem; flex: none; border-bottom: 1px solid var(--line); z-index: 40;
}
.logo { display: flex; align-items: center; gap: 0.6rem; }
.logo svg { height: 30px; width: auto; }
.logo .wm { font-family: var(--serif); font-weight: 700; font-size: 1.5rem; letter-spacing: 0.01em; color: var(--ink); line-height: 1; }
.logo .sub { font-family: var(--mono); font-size: 0.56rem; letter-spacing: 0.22em; color: var(--gold); text-transform: uppercase; font-weight: 700; border-left: 1px solid var(--line-2); padding-left: 0.6rem; margin-left: 0.2rem; line-height: 1.3; }
.hdr__search { flex: 1; max-width: 460px; position: relative; }
.hdr__search input {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--ink);
  padding: 0.5rem 0.8rem 0.5rem 2.1rem; border-radius: 9px; transition: var(--t);
}
.hdr__search input::placeholder { color: var(--faint); }
.hdr__search input:focus { outline: none; background: var(--panel-3); border-color: var(--gold); }
.hdr__search svg { position: absolute; left: 0.7rem; top: 50%; transform: translateY(-50%); color: var(--faint); }
.hdr__right { display: flex; align-items: center; gap: 0.9rem; margin-left: auto; }
.hdr__btn { background: var(--gold); color: var(--on-gold); border: 0; padding: 0.5rem 0.95rem; border-radius: 9px; font-weight: 700; cursor: pointer; transition: var(--t); display: inline-flex; align-items: center; gap: 0.4rem; }
.hdr__btn:hover { background: var(--gold-bright); }
.hdr__btn--ghost { background: var(--panel-2); color: var(--ink); border: 1px solid var(--line-2); font-weight: 600; }
.hdr__btn--ghost:hover { background: var(--panel-3); border-color: var(--gold-deep); }
.srctoggle { display: flex; border: 1px solid var(--line-2); border-radius: 9px; overflow: hidden; }
.srctoggle button { background: var(--panel-2); color: var(--muted); border: 0; padding: 0.45rem 0.85rem; font-weight: 600; font-size: 0.84rem; cursor: pointer; transition: var(--t); white-space: nowrap; }
.srctoggle button.active { background: var(--gold); color: var(--on-gold); }
.srctoggle button:hover:not(.active) { background: var(--panel-3); color: var(--ink); }
.srcmeta { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); display: inline-flex; align-items: center; gap: 0.35rem; }
.srcmeta .live { color: var(--gold); font-weight: 700; }
.hdr__user { width: 34px; height: 34px; border-radius: 50%; background: var(--gold-soft-2); border: 1px solid var(--gold-deep); display: grid; place-items: center; font-weight: 700; font-size: 0.78rem; color: var(--gold-bright); }

/* ---------- KPI bar ---------- */
.kpis { height: var(--kpi-h); background: var(--panel); border-bottom: 1px solid var(--line); display: flex; align-items: stretch; flex: none; overflow-x: auto; }
.kpi { padding: 0.8rem 1.3rem; display: flex; flex-direction: column; justify-content: center; border-right: 1px solid var(--line); min-width: 152px; }
.kpi .label { font-family: var(--mono); font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--faint); font-weight: 700; }
.kpi .val { font-family: var(--serif); font-size: 1.7rem; font-weight: 700; color: var(--ink); line-height: 1.1; margin-top: 0.1rem; }
.kpi .val.high { color: var(--high); }
.kpi .delta { font-size: 0.72rem; color: var(--muted); }
.kpi .delta b { color: var(--low); }

/* ---------- Body layout ---------- */
.body { flex: 1; display: grid; grid-template-columns: 296px 1fr; min-height: 0; }

/* ---------- Sidebar / filters ---------- */
.side { background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; display: flex; flex-direction: column; }
.seg { display: flex; padding: 0.7rem; gap: 0.4rem; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 5; }
.seg button { flex: 1; padding: 0.5rem 0.25rem; border: 1px solid var(--line-2); background: var(--panel-2); border-radius: 9px; font-weight: 600; font-size: 0.68rem; color: var(--muted); cursor: pointer; transition: var(--t); display: flex; flex-direction: column; align-items: center; gap: 0.2rem; line-height: 1.1; }
.seg button .c { font-size: 0.68rem; color: var(--faint); font-weight: 700; }
.seg button:hover { border-color: var(--gold-deep); }
.seg button.active { background: var(--gold-soft); color: var(--gold-bright); border-color: var(--gold); }
.seg button.active .c { color: var(--gold); }

.filters { padding: 0.4rem 0.95rem 1.4rem; }
.fgroup { padding: 0.85rem 0; border-bottom: 1px solid var(--line); }
.fgroup > label, .fgroup > .flabel { display: block; font-family: var(--mono); font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--faint); font-weight: 700; margin-bottom: 0.5rem; }
.fselect, .frange { width: 100%; }
select.fselect { padding: 0.5rem 0.6rem; border: 1px solid var(--line-2); border-radius: 8px; background: var(--panel-3); color: var(--ink); }
select.fselect:focus { outline: none; border-color: var(--gold); }
select.fselect option { background: var(--panel-2); color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.chip { padding: 0.32rem 0.62rem; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel-2); font-size: 0.74rem; font-weight: 600; color: var(--muted); cursor: pointer; transition: var(--t); }
.chip:hover { border-color: var(--gold-deep); color: var(--ink); }
.chip.active { color: #fff; border-color: transparent; }
.chip.active[data-v="all"] { background: var(--gold); color: var(--on-gold); }
.chip.active[data-v="high"] { background: var(--high); }
.chip.active[data-v="medium"] { background: var(--med); color: var(--on-gold); }
.chip.active[data-v="low"] { background: var(--low); }
.range__val { font-family: var(--mono); font-size: 0.72rem; color: var(--gold-bright); font-weight: 700; float: right; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 5px; background: var(--panel-3); border-radius: 4px; margin: 0.6rem 0 0.2rem; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 17px; height: 17px; border-radius: 50%; background: var(--gold); cursor: pointer; border: 2px solid var(--bg); box-shadow: var(--shadow-sm); }
input[type=range]::-moz-range-thumb { width: 15px; height: 15px; border-radius: 50%; background: var(--gold); cursor: pointer; border: 2px solid var(--bg); }
.fbtn { width: 100%; margin-top: 1rem; padding: 0.55rem; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 9px; color: var(--muted); font-weight: 600; cursor: pointer; transition: var(--t); }
.fbtn:hover { background: var(--panel-3); color: var(--ink); border-color: var(--gold-deep); }

/* ---------- Main ---------- */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.toolbar { display: flex; align-items: center; gap: 0.7rem; padding: 0.6rem 1rem; background: var(--panel); border-bottom: 1px solid var(--line); flex: none; }
.toolbar .count { font-weight: 700; color: var(--ink); }
.toolbar .count small { font-weight: 500; color: var(--muted); }
.viewtoggle { display: flex; border: 1px solid var(--line-2); border-radius: 9px; overflow: hidden; margin-left: auto; }
.viewtoggle button { padding: 0.42rem 0.85rem; border: 0; background: var(--panel-2); color: var(--muted); font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 0.35rem; transition: var(--t); }
.viewtoggle button:hover { color: var(--ink); }
.viewtoggle button.active { background: var(--gold-soft); color: var(--gold-bright); }
.sortsel { padding: 0.42rem 0.6rem; border: 1px solid var(--line-2); border-radius: 9px; background: var(--panel-3); color: var(--ink); }
.sortsel option { background: var(--panel-2); }

.stage { flex: 1; position: relative; min-height: 0; isolation: isolate; }
#map { position: absolute; inset: 0; background: #0b0a08; }
.view { position: absolute; inset: 0; display: none; }
.view.active { display: block; }
#view-table { overflow: auto; background: var(--bg); }
/* dark map controls */
.leaflet-bar a, .leaflet-bar a:hover { background: var(--panel-2); color: var(--ink); border-bottom-color: var(--line); }
.leaflet-control-attribution { background: rgba(11,10,8,0.7) !important; color: var(--faint) !important; }
.leaflet-control-attribution a { color: var(--muted) !important; }

/* map legend */
.legend { position: absolute; bottom: 16px; left: 16px; z-index: 500; background: var(--panel); border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow); padding: 0.7rem 0.9rem; font-size: 0.78rem; }
.legend b { display: block; font-family: var(--mono); font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--faint); margin-bottom: 0.45rem; }
.legend .row { display: flex; align-items: center; gap: 0.5rem; padding: 0.12rem 0; color: var(--muted); }
.legend .dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--panel); box-shadow: 0 0 0 1px rgba(0,0,0,0.5); }
.dot.high { background: var(--high); } .dot.medium { background: var(--med); } .dot.low { background: var(--low); }

/* ---------- Table ---------- */
table.leads { width: 100%; border-collapse: collapse; background: var(--panel); }
table.leads thead th { position: sticky; top: 0; background: var(--panel-2); border-bottom: 1px solid var(--line-2); padding: 0.6rem 0.7rem; text-align: left; font-family: var(--mono); font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); font-weight: 700; cursor: pointer; white-space: nowrap; z-index: 2; }
table.leads thead th.sorted::after { content: " ▾"; color: var(--gold); }
table.leads tbody tr { border-bottom: 1px solid var(--line); cursor: pointer; transition: background var(--t); }
table.leads tbody tr:hover { background: var(--gold-soft); }
table.leads tbody tr.sel { background: rgba(201, 162, 75, 0.16); }
table.leads td { padding: 0.55rem 0.7rem; vertical-align: middle; }
table.leads td.name b { color: var(--ink); }
table.leads td.name span { display: block; font-size: 0.76rem; color: var(--muted); }
.scorebadge { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; padding: 0.2rem 0.4rem; border-radius: 7px; font-weight: 800; font-size: 0.86rem; }
.scorebadge.high { background: var(--high-bg); color: var(--high); }
.scorebadge.medium { background: var(--med-bg); color: var(--med); }
.scorebadge.low { background: var(--low-bg); color: var(--low); }
/* matrix tier (A1–D3) */
.matrix { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; padding: 0.18rem 0.42rem; border-radius: 6px; font-weight: 800; font-size: 0.78rem; letter-spacing: 0.02em; border: 1px solid var(--line-2); }
.matrix--a { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }
.matrix--b { background: var(--gold-soft-2); color: var(--gold-bright); border-color: var(--gold-deep); }
.matrix--c { background: var(--panel-3); color: var(--muted); }
.matrix--d { background: transparent; color: var(--faint); }
.tag { display: inline-block; padding: 0.12rem 0.5rem; border-radius: 999px; font-size: 0.7rem; font-weight: 600; background: var(--panel-3); color: var(--muted); }
.tag.storm { background: var(--high-bg); color: #ef8475; }
.tag.reno { background: rgba(150, 128, 214, 0.18); color: #bcaaf0; }
.tag.forever { background: var(--low-bg); color: #6cc795; }
.prov { display: inline-block; font-size: 0.6rem; font-weight: 800; letter-spacing: 0.05em; padding: 0.05rem 0.32rem; border-radius: 4px; vertical-align: 1px; }
.prov.demo { background: var(--panel-3); color: var(--faint); }
.prov.real { background: var(--gold-soft-2); color: var(--gold-bright); }
.cbx { width: 16px; height: 16px; accent-color: var(--gold); cursor: pointer; }
.muted { color: var(--muted); }

/* ---------- Detail drawer ---------- */
.drawer { position: fixed; top: 0; right: 0; height: 100vh; width: 444px; max-width: 92vw; background: var(--panel); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform 0.26s cubic-bezier(0.22,0.61,0.36,1); z-index: 60; display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.drawer__head { padding: 1.1rem 1.2rem; color: #fff; position: relative; }
.drawer__head.high { background: linear-gradient(135deg, #7a241b, var(--high)); }
.drawer__head.medium { background: linear-gradient(135deg, #80571a 10%, var(--med)); }
.drawer__head.low { background: linear-gradient(135deg, #1d6442, var(--low)); }
.drawer__close { position: absolute; top: 0.9rem; right: 0.9rem; background: rgba(0,0,0,0.25); border: 0; width: 30px; height: 30px; border-radius: 7px; color: #fff; cursor: pointer; font-size: 1.1rem; }
.drawer__close:hover { background: rgba(0,0,0,0.4); }
.drawer__score { display: flex; align-items: center; gap: 0.8rem; }
.drawer__score .big { font-family: var(--serif); font-size: 2.9rem; font-weight: 700; line-height: 1; }
.drawer__score .meta .pr { font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.78rem; }
.drawer__score .meta .id { opacity: 0.92; font-size: 0.78rem; }
.drawer__name { margin-top: 0.8rem; font-size: 1.2rem; font-weight: 800; }
.drawer__addr { opacity: 0.92; font-size: 0.85rem; }
.dualpill { display: flex; gap: 0.5rem; margin-top: 0.85rem; }
.dp { background: rgba(0,0,0,0.22); border: 1px solid rgba(255,255,255,0.22); border-radius: 8px; padding: 0.32rem 0.6rem; font-size: 0.74rem; font-weight: 600; }
.dp b { font-size: 0.9rem; }
.drawer__body { overflow-y: auto; padding: 1.1rem 1.2rem; flex: 1; background: var(--panel); }
.dsec { margin-bottom: 1.3rem; }
.dsec h4 { font-family: var(--mono); font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--faint); font-weight: 700; margin-bottom: 0.55rem; display: flex; align-items: center; gap: 0.4rem; }
.dgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 1rem; }
.dgrid .it { padding: 0.4rem 0; border-bottom: 1px dashed var(--line-2); }
.dgrid .it .k { font-size: 0.7rem; color: var(--muted); }
.dgrid .it .v { font-weight: 700; color: var(--ink); }
/* combined index split bar */
.cpibar { display: flex; height: 30px; border-radius: 8px; overflow: hidden; margin: 0.4rem 0 0.7rem; font-size: 0.72rem; font-weight: 700; }
.cpibar__seg { display: flex; align-items: center; justify-content: center; white-space: nowrap; }
.cpibar__seg.fit { background: var(--fit); color: #0d1217; }
.cpibar__seg.int { background: var(--gold); color: var(--on-gold); }
/* scoring breakdown bars */
.bd { margin-bottom: 0.6rem; }
.bd__top { display: flex; justify-content: space-between; font-size: 0.78rem; margin-bottom: 0.2rem; color: var(--muted); }
.bd__top .pts { font-weight: 700; color: var(--ink); }
.bd__bar { height: 9px; background: var(--panel-3); border-radius: 5px; overflow: hidden; }
.bd__fill { height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--gold-deep), var(--gold)); transition: width 0.5s ease; }
.bd__fill.fitfill { background: linear-gradient(90deg, #4d5866, var(--fit)); }
.bd__fill.intfill { background: linear-gradient(90deg, var(--gold-deep), var(--gold-bright)); }
.bd__total { display: flex; justify-content: space-between; margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--line-2); font-weight: 800; color: var(--ink); }
.bd__total.ded { color: var(--high); font-weight: 700; }
.triggers li { display: flex; gap: 0.5rem; padding: 0.4rem 0; font-size: 0.84rem; color: var(--muted); border-bottom: 1px solid var(--line); }
.triggers li svg { flex: none; color: var(--gold); margin-top: 2px; }
.permits .p { display: flex; justify-content: space-between; gap: 0.8rem; font-size: 0.8rem; padding: 0.35rem 0; border-bottom: 1px solid var(--line); }
.permits .p span:first-child { color: var(--ink); }
.permits .p span:last-child { text-align: right; }
.rawtoggle { float: right; background: var(--panel-3); border: 1px solid var(--line-2); color: var(--gold); font-family: var(--font); font-size: 0.7rem; font-weight: 700; padding: 0.12rem 0.55rem; border-radius: 6px; cursor: pointer; text-transform: none; letter-spacing: 0; }
.rawtoggle:hover { background: var(--gold-soft); border-color: var(--gold); }
.provenance { font-size: 0.76rem; color: var(--muted); line-height: 1.5; margin-bottom: 0.6rem; }
.scoredef { font-size: 0.76rem; color: var(--muted); line-height: 1.5; margin-bottom: 0.85rem; padding: 0.55rem 0.7rem; background: var(--panel-2); border-left: 3px solid var(--gold); border-radius: 0 7px 7px 0; }
.rawjson { background: #08070500; background-color: #080705; color: var(--gold-bright); font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.74rem; line-height: 1.45; padding: 0.9rem; border-radius: 9px; overflow-x: auto; white-space: pre; max-height: 340px; overflow-y: auto; border: 1px solid var(--line); }
.rawactions { margin-top: 0.5rem; }
.drawer__actions { padding: 0.9rem 1.2rem; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; flex: none; background: var(--panel); }
.daction { padding: 0.6rem; border-radius: 9px; border: 1px solid var(--line-2); background: var(--panel-2); font-weight: 600; cursor: pointer; transition: var(--t); display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; color: var(--ink); }
.daction:hover { border-color: var(--gold); color: var(--gold-bright); }
.daction--ev { grid-column: 1 / -1; border-color: var(--gold-deep); color: var(--gold-bright); background: var(--gold-soft); }
.daction--ev:hover { background: var(--gold-soft-2); border-color: var(--gold); color: var(--gold-bright); }
.daction--primary { grid-column: 1 / -1; background: var(--gold); color: var(--on-gold); border-color: var(--gold); }
.daction--primary:hover { background: var(--gold-bright); color: var(--on-gold); }
.daction--primary.synced { background: var(--low); border-color: var(--low); color: #07150d; pointer-events: none; }

/* ---------- Selection action bar ---------- */
.selbar { position: fixed; bottom: 0; left: 296px; right: 0; background: #0a0907; border-top: 1px solid var(--line-2); color: var(--ink); padding: 0.7rem 1.1rem; display: none; align-items: center; gap: 0.9rem; z-index: 50; box-shadow: 0 -10px 30px rgba(0,0,0,0.5); }
.selbar.show { display: flex; }
.selbar .n { font-weight: 800; }
.selbar .n b { color: var(--gold-bright); }
.selbar .sbtn { background: var(--panel-2); border: 1px solid var(--line-2); color: var(--ink); padding: 0.5rem 0.9rem; border-radius: 9px; font-weight: 600; cursor: pointer; transition: var(--t); display: inline-flex; align-items: center; gap: 0.4rem; }
.selbar .sbtn:hover { background: var(--panel-3); border-color: var(--gold-deep); }
.selbar .sbtn--go { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
.selbar .sbtn--go:hover { background: var(--gold-bright); }
.selbar .clear { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; text-decoration: underline; }

/* ---------- Toast ---------- */
.toasts { position: fixed; top: calc(var(--header-h) + 12px); right: 16px; z-index: 90; display: flex; flex-direction: column; gap: 0.5rem; }
.toast { background: var(--panel-2); border: 1px solid var(--line-2); color: var(--ink); padding: 0.7rem 1rem; border-radius: 10px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 0.6rem; font-weight: 600; animation: slideIn 0.25s ease; max-width: 340px; }
.toast.ok { border-color: var(--low); }
.toast.ok svg { color: var(--low); }
.toast svg { flex: none; color: var(--gold); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* ---------- mini charts ---------- */
.spark { display: flex; align-items: flex-end; gap: 3px; height: 38px; }
.spark .b { width: 14px; background: linear-gradient(180deg, var(--gold), var(--gold-deep)); border-radius: 3px 3px 0 0; position: relative; }
.spark .b .lab { position: absolute; bottom: -15px; left: 50%; transform: translateX(-50%); font-size: 0.58rem; color: var(--faint); white-space: nowrap; }
.donut { display: flex; align-items: center; gap: 0.7rem; }
.donut .legend2 { font-size: 0.72rem; }
.donut .legend2 .r { display: flex; align-items: center; gap: 0.35rem; color: var(--muted); }
.donut .legend2 .r i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }

/* ---------- empty state ---------- */
.empty { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); text-align: center; padding: 2rem; }
.empty.show { display: flex; }
.empty svg { color: var(--line-2); margin-bottom: 0.8rem; }
.empty h3 { color: var(--ink); }

/* ---------- print labels ---------- */
@media print {
  body * { visibility: hidden; }
  #print-area, #print-area * { visibility: visible; }
  #print-area { position: absolute; inset: 0; display: block !important; color: #000; }
}
#print-area { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .body { grid-template-columns: 1fr; }
  .side { position: fixed; inset: calc(var(--header-h) + var(--kpi-h)) auto 0 0; width: 286px; z-index: 30; transform: translateX(-100%); transition: transform var(--t); }
  .side.open { transform: none; }
  .selbar { left: 0; }
  .hdr__search { display: none; }
}
.side-toggle { display: none; }
@media (max-width: 980px) { .side-toggle { display: inline-flex; } }
