/* design-system v4 — Ad network control center. Tokens first; change values here, not markup.
   Mint canvas, white surfaces, charcoal type and dark pill buttons, lavender as the one brand accent.
   Geist is bundled in assets/vendor/geist. */

@font-face {
  font-family: "Geist";
  src: url("/assets/vendor/geist/geist-latin-wght-normal.woff2") format("woff2-variations"), url("/assets/vendor/geist/geist-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #e2efea;
  --panel: #ffffff;
  --panel-2: #f3f8f6;
  --line: #d6e2dd;
  --line-strong: #bdcdc6;
  --text: #111315;
  --muted: #55645e;
  --accent: #b874f8;
  --accent-hover: #a855f7;
  --on-accent: #111315;
  --accent-ink: #7e22ce;
  --accent-soft: #f3e8ff;
  --chart: #a855f7;
  --good: #0f7a55;
  --good-soft: #d8f1e5;
  --amber: #8a5a00;
  --amber-soft: #fbefd5;
  --danger: #b4281c;
  --danger-soft: #fbe3e0;
  --dark: #111315;
  --on-dark: #ffffff;
  --focus: #7e22ce;
  --side-bg: #ffffff;
  --side-line: #d6e2dd;
  --side-text: #3d4a45;
  --side-hover: #e2efea;
  --side-active-bg: #f3e8ff;
  --side-active: #111315;
  --map-bubble: #a855f7;
  --radius: 16px;
  --radius-sm: 10px;
  --pill: 9999px;
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0d1311;
  --panel: #151d1a;
  --panel-2: #1a2420;
  --line: #26332e;
  --line-strong: #364640;
  --text: #eef3f1;
  --muted: #96a8a1;
  --accent: #b874f8;
  --accent-hover: #c791fa;
  --on-accent: #111315;
  --accent-ink: #d4b0fd;
  --accent-soft: #2a1b3d;
  --chart: #c28bfa;
  --good: #4fd6a0;
  --good-soft: #12332a;
  --amber: #f2b440;
  --amber-soft: #2f2410;
  --danger: #f47a6e;
  --danger-soft: #3a1a17;
  --dark: #eef3f1;
  --on-dark: #111315;
  --focus: #d4b0fd;
  --side-bg: #101714;
  --side-line: #26332e;
  --side-text: #aebdb7;
  --side-hover: #1a2420;
  --side-active-bg: #2a1b3d;
  --side-active: #ffffff;
  --map-bubble: #c28bfa;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1311; --panel: #151d1a; --panel-2: #1a2420; --line: #26332e; --line-strong: #364640;
    --text: #eef3f1; --muted: #96a8a1; --accent: #b874f8; --accent-hover: #c791fa; --on-accent: #111315;
    --accent-ink: #d4b0fd; --accent-soft: #2a1b3d; --chart: #c28bfa; --good: #4fd6a0; --good-soft: #12332a;
    --amber: #f2b440; --amber-soft: #2f2410; --danger: #f47a6e; --danger-soft: #3a1a17;
    --dark: #eef3f1; --on-dark: #111315; --focus: #d4b0fd;
    --side-bg: #101714; --side-line: #26332e; --side-text: #aebdb7; --side-hover: #1a2420;
    --side-active-bg: #2a1b3d; --side-active: #ffffff; --map-bubble: #c28bfa;
    color-scheme: dark;
  }
}

/* Thin, quiet scrollbars everywhere (sidebar, tables, panels, page). */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 9999px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }
*::-webkit-scrollbar-corner { background: transparent; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  font: 15px/1.55 var(--font);
  font-feature-settings: "tnum" 1, "cv11" 1;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-ink); text-decoration: none; font-weight: 550; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -.02em; margin: 0 0 .5rem; font-weight: 700; }
h1 { font-size: clamp(1.7rem, 2.6vw, 2.25rem); letter-spacing: -.035em; }
h2 { font-size: 1.05rem; }
h3 { font-size: .98rem; }
p { margin: .5rem 0; }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .88em; background: var(--panel-2); border: 1px solid var(--line); padding: .05rem .35rem; border-radius: 5px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: 1rem; top: 1rem; background: var(--panel); padding: .5rem .8rem; border-radius: 8px; z-index: 50; border: 1px solid var(--line-strong); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }

/* ---------- App shell ---------- */
.app-frame { min-height: 100vh; }
.app-frame.has-sidebar { display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
  background: var(--side-bg); color: var(--side-text);
  padding: 18px 12px 12px; border-right: 1px solid var(--side-line);
}
.brand { display: flex; align-items: center; gap: .6rem; color: var(--text); font-weight: 650; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-flex; line-height: 0; flex: none; }
.brand-mark img { width: 28px; height: 28px; object-fit: contain; border-radius: 6px; }
.sidebar .brand { color: var(--text); padding: 2px 10px 18px; }
.brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-group { margin: 16px 12px 4px; font-size: .78rem; font-weight: 600; color: var(--muted); }
.side-nav a {
  display: flex; align-items: center; gap: .7rem;
  padding: 8px 12px; border-radius: var(--pill); border-left: none;
  color: var(--side-text); font-weight: 500; font-size: .92rem;
}
.side-nav a:hover { color: var(--text); background: var(--side-hover); text-decoration: none; }
.side-nav a[aria-current="page"] { color: var(--side-active); background: var(--side-active-bg); font-weight: 700; border-left: none; box-shadow: none; }
.nav-icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.side-foot { border-top: 1px solid var(--side-line); padding-top: 12px; margin-top: 12px; display: grid; gap: 10px; }
.user-row { display: flex; align-items: center; gap: .6rem; padding: 4px 4px 0; }
.avatar { width: 32px; height: 32px; flex: none; border-radius: var(--pill); display: grid; place-items: center; font-weight: 700; font-size: .88rem; color: var(--on-accent); background: var(--accent); }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; flex: 1; }
.user-name { color: var(--text); font-weight: 600; font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: .76rem; color: var(--muted); text-transform: capitalize; }
.signout-form { margin: 0; }
.sidebar .theme-form select { background: var(--panel-2); border-color: var(--side-line); color: var(--side-text); }
.sidebar button.ghost { color: var(--side-text); border-color: var(--side-line); background: transparent; }
.sidebar button.ghost:hover { color: var(--text); box-shadow: none; transform: none; border-color: var(--text); background: transparent; }
.app-main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { display: none; align-items: center; gap: .75rem; padding: .6rem 1rem; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 12; }
.app-frame:not(.has-sidebar) .topbar { display: flex; justify-content: space-between; padding: .8rem clamp(1rem, 3vw, 2rem); }
.topbar-tools { margin-left: auto; }
.menu-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--pill); border: 1px solid var(--line); cursor: pointer; color: var(--text); }
.menu-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
.nav-toggle:focus-visible ~ .app-main .menu-btn { outline: 2px solid var(--focus); outline-offset: 2px; }
.scrim { display: none; }
main { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: clamp(1.1rem, 2.4vw, 2rem) clamp(1rem, 3vw, 2.25rem) 3rem; }

/* ---------- Page structure ---------- */
.page-head { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: flex-end; margin-bottom: 1.1rem; }
.page-head h1 { margin-bottom: .2rem; }
.page-head p { margin: 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1rem, 1.8vw, 1.35rem); margin: 1rem 0; }
.card.narrow { max-width: 460px; margin: 2rem auto; }
.card-head { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: space-between; align-items: flex-start; margin-bottom: .85rem; }
.card-head h2 { margin-bottom: .1rem; }
.card-head p { margin: 0; }
.stack { display: flex; flex-direction: column; gap: .85rem; }
.grid-form { display: grid; gap: .85rem; max-width: 720px; }
.grid-form fieldset, .logo-slot { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .9rem 1rem; background: var(--panel-2); }
.actions { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; margin-top: .75rem; }
.filters { margin-bottom: 1rem; flex-wrap: wrap; }
.filter-bar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: 1rem; }
.filter-bar label { min-width: 11rem; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .85rem; }
.flash { padding: .7rem 1.1rem; border-radius: var(--radius-sm); margin: 0 0 1rem; border: 1px solid var(--line); background: var(--panel); }
.flash-error { background: var(--danger-soft); border-color: transparent; color: var(--danger); font-weight: 550; }
.flash-info, .flash-ok { background: var(--accent-soft); border-color: transparent; }
.empty-state { text-align: center; padding: 2.2rem 1rem; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); }

/* ---------- Forms ---------- */
label { display: flex; flex-direction: column; gap: .35rem; font-weight: 550; font-size: .88rem; }
label.checkbox { flex-direction: row; align-items: center; gap: .55rem; font-weight: 450; color: var(--muted); }
input, select, textarea {
  font: inherit; font-weight: 450; color: var(--text);
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: .55rem .75rem; min-height: 2.6rem; width: 100%;
  transition: border-color .12s ease, box-shadow .12s ease;
}
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; accent-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .65; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-ink); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 4.5rem; resize: vertical; }
.inline-form input, .inline-form select { width: auto; }
.code-input { font-size: 1.6rem; letter-spacing: .5em; text-align: center; font-weight: 650; padding: .65rem .5rem .65rem 1rem; }

button, .button {
  font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border-radius: var(--pill); padding: .5rem 1.15rem; min-height: 2.6rem; line-height: 1.1;
  border: 1px solid var(--text); background: transparent; color: var(--text);
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
button:hover, .button:hover { text-decoration: none; background: var(--panel-2); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.primary:hover, .button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
button.dark, .button.dark { background: var(--dark); border-color: var(--dark); color: var(--on-dark); }
button.dark:hover, .button.dark:hover { background: var(--dark); opacity: .86; }
button.secondary, .button.secondary { background: var(--accent-soft); color: var(--text); border-color: transparent; }
button.secondary:hover, .button.secondary:hover { background: var(--accent); }
button.ghost, .button.ghost { background: transparent; border-color: var(--line-strong); color: var(--text); min-height: 2.1rem; padding: .25rem .85rem; font-size: .82rem; }
button.ghost:hover, .button.ghost:hover { border-color: var(--text); }
button.danger, .button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
button.danger:hover { background: var(--danger); opacity: .88; }
button.small, .button.small { min-height: 2rem; padding: .2rem .8rem; font-size: .8rem; }
button.link-button, .link-button { background: none; border: 0; padding: 0; min-height: 0; border-radius: 0; color: var(--accent-ink); font-weight: 600; }
button.link-button:hover { text-decoration: underline; background: none; }
button.wide, .wide { width: 100%; }
.inline-form { display: inline-flex; gap: .5rem; align-items: center; margin: 0; flex-wrap: wrap; }
.theme-form { display: flex; gap: .4rem; align-items: center; margin: 0; }
.theme-form select { min-height: 2.1rem; padding: .2rem .5rem; font-size: .84rem; flex: 1; }
.js .theme-form button { display: none; }
.resend-row { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: .75rem 0; }
.badge { display: inline-flex; align-items: center; font-size: .74rem; font-weight: 600; border: 1px solid var(--line-strong); border-radius: 999px; padding: .1rem .55rem; color: var(--muted); text-transform: capitalize; vertical-align: middle; }
.badge-ok { background: var(--good-soft); color: var(--good); border-color: transparent; }
.badge-warn { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.badge-bad { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge-brand { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.flag-code { display: inline-block; min-width: 2rem; font-size: .72rem; font-weight: 650; text-align: center; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); border-radius: 5px; padding: .05rem .3rem; margin-right: .35rem; }
.danger { color: var(--danger); }
.secret { word-break: break-all; font-family: ui-monospace, Menlo, Consolas, monospace; }
.setup-key { background: var(--panel-2); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); padding: .85rem 1rem; }
.setup-key code { background: none; border: 0; padding: 0; font-size: 1.02rem; }
.tips { padding-left: 1.1rem; list-style: disc; }
.tips li { margin: .3rem 0; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 550; font-size: .82rem; white-space: nowrap; border-bottom-color: var(--line-strong); }
tbody tr:hover td { background: var(--panel-2); }
tbody tr:last-child td { border-bottom: 0; }
caption { text-align: left; }
th:first-child, td:first-child { padding-left: .25rem; }
.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; margin: 1rem 0 0; color: var(--muted); }
.checklist { list-style: none; padding: 0; }
.checklist li { padding: .35rem 0; border-bottom: 1px solid var(--line); }
.checklist .ok { color: var(--good); font-weight: 600; }
.checklist .fail { color: var(--danger); font-weight: 600; }
.facts { display: grid; grid-template-columns: minmax(10rem, max-content) 1fr; gap: .45rem 1.1rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.flagged td { background: var(--danger-soft); }

/* ---------- Ledger strip (metric cards) ---------- */
.metrics-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(214px, 1fr)); gap: .85rem; margin: 1rem 0;
}
.metric {
  position: relative; overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px 0; display: flex; flex-direction: column; min-height: 168px;
}
.metric-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.metric-label { font-size: .86rem; font-weight: 600; color: var(--muted); }
.metric-value { font-size: clamp(1.65rem, 2.3vw, 2.15rem); font-weight: 700; letter-spacing: -.035em; margin: .35rem 0 .2rem; font-variant-numeric: tabular-nums; line-height: 1.08; overflow-wrap: anywhere; }
.metric-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: 0; min-height: 1.5rem; }
.metric-sub { margin: .15rem 0 0; font-size: .8rem; color: var(--muted); }
.delta { display: inline-flex; align-items: center; gap: .25rem; font-size: .78rem; font-weight: 700; padding: .1rem .5rem; border-radius: var(--pill); font-variant-numeric: tabular-nums; }
.delta-up { color: var(--good); background: var(--good-soft); }
.delta-down { color: var(--danger); background: var(--danger-soft); }
.delta-flat { color: var(--muted); background: var(--panel-2); }
.metric-spark { width: calc(100% + 36px); margin: auto -18px 0; height: 52px; padding-top: .5rem; display: block; }
.spark-area { fill: var(--chart); opacity: .14; }
.spark-line { stroke: var(--chart); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark-flat { stroke: var(--line-strong); stroke-width: 1.5; stroke-dasharray: 2 5; opacity: .9; }
.metric-accent { background: var(--accent-soft); border-color: transparent; }
.metric-dark { background: var(--dark); border-color: var(--dark); color: var(--on-dark); }
.metric-dark .metric-label, .metric-dark .metric-sub, .metric-dark .muted { color: inherit; opacity: .72; }
.metric-dark .delta-up { background: #b874f8; color: #111315; }
.metric-dark .delta-down { background: #fbe3e0; color: #b4281c; }
.metric-dark .delta-flat { background: rgba(255, 255, 255, .14); color: inherit; }
.metric-dark .spark-line { stroke: #d4b0fd; }
.metric-dark .spark-area { fill: #b874f8; opacity: .25; }
.metric-dark .spark-flat { stroke: rgba(255, 255, 255, .35); }
.metric-warn .metric-value { color: var(--danger); }
.section-title { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem; margin: 1.6rem 0 .1rem; }
.section-title h2 { margin: 0; font-size: 1.1rem; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .85rem; margin: 1rem 0; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; display: flex; flex-direction: column; }
.kpi-label { color: var(--muted); font-size: .85rem; }
.kpi-value { font-size: 1.6rem; font-weight: 620; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: .8rem; }
.mini-stat { display: flex; flex-direction: column; gap: .1rem; margin-top: auto; padding-top: .9rem; border-top: 1px solid var(--line); }
.mini-stat strong { font-size: 1.45rem; font-weight: 620; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* ---------- Charts, gauges, map ---------- */
.dash-row { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(250px, 1fr); gap: 1rem; margin: 1rem 0; align-items: stretch; }
.dash-row > .card { margin: 0; }
.chart-card, .gauges-card { display: flex; flex-direction: column; }
.chart-wrap { position: relative; margin-top: .5rem; touch-action: pan-y; }
.chart { width: 100%; height: 230px; display: block; }
.chart-line { stroke: var(--chart); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart-area { fill: var(--chart); opacity: .12; }
.chart-bar { fill: var(--chart); opacity: .9; }
.chart-grid { stroke: var(--line); stroke-dasharray: 3 5; vector-effect: non-scaling-stroke; }
.chart-axis { display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted); margin-top: .35rem; }
.chart-rule, .chart-dot, .chart-tip { position: absolute; opacity: 0; pointer-events: none; transition: opacity .1s ease; }
.chart-rule { top: 0; bottom: 0; width: 1px; background: var(--line-strong); }
.chart-dot { width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--chart); border: 2px solid var(--panel); }
.chart-tip { top: -6px; transform: translate(-50%, -100%); background: var(--text); color: var(--bg); border-radius: 8px; padding: .35rem .6rem; display: flex; flex-direction: column; line-height: 1.25; font-size: .78rem; white-space: nowrap; }
.chart-tip-value { font-size: .95rem; }
.chart-wrap.is-hot .chart-rule, .chart-wrap.is-hot .chart-dot, .chart-wrap.is-hot .chart-tip { opacity: 1; }
.gauge-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.gauge { margin: 0; text-align: center; }
.gauge svg { width: 100%; max-width: 170px; height: auto; display: block; margin: 0 auto; }
.gauge-track { stroke: var(--line); stroke-width: 10; }
.gauge-fill { stroke: var(--chart); stroke-width: 10; }
.gauge figcaption { display: flex; flex-direction: column; gap: .05rem; margin-top: -.3rem; }
.gauge-value { font-size: 1.25rem; font-weight: 620; font-variant-numeric: tabular-nums; }
.geo-map { width: 100%; height: clamp(260px, 38vw, 380px); border-radius: var(--radius-sm); border: 1px solid var(--line); margin-bottom: 1rem; background: var(--panel-2); overflow: hidden; }
.geo-table td:first-child { white-space: nowrap; }
.share-cell { display: flex; align-items: center; gap: .6rem; min-width: 160px; }
.share-track { flex: 1; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.share-bar { display: block; height: 100%; background: var(--chart); border-radius: 3px; }
.num-inline { min-width: 3.4rem; text-align: right; font-variant-numeric: tabular-nums; }
/* share bar widths (inline styles are blocked by the security policy) */
.w-0 { width: 0%; }
.w-2 { width: 2%; }
.w-4 { width: 4%; }
.w-6 { width: 6%; }
.w-8 { width: 8%; }
.w-10 { width: 10%; }
.w-12 { width: 12%; }
.w-14 { width: 14%; }
.w-16 { width: 16%; }
.w-18 { width: 18%; }
.w-20 { width: 20%; }
.w-22 { width: 22%; }
.w-24 { width: 24%; }
.w-26 { width: 26%; }
.w-28 { width: 28%; }
.w-30 { width: 30%; }
.w-32 { width: 32%; }
.w-34 { width: 34%; }
.w-36 { width: 36%; }
.w-38 { width: 38%; }
.w-40 { width: 40%; }
.w-42 { width: 42%; }
.w-44 { width: 44%; }
.w-46 { width: 46%; }
.w-48 { width: 48%; }
.w-50 { width: 50%; }
.w-52 { width: 52%; }
.w-54 { width: 54%; }
.w-56 { width: 56%; }
.w-58 { width: 58%; }
.w-60 { width: 60%; }
.w-62 { width: 62%; }
.w-64 { width: 64%; }
.w-66 { width: 66%; }
.w-68 { width: 68%; }
.w-70 { width: 70%; }
.w-72 { width: 72%; }
.w-74 { width: 74%; }
.w-76 { width: 76%; }
.w-78 { width: 78%; }
.w-80 { width: 80%; }
.w-82 { width: 82%; }
.w-84 { width: 84%; }
.w-86 { width: 86%; }
.w-88 { width: 88%; }
.w-90 { width: 90%; }
.w-92 { width: 92%; }
.w-94 { width: 94%; }
.w-96 { width: 96%; }
.w-98 { width: 98%; }
.w-100 { width: 100%; }

/* ---------- Sign-in, sign-up and verification ---------- */
.auth-page { position: relative; }
.auth-page main { max-width: none; padding: 0; margin: 0; }
.auth-brand { position: absolute; top: 26px; left: clamp(1.25rem, 4vw, 3rem); z-index: 3; display: flex; align-items: center; gap: .6rem; font-weight: 650; color: var(--text); letter-spacing: -.01em; }
.auth-brand:hover { text-decoration: none; }
.auth-theme { position: absolute; left: clamp(1.25rem, 4vw, 3rem); bottom: 18px; z-index: 3; width: 150px; }
.auth-page .flash { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 30; width: min(560px, 92vw); box-shadow: 0 10px 30px rgba(17, 19, 21, .14); border-radius: var(--pill); padding-inline: 1.4rem; }
.auth-shell { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; }
.auth-shell-wide { grid-template-columns: minmax(0, 1.45fr) minmax(0, .8fr); }
.auth-form-panel { background: var(--panel); display: grid; place-items: center; padding: 110px clamp(1.25rem, 5vw, 4rem) 90px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card.wide-card, .wide-card { max-width: 640px; }
.auth-card h1 { font-size: clamp(1.7rem, 2.6vw, 2.2rem); margin-bottom: .4rem; }
.auth-card > p.muted { margin-bottom: 1.2rem; }
.auth-form { margin-top: .5rem; }
.choice-fieldset { border: 0; padding: 0; margin: 0; }
.choice-fieldset legend { font-weight: 550; font-size: .88rem; margin-bottom: .4rem; padding: 0; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .75rem; margin: .75rem 0 1rem; }
.choice-card { position: relative; display: flex; flex-direction: column; gap: .3rem; align-items: flex-start; border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 1rem; background: var(--panel); color: var(--text); font-weight: 450; }
.choice-card:hover { border-color: var(--text); text-decoration: none; }
.choice-card strong { font-size: 1rem; font-weight: 600; }
.choice-cta { display: inline-flex; align-items: center; align-self: stretch; justify-content: center; margin-top: .6rem; padding: .55rem .9rem; border-radius: var(--pill); background: var(--dark); color: var(--on-dark); font-weight: 600; font-size: .9rem; }
.choice-cta-on { background: var(--accent-soft); color: var(--text); }
.choice-card:hover .choice-cta { filter: brightness(1.08); }
.choice-icon { font-size: 1.3rem; line-height: 1; color: var(--accent-ink); }
.choice-radio { cursor: pointer; }
.choice-radio input { position: absolute; top: 1rem; right: 1rem; }
.choice-radio:has(input:checked) { border-color: var(--accent-ink); box-shadow: 0 0 0 3px var(--accent-soft); }

.auth-hero { position: sticky; top: 0; align-self: start; height: 100vh; display: grid; place-items: center; padding: 3rem clamp(1.5rem, 5vw, 4.5rem); background: linear-gradient(180deg, #dcefe8 0%, var(--bg) 100%); color: var(--text); overflow: hidden; }
.ladder { position: relative; width: 100%; max-width: 440px; }
.ladder-title { font-size: clamp(1.9rem, 3.2vw, 2.8rem); font-weight: 700; letter-spacing: -.04em; line-height: 1.05; color: var(--text); margin: 0 0 .8rem; }
.ladder-sub { color: var(--muted); margin: 0 0 1.6rem; }
.ladder-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; }
.bid { display: grid; grid-template-columns: 8.5rem 1fr 3rem; align-items: center; gap: .8rem; padding: .6rem .85rem; border-radius: var(--pill); border: 1px solid var(--line); background: var(--panel); font-size: .9rem; }
.bid-name { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bid-track { height: 8px; border-radius: var(--pill); background: var(--bg); overflow: hidden; }
.bid-fill { display: block; height: 100%; border-radius: var(--pill); background: #a9c4ba; transform-origin: left; animation: bid-grow .9s cubic-bezier(.2, .7, .2, 1) both; }
.b1 .bid-fill { width: 58%; animation-delay: .15s; }
.b2 .bid-fill { width: 76%; animation-delay: .4s; }
.b3 .bid-fill { width: 100%; animation-delay: .65s; background: var(--accent); }
.bid-amount { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.bid.win { border-color: var(--accent); background: var(--accent-soft); animation: bid-win .5s ease 1.4s both; }
.bid.win .bid-name { color: var(--text); font-weight: 600; }
.ladder-foot { color: var(--muted); font-size: .82rem; margin: 1rem 0 0; }
@keyframes bid-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes bid-win { from { box-shadow: 0 0 0 0 #b874f800; } to { box-shadow: 0 0 0 4px #b874f833; } }

:root[data-theme="dark"] .brand-mark svg rect { fill: #b874f8; }
:root[data-theme="dark"] .brand-mark svg path { stroke: #111315; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-mark svg rect { fill: #b874f8; }
  :root:not([data-theme="light"]) .brand-mark svg path { stroke: #111315; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .dash-row { grid-template-columns: 1fr; }
  .auth-shell, .auth-shell-wide { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-form-panel { padding-top: 96px; }
}
@media (max-width: 900px) {
  .app-frame.has-sidebar { grid-template-columns: minmax(0, 1fr); }
  .app-frame.has-sidebar .topbar { display: flex; }
  .sidebar { position: fixed; z-index: 30; left: 0; top: 0; bottom: 0; width: 272px; transform: translateX(-100%); transition: transform .2s ease; }
  .nav-toggle:checked ~ .sidebar { transform: none; }
  .nav-toggle:checked ~ .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(17, 19, 21, .45); }
}
@media (max-width: 640px) {
  .facts { grid-template-columns: 1fr; }
  .filter-bar label { min-width: 0; flex: 1 1 9rem; }
  .bid { grid-template-columns: 6.5rem 1fr 2.6rem; }
  .metric { min-height: 0; padding-bottom: .25rem; }
  .metric-spark { height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- Print ---------- */
@media print {
  .sidebar, .topbar, .scrim, .auth-brand, .auth-theme, .theme-form, button, .button, .actions, .filters, .filter-bar, .page-actions, .pager, .auth-hero { display: none !important; }
  .app-frame.has-sidebar { display: block; }
  body { background: #fff; color: #000; }
  .card, .metrics-grid { border-color: #bbb; }
  .table-wrap { overflow: visible; }
  .geo-map, .chart-tip { display: none; }
}

/* ---------- Control center ---------- */
.period-tabs { display: inline-flex; gap: .2rem; padding: .22rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--pill); }
.period-tabs a { padding: .32rem .85rem; border-radius: var(--pill); font-size: .84rem; font-weight: 600; color: var(--muted); text-decoration: none; white-space: nowrap; }
.period-tabs a:hover { color: var(--text); background: var(--panel-2); }
.period-tabs a[aria-current="true"] { background: var(--dark); color: var(--on-dark); }
.dash-row-even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dash-row-even > .card { min-width: 0; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); flex: none; margin-top: .35rem; }
.live-bars { width: 100%; height: 96px; display: block; margin-top: .4rem; }
.bar-live { fill: var(--chart); }
.bar-idle { fill: var(--line-strong); }
.attention { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.attention li + li { border-top: 1px solid var(--line); }
.attention a { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .62rem .35rem; color: var(--text); text-decoration: none; border-radius: var(--radius-sm); font-size: .9rem; }
.attention a:hover { background: var(--panel-2); }
.row-actions { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.row-actions form { margin: 0; }
.form-wide { max-width: 860px; }
.inline-label { flex-direction: row; align-items: center; gap: .5rem; font-weight: 550; }
.inline-label select { width: auto; min-height: 2.1rem; padding: .2rem .6rem; }
.pick-list { max-height: 15rem; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .35rem .5rem; margin-top: .5rem; background: var(--panel); display: grid; gap: .1rem; }
.pick-item { padding: .3rem .35rem; border-radius: 8px; }
.pick-item:hover { background: var(--panel-2); }
.pick-list.is-off { opacity: .45; pointer-events: none; }
.param-builder { display: grid; gap: .6rem; }
.param-rows { display: grid; gap: .5rem; }
.param-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: .5rem; align-items: center; }
.macro-chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip { min-height: 1.8rem; padding: .1rem .65rem; font-size: .78rem; font-weight: 550; font-family: ui-monospace, Menlo, Consolas, monospace; border-color: var(--line-strong); background: var(--panel-2); border-radius: var(--pill); }
.chip:hover { background: var(--accent-soft); border-color: var(--accent); }
.detail-list { display: grid; gap: .1rem; margin: 0; }
.detail-list > div { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: .75rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.detail-list > div:last-child { border-bottom: 0; }
.detail-list dt { color: var(--muted); font-size: .86rem; }
.detail-list dd { margin: 0; min-width: 0; }
.danger-zone { border-color: var(--danger-soft); }
.code-block { display: block; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .65rem .8rem; font-size: .84rem; overflow-x: auto; white-space: pre; user-select: all; }
.toolbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; margin-bottom: .85rem; }
.toolbar label { min-width: 11rem; }
.toolbar form { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; margin: 0; }
.create-panel { margin: 1rem 0; }
.create-panel > summary { list-style: none; cursor: pointer; display: inline-flex; }
.create-panel > summary::-webkit-details-marker { display: none; }
.create-panel[open] > summary { margin-bottom: .85rem; }
.create-panel .grid-form { max-width: none; }
.stat-pair { display: flex; flex-direction: column; gap: .05rem; }
.stat-pair .muted { font-size: .78rem; }
.cell-sub { display: block; color: var(--muted); font-size: .78rem; }
@media (max-width: 860px) {
  .dash-row-even { grid-template-columns: 1fr; }
  .param-row { grid-template-columns: 1fr; }
  .detail-list > div { grid-template-columns: 1fr; gap: .1rem; }
  .period-tabs { max-width: 100%; overflow-x: auto; }
}
.check-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .25rem .75rem; }
td.num, th.num { white-space: nowrap; }
.live-card { display: flex; flex-direction: column; }
.live-card .live-bars { flex: 1; min-height: 190px; height: auto; }
.param-builder > button { justify-self: start; }
.form-wide { max-width: none; }
.row-actions { flex-wrap: nowrap; white-space: nowrap; }
.grid-form > button, .grid-form > .button { justify-self: start; }
.card > h2 + .muted, .card > h2 + p { margin-top: .1rem; }
.card > h2 { margin-bottom: .35rem; }
main > .table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .4rem 1rem; margin: 1rem 0; }
main > form.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; }
.logo-slot + .logo-slot { margin-top: .75rem; }
.logo-slot form > button, .logo-slot form > .button { justify-self: start; width: auto; }
.logo-slot form { display: grid; gap: .6rem; }

/* Navigation loader: a blurred veil shown while the next page loads. */
.nav-loader { position: fixed; inset: 0; z-index: 1000; display: none; align-items: center; justify-content: center; background: rgb(255 255 255 / 0.25); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.nav-loader.is-on { display: flex; }
.nav-loader-dot { width: 2.25rem; height: 2.25rem; border-radius: 50%; border: 3px solid var(--line-strong); border-top-color: var(--accent); animation: nav-spin 0.8s linear infinite; }
@keyframes nav-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .nav-loader-dot { animation-duration: 2.4s; } }

/* Copyable text blocks (feed details, inspector request and bids). */
.copy-block { white-space: pre-wrap; word-break: break-all; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem; margin: 0.5rem 0; }

/* ---------- Remote feed form: tabs and tick-box groups ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: .35rem; border-bottom: 1px solid var(--line); padding-bottom: .6rem; margin-bottom: .25rem; }
.tab { min-height: 2.1rem; padding: .25rem .95rem; border-radius: var(--pill); border: 1px solid var(--line-strong); background: var(--panel); color: var(--text); font-weight: 550; font-size: .85rem; cursor: pointer; }
.tab:hover { background: var(--panel-2); }
.tab[aria-selected="true"] { background: var(--dark); color: var(--on-dark); border-color: var(--dark); }
.tab-panel { display: grid; gap: 1rem; }
.tab-panel[hidden] { display: none; }
.toolbar { display: flex; flex-wrap: wrap; gap: .4rem; margin: .25rem 0 .5rem; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .15rem .9rem; margin: .3rem 0; }
.check-grid-wide { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.check-grid .checkbox { padding: .2rem 0; }
.check-group { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .35rem .8rem; margin: .4rem 0; background: var(--panel); }
.check-group > summary { cursor: pointer; padding: .3rem 0; list-style-position: outside; }
.check-group > summary .checkbox { display: inline-flex; color: var(--text); }
.tree-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .6rem 1rem; margin: .3rem 0; }
.tree-node { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .5rem .7rem; background: var(--panel); }
.tree-node > .checkbox { color: var(--text); }
.tree-children { display: grid; gap: .1rem; margin: .3rem 0 0 1.4rem; }
.tree-children .checkbox { padding: .1rem 0; }
.form-wide details > summary { cursor: pointer; font-weight: 550; padding: .3rem 0; }

/* Remote feed: the steps from set-up to sharing */
.steps { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; padding: 0; margin: 0 0 1rem; }
.steps li { display: inline-flex; align-items: center; gap: .5rem; padding: .35rem .8rem .35rem .4rem; border: 1px solid var(--line-strong); border-radius: var(--pill); background: var(--panel); font-size: .85rem; font-weight: 550; color: var(--muted); }
.steps .step-n { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--panel-2); border: 1px solid var(--line-strong); font-size: .78rem; }
.steps li.is-done { color: var(--text); }
.steps li.is-done .step-n { background: var(--good-soft); color: var(--good); border-color: transparent; }
.steps li.is-current { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
.steps li.is-current .step-n { background: var(--accent); color: var(--on-accent); border-color: transparent; }
