/* webmonitor dashboard styling.
 *
 * WEB-121 — FULL overhaul (fourth pass). The board liked the direction but
 * called the prior pass "AI-looking" and asked for a richer left sidebar and a
 * genuine, opinionated point of view. So this pass commits to one:
 *
 *   "Operations console." A warm-neutral *paper* palette (not the default cool
 *   slate every AI mockup ships), a signature EMERALD accent that ties the
 *   whole identity to the product's job — uptime, health, "up" — paired with
 *   high-contrast INK primary actions (the Linear/Vercel move, not a pastel
 *   indigo button). All data is set in a MONOSPACE ledger face (the Datadog /
 *   Grafana tell that reads as "real instrument, not a marketing site"). The
 *   left rail is a dark command surface in BOTH themes — the anchor real tools
 *   use and the thing AI mockups never commit to.
 *
 * Deliberately NOT the "tasteful AI" defaults the board flagged: no uniform
 * pastel card tints, no single generic indigo, no everything-equally-rounded,
 * no big centered-emoji empty states. Radii are tight and purposeful, borders
 * are hairlines doing the work instead of soft even shadows, density is real.
 *
 * Still a single, dependency-free, hand-written stylesheet. Theming is driven
 * by `prefers-color-scheme` (so the screenshot tool captures both) AND an
 * explicit `[data-theme]` override for the in-app theme switch. Class names
 * remain a superset of the markup — nothing the app wires was renamed. */

/* ============================================================ *
 * DESIGN TOKENS                                                *
 * ============================================================ */
:root {
  /* spacing — 4px base, 8px rhythm */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px;

  /* radius — tight & purposeful, not uniformly pillowy. Controls are nearly
   * square (instrument-grade); only modals get real curvature. */
  --r-sm: 5px;   /* controls / chips */
  --r-md: 8px;   /* cards / panels */
  --r-lg: 12px;  /* modals */
  --radius: var(--r-md); /* back-compat alias */
  --r-pill: 999px;

  /* type — UI in a grotesque system stack; ALL data/metrics in a mono ledger
   * face. The mono-for-numbers split is the core "real tool" signal. */
  --font: "Inter var", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Cascadia Code", ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;

  /* warm-neutral "paper" ramp (light) — a faint warm cast instead of the
   * generic cool blue-grey, so surfaces read as paper, not dialog chrome. */
  --bg: #f3f2ee;
  --panel: #ffffff;        /* raised surface (kept name: used widely) */
  --panel-2: #faf9f6;      /* faint alt surface — table head, sunken panels */
  --surface-2: #ecebe4;    /* hover / sunken fill */
  --border: #e4e1d8;
  --border-strong: #d2cec2;
  --text: #1b1a16;         /* warm ink, not pure black */
  --muted: #6a665c;        /* secondary text */
  --text-3: #969185;       /* faint labels */

  /* brand — a signature emerald (uptime = healthy = green). One opinionated
   * hue, not a default indigo. */
  --accent: #0c8a4d;
  --accent-strong: #0a6f3e;
  --accent-fg: #ffffff;
  --accent-soft: #e3f2e9;

  /* high-contrast INK — primary buttons & emphasis. The Linear/Vercel move. */
  --ink: #201e1a;
  --ink-strong: #000000;
  --ink-fg: #faf9f6;

  /* semantic — warm, slightly desaturated (a leaf green / brick red / ochre),
   * not the bright candy primaries AI mockups default to. */
  --up: #0c8a4d;      --up-bg: #e3f2e9;
  --down: #cf3f33;    --down-bg: #fae9e6;
  --unknown: #b87410; --unknown-bg: #f7eddc;

  /* chart ink (works on both themes; lines own their own area fill) */
  --c-seo: var(--accent);
  --c-resp: #c2741a;
  --c-cert: #0e8a6a;

  /* dark command-rail surface — fixed across BOTH themes (the signature
   * anchor). Its own token family so the rail never flips with the content. */
  --side-bg: #1a1815;
  --side-bg-2: #252220;     /* hover / active fill */
  --side-bg-3: #100f0d;     /* search well / inset */
  --side-border: #322e29;
  --side-text: #ece8df;
  --side-muted: #a39d90;
  --side-faint: #736d62;
  --side-accent: #36d27e;   /* brighter emerald that holds on near-black */
  --side-accent-soft: rgba(54, 210, 126, 0.14);

  /* elevation — restrained; borders do most of the structural work */
  --shadow-sm: 0 1px 2px rgba(27, 26, 22, 0.05);
  --shadow: var(--shadow-sm); /* back-compat alias */
  --shadow-md: 0 8px 24px rgba(27, 26, 22, 0.10), 0 2px 6px rgba(27, 26, 22, 0.05);
  --shadow-lg: 0 24px 60px rgba(20, 18, 14, 0.28);

  --ring: 0 0 0 3px rgba(12, 138, 77, 0.32);
}

/* Dark content theme. Applied when the OS prefers dark AND the user hasn't
 * forced light, OR when the user explicitly picks dark via the in-app switch.
 * The rail tokens above are intentionally NOT redefined here. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; }
  :root:not([data-theme="light"]) {
    --bg: #0c0b0a;
    --panel: #16140f;
    --panel-2: #1b1813;
    --surface-2: #242017;
    --border: #2a261d;
    --border-strong: #3a352a;
    --text: #ece7da;
    --muted: #a39d8c;
    --text-3: #726c5c;

    --accent: #2fc173;
    --accent-strong: #4fd98c;
    --accent-fg: #08110a;
    --accent-soft: #11281a;

    --ink: #ece7da;
    --ink-strong: #ffffff;
    --ink-fg: #16140f;

    --up: #2fc173;      --up-bg: #11281a;
    --down: #f06a5b;    --down-bg: #2c1612;
    --unknown: #e0a338; --unknown-bg: #2a2010;

    --c-seo: #4fd98c;
    --c-resp: #e0a14a;
    --c-cert: #34c79b;

    --shadow-sm: 0 0 0 1px rgba(0, 0, 0, 0.22);
    --shadow-md: 0 10px 26px rgba(0, 0, 0, 0.52);
    --shadow-lg: 0 24px 58px rgba(0, 0, 0, 0.68);
    --ring: 0 0 0 3px rgba(79, 217, 140, 0.32);
  }
}
/* Explicit dark via the in-app switch (wins regardless of OS preference). */
:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="dark"] {
  --bg: #0c0b0a;
  --panel: #16140f;
  --panel-2: #1b1813;
  --surface-2: #242017;
  --border: #2a261d;
  --border-strong: #3a352a;
  --text: #ece7da;
  --muted: #a39d8c;
  --text-3: #726c5c;

  --accent: #2fc173;
  --accent-strong: #4fd98c;
  --accent-fg: #08110a;
  --accent-soft: #11281a;

  --ink: #ece7da;
  --ink-strong: #ffffff;
  --ink-fg: #16140f;

  --up: #2fc173;      --up-bg: #11281a;
  --down: #f06a5b;    --down-bg: #2c1612;
  --unknown: #e0a338; --unknown-bg: #2a2010;

  --c-seo: #4fd98c;
  --c-resp: #e0a14a;
  --c-cert: #34c79b;

  --shadow-sm: 0 0 0 1px rgba(0, 0, 0, 0.22);
  --shadow-md: 0 10px 26px rgba(0, 0, 0, 0.52);
  --shadow-lg: 0 24px 58px rgba(0, 0, 0, 0.68);
  --ring: 0 0 0 3px rgba(79, 217, 140, 0.32);
}
:root[data-theme="light"] { color-scheme: light; }

/* ============================================================ *
 * BASE                                                         *
 * ============================================================ */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 14px/1.5 var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01";
}
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.012em; color: var(--text); }
h1 { font-size: 1.3rem; }
h2 { font-size: 1.02rem; margin: 0 0 0.75rem; }
h3 { font-size: 0.92rem; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--down); margin: 0.25rem 0 0; font-size: 0.9rem; }
.empty { padding: var(--s-6) 0; color: var(--muted); text-align: center; }
/* All data/metrics ride the mono ledger face — the core "real instrument"
 * signal (Datadog/Grafana), and the thing that most separates this from a
 * marketing-site look. Labels & prose stay in the grotesque UI face. */
.tabnum, .stat-value, .kpi-value, .kpi-stat-value, .score-value, .metric-value,
.ov-uptime, .ov-score, .ov-resp-val, .ov-sync, .nav-badge, .version-badge,
.cmp-score .score-value, .kpi-stat-value {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* ============================================================ *
 * CONTROLS — buttons / inputs                                  *
 * ============================================================ */
button {
  font: inherit; font-weight: 550; cursor: pointer;
  display: inline-flex; align-items: center; gap: var(--s-2);
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  padding: 0.45rem 0.85rem;
  background: var(--panel);
  color: var(--text);
  line-height: 1.2;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s, filter 0.12s, color 0.12s;
}
button:hover { background: var(--surface-2); border-color: var(--border-strong); }
button:focus-visible { outline: none; box-shadow: var(--ring); }
/* Primary = solid INK, high-contrast (Linear/Vercel), not a pastel accent. */
button.primary {
  background: var(--ink); color: var(--ink-fg);
  border-color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(27, 26, 22, 0.16);
}
button.primary:hover { background: var(--ink-strong); border-color: var(--ink-strong); filter: none; }
/* The emerald accent earns its own button for affirmative, brand-y actions. */
button.accent { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); font-weight: 600; }
button.accent:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover { background: var(--surface-2); color: var(--text); }
button.small { padding: 0.32rem 0.65rem; font-size: 0.85rem; }
button:disabled { opacity: 0.5; cursor: default; }
.linklike {
  border: none; background: none; padding: 0; color: var(--accent);
  font: inherit; font-size: 0.78rem; font-weight: 600; cursor: pointer;
}
.linklike:hover { background: none; text-decoration: underline; }

input, select {
  font: inherit;
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--panel);
  color: var(--text);
}
input::placeholder { color: var(--text-3); }
input:focus, select:focus { outline: none; box-shadow: var(--ring); border-color: var(--accent); }
label span { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.25rem; }

/* ============================================================ *
 * LOGIN                                                        *
 * ============================================================ */
.login { min-height: 100vh; display: grid; place-items: center; padding: var(--s-4); }
.login-card {
  width: min(380px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  padding: var(--s-6);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.login-card h1 { text-align: center; }
.login-card p.muted { text-align: center; margin: -0.4rem 0 0.4rem; }

/* ============================================================ *
 * APP SHELL — dark command rail + scrolling content column      *
 * The rail is the signature surface: a near-black "ops console"  *
 * anchor (in BOTH themes) with a workspace switcher, working     *
 * search, grouped nav w/ section labels + live badges, a collapse*
 * toggle, and an account/theme/build footer.                    *
 * ============================================================ */
.app {
  --rail-w: 248px;
  display: grid;
  grid-template-columns: var(--rail-w) 1fr;
  min-height: 100vh;
}
.app.rail-collapsed { --rail-w: 64px; }

.sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-3) var(--s-4);
  background: var(--side-bg);
  color: var(--side-text);
  border-right: 1px solid var(--side-border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

/* ---- top: workspace switcher + collapse toggle ---- */
.sidebar-top { display: flex; align-items: center; gap: var(--s-1); }
.ws-switch {
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: center; gap: var(--s-2);
  padding: 0.5rem 0.55rem;
  background: transparent; border: 1px solid transparent; border-radius: var(--r-sm);
  color: var(--side-text); text-align: left;
}
.ws-switch:hover { background: var(--side-bg-2); border-color: var(--side-border); }
.ws-mark {
  width: 28px; height: 28px; flex: none; border-radius: 7px;
  display: grid; place-items: center;
  font-weight: 700; font-size: 0.86rem; color: #08110a;
  background: linear-gradient(155deg, var(--side-accent), #14a85f);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18), 0 1px 2px rgba(0,0,0,0.4);
}
.ws-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.ws-name { font-weight: 650; font-size: 0.86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-chev { margin-left: auto; color: var(--side-faint); font-size: 0.9rem; flex: none; }
.rail-toggle {
  flex: none; width: 30px; height: 30px; padding: 0; justify-content: center;
  background: transparent; border: 1px solid transparent; color: var(--side-muted);
  border-radius: var(--r-sm); font-size: 1rem; line-height: 1;
}
.rail-toggle:hover { background: var(--side-bg-2); color: var(--side-text); border-color: var(--side-border); }

/* ---- search ---- */
.sidebar-search {
  position: relative; display: flex; align-items: center;
  margin: var(--s-1) 0 var(--s-2);
}
.sidebar-search .search-ico {
  position: absolute; left: 0.6rem; color: var(--side-faint); font-size: 0.95rem; pointer-events: none;
}
#monitor-search {
  width: 100%;
  padding: 0.46rem 2rem 0.46rem 1.9rem;
  background: var(--side-bg-3); color: var(--side-text);
  border: 1px solid var(--side-border); border-radius: var(--r-sm);
  font-size: 0.84rem;
}
#monitor-search::placeholder { color: var(--side-faint); }
#monitor-search:focus { outline: none; border-color: var(--side-accent); box-shadow: 0 0 0 3px var(--side-accent-soft); }
#monitor-search::-webkit-search-cancel-button { filter: invert(0.6); }
.search-kbd {
  position: absolute; right: 0.5rem;
  font-family: var(--mono); font-size: 0.66rem; color: var(--side-muted);
  background: var(--side-bg-2); border: 1px solid var(--side-border);
  border-radius: 4px; padding: 0.05rem 0.34rem; pointer-events: none;
}

/* ---- nav ---- */
.sidebar-nav {
  display: flex; flex-direction: column; gap: 1px;
  margin-top: var(--s-1);
  overflow-y: auto; overflow-x: hidden;
  flex: 1 1 auto;
  scrollbar-width: thin; scrollbar-color: var(--side-border) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 8px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--side-border); border-radius: 4px; }
.nav-group { display: flex; flex-direction: column; gap: 1px; margin-top: var(--s-3); }
.nav-group-label {
  font-size: 0.64rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--side-faint);
  padding: 0.3rem 0.55rem 0.25rem;
}
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.46rem 0.55rem;
  border-radius: var(--r-sm);
  color: var(--side-muted);
  font-weight: 500; font-size: 0.875rem;
  text-decoration: none; white-space: nowrap;
}
.nav-item:hover { background: var(--side-bg-2); color: var(--side-text); text-decoration: none; }
.nav-item.active { background: var(--side-accent-soft); color: #ffffff; font-weight: 600; }
.nav-item.active::before {
  content: ""; position: absolute; left: -0.55rem; top: 50%; transform: translateY(-50%);
  height: 56%; width: 3px; border-radius: 0 3px 3px 0; background: var(--side-accent);
}
.nav-item.active .nav-ico { color: var(--side-accent); opacity: 1; }
.nav-ico { width: 18px; flex: none; text-align: center; font-size: 0.96rem; opacity: 0.7; }
.nav-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* live counts */
.nav-badge {
  font-family: var(--mono); font-size: 0.68rem; font-weight: 600;
  min-width: 1.25rem; text-align: center;
  padding: 0.05rem 0.34rem; border-radius: var(--r-pill);
  background: var(--side-bg-2); color: var(--side-muted);
  border: 1px solid var(--side-border);
}
.nav-badge[hidden] { display: none; }
.nav-badge.danger { background: rgba(207, 63, 51, 0.18); color: #ff8a7a; border-color: rgba(207, 63, 51, 0.35); }
.nav-badge.danger.pulse { animation: pulse-down 2s ease-in-out infinite; }
/* inert "coming soon" items — clearly not wired, never look broken */
.nav-item[data-soon] { color: var(--side-faint); cursor: default; }
.nav-item[data-soon]:hover { background: transparent; color: var(--side-muted); }
.nav-soon {
  font-size: 0.6rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--side-faint); border: 1px solid var(--side-border);
  border-radius: 4px; padding: 0.04rem 0.3rem;
}

/* ---- footer: status, controls, account, build ---- */
.sidebar-foot {
  margin-top: var(--s-2);
  display: flex; flex-direction: column; gap: var(--s-2);
  padding-top: var(--s-3);
  border-top: 1px solid var(--side-border);
}
.refresh-status { font-size: 0.72rem; color: var(--side-muted); min-height: 1em; padding: 0 0.55rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foot-controls { display: flex; gap: var(--s-1); }
.sidebar .ghost { color: var(--side-muted); }
.sidebar .ghost:hover { background: var(--side-bg-2); color: var(--side-text); }
#refresh-btn { flex: 1 1 auto; justify-content: flex-start; border: 1px solid var(--side-border); background: var(--side-bg-2); color: var(--side-text); }
#refresh-btn:hover { background: var(--side-bg-3); }
.icon-only { flex: none; width: 32px; justify-content: center; padding: 0; border: 1px solid var(--side-border); background: var(--side-bg-2); }
.account {
  display: flex; align-items: center; gap: var(--s-2);
  padding: 0.45rem 0.55rem; border-radius: var(--r-sm);
  background: var(--side-bg-2); border: 1px solid var(--side-border);
}
.acct-mark {
  width: 26px; height: 26px; flex: none; border-radius: 6px;
  display: grid; place-items: center; font-weight: 700; font-size: 0.78rem;
  background: var(--side-bg-3); color: var(--side-accent); border: 1px solid var(--side-border);
}
.acct-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.who { font-size: 0.78rem; color: var(--side-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.block { width: 100%; justify-content: center; }
.version-badge {
  align-self: flex-start;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.01em;
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--side-border);
  border-radius: var(--r-pill);
  background: var(--side-bg-3);
  color: var(--side-faint);
  cursor: default;
}

/* ---- collapsed rail: icon-only ---- */
.app.rail-collapsed .ws-meta,
.app.rail-collapsed .ws-chev,
.app.rail-collapsed .sidebar-search,
.app.rail-collapsed .nav-label,
.app.rail-collapsed .nav-group-label,
.app.rail-collapsed .nav-soon,
.app.rail-collapsed .refresh-status,
.app.rail-collapsed .acct-meta,
.app.rail-collapsed #version-badge,
.app.rail-collapsed #refresh-btn .nav-label { display: none; }
.app.rail-collapsed .sidebar { padding-left: var(--s-2); padding-right: var(--s-2); align-items: stretch; }
.app.rail-collapsed .sidebar-top { flex-direction: column; gap: var(--s-2); }
.app.rail-collapsed .ws-switch { justify-content: center; padding: 0.4rem; }
.app.rail-collapsed .nav-item { justify-content: center; padding: 0.5rem 0; gap: 0; }
.app.rail-collapsed .nav-item.active::before { left: -0.5rem; }
.app.rail-collapsed .nav-badge {
  position: absolute; top: 2px; right: 4px; min-width: 0; padding: 0.05rem 0.22rem; font-size: 0.58rem;
}
.app.rail-collapsed .nav-group { margin-top: var(--s-2); padding-top: var(--s-2); border-top: 1px solid var(--side-border); }
.app.rail-collapsed .foot-controls { flex-direction: column; }
.app.rail-collapsed #refresh-btn { justify-content: center; }
.app.rail-collapsed .account { justify-content: center; padding: 0.4rem; }
.app.rail-collapsed .rail-toggle { transform: rotate(180deg); }

.main { display: flex; flex-direction: column; min-width: 0; }

/* Page header — title + summary on the left, primary action on the right. */
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-4); flex-wrap: wrap;
  padding: var(--s-4) var(--s-6);
  min-height: 62px;
  background: color-mix(in srgb, var(--panel) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.page-head-titles { display: flex; align-items: baseline; gap: var(--s-3); flex-wrap: wrap; }
.page-head h1 { font-size: 1.18rem; letter-spacing: -0.02em; }
.page-sub { font-size: 0.85rem; font-family: var(--mono); }

.content {
  padding: var(--s-6);
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  display: flex; flex-direction: column; gap: var(--s-5);
}

/* Generic raised panel used for the table and the alerts feed. */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-3);
  padding: 0.85rem var(--s-5);
  border-bottom: 1px solid var(--border);
}
.panel-head h2 { margin: 0; font-size: 0.92rem; font-weight: 650; }
#alerts-section .alerts, #alerts-section .empty { padding: var(--s-4) var(--s-5); }

/* Manage-monitors disclosure — keeps the verbose per-site cards available
 * without cluttering the conventional table that is the primary surface. */
.manage > summary {
  cursor: pointer;
  font-size: 0.85rem; font-weight: 600; color: var(--muted);
  padding: var(--s-2) 0;
  list-style: none;
  display: inline-flex; align-items: center; gap: var(--s-2);
}
.manage > summary::-webkit-details-marker { display: none; }
.manage > summary::before { content: "▸"; transition: transform 0.12s; font-size: 0.8em; }
.manage[open] > summary::before { transform: rotate(90deg); }
.manage[open] > summary { margin-bottom: var(--s-3); }
.manage > summary:hover { color: var(--text); }

@media (max-width: 860px) {
  .app, .app.rail-collapsed { grid-template-columns: 1fr; --rail-w: auto; }
  .sidebar {
    position: static; height: auto; overflow: visible;
    flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--s-2);
    border-right: none; border-bottom: 1px solid var(--side-border);
  }
  .sidebar-top { flex: 1 1 200px; }
  .sidebar-search { flex: 1 1 200px; margin: 0; }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; flex-basis: 100%; overflow: visible; }
  .nav-group { flex-direction: row; flex-wrap: wrap; margin-top: 0; }
  .nav-group-label { display: none; }
  .nav-item.active::before { display: none; }
  .sidebar-foot { margin: 0 0 0 auto; flex-direction: row; align-items: center; border-top: none; padding-top: 0; }
  .rail-toggle { display: none; }
  .content, .page-head { padding-left: var(--s-4); padding-right: var(--s-4); }
}

/* ============================================================ *
 * ADD FORM                                                     *
 * ============================================================ */
.add-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--s-3);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-4);
  box-shadow: var(--shadow-sm);
}
.add-form .field { display: flex; flex-direction: column; }
.add-form .field.grow { flex: 1 1 220px; }
.add-form .field label { font-size: 0.82rem; color: var(--muted); margin-bottom: 0.3rem; font-weight: 550; }
.add-form .error { flex-basis: 100%; }

/* ============================================================ *
 * OVERVIEW FLEET-SUMMARY KPI STRIP (#overview-kpis .kpi-strip)  *
 * The at-a-glance row every mature monitoring overview leads    *
 * with (BetterStack / UptimeRobot). The DOM + tone classes are  *
 * rendered by the app (renderOverviewKpis → .kpi-stat with a    *
 * `up`/`down`/`warn` tone); this is the visual treatment for    *
 * those hooks. A status-tinted left rule reads the fleet state   *
 * at a glance; the value leads, the label sits beneath.         *
 * ============================================================ */
/* One unified, hairline-divided stat bar — not a row of evenly-tinted cards.
 * Reads like the summary strip in a real monitoring header (Linear/Vercel),
 * with a status dot per metric instead of a pastel fill. */
.kpi-strip {
  display: flex; flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.kpi-strip[hidden] { display: none; }
.kpi-stat {
  position: relative;
  flex: 1 1 0; min-width: 140px;
  display: flex; flex-direction: column; gap: 0.3rem;
  padding: 0.85rem 1.15rem;
  border-left: 1px solid var(--border);
}
.kpi-stat:first-child { border-left: none; }
.kpi-stat-value {
  font-size: 1.55rem; font-weight: 600; line-height: 1; letter-spacing: -0.03em;
  color: var(--text);
}
.kpi-stat.up .kpi-stat-value { color: var(--up); }
.kpi-stat.down .kpi-stat-value { color: var(--down); }
.kpi-stat.warn .kpi-stat-value { color: var(--unknown); }
.kpi-stat-label {
  font-size: 0.66rem; font-weight: 650; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-3);
  display: inline-flex; align-items: center; gap: 6px;
}
.kpi-stat.up .kpi-stat-label::before,
.kpi-stat.down .kpi-stat-label::before,
.kpi-stat.warn .kpi-stat-label::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}
.kpi-stat.up .kpi-stat-label::before { background: var(--up); }
.kpi-stat.down .kpi-stat-label::before { background: var(--down); }
.kpi-stat.warn .kpi-stat-label::before { background: var(--unknown); }
@media (max-width: 640px) { .kpi-stat { flex-basis: 50%; border-top: 1px solid var(--border); } }

/* ============================================================ *
 * STATUS CHIP — the .badge, used everywhere (overview / detail /
 * alerts). One component: a soft pill with a leading status dot. *
 * ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  text-transform: capitalize;
  padding: 0.2rem 0.6rem 0.2rem 0.5rem;
  border-radius: var(--r-pill);
  line-height: 1.35;
  border: 1px solid transparent;
}
.badge::before {
  content: "";
  width: 7px; height: 7px; border-radius: var(--r-pill);
  background: currentColor;
  flex: none;
}
.badge.up { color: var(--up); background: var(--up-bg); border-color: color-mix(in srgb, var(--up) 22%, transparent); }
.badge.down { color: var(--down); background: var(--down-bg); border-color: color-mix(in srgb, var(--down) 26%, transparent); }
.badge.down::before { box-shadow: 0 0 0 3px color-mix(in srgb, var(--down) 22%, transparent); animation: pulse-down 2s ease-in-out infinite; }
.badge.unknown { color: var(--unknown); background: var(--unknown-bg); border-color: color-mix(in srgb, var(--unknown) 24%, transparent); }
@keyframes pulse-down {
  0%, 100% { box-shadow: 0 0 0 2px color-mix(in srgb, var(--down) 26%, transparent); }
  50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--down) 10%, transparent); }
}

.cert-warn { color: var(--unknown); font-weight: 600; }
.cert-bad { color: var(--down); font-weight: 600; }

/* SEO score grades — small letter-grade emphasis. */
.seo-grade { font-weight: 700; }
.seo-A, .seo-B { color: var(--up); }
.seo-C, .seo-D { color: var(--unknown); }
.seo-F { color: var(--down); }

/* ============================================================ *
 * FAVICON (WEB-102)                                            *
 * ============================================================ */
.favicon {
  width: 18px; height: 18px; border-radius: 4px; flex: none;
  object-fit: contain;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--border);
  vertical-align: -3px;
  margin-right: 9px;
}
.favicon-lg { width: 22px; height: 22px; border-radius: 6px; margin-right: 10px; vertical-align: -5px; }

/* ============================================================ *
 * MONITOR LIST TABLE (WEB-101 → WEB-114)                       *
 * The data-dense, sortable monitor list — the conventional      *
 * BetterStack/UptimeRobot overview. Lives inside a .panel.      *
 * ============================================================ */
.overview-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.overview-table thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--panel-2);
  color: var(--text-3);
  font-weight: 650; font-size: 0.68rem;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 0.6rem var(--s-5);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  text-align: left;
}
/* numeric columns right-align for a clean ledger edge */
.overview-table th.ov-th-uptime, .overview-table td.ov-uptime,
.overview-table th.ov-th-score, .overview-table td.ov-score { text-align: right; }
.overview-table th.ov-th-actions, .overview-table td.ov-actions { text-align: right; }

.overview-table th.sortable { cursor: pointer; user-select: none; }
.overview-table th.sortable:hover { color: var(--text); }
.overview-table th.sorted { color: var(--accent); }
.overview-table th.sortable:focus-visible { outline: none; box-shadow: inset var(--ring); }

.overview-table td {
  padding: 0.72rem var(--s-5);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  vertical-align: middle;
}
.overview-table tbody tr:last-child td { border-bottom: none; }
.overview-row { cursor: pointer; transition: background 0.1s, box-shadow 0.1s; }
.overview-row:hover { background: var(--surface-2); }
.overview-row:hover td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.overview-row:focus-visible { outline: none; box-shadow: inset var(--ring); }

.ov-url-wrap { display: flex; align-items: center; min-width: 0; gap: 0; }
.ov-url-text { font-weight: 600; word-break: break-all; white-space: normal; color: var(--text); }
.overview-table .ov-uptime { font-weight: 650; color: var(--text); }
.overview-table .ov-uptime.up { color: var(--up); }
.overview-table .ov-uptime.warn { color: var(--unknown); }
.overview-table .ov-uptime.down { color: var(--down); }
.ov-resp-wrap { display: flex; align-items: center; gap: var(--s-3); justify-content: flex-start; }
.ov-resp-val { color: var(--muted); font-size: 0.85rem; min-width: 52px; text-align: right; }
.overview-table .ov-sync { color: var(--muted); font-size: 0.85rem; }
.overview-table .ov-score { font-size: 0.9rem; }
.ov-actions { text-align: right; }
.overview-row .ov-actions button { opacity: 0; transition: opacity 0.1s; }
.overview-row:hover .ov-actions button,
.overview-row:focus-within .ov-actions button { opacity: 1; }

/* response-time sparkline — line + soft area fill so it reads as a chart */
.sparkline { display: block; flex: none; width: 88px; height: 26px; overflow: visible; }
.sparkline-area { fill: var(--accent); opacity: 0.12; stroke: none; }
.sparkline-line { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.sparkline-dot { fill: var(--accent); }

/* ============================================================ *
 * MONITOR CARDS (Manage disclosure)                            *
 * ============================================================ */
.cards { display: flex; flex-direction: column; gap: var(--s-3); }
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  padding: var(--s-4) var(--s-5);
}
.card-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.card-url { font-weight: 600; word-break: break-all; display: flex; align-items: center; min-width: 0; }
.card-url a { color: inherit; text-decoration: none; }
.card-url a:hover { text-decoration: underline; }
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-5);
  margin-top: var(--s-3);
  font-size: 0.875rem;
  color: var(--muted);
}
.card-meta b { color: var(--text); font-weight: 600; }
.card-actions { display: flex; gap: var(--s-2); margin-top: var(--s-4); flex-wrap: wrap; }

.card.clickable { cursor: pointer; transition: border-color 0.12s, box-shadow 0.12s; }
.card.clickable:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.card.clickable:focus-visible { outline: none; box-shadow: var(--ring); }

/* ============================================================ *
 * PER-SITE DETAIL (full-screen, WEB-99.6 / WEB-103)           *
 * ============================================================ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding: 0 var(--s-6);
  min-height: 60px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar h1 { font-size: 1.12rem; font-weight: 650; }
.topbar-right { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.topbar-left { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.topbar-left h1 { word-break: break-all; display: flex; align-items: center; }
#detail-back { border: 1px solid var(--border-strong); color: var(--text); }
#detail-status { font-size: 0.85rem; }
.detail {
  max-width: 1040px;
  margin: 0 auto;
  padding: var(--s-5) var(--s-6);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}
.detail-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.detail-open { margin-left: auto; color: var(--accent); font-size: 0.9rem; }

/* --- tabs (WAI-ARIA tablist; underline style) --- */
.detail-tabs {
  display: flex;
  gap: var(--s-1);
  border-bottom: 1px solid var(--border);
  margin-top: var(--s-1);
}
.detail-tab {
  border: none;
  background: transparent;
  padding: 0.65rem 0.9rem;
  font-weight: 550;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  margin-bottom: -1px;
}
.detail-tab:hover { background: var(--surface-2); color: var(--text); }
.detail-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 650; }
.detail-tab:focus-visible { outline: none; box-shadow: var(--ring); }
.detail-panels { margin-top: var(--s-4); }
.detail-panel { display: flex; flex-direction: column; gap: var(--s-4); }
.detail-panel[hidden] { display: none; } /* class display must not defeat the hidden attr */
.detail-panel:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }

.detail-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  padding: var(--s-5);
}
.detail-section > h2 { margin-bottom: var(--s-4); font-size: 0.98rem; font-weight: 650; }
.captioned { margin-top: var(--s-5); }
.captioned > h3 { font-size: 0.82rem; margin: 0 0 var(--s-3); color: var(--muted); font-weight: 600; }

/* health summary — KPI tiles */
.summary-badge { margin-bottom: var(--s-4); }
.summary-grid {
  display: grid;
  /* Fixed 3-up grid so the health KPI tiles always land on an even rhythm — a
   * 6-tile summary reads as a clean 3×2 block, never an orphaned last tile
   * (the auto-fit version stranded "Cert warn at" alone on its own row). */
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-3);
}
@media (max-width: 640px) { .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 0.7rem 0.85rem;
}
.stat-label {
  font-size: 0.68rem; font-weight: 650; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-3);
}
.stat-value { font-weight: 700; font-size: 1.05rem; }

/* SEO score breakdown */
.score-block { display: flex; flex-direction: column; gap: var(--s-3); }
.score-head { display: flex; align-items: baseline; gap: var(--s-3); flex-wrap: wrap; }
.score-num { display: flex; align-items: baseline; gap: 0.35rem; }
.score-value { font-size: 2.6rem; font-weight: 760; line-height: 1; letter-spacing: -0.03em; }
.score-grade { font-size: 1.2rem; font-weight: 700; }
.score-sub { font-size: 0.9rem; }
.tally { display: flex; gap: var(--s-2); flex-wrap: wrap; }

.cat-table td, .cat-table th { white-space: nowrap; }

/* status pills (pass / warn / fail) */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.15rem 0.55rem;
  border-radius: var(--r-pill);
}
.pill-pass { color: var(--up); background: var(--up-bg); }
.pill-warn { color: var(--unknown); background: var(--unknown-bg); }
.pill-fail { color: var(--down); background: var(--down-bg); }

/* fix suggestions */
.fix-list { display: flex; flex-direction: column; gap: var(--s-2); }
.fix-item {
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--r-sm);
  padding: 0.6rem 0.8rem;
  background: var(--panel-2);
}
.fix-item.fail { border-left-color: var(--down); }
.fix-item.warn { border-left-color: var(--unknown); }
.fix-head { display: flex; align-items: center; gap: var(--s-2); margin-bottom: 0.3rem; }
.fix-id { font-family: var(--mono); font-size: 0.85rem; font-weight: 600; }
.fix-why { font-size: 0.92rem; }
.fix-how { font-size: 0.9rem; color: var(--muted); margin-top: 0.2rem; }
.fix-label { font-weight: 700; color: var(--text); }

/* per-category check tables */
.check-table td { vertical-align: top; white-space: normal; }
.check-table .check-id { font-family: var(--mono); font-size: 0.85rem; white-space: nowrap; }
.check-row.fail .check-id { color: var(--down); }
.check-row.warn .check-id { color: var(--unknown); }
.check-fix { color: var(--muted); font-size: 0.88rem; margin-top: 0.25rem; }

.link-table .link-url { font-family: var(--mono); font-size: 0.85rem; word-break: break-all; }

.note { margin: 0; }
.note.muted { color: var(--muted); }
.note.pass { color: var(--up); }
.note.fail { color: var(--down); font-weight: 600; }

/* ============================================================ *
 * ALERTS                                                       *
 * ============================================================ */
.alerts { display: flex; flex-direction: column; gap: var(--s-2); }
.alert {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--r-sm);
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
}
.alert.down { border-left-color: var(--down); }
.alert.recovery { border-left-color: var(--up); }
.alert.cert-expiry { border-left-color: var(--unknown); }
.alert .alert-kind { font-weight: 700; text-transform: uppercase; font-size: 0.68rem; letter-spacing: 0.06em; }
.alert.down .alert-kind { color: var(--down); }
.alert.recovery .alert-kind { color: var(--up); }
.alert.cert-expiry .alert-kind { color: var(--unknown); }
.alert .alert-url { word-break: break-all; }
.alert .alert-time { color: var(--muted); font-size: 0.8rem; }

/* ============================================================ *
 * MODAL                                                        *
 * ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 18, 0.55);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: var(--s-4);
  z-index: 20;
}
.modal-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  width: min(720px, 100%);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal-card.narrow { width: min(420px, 100%); }
.modal-card.wide { width: min(880px, 100%); }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--border);
}
.modal-body { padding: var(--s-5); overflow: auto; display: flex; flex-direction: column; gap: var(--s-3); }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--s-2); }

/* ============================================================ *
 * TABLES (generic)                                            *
 * ============================================================ */
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.55rem 0.65rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
th {
  color: var(--text-3); font-weight: 650; font-size: 0.7rem;
  letter-spacing: 0.06em; text-transform: uppercase;
  position: sticky; top: 0; background: var(--panel);
}
tbody tr:last-child td { border-bottom: none; }
td.ok { color: var(--up); }
td.bad { color: var(--down); }

/* ============================================================ *
 * TRENDS (WEB-45) — Grafana/Datadog-grade line + area chart    *
 * ============================================================ */
.trend-charts { display: flex; flex-direction: column; gap: var(--s-6); }
.trend-svg { width: 100%; height: auto; display: block; overflow: visible; font: inherit; }
.trend-line { fill: none; stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.trend-area { stroke: none; fill-opacity: 0.12; }
.trend-dot { stroke: var(--panel); stroke-width: 1.5; }
.trend-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 4; }
.trend-axis { fill: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }

/* ============================================================ *
 * COMPARE (WEB-47)                                            *
 * ============================================================ */
.compare-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s-3); }
.compare-form > p { flex-basis: 100%; margin: 0; }
.compare-form .field { display: flex; flex-direction: column; }
.compare-form .field.grow { flex: 1 1 240px; }
.compare-form .field label { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.25rem; }
.compare-form .error { flex-basis: 100%; }

.compare-result { display: flex; flex-direction: column; gap: var(--s-4); }
.cmp-block { display: flex; flex-direction: column; gap: var(--s-3); }
.cmp-scores { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
@media (max-width: 560px) { .cmp-scores { grid-template-columns: 1fr; } }
.cmp-panel {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0.85rem 1rem;
  display: flex; flex-direction: column; gap: var(--s-2);
  background: var(--panel-2);
}
.cmp-panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-2); flex-wrap: wrap; }
.cmp-label { font-weight: 700; text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.05em; color: var(--muted); }
.cmp-source { font-size: 0.72rem; }
.cmp-url { word-break: break-all; font-size: 0.9rem; }
.cmp-url a { color: var(--accent); }
.cmp-score { display: flex; align-items: baseline; gap: 0.4rem; }
.cmp-delta { font-weight: 600; }
.cmp-diff-table td { vertical-align: middle; }
.cmp-edge { font-weight: 600; font-size: 0.85rem; }
.cmp-edge.pass { color: var(--up); }
.cmp-edge.fail { color: var(--down); }
.cmp-edge.muted { color: var(--muted); }
.cmp-row.cmp-a-better { background: var(--up-bg); }
.cmp-row.cmp-b-better { background: var(--down-bg); }

/* ============================================================ *
 * ANALYTICS — GA4 + Clarity (WEB-58 / WEB-100)                *
 * ============================================================ */
.analytics-body { display: flex; flex-direction: column; gap: var(--s-4); }
.analytics-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }
.analytics-intro { flex: 1 1 320px; font-size: 0.85rem; }
.analytics-head-actions { display: flex; align-items: center; gap: var(--s-3); flex-shrink: 0; }

.analytics-panel {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0.9rem 1rem 1.1rem;
  background: var(--panel-2);
  display: flex; flex-direction: column; gap: var(--s-3);
}
.analytics-panel > h3 { margin: 0; font-size: 0.95rem; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }
.analytics-panel.ga > h3 { color: var(--accent); }
.analytics-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.analytics-meta-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); font-size: 0.85rem; }
.analytics-inline-err { margin: 0; }

/* KPI cards — GA totals + Clarity insights */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--s-3); }
.kpi-card {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 0.7rem 0.8rem;
  display: flex; flex-direction: column; gap: 0.2rem;
  background: var(--panel);
}
.kpi-value { font-size: 1.4rem; font-weight: 720; line-height: 1.1; letter-spacing: -0.02em; }
.kpi-label { font-size: 0.68rem; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }

.analytics-table td, .analytics-table th { white-space: nowrap; }
.analytics-table .link-url { white-space: normal; word-break: break-all; max-width: 460px; }

.prop-form, .clarity-form { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.prop-form > .note, .clarity-form > .note { flex-basis: 100%; }
.prop-select { width: auto; min-width: 240px; flex: 1 1 240px; }
.prop-input, .clarity-input { width: auto; flex: 1 1 200px; }

/* ============================================================ *
 * EMPTY / LOADING / ERROR STATE — shared component             *
 * ============================================================ */
/* Empty / error states — deliberately NOT the big-centered-emoji treatment the
 * board flagged as an AI tell. A compact, left-aligned row: a small, square,
 * monochrome glyph beside real copy, like an inline notice in a real tool. */
.state {
  display: flex; align-items: flex-start; gap: var(--s-3); text-align: left;
  padding: var(--s-5);
  border: 1px dashed var(--border-strong); border-radius: var(--r-md);
  background: var(--panel-2);
}
.state .state-glyph {
  width: 30px; height: 30px; border-radius: var(--r-sm); flex: none;
  display: grid; place-items: center; font-size: 15px;
  background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--border);
}
.state.error .state-glyph { background: var(--down-bg); color: var(--down); border-color: color-mix(in srgb, var(--down) 30%, transparent); }
.state-text { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.state h4 { font-size: 0.92rem; margin: 0; }
.state p { margin: 0; color: var(--muted); font-size: 0.88rem; max-width: 52ch; }

/* skeleton loading shimmer — for placeholder rows / charts while data loads */
.skeleton, .skeleton-row {
  position: relative; overflow: hidden;
  background: var(--surface-2); border-radius: var(--r-sm);
}
.skeleton-row { height: 14px; margin: 0.5rem 0; }
.skeleton::after, .skeleton-row::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--panel) 60%, transparent), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.3s ease-in-out infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }

@media (prefers-reduced-motion: reduce) {
  .badge.down::before { animation: none; }
  .skeleton::after, .skeleton-row::after { animation: none; }
  * { scroll-behavior: auto; }
}
