/* Linucat Analytics dashboard. Tokens follow the dataviz reference palette:
   light and dark are each selected (not an automatic flip). No external assets. */

:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-raised: #ffffff;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --border-strong: rgba(11, 11, 11, 0.18);
  --hover: rgba(11, 11, 11, 0.04);
  --accent: #2a78d6;
  --accent-ink: #1c5cab;
  --accent-wash: rgba(42, 120, 214, 0.10);
  --bar-wash: rgba(42, 120, 214, 0.13);
  --series-1: #2a78d6;
  --series-compare: #a8a69d;
  --good: #006300;
  --bad: #b42d2d;
  --live: #0ca30c;
  --warn-bg: #fff6e0;
  --warn-ink: #6b4a00;
  --alert-bg: #fdecec;
  --alert-ink: #8a1f1f;
  --alert-line: #f1b9b9;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.04), 0 4px 16px rgba(11, 11, 11, 0.04);
  --seq-1: #86b6ef; --seq-2: #5598e7; --seq-3: #2a78d6; --seq-4: #1c5cab; --seq-5: #104281; /* validated ordinal ramp */
  --map-none: #ecebe6;
  --radius: 10px;
  --radius-sm: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-raised: #222220;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --border-strong: rgba(255, 255, 255, 0.18);
    --hover: rgba(255, 255, 255, 0.05);
    --accent: #3987e5;
    --accent-ink: #86b6ef;
    --accent-wash: rgba(57, 135, 229, 0.16);
    --bar-wash: rgba(57, 135, 229, 0.22);
    --series-1: #3987e5;
    --series-compare: #6a6964;
    --good: #0ca30c;
    --bad: #e66767;
    --warn-bg: #2e2510;
    --warn-ink: #f2c45a;
  --alert-bg: #3a1618;
  --alert-ink: #ffb4b4;
  --alert-line: #6b2a2d;
    --alert-bg: #3a1618;
    --alert-ink: #ffb4b4;
    --alert-line: #6b2a2d;
    --seq-1: #184f95; --seq-2: #256abf; --seq-3: #3987e5; --seq-4: #6da7ec; --seq-5: #9ec5f4;
    --map-none: #2c2c2a;
    --shadow: none;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-raised: #222220;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);
  --hover: rgba(255, 255, 255, 0.05);
  --accent: #3987e5;
  --accent-ink: #86b6ef;
  --accent-wash: rgba(57, 135, 229, 0.16);
  --bar-wash: rgba(57, 135, 229, 0.22);
  --series-1: #3987e5;
  --series-compare: #6a6964;
  --good: #0ca30c;
  --bad: #e66767;
  --warn-bg: #2e2510;
  --warn-ink: #f2c45a;
  --seq-1: #184f95; --seq-2: #256abf; --seq-3: #3987e5; --seq-4: #6da7ec; --seq-5: #9ec5f4;
  --map-none: #2c2c2a;
  --shadow: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 14px/1.5 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 15px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
main.container { flex: 1; padding-top: 24px; padding-bottom: 48px; outline: none; }
.loading { color: var(--muted); padding: 48px 0; text-align: center; }

.alert-banner { background: var(--alert-bg); color: var(--alert-ink); border-bottom: 1px solid var(--alert-line); }
.alert-banner .container { display: flex; gap: 10px; align-items: flex-start; padding-top: 10px; padding-bottom: 10px; font-weight: 500; }
.alert-banner svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.alert-banner ul { margin: 0; padding-left: 18px; }
.alert-banner ul:has(> li:only-child) { padding-left: 0; list-style: none; }
.alert-banner a { color: inherit; font-weight: 600; display: inline-block; margin-top: 4px; }
.mock-banner {
  background: var(--warn-bg); color: var(--warn-ink);
  font-size: 12px; text-align: center; padding: 6px 16px;
  border-bottom: 1px solid var(--border);
}

/* ---------- Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 16px;
  height: 56px; display: flex; align-items: center; gap: 16px;
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink); font-size: 15px; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 22px; height: 22px; fill: var(--accent); }
.topbar-right { margin-left: auto; display: flex; gap: 4px; }
.icon-link {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  border-radius: 8px; color: var(--ink-2); border: 0; background: none; cursor: pointer; padding: 0;
}
.icon-link:hover { background: var(--hover); color: var(--ink); }
.icon-link svg { width: 19px; height: 19px; }

.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs a {
  padding: 6px 10px; border-radius: 8px; color: var(--ink-2); font-weight: 500; white-space: nowrap;
}
.tabs a:hover { background: var(--hover); text-decoration: none; color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); background: var(--hover); box-shadow: inset 0 -2px 0 var(--accent); }

.site-switcher { position: relative; }
.switcher-btn {
  display: inline-flex; align-items: center; gap: 8px; max-width: 240px;
  background: var(--surface-raised); border: 1px solid var(--border); border-radius: 8px;
  padding: 5px 10px; cursor: pointer; font-weight: 600;
}
.switcher-btn:hover { border-color: var(--border-strong); }
.switcher-btn svg { width: 14px; height: 14px; color: var(--muted); flex: none; }
.switcher-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.favicon-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); flex: none; }

/* ---------- Generic controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-raised); font-weight: 500;
}
.btn:hover { border-color: var(--border-strong); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--hover); color: var(--ink); }
.btn-danger { color: var(--bad); }
.btn-block { width: 100%; }
.btn svg { width: 16px; height: 16px; }

.segmented {
  display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px;
  background: var(--hover); border: 1px solid var(--border);
}
.segmented button {
  border: 0; background: transparent; padding: 4px 10px; border-radius: 6px;
  cursor: pointer; color: var(--ink-2); font-weight: 500;
}
.segmented button[aria-pressed="true"] { background: var(--surface-raised); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

input[type="text"], input[type="search"], input[type="password"], input[type="date"], input:not([type]), select, textarea {
  height: 34px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface-raised);
}
textarea { height: auto; padding: 8px 10px; min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-wash); border-color: var(--accent); }
label { display: grid; gap: 6px; font-weight: 500; align-content: start; }
.hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 400; }

/* ---------- Page header */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 20px; }
.page-head h1 { margin-right: auto; }
.page-head .sub { color: var(--muted); font-size: 13px; width: 100%; margin-top: -8px; }

/* ---------- Cards */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 16px 18px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px 0; }
.card-head h2 { margin-right: auto; }

/* ---------- Stat tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stats.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1000px) { .stats.six { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.stat {
  text-align: left; padding: 14px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  display: grid; gap: 4px; position: relative;
}
button.stat { cursor: pointer; }
button.stat:hover { border-color: var(--border-strong); }
.stat[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 -3px 0 var(--accent), var(--shadow); }
.stat-label { color: var(--ink-2); font-size: 12px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.15; }
.delta { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 3px; }
.delta.good { color: var(--good); }
.delta.bad { color: var(--bad); }
.delta.flat { color: var(--muted); }
.delta svg { width: 10px; height: 10px; }
.live-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--live); display: inline-block; flex: none;
  box-shadow: 0 0 0 0 rgba(12, 163, 12, 0.5); animation: pulse 2s infinite;
}
@keyframes pulse { 70% { box-shadow: 0 0 0 6px rgba(12, 163, 12, 0); } 100% { box-shadow: 0 0 0 0 rgba(12, 163, 12, 0); } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

/* ---------- Toolbar (period, compare, filters) */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
.dropdown { position: relative; }
.menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; min-width: 220px;
  background: var(--surface-raised); border: 1px solid var(--border-strong); border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,.14); padding: 6px; max-height: 70vh; overflow: auto;
}
.menu.right { left: auto; right: 0; }
.menu button, .menu a {
  display: flex; width: 100%; align-items: center; gap: 8px; text-align: left; border: 0; background: none;
  padding: 7px 10px; border-radius: 6px; cursor: pointer; color: var(--ink);
}
.menu button:hover, .menu a:hover, .menu [aria-selected="true"] { background: var(--hover); text-decoration: none; }
.menu .check { width: 16px; color: var(--accent); font-weight: 700; }
.menu .kbd { margin-left: auto; color: var(--muted); font-size: 11px; }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.menu-custom { display: grid; gap: 8px; padding: 8px 10px; }
.menu-custom .row { display: flex; gap: 6px; }
.menu-custom input { flex: 1; min-width: 0; }
.menu-search { width: 100%; margin-bottom: 6px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 4px 0 10px;
  border-radius: 999px; background: var(--accent-wash); color: var(--ink); font-size: 13px;
}
.chip b { font-weight: 600; }
.chip button {
  border: 0; background: none; cursor: pointer; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; color: var(--ink-2);
}
.chip button:hover { background: var(--hover); color: var(--ink); }

.notice {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; margin-bottom: 16px;
  border-radius: var(--radius); background: var(--warn-bg); color: var(--warn-ink); border: 1px solid var(--border);
}
.notice svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.notice-body { display: grid; gap: 10px; }
.notice-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Main chart */
.chart-card { padding: 4px 8px 8px; margin-bottom: 16px; }
.chart-head { display: flex; align-items: center; gap: 12px; padding: 10px 10px 0; flex-wrap: wrap; }
.chart-head h2 { margin-right: auto; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 2px; border-radius: 1px; background: var(--series-1); display: inline-block; }
.legend i.compare { background: var(--series-compare); }
.chart { position: relative; height: 280px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.compare { stroke: var(--series-compare); }
/* The current, still-filling bucket: dashed so a partial day never reads as a drop. */
.chart .line.incomplete { stroke-dasharray: 3 4; opacity: 0.7; }
.chart .area { fill: var(--series-1); opacity: 0.10; }
.chart .crosshair { stroke: var(--axis); stroke-width: 1; }
.chart .dot { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
.chart .dot.compare { fill: var(--series-compare); }
.chart .bar { fill: var(--series-1); }
.chart .bar.dim { opacity: 0.45; }
.tooltip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 150px;
  background: var(--surface-raised); border: 1px solid var(--border-strong); border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.14); padding: 8px 10px; font-size: 12px;
}
.tooltip .t-title { color: var(--muted); margin-bottom: 4px; }
.tooltip .t-row { display: flex; align-items: center; gap: 8px; }
.tooltip .t-row b { margin-left: auto; font-variant-numeric: tabular-nums; padding-left: 12px; }
.tooltip i { width: 10px; height: 2px; background: var(--series-1); display: inline-block; }
.tooltip i.compare { background: var(--series-compare); }

/* ---------- Panels (breakdown lists) */
.panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.panel { display: flex; flex-direction: column; min-height: 420px; }
.panel.wide { grid-column: 1 / -1; min-height: 0; }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 8px; flex-wrap: wrap; }
.panel-head h2 { margin-right: auto; }
.panel-tabs { display: flex; gap: 2px; flex-wrap: wrap; }
.panel-tabs button {
  border: 0; background: none; cursor: pointer; padding: 3px 8px; border-radius: 6px;
  color: var(--muted); font-size: 12px; font-weight: 600;
}
.panel-tabs button:hover { color: var(--ink); background: var(--hover); }
.panel-tabs button[aria-selected="true"] { color: var(--ink); background: var(--hover); }
.list-head {
  display: flex; padding: 4px 14px; font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted);
}
.list-head span:first-child { margin-right: auto; }
.list-head span + span, .row .val { width: 72px; text-align: right; flex: none; }
.list { list-style: none; margin: 0; padding: 0 8px 8px; flex: 1; }
.row {
  position: relative; display: flex; align-items: center; gap: 8px; min-height: 32px;
  padding: 0 6px; border-radius: 6px; cursor: pointer; isolation: isolate;
}
.row:hover { background: var(--hover); }
.row::before {
  content: ""; position: absolute; inset: 3px auto 3px 0; width: var(--w, 0%);
  background: var(--bar-wash); border-radius: 0 4px 4px 0; z-index: -1;
}
.row .key {
  margin-right: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
  display: flex; align-items: center; gap: 8px; padding-left: 4px;
}
.row .key .ext { opacity: 0; color: var(--muted); flex: none; }
.row:hover .key .ext { opacity: 1; }
.row .val { font-variant-numeric: tabular-nums; }
.row .val.secondary { color: var(--muted); }
.flag { font-size: 15px; line-height: 1; width: 18px; text-align: center; flex: none; }
.panel-foot { display: flex; justify-content: center; padding: 4px 8px 10px; }
.empty { color: var(--muted); text-align: center; padding: 40px 12px; }

/* ---------- Overview table */
.overview-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.overview-table th {
  text-align: right; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600;
  color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.overview-table th:first-child, .overview-table td:first-child { text-align: left; }
.overview-table th button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.overview-table th button:hover { color: var(--ink); }
.overview-table th[aria-sort] button { color: var(--ink); }
.overview-table td {
  text-align: right; padding: 10px 14px; border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums; vertical-align: middle;
}
.overview-table tbody tr { cursor: pointer; }
.overview-table tbody tr:hover td { background: var(--hover); }
.overview-table tbody tr:last-child td { border-bottom: 0; }
.site-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.site-cell .names { display: grid; min-width: 0; }
.site-cell .name { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-cell .domain { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pin { border: 0; background: none; cursor: pointer; color: var(--axis); padding: 2px; display: grid; }
.pin[aria-pressed="true"] { color: #eda100; }
.pin svg { width: 16px; height: 16px; }
.cell-stack { display: grid; justify-items: end; gap: 1px; }
.spark { width: 120px; height: 32px; display: block; margin-left: auto; }
.spark path { fill: none; stroke: var(--series-1); stroke-width: 1.5; stroke-linejoin: round; }
.spark .spark-area { fill: var(--series-1); opacity: 0.10; stroke: none; }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--hover); color: var(--ink-2); border: 1px solid var(--border); }
.now-cell { display: inline-flex; align-items: center; gap: 6px; }
.table-wrap { overflow-x: auto; }

/* ---------- Realtime */
.rt-hero { display: flex; align-items: center; gap: 14px; padding: 22px 22px 6px; }
.rt-hero .big { font-size: 56px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.rt-hero .lbl { color: var(--ink-2); }
.rt-chart { height: 180px; }

/* ---------- Settings */
.settings-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 24px; align-items: start; }
.settings-nav { position: sticky; top: 76px; display: grid; gap: 2px; }
.settings-nav a { padding: 7px 10px; border-radius: 6px; color: var(--ink-2); }
.settings-nav a:hover { background: var(--hover); text-decoration: none; }
.settings-nav a[aria-current="true"] { background: var(--hover); color: var(--ink); font-weight: 600; }
.section { margin-bottom: 20px; }
.section > .card-pad { display: grid; gap: 14px; }
.section h2 { font-size: 16px; }
.section .desc { color: var(--muted); margin: -8px 0 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-actions { display: flex; gap: 8px; align-items: center; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kv div { padding: 10px 12px; border-radius: 8px; background: var(--hover); }
.kv dt { color: var(--muted); font-size: 12px; }
.kv dd { margin: 2px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.meter { height: 8px; border-radius: 4px; background: var(--accent-wash); overflow: hidden; margin-top: 6px; }
.meter > span { display: block; height: 100%; width: var(--w, 0%); background: var(--accent); border-radius: 4px; }
.data-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: right; }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--live); }
.status.warn::before { background: #fab219; }
.snippet {
  font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--hover);
  border: 1px solid var(--border); border-radius: 8px; padding: 12px; white-space: pre-wrap; word-break: break-all;
}
.item-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.item-row:last-child { border-bottom: 0; }
.item-row .kind { font-size: 11px; }
.item-row .grow { margin-right: auto; }

/* ---------- Modal */
dialog {
  border: 1px solid var(--border-strong); border-radius: 12px; padding: 0; width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 64px); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.modal-head h2 { margin-right: auto; }
.modal-body { padding: 8px 18px 18px; overflow: auto; }

/* ---------- Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: var(--page); padding: 10px 16px; border-radius: 8px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}

/* ---------- Login */
.login-body { display: grid; place-items: center; padding: 16px; }
.login-card {
  width: min(380px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow); padding: 28px; display: grid; gap: 18px;
}
.login-card form { display: grid; gap: 14px; }
.login-brand { justify-content: center; font-size: 17px; }
.login-card h1 { text-align: center; font-size: 20px; }
.form-error { color: var(--bad); margin: 0; font-weight: 500; }

/* ---------- Footer */
.footer {
  display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between;
  color: var(--muted); font-size: 12px; padding-top: 16px; padding-bottom: 24px; border-top: 1px solid var(--border);
}

/* ---------- Responsive */
@media (max-width: 900px) {
  .panels { grid-template-columns: minmax(0, 1fr); }
  .panel { min-height: 0; }
  .settings-nav { position: static; display: flex; overflow-x: auto; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .topbar-inner { height: auto; min-height: 56px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; gap: 8px 12px; }
  .tabs { order: 5; width: 100%; }
  .brand span { display: none; }
  .switcher-btn { max-width: 52vw; }
  .stats, .stats.six { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-value { font-size: 20px; }
  .chart { height: 220px; }
  .col-hide-sm { display: none; }
  .spark { width: 72px; }
  .list-head span + span, .row .val { width: 58px; }
  .row .val.secondary { display: none; }
  .list-head .secondary { display: none; }
  .rt-hero .big { font-size: 44px; }
}

.totp-box { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 16px; align-items: start; }
.totp-qr { width: 180px; height: 180px; background: #fff; border-radius: 8px; padding: 6px; border: 1px solid var(--border); }
.totp-qr svg { width: 100%; height: 100%; display: block; }
.warn-list { margin: 0; padding-left: 18px; color: var(--warn-ink); }
@media (max-width: 640px) { .totp-box { grid-template-columns: minmax(0, 1fr); } }

/* ---------- World map */
.map-wrap { position: relative; padding: 4px 12px 0; }
.world { width: 100%; height: auto; display: block; }
.world .c { stroke: var(--surface); stroke-width: 0.6; stroke-linejoin: round; }
.world .c:not(.none) { cursor: pointer; }
.world .c:hover { stroke: var(--ink); stroke-width: 1; }
.world .none { fill: var(--map-none); }
.seq-1 { fill: var(--seq-1); background: var(--seq-1); } .seq-2 { fill: var(--seq-2); background: var(--seq-2); }
.seq-3 { fill: var(--seq-3); background: var(--seq-3); } .seq-4 { fill: var(--seq-4); background: var(--seq-4); }
.seq-5 { fill: var(--seq-5); background: var(--seq-5); }
.map-legend { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 6px 14px 12px; font-size: 11px; color: var(--muted); }
.map-legend .ramp { display: inline-flex; gap: 2px; }
.map-legend .ramp i { width: 18px; height: 8px; border-radius: 2px; display: inline-block; }
.stack-form { display: grid; gap: 14px; }
.empty-state { text-align: center; display: grid; gap: 10px; justify-items: center; padding: 40px 16px; }

.label { font-weight: 500; margin-bottom: 6px; }
.code-step { display: grid; gap: 4px; margin-bottom: 10px; }
.code-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg label { display: flex; align-items: center; gap: 6px; padding: 6px 12px; font-weight: 500; cursor: pointer; }
.seg label + label { border-left: 1px solid var(--border); }
.seg input { margin: 0; }
.seg label:has(input:checked) { background: var(--accent-wash); color: var(--ink); }
