/* RADAR dashboard styles. Internal prospecting tool. Density, speed, keyboard first.
   Vanilla CSS, no build step, no external fonts or CDN. */

/* ---------- Foundation reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scrollbar-gutter: stable; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-width: 390px; overflow-x: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: var(--fs-body); line-height: 1.4;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img, video, svg, canvas, picture { max-width: 100%; height: auto; display: block; }
h1,h2,h3,h4,p,span,a,li,button { overflow-wrap: break-word; }
button { font-family: inherit; }
@media (prefers-reduced-motion: reduce){ *{ animation:none !important; transition:none !important; scroll-behavior:auto !important; } }

/* ---------- Spacing scale. Use these everywhere, no arbitrary values. ---------- */
:root{
  --sp-1:4px; --sp-2:8px; --sp-3:12px; --sp-4:16px; --sp-5:24px; --sp-6:32px; --sp-7:48px;
  /* One radius for the whole interface. */
  --radius:10px;
  /* Three interface sizes plus one documented exception for large numeric
     callouts (stat totals, tile counts). Those are display numerals, not
     reading text, so they sit outside the three-size rule on purpose. */
  --fs-body:13.5px; --fs-small:12px; --fs-micro:11px; --fs-display:26px;
  --gut:24px;
}

/* ---------- Theme tokens ---------- */
:root{
  --bg:#ffffff; --surface:#f7f7f9; --surface2:#eef0f3; --ink:#111114; --muted:#63666d; --faint:#9a9da3;
  --line:#e3e4e8; --line2:#ecedf0;
  --accent:#3d5afe; --accent-ink:#ffffff; --accent-soft:#ecefff;
  --live:#1c9a4b; --parked:#b4720a; --off:#8b8f96;
  --review:#9c6b12; --contacted:#2f6fa8; --ignored:#8b8f96;
  --danger:#d1373f; --danger-ink:#ffffff; --danger-soft:#fbe9ea;
  --shadow-sm:0 1px 2px rgba(16,16,20,.05);
  --shadow:0 4px 16px rgba(16,16,20,.10);
  --shadow-lg:0 12px 40px rgba(16,16,20,.16);
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme]){
    --bg:#0a0a0c; --surface:#141417; --surface2:#1c1c20; --ink:#f2f2f4; --muted:#a2a3ab; --faint:#6f7078;
    --line:#28282e; --line2:#1f1f24;
    --accent:#7086ff; --accent-ink:#0a0a0c; --accent-soft:#1a1d3a;
    --live:#3fbf72; --parked:#d99a33; --off:#7c7f87;
    --review:#d9a441; --contacted:#5aa3d8; --ignored:#7c7f87;
    --danger:#f0555c; --danger-ink:#12070a; --danger-soft:#301316;
    --shadow-sm:0 1px 2px rgba(0,0,0,.35);
    --shadow:0 4px 16px rgba(0,0,0,.4);
    --shadow-lg:0 12px 40px rgba(0,0,0,.55);
  }
}
:root[data-theme="dark"]{
  --bg:#0a0a0c; --surface:#141417; --surface2:#1c1c20; --ink:#f2f2f4; --muted:#a2a3ab; --faint:#6f7078;
  --line:#28282e; --line2:#1f1f24;
  --accent:#7086ff; --accent-ink:#0a0a0c; --accent-soft:#1a1d3a;
  --live:#3fbf72; --parked:#d99a33; --off:#7c7f87;
  --review:#d9a441; --contacted:#5aa3d8; --ignored:#7c7f87;
  --danger:#f0555c; --danger-ink:#12070a; --danger-soft:#301316;
  --shadow-sm:0 1px 2px rgba(0,0,0,.35);
  --shadow:0 4px 16px rgba(0,0,0,.4);
  --shadow-lg:0 12px 40px rgba(0,0,0,.55);
}
:root[data-theme="grey"]{
  --bg:#1a1b1e; --surface:#212226; --surface2:#292a2f; --ink:#eceded; --muted:#a7a8ae; --faint:#75767c;
  --line:#333438; --line2:#26272b;
  --accent:#8296ff; --accent-ink:#0f1016; --accent-soft:#242741;
  --live:#3fbf72; --parked:#d99a33; --off:#84868d;
  --review:#d9a441; --contacted:#5aa3d8; --ignored:#84868d;
  --danger:#f0555c; --danger-ink:#12070a; --danger-soft:#2c1417;
  --shadow-sm:0 1px 2px rgba(0,0,0,.3);
  --shadow:0 4px 16px rgba(0,0,0,.35);
  --shadow-lg:0 12px 40px rgba(0,0,0,.5);
}
:root[data-theme="light"]{
  --bg:#ffffff; --surface:#f7f7f9; --surface2:#eef0f3; --ink:#111114; --muted:#63666d; --faint:#9a9da3;
  --line:#e3e4e8; --line2:#ecedf0;
  --accent:#3d5afe; --accent-ink:#ffffff; --accent-soft:#ecefff;
  --live:#1c9a4b; --parked:#b4720a; --off:#8b8f96;
  --review:#9c6b12; --contacted:#2f6fa8; --ignored:#8b8f96;
  --danger:#d1373f; --danger-ink:#ffffff; --danger-soft:#fbe9ea;
}
body{ background:var(--bg); color:var(--ink); }
::selection{ background:var(--accent); color:var(--accent-ink); }
.sr-only{ position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden;
  clip:rect(0,0,0,0); white-space:nowrap; border:0; }

/* visible focus ring on every interactive element */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, [tabindex]:focus-visible {
  outline:2px solid var(--accent); outline-offset:2px; border-radius:4px;
}

/* ---------- Brand eye mark ---------- */
.brand-eye{ width:44px; height:44px; border-radius:50%; position:relative; flex:0 0 auto;
  background: radial-gradient(circle at center,
    #0a0a09 0 13%, #8a8a8a 13% 15.5%, #0a0a09 15.5% 29%, #5a5a5a 29% 31.5%, #0a0a09 31.5% 45%, #2e2e2e 45% 47.5%, #0a0a09 47.5% 100%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.brand-eye::after{ content:""; position:absolute; left:50%; top:50%; width:6px; height:6px; background:#F4F2EC; transform:translate(-50%,-50%); }
.brand-eye.small{ width:22px; height:22px; }
.brand-eye.small::after{ width:3px; height:3px; }

/* ---------- Buttons and controls. One radius. Three treatments. ---------- */
.btn{ display:inline-flex; align-items:center; justify-content:center; gap:var(--sp-2);
  min-height:32px; padding:6px var(--sp-3); border:1px solid var(--line); border-radius:var(--radius);
  background:var(--surface); color:var(--ink); font-size:var(--fs-small); font-weight:500; cursor:pointer;
  text-decoration:none; box-shadow:none;
  transition:background .12s ease, border-color .12s ease, color .12s ease; }
.btn:hover{ background:var(--surface2); }
.btn:active{ transform:translateY(1px); }
.btn-primary{ background:var(--accent); color:var(--accent-ink); border-color:var(--accent); font-weight:600; }
.btn-primary:hover{ filter:brightness(1.08); }
.btn-quiet{ background:transparent; border-color:transparent; color:var(--muted); }
.btn-quiet:hover{ background:var(--surface); color:var(--ink); }
.btn-text{ background:none; border:0; padding:0; color:var(--accent); font-size:var(--fs-small); font-weight:500; cursor:pointer; }
.btn-text:hover{ text-decoration:underline; }
.btn-danger{ background:var(--danger); color:var(--danger-ink); border-color:var(--danger); font-weight:600; }
.btn-danger:hover{ filter:brightness(1.08); }
.btn:disabled{ opacity:.5; pointer-events:none; cursor:not-allowed; }

/* icon-only button, must always carry an aria-label in markup */
.iconbtn{ display:inline-flex; align-items:center; justify-content:center; width:26px; height:26px;
  border:1px solid var(--line); border-radius:var(--radius); background:var(--bg); color:var(--muted); cursor:pointer;
  transition:background .12s ease, color .12s ease, border-color .12s ease; padding:0; }
.iconbtn:hover{ background:var(--surface2); color:var(--ink); }
.iconbtn svg{ width:14px; height:14px; }
.iconbtn.danger:hover{ background:var(--danger); color:var(--danger-ink); border-color:var(--danger); }

.chip{ display:inline-flex; align-items:center; justify-content:center; min-height:28px; padding:5px var(--sp-3);
  border:1px solid var(--line); border-radius:var(--radius); background:var(--surface); color:var(--muted);
  font-size:var(--fs-small); font-weight:500; cursor:pointer; text-decoration:none; transition:background .12s ease, color .12s ease, border-color .12s ease; }
.chip:hover{ background:var(--surface2); color:var(--ink); }
.chip.on{ background:var(--accent); color:var(--accent-ink); border-color:var(--accent); }

input, select, textarea{ font-size:15px; color:var(--ink); background:var(--bg); border:1px solid var(--line);
  border-radius:var(--radius); padding:7px var(--sp-3); min-height:32px; transition:border-color .12s ease, box-shadow .12s ease; }
input:focus, select:focus, textarea:focus{ outline:none; border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft); }
label.fcheck{ display:inline-flex; align-items:center; gap:var(--sp-2); font-size:var(--fs-small); color:var(--ink); min-height:32px; }
label.fcheck input{ min-height:auto; width:15px; height:15px; accent-color:var(--accent); }

/* ---------- Topbar ---------- */
.topbar{ position:sticky; top:0; z-index:30; display:flex; align-items:center; gap:var(--sp-5);
  padding:var(--sp-2) var(--gut); padding-top:calc(var(--sp-2) + env(safe-area-inset-top));
  background:color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter:saturate(1.5) blur(14px);
  border-bottom:1px solid var(--line); }
.logo{ display:inline-flex; align-items:center; gap:var(--sp-2); color:var(--ink); text-decoration:none; font-size:15px; font-weight:650; }
.mainnav{ display:flex; gap:2px; background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:3px; }
.navlink{ display:inline-flex; align-items:center; min-height:28px; padding:4px var(--sp-3); border-radius:6px;
  color:var(--muted); text-decoration:none; font-size:var(--fs-small); font-weight:500; }
.navlink:hover{ color:var(--ink); }
.navlink.on{ background:var(--bg); color:var(--ink); box-shadow:var(--shadow-sm); }
.topstats{ display:flex; gap:var(--sp-5); margin-left:auto; }
.stat{ display:flex; flex-direction:column; line-height:1.1; font-size:var(--fs-micro); color:var(--muted); text-align:right; letter-spacing:.02em; text-transform:uppercase; }
.stat b{ font-size:17px; color:var(--ink); font-weight:650; letter-spacing:-.01em; text-transform:none; }
.theme-toggle{ min-height:28px; }

/* ---------- Layout ---------- */
.wrap{ padding:var(--sp-5) var(--gut) var(--sp-7); max-width:1600px; margin:0 auto; }
.viewtitle{ font-size:22px; font-weight:650; letter-spacing:-.01em; margin:var(--sp-1) 0 var(--sp-4); }
.subhead{ font-size:15px; font-weight:650; margin:var(--sp-6) 0 var(--sp-3); letter-spacing:-.005em; }
.muted{ color:var(--muted); }
.faint{ color:var(--faint); }

/* ================================================================
   FILTER BAR
   ================================================================ */
.filters{ display:flex; flex-wrap:wrap; gap:var(--sp-2); align-items:center; padding:var(--sp-2) var(--sp-3);
  margin-bottom:var(--sp-2); background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); }
.filters .fgroup{ display:flex; }
.filters .search{ flex:1 1 320px; min-width:200px; position:relative; }
.filters .search input{ width:100%; padding-left:32px; padding-right:30px; }
.search-glyph{ position:absolute; left:9px; top:50%; transform:translateY(-50%); width:14px; height:14px; color:var(--faint); pointer-events:none; }
.search-clear{ position:absolute; right:4px; top:50%; transform:translateY(-50%); }
.search-clear[hidden]{ display:none; }

/* segmented control: date presets as one control, not four buttons */
.segmented{ display:inline-flex; border:1px solid var(--line); border-radius:var(--radius); background:var(--bg); padding:2px; }
.segmented .seg-btn{ border:0; background:none; min-height:26px; padding:3px var(--sp-3); border-radius:7px;
  font-size:var(--fs-small); font-weight:500; color:var(--muted); cursor:pointer; }
.segmented .seg-btn:hover{ color:var(--ink); }
.segmented .seg-btn.on{ background:var(--accent); color:var(--accent-ink); font-weight:600; }

/* custom select: button trigger + popover listbox, built from a real select
   element that stays in the DOM (aria-hidden, unreachable by tab) so the
   form still submits normally with no JS required as a fallback. */
.customselect{ position:relative; }
.customselect select{ position:absolute; inset:0; opacity:0; pointer-events:none; }
.cs-btn{ display:inline-flex; align-items:center; gap:6px; min-height:32px; padding:6px var(--sp-3);
  border:1px solid var(--line); border-radius:var(--radius); background:var(--bg); color:var(--ink);
  font-size:var(--fs-small); font-weight:500; cursor:pointer; white-space:nowrap; max-width:220px; }
.cs-btn .cs-label{ overflow:hidden; text-overflow:ellipsis; }
.cs-btn .cs-caret{ color:var(--faint); flex:0 0 auto; }
.cs-btn.placeholder .cs-label{ color:var(--muted); }
.cs-btn.active{ border-color:var(--accent); }
.cs-panel{ position:absolute; z-index:40; top:calc(100% + 6px); left:0; min-width:220px; max-width:320px;
  max-height:320px; overflow:auto; background:var(--bg); border:1px solid var(--line); border-radius:var(--radius);
  box-shadow:var(--shadow-lg); padding:var(--sp-1); }
.cs-panel[hidden]{ display:none; }
.cs-opt{ display:flex; align-items:center; gap:var(--sp-2); width:100%; text-align:left; border:0; background:none;
  padding:6px var(--sp-2); border-radius:6px; font-size:var(--fs-small); color:var(--ink); cursor:pointer; }
.cs-opt:hover, .cs-opt.focused{ background:var(--surface); }
.cs-opt.selected{ font-weight:600; }
.cs-opt input{ min-height:auto; width:14px; height:14px; accent-color:var(--accent); pointer-events:none; }
.cs-opt .cs-check{ width:14px; height:14px; flex:0 0 auto; border:1px solid var(--line); border-radius:4px; }
.cs-opt.selected .cs-check{ background:var(--accent); border-color:var(--accent); position:relative; }
.cs-opt.selected .cs-check::after{ content:""; position:absolute; left:4px; top:1px; width:4px; height:8px;
  border:solid var(--accent-ink); border-width:0 2px 2px 0; transform:rotate(45deg); }

/* secondary filters popover */
.filters-more{ position:relative; }
.filters-badge{ display:inline-flex; align-items:center; justify-content:center; min-width:16px; height:16px;
  padding:0 4px; border-radius:999px; background:var(--accent); color:var(--accent-ink); font-size:10px; font-weight:700; }
.filters-panel{ position:absolute; z-index:40; top:calc(100% + 6px); right:0; width:280px;
  background:var(--bg); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow-lg);
  padding:var(--sp-4); display:flex; flex-direction:column; gap:var(--sp-3); }
.filters-panel[hidden]{ display:none; }
.filters-panel .fp-row{ display:flex; flex-direction:column; gap:6px; }
.filters-panel .fp-lbl{ font-size:var(--fs-micro); text-transform:uppercase; letter-spacing:.05em; color:var(--muted); font-weight:650; }
.filters-panel select{ width:100%; }
.filters-panel .fp-actions{ display:flex; justify-content:flex-end; gap:var(--sp-2); margin-top:var(--sp-1); }

/* active filter chips, shown beneath the bar */
.activechips{ display:flex; flex-wrap:wrap; gap:6px; align-items:center; margin:0 0 var(--sp-3); }
.activechips[hidden]{ display:none; }
.activechip{ display:inline-flex; align-items:center; gap:6px; min-height:26px; padding:4px 6px 4px var(--sp-3);
  border:1px solid var(--line); border-radius:var(--radius); background:var(--surface); color:var(--ink); font-size:var(--fs-micro); }
.activechip .ac-remove{ display:inline-flex; align-items:center; justify-content:center; width:16px; height:16px;
  border:0; background:var(--surface2); color:var(--muted); border-radius:50%; cursor:pointer; font-size:11px; line-height:1; }
.activechip .ac-remove:hover{ background:var(--danger); color:var(--danger-ink); }
.activechips-clear{ font-size:var(--fs-micro); }

/* ---------- Source / list chip rows: same shape, same weight ---------- */
.chiprow{ display:flex; flex-wrap:wrap; gap:6px; align-items:center; margin-bottom:var(--sp-3); }
.chiprow-lbl{ font-size:var(--fs-micro); text-transform:uppercase; letter-spacing:.06em; color:var(--muted); margin-right:2px; font-weight:650; }
.fchip{ display:inline-flex; align-items:center; gap:6px; min-height:28px; padding:5px var(--sp-3);
  border:1px solid var(--line); border-radius:var(--radius); background:var(--surface); color:var(--ink);
  font-size:var(--fs-small); font-weight:500; text-decoration:none; }
.fchip b{ font-variant-numeric:tabular-nums; color:var(--faint); font-weight:600; }
.fchip:hover{ background:var(--surface2); }
.fchip.on{ background:var(--accent); color:var(--accent-ink); border-color:var(--accent); }
.fchip.on b{ color:var(--accent-ink); opacity:.8; }
.fchip.clear{ border-style:dashed; color:var(--muted); font-weight:500; }
.fchip.newlist{ border-style:dashed; color:var(--accent); border-color:var(--accent); background:none; }
.nosite{ font-size:var(--fs-micro); color:var(--faint); font-style:italic; white-space:nowrap; }

/* detail: list membership toggles */
.lb-lists{ display:flex; flex-wrap:wrap; gap:var(--sp-2); align-items:center; }
.lb-lists-lbl{ font-size:var(--fs-micro); text-transform:uppercase; letter-spacing:.05em; color:var(--muted); font-weight:650; }
.btn-list{ min-height:28px; }

/* ---------- List head ---------- */
.listhead{ display:flex; align-items:center; justify-content:space-between; gap:var(--sp-3); margin-bottom:var(--sp-2); }
.listhead-left{ display:flex; align-items:center; gap:var(--sp-4); }
.resultcount{ font-size:var(--fs-small); color:var(--muted); }
.viewtoggle{ display:flex; gap:4px; }
.legend{ display:flex; align-items:center; gap:var(--sp-4); font-size:var(--fs-micro); color:var(--muted); }
.legend-item{ display:inline-flex; align-items:center; gap:5px; cursor:default; }

/* ================================================================
   TABLE. This is the product.
   ================================================================ */
.tablewrap{ border:1px solid var(--line); border-radius:var(--radius); background:var(--bg); overflow:hidden; }
.tablescroll{ overflow-x:auto; }
.dtable{ width:100%; border-collapse:collapse; table-layout:fixed; font-size:var(--fs-small); }
.dtable col.c-check{ width:34px; } .dtable col.c-biz{ width:auto; min-width:260px; }
.dtable col.c-city{ width:130px; } .dtable col.c-cat{ width:150px; }
.dtable col.c-reg{ width:96px; } .dtable col.c-live{ width:64px; } .dtable col.c-flags{ width:70px; } .dtable col.c-actions{ width:76px; }
.dtable thead th{ position:sticky; top:0; z-index:5; background:var(--surface); text-align:left; padding:7px var(--sp-3);
  font-size:var(--fs-micro); text-transform:uppercase; letter-spacing:.04em; font-weight:650; color:var(--muted);
  border-bottom:1px solid var(--line); white-space:nowrap; }
.dtable th.c, .dtable td.c{ text-align:right; }
.dtable td.check, .dtable th.check{ text-align:center; }
.dtable tbody td{ padding:5px var(--sp-3); border-bottom:1px solid var(--line2); vertical-align:middle;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.dtable tbody tr{ transition:background .08s ease; }
.dtable tbody tr:hover, .dtable tbody tr:focus-within{ background:var(--surface); }
.dtable tbody tr:focus{ outline:none; background:var(--accent-soft); }
.dtable tr.is-ignored{ opacity:.4; }
.dtable tr.is-selected{ background:var(--accent-soft); }
.dtable td.mono, .mono{ font-variant-numeric:tabular-nums; font-family:ui-monospace, SFMono-Regular, Menlo, monospace; font-size:var(--fs-micro); color:var(--muted); }

.sortlink{ color:var(--muted); text-decoration:none; display:inline-flex; align-items:center; gap:3px; }
.sortlink:hover{ color:var(--ink); }
.sortlink.up::after{ content:"\2191"; color:var(--accent); } .sortlink.down::after{ content:"\2193"; color:var(--accent); }
.th-biz{ display:flex; align-items:center; gap:var(--sp-3); }
.th-biz .sortlink + .sortlink::before{ content:"\00b7"; margin-right:3px; color:var(--faint); }

/* combined business cell: company on top, domain quiet underneath */
.bizcell{ display:flex; flex-direction:column; gap:1px; min-width:0; overflow:hidden; }
.bizname{ background:none; border:0; padding:0; color:var(--ink); font:inherit; font-weight:600; cursor:pointer;
  text-align:left; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:100%; }
.bizname:hover{ text-decoration:underline; }
.bizdomain{ display:flex; align-items:center; gap:3px; font-size:var(--fs-micro); color:var(--faint);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.bizdomain::after{ content:"\2197"; font-size:9px; }
.bizdomain:empty::after{ content:""; }

.rowactions{ display:flex; align-items:center; justify-content:flex-end; gap:4px; opacity:0; }
tr:hover .rowactions, tr:focus-within .rowactions, tr.is-selected .rowactions{ opacity:1; }
@media (hover:none){ .rowactions{ opacity:1; } }

.rowchk{ width:15px; height:15px; accent-color:var(--accent); cursor:pointer; }
.thchk{ width:15px; height:15px; accent-color:var(--accent); cursor:pointer; }

.cat{ display:inline-block; padding:2px var(--sp-2); border:1px solid var(--line); border-radius:var(--radius);
  font-size:var(--fs-micro); font-weight:500; color:var(--muted); background:var(--surface);
  max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* status: shape + colour, never colour alone */
.dot{ display:inline-flex; align-items:center; justify-content:center; width:12px; height:12px; flex:0 0 auto; }
.dot::before{ content:""; display:block; }
.dot.live::before{ width:8px; height:8px; border-radius:50%; background:var(--live); }
.dot.parked::before{ width:8px; height:8px; background:var(--parked); transform:rotate(45deg); }
.dot.off::before{ width:8px; height:8px; border-radius:50%; border:1.5px solid var(--off); background:none; }

.flags{ white-space:nowrap; }
.flag{ display:inline-flex; align-items:center; justify-content:center; width:17px; height:17px; font-size:9.5px; font-weight:700;
  border-radius:5px; margin:0 1px; color:#fff; }
.flag.review{ background:var(--review); } .flag.contacted{ background:var(--contacted); } .flag.ignored{ background:var(--ignored); }

.pager{ display:flex; align-items:center; gap:var(--sp-4); justify-content:space-between; padding:var(--sp-3); border-top:1px solid var(--line); }
.pager-pos{ font-size:var(--fs-small); color:var(--muted); }
.pager-nav{ display:flex; gap:var(--sp-2); }

.empty{ padding:var(--sp-7) var(--sp-5); text-align:center; color:var(--muted); background:var(--surface); border:1px dashed var(--line); border-radius:var(--radius); }
.empty-actions{ display:flex; gap:var(--sp-2); justify-content:center; margin-top:var(--sp-4); flex-wrap:wrap; }
.empty-glyph{ font-size:22px; margin-bottom:var(--sp-2); color:var(--faint); }

.state-error{ padding:var(--sp-5); text-align:center; color:var(--danger); background:var(--danger-soft); border:1px solid var(--danger); border-radius:var(--radius); }
.state-error .btn{ margin-top:var(--sp-3); }

/* skeleton loading rows, matching real row height */
.skeleton tr{ height:29px; }
.skel-bar{ display:inline-block; height:9px; border-radius:4px; background:var(--surface2);
  animation:skel-pulse 1.1s ease-in-out infinite; }
@keyframes skel-pulse{ 0%,100%{ opacity:.5; } 50%{ opacity:1; } }
@media (prefers-reduced-motion: reduce){ .skel-bar{ animation:none; opacity:.7; } }

/* ---------- Bulk selection bar ---------- */
.bulkbar{ position:fixed; left:50%; bottom:var(--sp-5); transform:translate(-50%,0); z-index:50;
  display:flex; align-items:center; gap:var(--sp-4); padding:var(--sp-2) var(--sp-4); background:var(--ink);
  color:var(--bg); border-radius:var(--radius); box-shadow:var(--shadow-lg); }
.bulkbar[hidden]{ display:none; }
.bulkbar-count{ font-size:var(--fs-small); font-weight:600; white-space:nowrap; }
.bulkbar-actions{ display:flex; gap:6px; }
.bulkbar .btn{ background:transparent; border-color:color-mix(in srgb, var(--bg) 30%, transparent); color:var(--bg); }
.bulkbar .btn:hover{ background:color-mix(in srgb, var(--bg) 15%, transparent); }
.bulkbar .btn-danger{ background:var(--danger); border-color:var(--danger); color:var(--danger-ink); }
.bulkbar-sep{ width:1px; align-self:stretch; background:color-mix(in srgb, var(--bg) 25%, transparent); }
.bulkbar-scope{ font-size:var(--fs-micro); color:color-mix(in srgb, var(--bg) 70%, transparent); }
.bulkbar-scope button{ background:none; border:0; color:var(--accent); text-decoration:underline; cursor:pointer; font-size:inherit; padding:0; }

/* ---------- Modal confirm dialogs (delete, bulk delete) ---------- */
.modal-scrim{ position:fixed; inset:0; z-index:80; background:rgba(10,10,12,.55); display:grid; place-items:center; padding:var(--sp-4); }
.modal-scrim[hidden]{ display:none; }
.modal{ width:100%; max-width:400px; background:var(--bg); border:1px solid var(--line); border-radius:var(--radius);
  box-shadow:var(--shadow-lg); padding:var(--sp-5); display:flex; flex-direction:column; gap:var(--sp-3); }
.modal h3{ margin:0; font-size:16px; font-weight:650; }
.modal p{ margin:0; font-size:var(--fs-small); color:var(--muted); }
.modal input[type="text"], .modal input[type="number"]{ width:100%; text-align:center; font-weight:600; }
.modal-actions{ display:flex; justify-content:flex-end; gap:var(--sp-2); margin-top:var(--sp-2); }

/* ---------- Keyboard shortcut overlay ---------- */
.kbd-overlay .modal{ max-width:460px; }
.kbd-list{ display:flex; flex-direction:column; gap:var(--sp-2); }
.kbd-row{ display:flex; align-items:center; justify-content:space-between; gap:var(--sp-4); font-size:var(--fs-small); }
kbd{ display:inline-flex; align-items:center; justify-content:center; min-width:22px; height:20px; padding:0 5px;
  border:1px solid var(--line); border-bottom-width:2px; border-radius:5px; background:var(--surface);
  font-family:ui-monospace, Menlo, monospace; font-size:var(--fs-micro); }

/* ---------- Card grid (mobile / narrow) ---------- */
.cardgrid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(240px,1fr)); gap:var(--sp-3); }
.dcard{ display:flex; flex-direction:column; gap:6px; text-align:left; padding:var(--sp-4);
  background:var(--bg); border:1px solid var(--line); border-radius:var(--radius); cursor:pointer; color:var(--ink); }
.dcard:hover{ border-color:color-mix(in srgb, var(--line) 40%, var(--accent) 40%); }
.dcard-dom{ font-weight:650; font-size:14px; letter-spacing:-.005em; }
.dcard-co{ font-size:var(--fs-small); color:var(--muted); }
.dcard-meta{ font-size:var(--fs-micro); color:var(--muted); }
.dcard-foot{ display:flex; align-items:center; gap:var(--sp-2); font-size:var(--fs-micro); color:var(--muted); margin-top:4px; }

/* ---------- Tiles (city/category) ---------- */
.tilegrid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(200px,1fr)); gap:var(--sp-3); }
.tile{ display:flex; flex-direction:column; gap:4px; padding:var(--sp-4); background:var(--bg);
  border:1px solid var(--line); border-radius:var(--radius); text-decoration:none; color:var(--ink); }
.tile:hover{ border-color:color-mix(in srgb, var(--line) 40%, var(--accent) 40%); }
.tile-n{ font-size:var(--fs-display); font-weight:650; font-variant-numeric:tabular-nums; letter-spacing:-.01em; }
.tile-l{ font-size:var(--fs-small); font-weight:500; }
.tile-sub{ font-size:var(--fs-micro); color:var(--muted); }

/* ---------- Status ---------- */
.statgrid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(220px,1fr)); gap:var(--sp-3); }
.statcard{ padding:var(--sp-4); background:var(--bg); border:1px solid var(--line); border-radius:var(--radius); border-left:3px solid var(--off); }
.statcard.st-ok{ border-left-color:var(--live); } .statcard.st-partial{ border-left-color:var(--parked); }
.statcard.st-failed{ border-left-color:var(--danger); } .statcard.st-running{ border-left-color:var(--accent); }
.statcard-h{ display:flex; align-items:center; justify-content:space-between; gap:var(--sp-2); }
.statcard-b{ display:flex; flex-direction:column; gap:3px; margin-top:var(--sp-2); font-size:var(--fs-micro); color:var(--muted); }
.pill{ font-size:var(--fs-micro); text-transform:uppercase; letter-spacing:.04em; font-weight:650; padding:2px var(--sp-2); border:1px solid var(--line); border-radius:var(--radius); color:var(--muted); }
.qgrid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(140px,1fr)); gap:var(--sp-2); }
.qcell{ display:flex; flex-direction:column; padding:var(--sp-3); background:var(--bg); border:1px solid var(--line); border-radius:var(--radius); }
.qcell b{ font-size:20px; font-variant-numeric:tabular-nums; font-weight:650; letter-spacing:-.005em; }
.qcell span{ font-size:var(--fs-micro); color:var(--muted); }
.logbox{ max-height:340px; overflow:auto; padding:var(--sp-4); background:var(--surface); border:1px solid var(--line);
  border-radius:var(--radius); font-family:ui-monospace, Menlo, monospace; font-size:var(--fs-micro); color:var(--ink); white-space:pre-wrap; }

/* ---------- Login ---------- */
.login-body{ display:grid; place-items:center; min-height:100svh; padding:var(--sp-4);
  background:radial-gradient(circle at 50% 0%, var(--surface), var(--bg) 60%); }
.login-card{ width:100%; max-width:340px; display:flex; flex-direction:column; align-items:center; gap:var(--sp-4);
  padding:var(--sp-6) var(--sp-5); background:var(--bg); border:1px solid var(--line); border-radius:16px; box-shadow:var(--shadow-lg); text-align:center; }
.login-card h1{ font-size:20px; font-weight:650; margin:0; letter-spacing:-.01em; }
.login-card form{ display:flex; flex-direction:column; gap:var(--sp-3); width:100%; margin-top:var(--sp-2); }
.field{ display:flex; flex-direction:column; gap:6px; text-align:left; font-size:var(--fs-micro); color:var(--muted); font-weight:500; }
.field input{ width:100%; }
.form-error{ color:var(--danger); font-size:var(--fs-small); margin:0; }

/* ---------- Lightbox ---------- */
.lightbox{ position:fixed; inset:0; z-index:60; display:grid; place-items:center; padding:var(--sp-4); }
.lightbox[hidden]{ display:none; }
.lightbox-scrim{ position:absolute; inset:0; background:rgba(10,10,12,.55); }
.lightbox-card{ position:relative; width:100%; max-width:620px; max-height:88vh; overflow:auto;
  background:var(--bg); border:1px solid var(--line); border-radius:16px; box-shadow:var(--shadow-lg); }
.lb-head{ display:flex; align-items:flex-start; justify-content:space-between; gap:var(--sp-3); padding:var(--sp-4) var(--sp-5); border-bottom:1px solid var(--line); position:sticky; top:0; background:var(--bg); }
.lb-head h3{ margin:0; font-size:17px; font-weight:650; letter-spacing:-.005em; }
.lb-head .sub{ font-size:var(--fs-small); color:var(--muted); }
.lb-body{ padding:var(--sp-4) var(--sp-5); display:flex; flex-direction:column; gap:var(--sp-4); }
.kv{ display:grid; grid-template-columns:120px 1fr; gap:6px var(--sp-3); font-size:var(--fs-small); }
.kv dt{ color:var(--muted); } .kv dd{ margin:0; }
.lb-section h4{ margin:0 0 var(--sp-2); font-size:var(--fs-micro); text-transform:uppercase; letter-spacing:.05em; font-weight:650; color:var(--muted); }
.lb-actions{ display:flex; flex-wrap:wrap; gap:var(--sp-2); align-items:center; }
.lb-note{ width:100%; min-height:64px; resize:vertical; }
.retag{ min-height:32px; }
.savemsg{ font-size:var(--fs-micro); color:var(--ink); opacity:0; transition:opacity .2s; font-weight:600; }
.savemsg.show{ opacity:1; }
.btn.is-on{ background:var(--accent); color:var(--accent-ink); border-color:var(--accent); }
.btn.saving{ opacity:.7; pointer-events:none; }

/* ---------- Hover preview (live site thumbnail) ---------- */
.hoverpv{ position:absolute; z-index:70; width:420px; background:var(--bg); border:1px solid var(--line);
  border-radius:12px; box-shadow:var(--shadow-lg); overflow:hidden; }
.hoverpv[hidden]{ display:none; }
.hoverpv-cap{ padding:7px var(--sp-3); font-size:var(--fs-small); font-weight:650; border-bottom:1px solid var(--line);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.hoverpv-frame{ position:relative; width:420px; height:286px; overflow:hidden; background:var(--surface2); }
.hoverpv-frame iframe{ position:absolute; top:0; left:0; width:1100px; height:750px; transform:scale(0.382);
  transform-origin:0 0; border:0; background:#fff; }
.hoverpv-hint{ padding:5px var(--sp-3); font-size:var(--fs-micro); color:var(--muted); border-top:1px solid var(--line); }

/* the responsive card fallback is rendered alongside the table in list view
   and hidden on wide screens, so narrow screens get the real Cards view
   markup rather than a squeezed table. */
.cardgrid-responsive{ display:none; }

/* ================================================================
   Desktop tool: optimize for wide screens. Below ~1000px, collapse
   to the existing Cards view rather than compressing table columns.
   ================================================================ */
@media (max-width:999px){
  :root{ --gut:16px; }
  .topbar{ flex-wrap:wrap; gap:var(--sp-3); }
  .topstats{ order:3; width:100%; margin-left:0; justify-content:space-between; }
  .mainnav{ order:4; width:100%; overflow-x:auto; }
  .theme-toggle{ margin-left:auto; }
  .filters .search{ flex:1 1 100%; }
  .viewtoggle{ display:none; }

  .tablewrap{ display:none; }
  .cardgrid-responsive{ display:grid; }
  .bulkbar{ display:none; }
}

@media (max-width:390px){ .topstats{ gap:var(--sp-3); } }
