/* scrape-v3 dashboard — Nocturne console.
 *
 * Single hand-written stylesheet. No build pipeline. Cache-busted via a
 * content-hash suffix on the served filename (see static_assets.rs).
 *
 * Tokens and component classes ported from
 * specs/12-dashboard-redesign-handoff/design/_ds/nocturne-.../styles.css.
 *
 * TODO(fonts): self-host Inter 400/500 under static/ (per handoff) and add
 * @font-face rules. The repo has no CDN dependencies today; falling back to
 * system-ui until the woff2 files land. */

:root {
  /* — surface ————————————————————————————————————————————————— */
  --color-bg: #161826;
  --color-surface: #232532;
  --color-text: #e9e9ed;
  --color-accent: #9184d9;
  --color-accent-2: #a7a1db;
  --color-divider: color-mix(in srgb, #e9e9ed 16%, transparent);

  /* — neutral ramp ——————————————————————————————————————————— */
  --color-neutral-100: #f3f5fe;
  --color-neutral-200: #e4e7f5;
  --color-neutral-300: #cfd3e5;
  --color-neutral-400: #b2b6ca;
  --color-neutral-500: #9397ab;
  --color-neutral-600: #75798c;
  --color-neutral-700: #595d6c;
  --color-neutral-800: #3f424d;
  --color-neutral-900: #292b31;

  /* — accent ramp ———————————————————————————————————————————— */
  --color-accent-100: #f5f4ff;
  --color-accent-200: #e7e5fe;
  --color-accent-300: #d2cefd;
  --color-accent-400: #b5abfc;
  --color-accent-500: #968ae0;
  --color-accent-600: #796cbf;
  --color-accent-700: #5d5294;
  --color-accent-800: #423a6a;
  --color-accent-900: #2b2741;

  /* — status (outside the ramps, per handoff) ————————————————— */
  --color-warn: #f0c46a;
  --color-error-text: #f19b9b;
  --color-error-text-strong: #e07a7a;
  --color-error-bar: #c96a6a;
  --color-error-surface: color-mix(in srgb, #b81a1a 18%, transparent);
  --color-error-border: color-mix(in srgb, #b81a1a 55%, transparent);

  /* — spacing / radius ——————————————————————————————————————— */
  --space-1: 2.8px;
  --space-2: 5.6px;
  --space-3: 8.4px;
  --space-4: 11.2px;
  --space-6: 16.8px;
  --space-8: 22.4px;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;

  /* — elevation: hairline edge + ambient darkness on dark ground ——— */
  --shadow-sm: 0 0 0 1px #3f424d;
  --shadow-md: 0 0 0 1px #595d6c, 0 6px 18px rgba(0,0,0,0.55);
  --shadow-lg: 0 0 0 1px #9397ab, 0 16px 40px rgba(0,0,0,0.65);

  /* — typography ————————————————————————————————————————————— */
  --font-heading: system-ui, -apple-system, "Segoe UI", Roboto, "Inter", sans-serif;
  --font-heading-weight: 500;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Inter", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* — viewport breakpoints (#30) ————————————————————————————————
     Reference values only — `@media` feature queries can't consume CSS
     custom properties (media queries resolve before the cascade), so every
     `@media (max-width: …)` below hardcodes the matching px literal. Keep
     these three in sync by hand if a breakpoint ever changes; there's no
     build step to do it for us (see file header). */
  --bp-sm: 640px;  /* @media (max-width: 640px) */
  --bp-md: 960px;  /* @media (max-width: 960px) */
  --bp-lg: 1280px; /* @media (max-width: 1280px) */

  /* — legacy token aliases so pre-Nocturne templates still render on the
     new ground. Delete once every page is migrated. */
  --border: var(--color-divider);
  --border-strong: color-mix(in srgb, var(--color-text) 30%, transparent);
  --muted: color-mix(in srgb, var(--color-text) 55%, transparent);
  --muted-2: color-mix(in srgb, var(--color-text) 45%, transparent);
  --accent: var(--color-accent);
  --link: var(--color-accent);
  --danger: var(--color-error-text-strong);
  --danger-bg: var(--color-error-surface);
  --ok: var(--color-accent);
  --ok-bg: color-mix(in srgb, var(--color-accent) 18%, transparent);
  --warn: var(--color-warn);
  --warn-bg: color-mix(in srgb, var(--color-warn) 18%, transparent);
  --panel: var(--color-surface);
  --sidebar-bg: var(--color-surface);
  --sidebar-fg: var(--color-text);
  --sidebar-fg-active: var(--color-accent);
  --sidebar-section: var(--color-neutral-600);
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

/* #30: guards against page-level horizontal scroll. Mostly a safety net —
   individual overflow-prone elements (tables, the off-canvas nav-drawer)
   get their own fixes, but a `position:fixed` + `transform` element
   parked off-screen can still inflate `documentElement.scrollWidth` in
   some engines even though nothing is visibly overflowing; this is the
   standard belt-and-braces fix for that class of bug. */
html, body { overflow-x: hidden; }

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  font-size: 13px;
  line-height: 1.55;
  font-weight: 400;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0 0 var(--space-2);
}
h1 { font-size: 26px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
h4 { font-size: 20px; }
h5 { font-size: 16px; }
h6 {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--color-text) 70%, transparent);
}
p { margin: 0 0 var(--space-3); }

a { color: var(--color-accent); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--color-accent) 30%, transparent); }

.text-muted { color: color-mix(in srgb, var(--color-text) 55%, transparent); }
.muted       { color: color-mix(in srgb, var(--color-text) 55%, transparent); }
.mono        { font-family: var(--font-mono); }
.tabular     { font-variant-numeric: tabular-nums; }

/* — freestanding fading rule ——————————————————————————————————— */
.hr {
  height: 1px; border: 0; margin: var(--space-4) 0;
  background: linear-gradient(to right,
    transparent, var(--color-divider) 48px,
    var(--color-divider) calc(100% - 48px), transparent);
}

/* ══════════════════════════════════════════════════════════════════════
   Top nav — the three-destination shell for base.html.
   Replaces the old 220px sidebar.
   ══════════════════════════════════════════════════════════════════════ */
.topnav {
  display: flex; align-items: center; gap: 20px;
  padding: 10px 20px;
  box-shadow: inset 0 -1px 0 var(--color-divider);
  background: var(--color-bg);
  position: sticky; top: 0; z-index: 5;
}
.topnav .spacer { flex: 1; }
.topnav a {
  color: var(--color-text);
  font-size: 13px;
  padding: 4px 0;
}
.topnav a:hover,
.topnav a[aria-current='page'] { color: var(--color-accent); text-decoration: none; }

/* Top-nav dropdown — hover / focus-within reveals a floating menu of the
   destination's tail routes. Primary link stays clickable on desktop, so
   the parent navigates on click and the dropdown surfaces siblings.

   Three input paths, three reveal triggers:
   * mouse   → `@media (hover: hover) .nav-item:hover` (see below)
   * keyboard→ `.nav-item:focus-within`
   * touch   → Alpine toggles `.is-open` on tap of the parent (see base.html)

   The mouse rule is gated behind `hover: hover` so touch devices don't
   trip the sticky-hover trap (iOS/Android keep `:hover` alive after a tap
   until the next tap elsewhere, which would leave the menu stuck open). */
.nav-item {
  position: relative;
  display: inline-flex; align-items: center;
  padding: 6px 0;
}
.nav-dropdown {
  position: absolute; top: 100%; left: -12px;
  display: none;
  min-width: 180px;
  padding: 6px;
  margin-top: 6px;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 20;
}
/* Transparent bridge over the 6px margin-top so the hover-active subtree
   is continuous: pill → bridge → menu. Without this, the pointer briefly
   leaves every hovered ancestor while crossing the gap and the menu closes. */
.nav-dropdown::before {
  content: '';
  position: absolute;
  top: -6px; left: 0; right: 0;
  height: 6px;
}
@media (hover: hover) {
  .nav-item:hover .nav-dropdown { display: block; }
}
.nav-item:focus-within .nav-dropdown,
.nav-dropdown.is-open { display: block; }
.nav-dropdown a {
  display: block;
  padding: 6px 10px;
  font-size: 12.5px;
  color: var(--color-text);
  border-radius: var(--radius-sm);
}
.nav-dropdown a:hover,
.nav-dropdown a:focus-visible {
  background: color-mix(in srgb, var(--color-accent) 12%, transparent);
  color: var(--color-accent);
  outline: none;
}
.nav-dropdown a[aria-current='page'] {
  color: var(--color-accent);
  background: color-mix(in srgb, var(--color-accent) 8%, transparent);
}

/* Brand lockup: 5×17px accent bar + "scrape" + "v3". No image asset. */
.brand-lockup {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 15px;
  color: var(--color-text);
}
.brand-lockup:hover { text-decoration: none; }
.brand-lockup .brand-bar {
  display: inline-block; width: 5px; height: 17px;
  background: var(--color-accent); border-radius: 2px;
}
.brand-lockup .brand-suffix { color: var(--color-neutral-600); }

/* Search affordance (opens the ⌘K palette in a later slice). */
.search-affordance {
  display: inline-flex; align-items: center; gap: 8px;
  min-width: 260px; padding: 5px 9px;
  border-radius: var(--radius-md);
  box-shadow: inset 0 0 0 1px var(--color-divider);
  font-size: 12px;
  color: color-mix(in srgb, var(--color-text) 40%, transparent);
  cursor: pointer;
  background: transparent;
  border: 0;
  font-family: inherit;
  text-align: left;
}
.search-affordance:hover { color: var(--color-text); }
.search-affordance .kbd {
  margin-left: auto;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--color-neutral-600);
}

/* Right-side session identity */
.topnav .who {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11.5px;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
}
/* SUPER-only team switcher (topnav). */
.team-switcher { display: inline; margin: 0; }
.team-switcher-select {
  min-height: 26px; padding: 2px 22px 2px 8px;
  font: inherit; font-size: 11.5px;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-sm);
  cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--color-neutral-500) 50%),
                    linear-gradient(135deg, var(--color-neutral-500) 50%, transparent 50%);
  background-position: calc(100% - 12px) 50%, calc(100% - 7px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.team-switcher-select:hover { border-color: color-mix(in srgb, var(--color-text) 45%, transparent); }
.team-switcher-select:focus-visible { border-color: var(--color-accent); outline: none; }
.topnav .who form { display: inline; margin: 0; }
.topnav .who form button {
  background: transparent; border: 1px solid var(--color-divider);
  color: var(--color-text); font: inherit; cursor: pointer;
  padding: 4px 10px; border-radius: var(--radius-md);
  font-size: 12px;
}
.topnav .who form button:hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }

/* #30: hamburger trigger — desktop-hidden, shown under 960px. 44×44px
   touch target (WCAG AA) even though the drawn icon is much smaller. */
.hamburger-btn {
  display: none;
  align-items: center; justify-content: center;
  flex-direction: column; gap: 4px;
  width: 44px; height: 44px;
  padding: 0; margin: 0;
  background: transparent; border: 0; cursor: pointer;
}
.hamburger-bar {
  display: block; width: 20px; height: 2px;
  background: var(--color-text);
  border-radius: 1px;
}

/* #30: nav-drawer. `display:contents` on desktop — the wrapper is
   layout-transparent, so `.nav-item`/`.spacer`/`.search-affordance`/`.who`
   stay direct flex children of `.topnav` exactly as before this issue.
   Under 960px it becomes the slide-out panel itself. */
.nav-drawer { display: contents; }

@media (max-width: 960px) {
  .hamburger-btn { display: inline-flex; }
  .topnav .search-affordance { display: none; } /* lives inside the drawer instead */

  .nav-drawer {
    display: flex; flex-direction: column; align-items: stretch; gap: 4px;
    position: fixed; top: 0; right: 0; bottom: 0;
    /* Flush against the viewport's right edge at rest — required for
       `translateX(100%)` below to clear the element fully off-screen. A
       box positioned via `inset: 0 20% 0 auto` (tried first) sits inset
       from the edge, so translating it by its own width still leaves a
       sliver on-screen; anchoring to `right: 0` avoids that entirely. */
    width: min(80vw, 320px);
    padding: 16px;
    background: var(--color-surface);
    box-shadow: var(--shadow-lg);
    z-index: 40;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.18s ease-out;
  }
  .nav-drawer.is-open { transform: translateX(0); }

  .nav-drawer .search-affordance {
    display: inline-flex; /* re-shown inside the drawer, full width */
    width: 100%; min-width: 0;
  }
  .nav-drawer .nav-item {
    display: block; width: 100%;
    padding: 10px 4px;
    border-bottom: 1px solid var(--color-divider);
  }
  .nav-drawer .nav-item > a { display: block; padding: 4px 0; font-size: 15px; }
  /* Dropdown sub-links render inline (stacked) in the drawer, not as a
     floating absolutely-positioned menu — there's no hover/desktop-style
     surface to float over on a touch-only 80vw panel. */
  .nav-drawer .nav-dropdown {
    position: static; display: block !important;
    min-width: 0; margin-top: 4px; padding: 0 0 0 12px;
    background: transparent; box-shadow: none;
  }
  .nav-drawer .nav-dropdown::before { display: none; }
  .nav-drawer .nav-dropdown a { padding: 8px 6px; font-size: 13.5px; }

  .nav-drawer .spacer { flex: 1 0 auto; min-height: 12px; }

  .nav-drawer .who {
    display: flex; flex-direction: column; align-items: stretch; gap: 8px;
    padding-top: 12px; border-top: 1px solid var(--color-divider);
    font-size: 13px;
  }
  .nav-drawer .who form,
  .nav-drawer .who form button { width: 100%; }
  .nav-drawer .who form button { padding: 10px; } /* ≥44px tall touch target */
}

/* Main content shell */
main.main { display: block; min-width: 0; }
.content { padding: 16px 20px; }

/* ══════════════════════════════════════════════════════════════════════
   Buttons — primary is OUTLINED (never filled). Ported from the DS.
   ══════════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; text-decoration: none;
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 14px; line-height: 1.2; color: var(--color-text);
  background: transparent; border: 1px solid transparent;
  padding: var(--space-2) calc(var(--space-3) * 1.2);
  border-radius: var(--radius-md);
}
.btn svg { display: block; }
.btn:disabled, .btn[aria-disabled='true'] { opacity: 0.45; cursor: not-allowed; }
.btn:hover { text-decoration: none; }

.btn-primary          { color: var(--color-accent); border-color: var(--color-accent); }
.btn-primary:hover    { background: color-mix(in srgb, var(--color-accent) 12%, transparent); }
.btn-primary:active   { background: color-mix(in srgb, var(--color-accent) 22%, transparent); }
.btn-secondary        { border-color: var(--color-divider); }
.btn-secondary:hover  { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.btn-secondary:active { background: color-mix(in srgb, var(--color-text) 14%, transparent); }
.btn-ghost            { color: var(--color-accent); padding-inline: var(--space-1); }
.btn-ghost:hover      { background: color-mix(in srgb, var(--color-accent) 10%, transparent); }
.btn-ghost:active     { background: color-mix(in srgb, var(--color-accent) 18%, transparent); }
.btn-icon             { width: 36px; height: 36px; padding: 0; }
.btn-block            { width: 100%; margin-top: var(--space-2); }
.btn-sm               { padding: 4px 10px; font-size: 12px; }

/* #30: WCAG AA touch target (≥44×44px). Desktop keeps the compact sizing
   above — `min-height` only bites once padding+line-height would
   otherwise fall short, so normal `.btn` (already ~30px tall) doesn't
   visibly grow, while `.btn-sm`/`.btn-icon` (the worst offenders — table
   row actions, Approve/Reject/Unlink) do. */
@media (max-width: 960px) {
  .btn, .btn-sm, .btn-icon { min-height: 44px; min-width: 44px; }
  .btn-sm { padding: 10px 14px; }
}

/* Legacy .btn.primary / .btn.danger / .btn.sm shims for un-migrated pages. */
.btn.primary          { color: var(--color-accent); border-color: var(--color-accent); background: transparent; }
.btn.primary:hover    { background: color-mix(in srgb, var(--color-accent) 12%, transparent); }
.btn.danger           { color: var(--color-error-text); border-color: var(--color-error-border); background: transparent; }
.btn.danger:hover     { background: color-mix(in srgb, #b81a1a 12%, transparent); }
.btn.sm               { padding: 4px 10px; font-size: 12px; }

/* ══════════════════════════════════════════════════════════════════════
   Forms
   ══════════════════════════════════════════════════════════════════════ */
.field { display: grid; gap: 5px; margin-bottom: var(--space-3); }
.field > label {
  display: block; font-size: 12px; margin-bottom: 5px;
  color: color-mix(in srgb, var(--color-text) 70%, transparent);
  font-weight: 500;
}
.input,
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="number"],
.field input[type="search"],
.field input[type="url"],
.field select,
.field textarea {
  width: 100%; min-height: 36px; padding: 6px 10px; font: inherit;
  font-size: 14px; color: var(--color-text); caret-color: var(--color-accent);
  background: var(--color-surface);
  border: 1px solid var(--color-divider); border-radius: var(--radius-md);
}
.input:hover,
.field input:hover, .field select:hover, .field textarea:hover {
  border-color: color-mix(in srgb, var(--color-text) 45%, transparent);
}
.input:focus-visible,
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible {
  border-color: var(--color-accent); outline-offset: 0;
}
textarea.input, .field textarea { min-height: 90px; resize: vertical; }

.field.checkbox { display: flex; align-items: center; gap: 8px; }
.field-error {
  color: var(--color-error-text);
  font-size: 11px;
  padding: 8px 10px;
  background: var(--color-error-surface);
  border-radius: var(--radius-sm);
  margin-top: 5px;
}

.radio { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.radio input, .seg-opt input {
  position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none;
}
.radio .dot {
  width: 16px; height: 16px; flex: none; border-radius: 50%;
  border: 1.5px solid var(--color-divider);
}
.radio:hover .dot { border-color: var(--color-accent); }
.radio input:checked + .dot {
  border-color: var(--color-accent); background: var(--color-accent);
  box-shadow: inset 0 0 0 4px var(--color-bg);
}
.radio input:focus-visible + .dot { outline: 2px solid var(--color-accent); outline-offset: 2px; }

.seg {
  display: inline-flex; overflow: hidden;
  border: 1px solid var(--color-divider); border-radius: var(--radius-md);
}
.seg-opt {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; font-size: 13px; cursor: pointer;
}
.seg-opt + .seg-opt { border-left: 1px solid var(--color-divider); }
.seg-opt:has(input:checked) { color: var(--color-accent); box-shadow: inset 0 0 0 1px var(--color-accent); }
.seg-opt:not(:has(input:checked)):hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.seg-opt:has(input:focus-visible) { outline: 2px solid var(--color-accent); outline-offset: -2px; }

form.stack { display: grid; gap: var(--space-4); max-width: 560px; }
.form-actions { display: flex; gap: 8px; margin-top: var(--space-3); }

/* ══════════════════════════════════════════════════════════════════════
   Cards + elevation
   ══════════════════════════════════════════════════════════════════════ */
.card {
  display: flex; flex-direction: column; gap: var(--space-2);
  padding: var(--space-3); border-radius: var(--radius-md);
  background: var(--color-surface);
}
.card-kicker {
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--color-accent);
}
.card-title {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 17px; line-height: 1.2;
}
.card-body { margin: 0; font-size: 13px; opacity: 0.8; flex: 1; }
.card-meta {
  display: flex; align-items: center; gap: 6px; font-size: 11px;
  color: color-mix(in srgb, var(--color-text) 50%, transparent);
}
.elev-sm { box-shadow: var(--shadow-sm); }
.elev-md { box-shadow: var(--shadow-md); }
.elev-lg { box-shadow: var(--shadow-lg); }

/* ══════════════════════════════════════════════════════════════════════
   Tags
   ══════════════════════════════════════════════════════════════════════ */
.tag {
  display: inline-flex; align-items: center; font-size: 11px;
  letter-spacing: 0.02em; padding: 3px 10px;
  border-radius: calc(var(--radius-md) * 0.75);
}
.tag-accent  { background: var(--color-accent-800);  color: var(--color-accent-100); }
.tag-neutral { background: var(--color-neutral-800); color: var(--color-neutral-100); }
.tag-outline { border: 1px solid var(--color-accent); color: var(--color-accent); }
.tag-warn    { background: color-mix(in srgb, var(--color-warn) 22%, transparent); color: var(--color-warn); }
.tag-error   { background: var(--color-error-surface); color: var(--color-error-text); }

/* Legacy .badge shim — restyled onto the dark ground. */
.badge {
  display: inline-flex; align-items: center; font-size: 11px;
  padding: 3px 10px; border-radius: calc(var(--radius-md) * 0.75);
  background: var(--color-neutral-800); color: var(--color-neutral-100);
}
.badge.on      { background: var(--color-accent-800);  color: var(--color-accent-100); }
.badge.off     { background: var(--color-error-surface); color: var(--color-error-text); }
.badge.warn    { background: color-mix(in srgb, var(--color-warn) 22%, transparent); color: var(--color-warn); }
.badge.neutral { background: var(--color-neutral-800); color: var(--color-neutral-100); }

/* ── delta badges (exports archive-direct page, issue #221) ─────────── */
.delta {
  display: inline-flex;
  align-items: center;
  font: 500 12px/1 var(--font-mono);
  padding: 2px 7px;
  border-radius: 99px;
}
.delta-up   { color: var(--color-warn);      background: var(--warn-bg); }
.delta-down { color: var(--color-error-text); background: var(--color-error-surface); }
.delta-flat { color: var(--muted);            background: transparent; }

/* ══════════════════════════════════════════════════════════════════════
   Tables — row rules fade at both ends. Painted as a row-level background,
   not a border-bottom on each cell. DS signature.
   ══════════════════════════════════════════════════════════════════════ */
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th {
  text-align: left; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: color-mix(in srgb, var(--color-text) 60%, transparent);
  padding: var(--space-2); border-bottom: 1px solid transparent;
  font-weight: 500;
}
.table td { padding: var(--space-2); border-bottom: 1px solid transparent; }
.table thead tr {
  background: linear-gradient(to right,
    transparent, var(--color-divider) 48px,
    var(--color-divider) calc(100% - 48px), transparent) no-repeat bottom / 100% 1px;
}
.table tbody tr {
  background: linear-gradient(to right,
    transparent, color-mix(in srgb, var(--color-text) 8%, transparent) 48px,
    color-mix(in srgb, var(--color-text) 8%, transparent) calc(100% - 48px), transparent) no-repeat bottom / 100% 1px;
}
.table tbody tr:hover {
  background:
    linear-gradient(color-mix(in srgb, var(--color-text) 4%, transparent),
                    color-mix(in srgb, var(--color-text) 4%, transparent)) no-repeat 0 0 / 100% 100%,
    linear-gradient(to right,
      transparent, color-mix(in srgb, var(--color-text) 8%, transparent) 48px,
      color-mix(in srgb, var(--color-text) 8%, transparent) calc(100% - 48px), transparent) no-repeat bottom / 100% 1px;
}
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* #30: default mobile treatment for every table — scroll internally
   instead of blowing out the page. `display:block` on `<table>` doesn't
   disturb the table layout algorithm (children keep their table-row/
   table-cell display), it just makes the *outer* box overflow-scrollable.
   `width:max-content` + `max-width:100%` lets the box size itself to the
   viewport while its content (the actual rows) can still be wider,
   which is what triggers the scrollbar. No markup change needed — this
   is the "not every table has to convert to cards" path from the issue;
   the 5 widest/highest-traffic tables get a real card view below instead
   (their `.table-cards` rule takes priority via source order + specificity
   since it's more specific / declared later). First column stays visible
   via `position: sticky` so a scrolled-right row is still identifiable. */
@media (max-width: 960px) {
  .table, table {
    display: block;
    width: max-content;
    max-width: 100%;
    overflow-x: auto;
  }
  .table th:first-child, .table td:first-child,
  table th:first-child, table td:first-child {
    position: sticky; left: 0;
    background: var(--color-bg);
  }
}

/* #30 (QA re-pass): real card-list view for the widest/highest-traffic
   tables (watchlist, subscriptions, ticket_groups, exports) — opt in via
   `table-cards` alongside the base `.table` class. `.table.table-cards`
   compound selectors so this reliably overrides the generic scroll
   fallback above regardless of source order.
   Each `<tr>` becomes a flex column (not just `display:block`) so a
   `.card-title` cell — the row's primary identity (event name, section,
   team) — can use `order: -1` to float to the top of the card without
   reordering the underlying `<td>`s, which would desync the desktop
   `<th>`/`<td>` column alignment (same markup renders both layouts). */
@media (max-width: 960px) {
  .table.table-cards {
    display: block; width: 100%; max-width: 100%; overflow-x: visible;
  }
  .table.table-cards thead { display: none; }
  .table.table-cards tbody { display: block; }
  .table.table-cards tr {
    display: flex; flex-direction: column;
    margin-bottom: 10px; padding: 12px;
    border-radius: var(--radius-md);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
  }
  .table.table-cards td {
    display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
    padding: 6px 0; text-align: right;
    border-bottom: 1px solid var(--color-divider);
    background: none; /* clear the row-fading-rule gradient .table tbody tr paints */
    position: static; /* undo the sticky-first-column rule above */
  }
  .table.table-cards td:empty { display: none; }
  .table.table-cards td:last-child { border-bottom: 0; }
  .table.table-cards td::before {
    content: attr(data-label);
    font-weight: 500; font-size: 11px; text-transform: uppercase;
    color: color-mix(in srgb, var(--color-text) 60%, transparent);
    text-align: left; flex-shrink: 0;
  }
  .table.table-cards td.card-title {
    order: -1; display: block; text-align: left;
    font-size: 15px; font-weight: var(--font-heading-weight);
    padding-bottom: 10px; margin-bottom: 4px;
    border-bottom: 1px solid var(--color-divider);
  }
  .table.table-cards td.card-title::before { content: none; }
  .table.table-cards td.col-state {
    order: -2; display: inline-flex; padding-bottom: 0;
  }
  .table.table-cards td.col-action {
    order: 99; justify-content: flex-start; flex-wrap: wrap;
    border-bottom: 0; padding-top: 10px;
  }
  .table.table-cards td.col-action::before { content: none; }
}

/* Legacy generic table shim — same fading-rule treatment applied to bare
   <table> so pre-migration pages don't render on a hard-edged white grid. */
table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.table-wrap { overflow-x: auto; border-radius: var(--radius-md); }
th, td { padding: var(--space-2); text-align: left; border-bottom: 1px solid transparent; }
th {
  background: transparent; font-weight: 500; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: color-mix(in srgb, var(--color-text) 60%, transparent);
}
thead tr {
  background: linear-gradient(to right,
    transparent, var(--color-divider) 48px,
    var(--color-divider) calc(100% - 48px), transparent) no-repeat bottom / 100% 1px;
}
tbody tr {
  background: linear-gradient(to right,
    transparent, color-mix(in srgb, var(--color-text) 8%, transparent) 48px,
    color-mix(in srgb, var(--color-text) 8%, transparent) calc(100% - 48px), transparent) no-repeat bottom / 100% 1px;
}

/* ══════════════════════════════════════════════════════════════════════
   Dialog / modal
   ══════════════════════════════════════════════════════════════════════ */
.dialog-backdrop, .modal-backdrop {
  position: fixed; inset: 0; display: grid; place-items: center;
  padding: var(--space-4); z-index: 50;
  background: color-mix(in srgb, var(--color-neutral-900) 60%, transparent);
}
.dialog, .modal {
  width: min(440px, 100%); display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-4); border-radius: var(--radius-lg);
  background: var(--color-surface); box-shadow: var(--shadow-lg);
}
.dialog-title {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 20px;
}
.dialog-body { font-size: 14px; opacity: 0.85; }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-2); }

/* ══════════════════════════════════════════════════════════════════════
   KPI tiles — legacy shim so /ops home still renders on the new ground.
   Retuned onto dark; per-screen slices will replace it.
   ══════════════════════════════════════════════════════════════════════ */
.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: var(--space-4); margin-bottom: var(--space-6);
}
.kpi {
  padding: var(--space-4); border-radius: var(--radius-md);
  background: var(--color-surface);
}
.kpi .label {
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
}
.kpi .value {
  font-size: 26px; font-weight: 500; margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.kpi .sub {
  color: color-mix(in srgb, var(--color-text) 45%, transparent);
  font-size: 11px; margin-top: 4px;
}
.kpi.danger .value { color: var(--color-error-text-strong); }
.kpi.warn   .value { color: var(--color-warn); }
.kpi.ok     .value { color: var(--color-accent); }

/* ══════════════════════════════════════════════════════════════════════
   Misc utilities
   ══════════════════════════════════════════════════════════════════════ */
.empty {
  color: color-mix(in srgb, var(--color-text) 45%, transparent);
  padding: var(--space-8) 0; text-align: center;
}

/* Toasts (HTMX-driven) — dark-friendly */
#toast-area {
  position: fixed; top: 16px; right: 16px; z-index: 100;
  display: flex; flex-direction: column; gap: var(--space-2); max-width: 320px;
}
.toast {
  padding: 10px 12px; border-radius: var(--radius-md);
  background: var(--color-surface); color: var(--color-text);
  box-shadow: var(--shadow-md); font-size: 13px;
}
.toast.ok     { color: var(--color-accent); }
.toast.danger { color: var(--color-error-text); }

/* ══════════════════════════════════════════════════════════════════════
   Watchlist (screen 2b) — ribbon + toolbar + watchlist table + pager.
   ══════════════════════════════════════════════════════════════════════ */

/* Pipeline ribbon — six metric slots on one row, each divided by a vertical
   hairline. Last item drops the divider. */
.ribbon {
  display: flex; align-items: stretch;
  padding: 0 20px;
  box-shadow: inset 0 -1px 0 var(--color-divider);
  margin: -16px -20px 12px;
}
.ribbon-item {
  padding: 9px 18px 9px 0; margin-right: 18px;
  box-shadow: inset -1px 0 0 var(--color-divider);
}
.ribbon-item:last-child { box-shadow: none; margin-right: 0; padding-right: 0; }
.ribbon-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
}
.ribbon-value {
  font-size: 15px; margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.ribbon-note {
  font-size: 10.5px; margin-top: 2px;
  color: color-mix(in srgb, var(--color-text) 35%, transparent);
}
.ribbon-item--warn .ribbon-value { color: var(--color-warn); }

/* #30 (QA re-pass): found by screenshot audit — the last ribbon item
   (e.g. "Exports · 24h") was rendering clipped off the right edge,
   invisible, once the html/body overflow-x:hidden guard landed (before
   that it silently forced page-level horizontal scroll instead). A KPI
   strip that scrolls internally is the standard mobile pattern here —
   same idea as the table-scroll fallback, just for stat cards. */
@media (max-width: 640px) {
  .ribbon { overflow-x: auto; }
  .ribbon-item { flex-shrink: 0; }
}

/* Compact filter bar under an editor-header (list pages). */
.filter-bar {
  display: flex; align-items: flex-end; gap: 12px;
  flex-wrap: wrap;
  margin: 12px 0 16px;
}
.filter-bar .field { margin-bottom: 0; min-width: 160px; }
.filter-bar .filter-narrow { min-width: 90px; }
.filter-bar .filter-actions { display: inline-flex; gap: 6px; }
/* inline-block (not `inline`) so adjacent action forms — e.g. Approve +
 * Reject in the venue/event link review queues — sit side-by-side reliably;
 * `display: inline` on <form> leaves layout at the mercy of whitespace
 * between siblings and inner button box models. */
.inline-delete { display: inline-block; margin: 0; }
.inline-delete + .inline-delete { margin-left: 6px; }

/* Explicit flex wrapper for review-queue action pairs (Approve + Reject).
 * Guarantees side-by-side rendering regardless of parent's display mode
 * or inner button box model, and gives us a consistent gap without relying
 * on adjacent-sibling margins. */
.action-buttons { display: inline-flex; gap: 6px; align-items: center; justify-content: flex-end; }

/* "Open on source platform" deep-link. Distinct from `.event-link` (which
 * navigates within /ops) so it's obvious in the UI that a click opens an
 * external site. The ↗ suffix in templates plus this styling combine to
 * signal "leaves the dashboard". */
.ext-link {
  color: var(--color-accent);
  text-decoration: none;
  font-size: 12.5px;
}
.ext-link:hover { text-decoration: underline; }

/* Chip strip on venue/event drill-in headers showing every cross-platform
 * counterpart the entity is linked to. Renders as horizontally-wrapped
 * pills so many mappings still look tidy on narrow columns. */
.xplatform-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
}
.xplatform-chips > .muted { font-size: 12.5px; }

/* Bulk-import upload page */
.bulk-intro { margin: 12px 0 16px; }
.bulk-form { max-width: 520px; margin: 0; }

/* Generic CRUD form width (single-column edit/new templates). */
.crud-form { max-width: 520px; margin: 0; }
.crud-danger {
  margin-top: 32px; padding-top: 16px;
  border-top: 1px dashed var(--color-error-border);
  max-width: 520px;
}
.crud-danger > h6 { margin: 0 0 4px; color: var(--color-error-text); }

/* ══════════════════════════════════════════════════════════════════════
   Catalog page (#160): find a show and start watching it. One search,
   answered with performers, venues and events; every row says how much of
   it the team watches and offers one action. Markup: ops/catalog*.html.
   ══════════════════════════════════════════════════════════════════════ */
.ctl { max-width: 1280px; }

/* — the question and the box that answers it ————————————————————— */
.ctl-head { padding: 14px 0 0; }
.ctl-head h4 { margin: 8px 0 10px; }
.ctl-search { position: relative; margin: 0; }
.ctl-search svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; pointer-events: none;
  color: color-mix(in srgb, var(--color-text) 45%, transparent);
}
.ctl-search input {
  width: 100%; min-height: 52px; padding: 10px 14px 10px 44px;
  font: inherit; font-size: 18px; color: var(--color-text);
  caret-color: var(--color-accent); background: var(--color-surface);
  border: 1px solid var(--color-divider); border-radius: var(--radius-md);
}
.ctl-search input:hover { border-color: color-mix(in srgb, var(--color-text) 45%, transparent); }
.ctl-search input:focus-visible { border-color: var(--color-accent); outline-offset: 0; }
.ctl-search input::placeholder { color: color-mix(in srgb, var(--color-text) 38%, transparent); }
/* A search in flight: the box says so, the results stay readable. */
.ctl-search.htmx-request input { border-color: var(--color-accent); }
.ctl-hint { margin: 8px 0 0; font-size: 12px; }
.ctl-note { margin: 16px 0 0; font-size: 13px; }

.ctl-link {
  background: none; border: 0; padding: 0; font: inherit; cursor: pointer;
  color: var(--color-accent);
}
.ctl-link:hover { text-decoration: underline; }

/* — results: performers and venues on the left, events on the right ——— */
.ctl-cols {
  display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 0 24px;
  align-items: start;
}
.ctl-sec { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 20px 0 10px; scroll-margin-top: 64px; }
.ctl-sec h6 { margin: 0; }
.ctl-sec .n, .ctl-jump .n { font-variant-numeric: tabular-nums; }
.ctl-sec > span { font-size: 12.5px; }
.ctl-nohit { margin: 0 0 4px; font-size: 13px; }
.ctl-main > .ctl-nohit:first-child { margin-top: 20px; }
.ctl-jump { display: none; }
#ctl-events { scroll-margin-top: 64px; }

.ctl-evs { list-style: none; margin: 0 0 10px; padding: 0; border-radius: var(--radius-md); background: var(--color-surface); }
.ctl-ev {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1px 10px;
  align-items: center; padding: 9px 12px;
}
.ctl-ev + .ctl-ev { box-shadow: inset 0 1px 0 var(--color-divider); }
.ctl-ev-name { font-size: 13.5px; min-width: 0; overflow-wrap: anywhere; }
.ctl-ev-name a { color: var(--color-text); }
.ctl-ev-name .tag { margin-left: 4px; padding: 1px 7px; font-size: 10.5px; vertical-align: 1px; }
.ctl-ev-when { grid-column: 1; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.ctl-ev-where { grid-column: 1; font-size: 11.5px; min-width: 0; overflow-wrap: anywhere; }
.ctl-ev-act { grid-column: 2; grid-row: 1 / span 3; }
.ctl-ev.is-off .ctl-ev-when { text-decoration: line-through; opacity: 0.6; }
.ctl-ev-off { color: var(--color-error-text); }

.ctl-banner {
  margin: 16px 0 0; padding: 10px 12px; font-size: 13.5px;
  color: var(--color-error-text); background: var(--color-error-surface);
  border-radius: var(--radius-md);
}
.ctl-added {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px;
  margin: 16px 0 0; padding: 10px 12px; font-size: 13.5px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--color-accent) 14%, transparent);
}
.ctl-added b { font-weight: 500; }
.ctl-added .spacer { flex: 1; }

/* — a show, the venues it plays, and the dates at each ————————————— */
.ctl-show {
  margin-bottom: 12px; border-radius: var(--radius-md);
  background: var(--color-surface);
}
.ctl-show-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  padding: 12px 14px 10px;
}
.ctl-show-head h5 { margin: 0; font-size: 17px; min-width: 0; overflow-wrap: anywhere; }
.ctl-show-head h5 a { color: var(--color-text); }
.ctl-show-head h5 a:hover { color: var(--color-accent); text-decoration: none; }
.ctl-show-head .spacer { flex: 1; }
.ctl-show-meta { font-size: 12.5px; }
.ctl-found { font-size: 11.5px; color: var(--color-accent-2); }
/* Each action is its own small form; the button, not the form, is laid out. */
.ctl-show-head form, .ctl-acts form, .ctl-ev-act form { display: contents; }

.ctl-venue {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 232px;
  gap: 4px 14px; align-items: center; padding: 10px 14px;
  box-shadow: inset 0 1px 0 var(--color-divider);
}
.ctl-venue-name { font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
.ctl-venue-name a { color: var(--color-text); }
.ctl-venue-name .tag { margin-left: 6px; padding: 1px 7px; font-size: 10.5px; vertical-align: 1px; }
.ctl-venue-city { font-size: 12.5px; }
.ctl-when { font-size: 13px; min-width: 0; }
.ctl-state { font-size: 12px; color: color-mix(in srgb, var(--color-text) 55%, transparent); }
.ctl-state.is-on { color: var(--color-accent-2); }
.ctl-acts { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.ctl-acts .btn { white-space: nowrap; }
.ctl-more { padding: 8px 14px 12px; box-shadow: inset 0 1px 0 var(--color-divider); }
.ctl-tap { display: none; }

/* — choosing dates (inline on desktop, a bottom sheet on a phone) ——— */
.ctl-pick {
  margin: 0; padding: 12px 14px 14px;
  background: color-mix(in srgb, var(--color-bg) 55%, var(--color-surface));
  box-shadow: inset 0 1px 0 var(--color-divider);
}
.ctl-pick-head, .ctl-backdrop { display: none; }
.ctl-ranges { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 13px; }
.ctl-nowrap { white-space: nowrap; }
.ctl-months { max-height: 340px; overflow-y: auto; padding-right: 4px; }
.ctl-month h6 { margin: 10px 0 6px; font-size: 11px; }
.ctl-month:first-child h6 { margin-top: 0; }
.ctl-dates {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px;
}
.ctl-date {
  display: grid; grid-template-columns: 16px minmax(0, 1fr); column-gap: 6px;
  align-items: center; padding: 6px 8px; cursor: pointer;
  border: 1px solid var(--color-divider); border-radius: var(--radius-sm);
  font-size: 12.5px; line-height: 1.3; user-select: none;
}
.ctl-date input { position: absolute; opacity: 0; width: 0; height: 0; }
.ctl-date .box {
  width: 14px; height: 14px; border-radius: 3px; grid-row: span 2;
  border: 1.5px solid color-mix(in srgb, var(--color-text) 40%, transparent);
  display: grid; place-items: center; font-size: 10px; line-height: 1;
  color: var(--color-bg);
}
.ctl-date:has(input:checked) .box::after, .ctl-date.is-watched .box::after { content: '\2713'; }
.ctl-date .t { grid-column: 2; font-size: 11.5px; color: color-mix(in srgb, var(--color-text) 55%, transparent); }
.ctl-date:hover { border-color: color-mix(in srgb, var(--color-text) 45%, transparent); }
.ctl-date:has(input:checked) { border-color: var(--color-accent); background: color-mix(in srgb, var(--color-accent) 12%, transparent); }
.ctl-date:has(input:checked) .box { background: var(--color-accent); border-color: var(--color-accent); }
.ctl-date:has(input:focus-visible) { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.ctl-date.is-watched, .ctl-date.is-off { cursor: default; border-style: dashed; }
.ctl-date.is-watched:hover, .ctl-date.is-off:hover { border-color: var(--color-divider); }
.ctl-date.is-watched .box { background: var(--color-neutral-600); border-color: var(--color-neutral-600); }
.ctl-date.is-watched .t { color: var(--color-accent-2); }
.ctl-date.is-off .d { text-decoration: line-through; opacity: 0.6; }
.ctl-date.is-off .t { color: var(--color-error-text); }
.ctl-later { display: flex; align-items: flex-start; gap: 8px; margin: 14px 0 0; font-size: 13px; cursor: pointer; }
.ctl-later input { margin-top: 3px; accent-color: var(--color-accent); }
.ctl-pick-foot { display: flex; align-items: center; gap: 10px; margin-top: 14px; }

/* — nothing typed yet / nothing found ————————————————————————— */
.ctl-browse {
  display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: baseline;
  margin: 22px 0 0; padding-top: 14px; font-size: 13px;
  box-shadow: inset 0 1px 0 var(--color-divider);
}
.ctl-browse .n { font-variant-numeric: tabular-nums; }
.ctl-none { margin: 22px 0 0; font-size: 14px; line-height: 1.6; max-width: 60ch; }
.ctl-none h5 { margin: 0 0 6px; overflow-wrap: anywhere; }
.ctl-none ul { margin: 8px 0 0; padding-left: 18px; }

/* — narrower than a desk: one column, with a jump row to each group ——— */
@media (max-width: 960px) {
  .ctl-cols { grid-template-columns: minmax(0, 1fr); }
  .ctl-jump { display: flex; gap: 8px; margin: 16px 0 0; }
  .ctl-jump a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 48px; padding: 6px 8px; font-size: 13.5px; line-height: 1.25;
    color: var(--color-text); border: 1px solid var(--color-divider); border-radius: var(--radius-md);
  }
  .ctl-jump a:hover { text-decoration: none; border-color: var(--color-accent); }
}

/* — phone: search, tap a venue, pick in a sheet, confirm at the thumb — */
@media (max-width: 640px) {
  .content:has(> .ctl) { padding: 8px 16px 40px; }
  .ctl-head h4 { font-size: 19px; }
  .ctl-search input { font-size: 17px; min-height: 52px; }
  .ctl-ev { padding: 12px; min-height: 64px; }
  .ctl-ev-name { font-size: 15px; }
  .ctl-ev-when { font-size: 13.5px; }
  .ctl-ev-where { font-size: 13px; }
  .ctl-nohit { font-size: 14px; }
  .ctl-nohit .ctl-link, .ctl-nohit a { display: inline-block; padding: 10px 0; }
  .ctl-show-head { padding: 12px 12px 10px; }
  .ctl-show-head .btn { flex-basis: 100%; }

  .ctl-venue {
    grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px;
    padding: 12px; min-height: 64px; position: relative;
  }
  .ctl-venue-name { font-size: 15px; }
  .ctl-venue-city { display: block; font-size: 13px; }
  .ctl-dot { display: none; }
  .ctl-when { grid-column: 1; font-size: 13.5px; }
  .ctl-acts { grid-column: 2; grid-row: 1 / span 2; }
  .ctl-acts .ctl-link { display: none; }
  /* the whole row opens the date sheet; the button stays its own target */
  .ctl-tap {
    display: block; position: absolute; inset: 0; z-index: 0;
    background: transparent; border: 0; padding: 0; cursor: pointer;
  }
  .ctl-venue > * { position: relative; z-index: 1; pointer-events: none; }
  .ctl-venue > .ctl-tap, .ctl-venue .ctl-acts, .ctl-venue a { pointer-events: auto; }
  .ctl-venue > .ctl-tap { position: absolute; z-index: 0; }

  .ctl-pick {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    max-height: 86vh; display: flex; flex-direction: column;
    padding: 0; background: var(--color-surface);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: var(--shadow-lg);
  }
  .ctl-pick-head {
    display: flex; align-items: flex-start; gap: 10px; padding: 14px 16px 10px;
  }
  .ctl-pick-head div { flex: 1; min-width: 0; }
  .ctl-pick-head h5 { margin: 0 0 2px; font-size: 16px; overflow-wrap: anywhere; }
  .ctl-pick-body { overflow-y: auto; padding: 0 16px 8px; }
  .ctl-months { max-height: none; overflow: visible; padding: 0; }
  .ctl-ranges .seg { display: flex; width: 100%; }
  .ctl-next { display: none; }
  .ctl-ranges .seg-opt { flex: 1; justify-content: center; min-height: 44px; text-align: center; padding: 6px 8px; }
  .ctl-dates { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .ctl-date { min-height: 48px; padding: 8px 10px; font-size: 14px; column-gap: 8px; grid-template-columns: 18px minmax(0, 1fr); }
  .ctl-date .box { width: 18px; height: 18px; font-size: 12px; }
  .ctl-date .t { font-size: 12.5px; }
  .ctl-later { font-size: 14px; min-height: 44px; align-items: center; }
  .ctl-later input { width: 20px; height: 20px; margin: 0; flex: none; }
  .ctl-pick-foot {
    margin: 0; padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
    box-shadow: inset 0 1px 0 var(--color-divider);
  }
  .ctl-pick-foot .btn { flex: 1; min-height: 48px; font-size: 15px; }
  .ctl-pick-foot .btn-primary { background: color-mix(in srgb, var(--color-accent) 16%, transparent); }
  .ctl-pick-foot .ctl-cancel { display: none; }
  .ctl-backdrop {
    display: block; position: fixed; inset: 0; z-index: 55;
    background: color-mix(in srgb, var(--color-neutral-900) 70%, transparent);
  }
  .ctl-added { position: sticky; bottom: 10px; z-index: 20; box-shadow: var(--shadow-md);
    background: var(--color-accent-900); }
  .ctl-browse { flex-direction: column; gap: 0; }
  .ctl-browse a { padding: 12px 0; font-size: 15px; }
}

/* Catalog event detail: teams watching the event. */
.team-chips { list-style: none; padding: 0; margin: 6px 0; display: flex; flex-wrap: wrap; gap: 6px; }

/* #30: these 520px max-widths are already narrower than most desktop
   panels, but wider than a phone once the page's own 16-20px side padding
   is subtracted — cap at 100% under 960px instead of a fixed px value. */
@media (max-width: 960px) {
  .bulk-form,
  .crud-form,
  .crud-danger,
  .sub-new-form {
    max-width: 100%;
  }
}

/* Exports detail — two-card row */
.export-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  margin: 12px 0;
}
@media (max-width: 640px) {
  .export-grid { grid-template-columns: 1fr; }
}
.export-card > h6 { margin: 0 0 8px; }
.export-error { margin-top: 8px; }
.export-error-label { font-size: 10.5px; margin-bottom: 4px; }
.export-error-body {
  font-size: 11px;
  color: var(--color-error-text);
  background: var(--color-error-surface);
  padding: 8px; border-radius: var(--radius-sm);
  white-space: pre-wrap; word-break: break-word;
  max-height: 200px; overflow: auto;
  margin: 0;
}

/* Metrics — chart section under the KPI grid. */
/* ── Metrics velocity strip ──────────────────────────────────────────────── */
.vel-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--color-divider);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md, 8px);
  overflow: hidden;
  margin-bottom: 24px;
}
@media (max-width: 768px) { .vel-strip { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .vel-strip { grid-template-columns: 1fr; } }
.vel-cell {
  background: var(--color-surface);
  padding: 18px 20px 16px;
}
.vel-cell__label {
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px;
}
.vel-cell__val {
  font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums;
  line-height: 1; margin-bottom: 4px;
}
.vel-cell__val--ok    { color: var(--color-accent); }
.vel-cell__val--warn  { color: var(--color-warn); }
.vel-cell__val--err   { color: var(--color-error-text); }
.vel-cell__val--muted { color: var(--muted); }
.vel-cell__sub { font-size: 12.5px; color: var(--muted); }
.vel-cell__sub a { color: var(--color-accent); text-decoration: none; font-weight: 500; }
.vel-cell__sub a:hover { text-decoration: underline; }

/* ── Metrics two-column layout ───────────────────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) { .metrics-grid { grid-template-columns: 1fr; } }

.section-label {
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 10px;
}

/* ── Platform breakdown table ────────────────────────────────────────────── */
.platform-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 24px; }
.platform-table th {
  text-align: left; padding: 0 10px 8px 0;
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); border-bottom: 1px solid var(--color-divider);
}
.platform-table td { padding: 9px 10px 9px 0; border-bottom: 1px solid var(--color-divider); vertical-align: middle; }
.platform-table tr:last-child td { border-bottom: none; }
.platform-table .val-ok   { color: var(--color-accent); font-weight: 600; }
.platform-table .val-warn { color: var(--color-warn); font-weight: 600; }
.platform-table .val-err  { color: var(--color-error-text); font-weight: 600; }
.platform-name { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.platform-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.platform-dot--ok   { background: var(--color-accent); }
.platform-dot--warn { background: var(--color-warn); }
.platform-dot--err  { background: var(--color-error-bar, #c96a6a); }

/* ── Failing events table (left/wide column) ─────────────────────────────── */
.fail-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 24px; }
.fail-table th {
  text-align: left; padding: 0 12px 8px 0;
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); border-bottom: 1px solid var(--color-divider);
}
.fail-table td { padding: 9px 12px 9px 0; border-bottom: 1px solid var(--color-divider); vertical-align: middle; }
.fail-table tr:last-child td { border-bottom: none; }
.fail-table__name { font-weight: 500; max-width: 300px; }
.fail-table__count {
  font-weight: 700; font-variant-numeric: tabular-nums; color: var(--color-error-text);
  white-space: nowrap;
}
.fail-table__hint { font-size: 12px; color: var(--muted); }

/* ── Platform compact list (right/narrow column) ─────────────────────────── */
.platform-compact-list { margin-bottom: 16px; }
.platform-compact-row { padding: 10px 0; border-bottom: 1px solid var(--color-divider); }
.platform-compact-row:last-child { border-bottom: none; }
.platform-compact-head { display: flex; align-items: center; gap: 7px; margin-bottom: 3px; }
.platform-compact-name { font-weight: 600; font-size: 13px; flex: 1; min-width: 0; }
.platform-compact-rate { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.platform-compact-sub { font-size: 11.5px; color: var(--muted); padding-left: 15px; }
.platform-compact-row .val-ok   { color: var(--color-accent); }
.platform-compact-row .val-warn { color: var(--color-warn); }
.platform-compact-row .val-err  { color: var(--color-error-text); }

/* ── Bottom strip: queue + exports ──────────────────────────────────────── */
.bottom-strip { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.strip-card {
  background: var(--color-surface); border: 1px solid var(--color-divider);
  border-radius: var(--radius-md, 8px); padding: 12px 14px;
}
.strip-card__label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.strip-card__rows  { display: flex; flex-direction: column; gap: 5px; }
.strip-card__row   { display: flex; justify-content: space-between; font-size: 12.5px; }
.strip-card__row .val { font-variant-numeric: tabular-nums; }
.strip-card__row .val--err { color: var(--color-error-text); }
.strip-card__row .val--ok  { color: var(--color-accent); }

/* ── Trend charts grid ───────────────────────────────────────────────────── */
.trends-section { margin-top: 8px; }
.trends-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 760px) { .trends-grid { grid-template-columns: 1fr; } }
.chart-card {
  background: var(--color-surface); border: 1px solid var(--color-divider);
  border-radius: var(--radius-md, 8px); padding: 16px 18px;
}
.chart-card__head  { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 4px; flex-wrap: wrap; }
.chart-card__title { font-size: 13px; font-weight: 600; }
.chart-card__sub   { font-size: 12px; color: var(--muted); }
.chart-card__wrap  { height: 180px; margin-top: 12px; position: relative; }
.chart-card--full  { grid-column: 1 / -1; }
.chart-card--full .chart-card__wrap { height: 200px; }
.chart-card__controls { display: flex; gap: 10px; align-items: flex-end; margin-top: 2px; flex-wrap: wrap; }

/* ── Metrics chart section (scrapes over time, standalone) ───────────────── */
.metrics-chart-section { margin-bottom: 24px; }
.metrics-chart-controls { display: inline-flex; gap: 12px; align-items: flex-end; margin: 0; }
.metrics-chart-controls .field { margin-bottom: 0; min-width: 130px; }
.metrics-chart-controls .field > span {
  display: block; font-size: 12px; margin-bottom: 5px;
  color: color-mix(in srgb, var(--color-text) 70%, transparent);
}
.metrics-chart-wrap {
  position: relative; height: 220px;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  padding: 12px;
}

/* Toolbar row above the table. */
.toolbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0 10px;
}
/* #30 (QA re-pass): the toolbar's title + segmented filter + search + two
   buttons don't fit one row on a phone — found by screenshot audit (the
   "Watch an event" button was rendering clipped off the right edge,
   invisible and unreachable, not just visually cramped). */
@media (max-width: 640px) {
  .toolbar { flex-wrap: wrap; }
  .toolbar .spacer { flex-basis: 100%; height: 0; }
  .toolbar-search { width: 100%; }
}
.toolbar-title h4 { margin: 0; }
.toolbar-title .toolbar-sub {
  font-size: 11.5px;
  color: color-mix(in srgb, var(--color-text) 45%, transparent);
  margin: 2px 0 0;
}
.toolbar-search { width: 150px; min-height: 32px; }
.toolbar .spacer { flex: 1; }

/* Watchlist table specifics. */
.watchlist-table { padding-bottom: 18px; }
.watchlist-table .table { font-size: 12.5px; }
.watchlist-table .col-state { width: 26px; }
.watchlist-table .col-event { max-width: 250px; }
.watchlist-table .col-action { text-align: right; }
.event-link { color: var(--color-accent); font-size: 12.5px; }
.event-link:hover { text-decoration: underline; }
.event-sub {
  font-size: 10.5px; margin-top: 2px;
  color: color-mix(in srgb, var(--color-text) 42%, transparent);
}

/* State dot — 7px circle. Color encodes state. */
.state-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--color-neutral-700);
}
.state-dot--live    { background: var(--color-accent); }
.state-dot--stale   { background: var(--color-warn); }
.state-dot--failing { background: var(--color-error-text-strong); }
.state-dot--paused  { background: var(--color-neutral-700); }

/* Freshness sparkline: 12 vertical bars, 1.5px gap. Bar height per value. */
.freshness-bars {
  display: inline-flex; align-items: flex-end; gap: 1.5px; height: 16px;
}
.fbar {
  display: inline-block; width: 6px; border-radius: 1px;
  background: var(--color-accent);
}
.fbar--hi    { background: var(--color-accent); }
.fbar--mid   { background: var(--color-accent-600); }
.fbar--lo    { background: var(--color-accent-800); }
.fbar--empty { background: color-mix(in srgb, var(--color-text) 12%, transparent); height: 2px; }

/* ══════════════════════════════════════════════════════════════════════
   Event typeahead (subscriptions_new + fragment). Same visual grammar as
   the ⌘K palette but scoped to a form field's dropdown.
   ══════════════════════════════════════════════════════════════════════ */
.typeahead-field { position: relative; }
.typeahead-hits {
  position: absolute; z-index: 10; left: 0; right: 0;
  margin-top: 4px;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  max-height: 320px; overflow: auto;
}
.typeahead-hits:empty { display: none; }
.typeahead-list { list-style: none; margin: 0; padding: 6px; display: grid; gap: 2px; }
.typeahead-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
}
.typeahead-row:hover,
.typeahead-row.is-active {
  background: color-mix(in srgb, var(--color-accent) 12%, transparent);
}
.typeahead-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.typeahead-meta { font-size: 11px; display: inline-flex; align-items: center; gap: 6px; }
.typeahead-empty, .typeahead-selected { padding: 10px 12px; font-size: 12px; margin: 0; }
.sub-new-form { max-width: 520px; }

/* ══════════════════════════════════════════════════════════════════
   Rule form — a sentence on the left ("watch every date of …"), what
   that sentence catches on the right.
   ══════════════════════════════════════════════════════════════════ */
.rf-grid {
  display: grid;
  grid-template-columns: minmax(0, 560px) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  column-gap: 0;
  align-items: start;
}
.rf-what  { grid-column: 1; grid-row: 1; padding: 6px 32px 0 0; }
.rf-more  { grid-column: 1; grid-row: 2; padding: 0 32px 24px 0; }
.rf-right {
  grid-column: 2; grid-row: 1 / span 2;
  align-self: stretch;
  padding: 6px 0 24px 32px;
  box-shadow: inset 1px 0 0 var(--color-divider);
  min-height: 520px;
}
.rf-right-inner { max-width: 560px; }

.rf-lead {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 22px; line-height: 1.25; letter-spacing: -0.015em;
  margin: 0 0 var(--space-4);
}
.rf-head-actions { display: inline-flex; gap: 14px; }
.rf-kicker {
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--color-accent); margin: 0 0 var(--space-3);
}

/* — search — */
.rf-search .input { min-height: 48px; font-size: 16px; padding: 10px 14px; }
.rf-hits .typeahead-row { padding: 9px 10px; }
.rf-hit-group {
  padding: 8px 10px 4px; font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--color-text) 45%, transparent);
}
.rf-hit-name { display: block; font-size: 14px; }
.rf-hits .typeahead-label { white-space: normal; }
.rf-alt { margin: var(--space-3) 0 0; font-size: 12.5px; }
.rf-linkbtn {
  background: transparent; border: 0; padding: 0; cursor: pointer;
  font: inherit; color: var(--color-accent);
}
.rf-linkbtn:hover { text-decoration: underline; text-underline-offset: 3px; }

/* — the thing being followed — */
.rf-pick {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: inset 0 0 0 1px var(--color-accent-700);
}
.rf-pick-body { flex: 1; min-width: 0; }
.rf-pick-name {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 18px; line-height: 1.25; overflow-wrap: anywhere;
}
.rf-pick-sub { font-size: 12px; margin-top: 2px; }

/* — name match — */
.rf-name-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.rf-name-row .input { min-height: 48px; font-size: 16px; padding: 10px 14px; }
.rf-hint { font-size: 12px; margin: var(--space-2) 0 0; }
.rf-links { display: flex; flex-wrap: wrap; gap: 4px 18px; }

/* — clauses: "at any venue", "on any upcoming date" — */
.rf-clauses { margin-top: var(--space-6); }
.rf-clause {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center; column-gap: 10px;
  padding: 10px 0;
  box-shadow: inset 0 -1px 0 var(--color-divider);
}
.rf-clause-word { font-size: 14px; }
.rf-clause-val  { font-size: 15px; overflow-wrap: anywhere; }
.rf-clause-val.is-any { color: color-mix(in srgb, var(--color-text) 70%, transparent); }
.rf-clause-edit { grid-column: 2 / -1; padding: 8px 0 4px; }
.rf-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 380px; }
.rf-dates label, .rf-settings label {
  display: block; font-size: 12px; margin-bottom: 5px;
  color: color-mix(in srgb, var(--color-text) 70%, transparent);
}
.rf-settings { display: grid; grid-template-columns: 1fr 140px; gap: 12px; max-width: 420px; }
.rf-pct { position: relative; }
.rf-pct .input { padding-right: 28px; }
.rf-pct::after {
  content: '%'; position: absolute; right: 11px; bottom: 9px;
  color: color-mix(in srgb, var(--color-text) 45%, transparent);
}

.rf-foot { margin-top: var(--space-8); font-size: 12px; }
.rf-foot p { margin: 0 0 var(--space-2); }

/* — right column: what the rule catches — */
.rf-count {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 46px; line-height: 1; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.rf-count small {
  font-size: 16px; letter-spacing: 0; margin-left: 6px;
  color: color-mix(in srgb, var(--color-text) 60%, transparent);
}
.rf-facts {
  list-style: none; margin: var(--space-4) 0 var(--space-6); padding: 0;
  display: grid; gap: 6px; font-size: 13px;
}
.rf-facts li { display: flex; gap: 9px; align-items: baseline; }
.rf-facts .state-dot { flex: none; transform: translateY(-1px); }
.rf-facts .is-warn { color: var(--color-warn); }

.rf-events { list-style: none; margin: 0; padding: 0; }
.rf-event {
  display: grid; grid-template-columns: 138px minmax(0, 1fr) auto;
  column-gap: 12px; align-items: baseline;
  padding: 9px 0;
  box-shadow: inset 0 -1px 0 var(--color-divider);
}
.rf-event-when { font-size: 12.5px; font-variant-numeric: tabular-nums;
  color: color-mix(in srgb, var(--color-text) 62%, transparent); }
.rf-event-name { font-size: 13.5px; overflow-wrap: anywhere; }
.rf-event-where { font-size: 11.5px; margin-top: 1px; }
.rf-more-line { margin: var(--space-3) 0 0; font-size: 12px; }

.rf-placeholder { font-size: 14px; max-width: 44ch; }
.rf-suggest { list-style: none; margin: 0; padding: 0; }
.rf-suggest button {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 11px 0; text-align: left; cursor: pointer;
  background: transparent; border: 0; color: inherit; font: inherit;
  box-shadow: inset 0 -1px 0 var(--color-divider);
}
.rf-suggest button:hover .rf-suggest-go { text-decoration: underline; text-underline-offset: 3px; }
.rf-suggest-body { flex: 1; min-width: 0; }
.rf-suggest-name { font-size: 14px; }
.rf-suggest-sub { font-size: 12px; }
.rf-suggest-go { color: var(--color-accent); font-size: 13px; white-space: nowrap; }

/* — phone action bar + stop sheet — */
.rf-actionbar { display: none; }
.rf-toggle-events { display: none; }

@media (max-width: 960px) {
  .rf-grid { display: block; }
  .rf-what, .rf-more { padding: 0; }
  .rf-right {
    padding: var(--space-6) 0 0; margin-top: var(--space-6);
    min-height: 0;
    box-shadow: inset 0 1px 0 var(--color-divider);
  }
  .rf-more { margin-top: var(--space-4); }
}

@media (max-width: 640px) {
  .rf-page { padding-bottom: 96px; font-size: 14px; }
  .rf-head-actions { display: none; }
  .rf-lead { font-size: 20px; }
  .rf-page .input, .rf-page select { font-size: 16px; min-height: 48px; }

  /* hits flow in the page so the keyboard never covers them */
  .rf-hits { position: static; max-height: none; box-shadow: var(--shadow-sm); margin-top: 8px; }
  .rf-hits .typeahead-row {
    min-height: 52px; flex-direction: column; align-items: flex-start; gap: 4px;
    padding: 10px;
  }
  .rf-hits .typeahead-meta { font-size: 13px; }
  .rf-hit-name { font-size: 16px; }
  .rf-page .editor-crumb { font-size: 14px; width: 100%; }
  .rf-page .editor-crumb a { display: inline-block; padding: 10px 6px 10px 0; }
  .rf-pick-sub { font-size: 14px; }
  .rf-kicker { font-size: 11px; }
  .rf-alt { font-size: 14px; }
  .rf-linkbtn { min-height: 44px; }

  .rf-name-row { grid-template-columns: 1fr; }
  .rf-name-row .seg { display: flex; }
  .rf-name-row .seg-opt { flex: 1; justify-content: center; min-height: 44px; }
  .rf-hint { font-size: 14px; }

  .rf-clause { padding: 6px 0; }
  .rf-clause-word, .rf-clause-val { font-size: 16px; }
  .rf-dates, .rf-settings { grid-template-columns: 1fr; max-width: none; }
  .rf-dates label, .rf-settings label { font-size: 14px; }
  .rf-foot { font-size: 14px; }

  .rf-count { font-size: 40px; }
  .rf-facts { font-size: 14px; margin-bottom: var(--space-3); }
  .rf-event { grid-template-columns: minmax(0, 1fr) auto; row-gap: 2px; padding: 11px 0; }
  .rf-event-when { grid-column: 1 / -1; font-size: 14px; }
  .rf-event-name { font-size: 15px; }
  .rf-event-where { font-size: 14px; }
  .rf-more-line { font-size: 14px; }
  .rf-toggle-events { display: inline-flex; width: 100%; }
  .rf-events-wrap.is-closed { display: none; }
  .rf-suggest button { min-height: 60px; }
  .rf-suggest-name { font-size: 16px; }
  .rf-suggest-sub { font-size: 14px; }

  .rf-actionbar {
    display: flex; gap: 10px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: var(--color-bg);
    box-shadow: 0 -1px 0 var(--color-divider);
  }
  .rf-actionbar .btn { flex: 1; min-height: 50px; font-size: 16px; }
  .rf-actionbar .btn-primary { background: color-mix(in srgb, var(--color-accent) 16%, transparent); }

  /* stop-rule confirmation slides up from the bottom */
  .rf-sheet-backdrop { place-items: end stretch; padding: 0; }
  .rf-sheet {
    width: 100%; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: var(--space-6) 16px calc(var(--space-6) + env(safe-area-inset-bottom));
  }
  .rf-sheet .dialog-actions { flex-direction: column-reverse; }
  .rf-sheet .dialog-actions .btn { min-height: 50px; font-size: 16px; }
  .rf-sheet .dialog-body { font-size: 15px; }
}

/* Rule form — what the page needs beyond the mockup's block above: the
   real search fragment's venue line, banners above the form, field errors
   inside a clause, and the edit page's stop section. */
.rf-page .rf-banner { max-width: 560px; margin: 0 0 14px; font-size: 13px; }
.rf-banner-note {
  padding: 8px 10px; border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--color-warn) 14%, transparent);
  color: var(--color-warn);
}
.rf-sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.rf-hit-where { display: block; font-size: 12px; }
/* Two groups of six rows: tall enough that the list does not scroll inside
   itself on a desktop screen. */
.rf-search .rf-hits { max-height: min(70vh, 640px); }
.rf-narrow-hits .typeahead-list { padding: 6px 0 0; }
.rf-pattern { min-height: 48px; font-size: 15px; }
.rf-page .field-error { margin: var(--space-2) 0 0; font-size: 12px; }
.rf-rename { max-width: 420px; }
.rf-rename label { display: block; margin-bottom: 5px; }
.rf-edit-foot { margin-top: var(--space-8); }
.rf-edit-foot .btn { margin-top: var(--space-2); }
.rf-sheet form { margin: 0; }
@media (max-width: 640px) {
  .rf-search .rf-hits { max-height: none; }
  /* 44px tap target for the "‹ Rules" crumb (10px padding gave 42px). */
  .rf-page .editor-crumb a { padding-top: 12px; padding-bottom: 12px; }
  .rf-hit-where { font-size: 14px; }
  .rf-page .field-error { font-size: 14px; }
  .rf-rename { max-width: none; }
}

/* ══════════════════════════════════════════════════════════════════════
   ⌘K palette (screen 3d) — 640px card, top-anchored with 24px padding.
   Reachable from every screen via ⌘K / Ctrl+K (Alpine keydown) or the
   top-nav search affordance. HTMX-debounced (250 ms) into
   /ops/palette/search.
   ══════════════════════════════════════════════════════════════════════ */
.palette-backdrop {
  position: fixed; inset: 0; z-index: 60;
  display: flex; justify-content: center;
  padding: 24px 16px;
  background: color-mix(in srgb, var(--color-neutral-900) 60%, transparent);
  align-items: flex-start;
}
.palette {
  width: 100%; max-width: 640px;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.palette-input-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  box-shadow: inset 0 -1px 0 var(--color-divider);
}
.palette-prompt {
  color: var(--color-accent);
  font-size: 15px;
}
.palette-input {
  flex: 1; background: transparent; border: 0; outline: none;
  color: var(--color-text); font: inherit; font-size: 15px;
}
.palette-hint-inline {
  font-size: 10.5px;
  color: color-mix(in srgb, var(--color-text) 35%, transparent);
}
.palette-results {
  padding: 8px 6px;
  display: flex; flex-direction: column; gap: 2px;
  max-height: 60vh; overflow: auto;
}
.palette-hint {
  padding: 12px 10px; margin: 0;
  font-size: 12px;
}
.palette-group-heading {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--color-neutral-600);
  padding: 8px 10px 3px;
}
.palette-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  text-decoration: none;
  font-size: 13px;
}
.palette-row:hover,
.palette-row:focus-visible {
  background: color-mix(in srgb, var(--color-accent) 12%, transparent);
  outline: none;
  text-decoration: none;
}
.palette-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-meta { font-size: 11px; }
.palette-footer {
  display: flex; gap: 16px;
  padding: 9px 14px; font-size: 10.5px;
  box-shadow: inset 0 1px 0 var(--color-divider);
  color: color-mix(in srgb, var(--color-text) 38%, transparent);
}

/* #30: full-screen sheet under --bp-sm (640px). No Alpine/JS change needed
   — `x-trap.inert.noscroll` (base.html) already locks body scroll and
   traps focus; only the visual shape changes here (edge-to-edge, no
   floating card). `.search-affordance`'s 260px min-width can't fit the
   collapsed topnav either way, so mobile's only path to the palette is
   the drawer trigger added in the topnav/#30 work below. */
@media (max-width: 640px) {
  .palette-backdrop {
    padding: 0;
    align-items: stretch;
  }
  .palette {
    max-width: none;
    height: 100%;
    border-radius: 0;
  }
  .palette-results {
    max-height: none;
    flex: 1;
  }
  /* QA re-pass: "large search input and card results, not a shrunk
     desktop overlay" — the sheet shape already landed last pass, this is
     the density/touch polish on top of it. */
  .palette-input-row { padding: 16px; }
  .palette-prompt { font-size: 20px; }
  .palette-input { font-size: 18px; }
  .palette-results { padding: 10px; gap: 8px; }
  .palette-row {
    padding: 12px 14px;
    background: var(--color-bg);
    box-shadow: 0 0 0 1px var(--color-divider);
    min-height: 44px;
  }
}

/* ══════════════════════════════════════════════════════════════════════
   Admin (screen 3c) — 280 / 1fr grid: teams rail on the left,
   per-team detail on the right. Global users/uploaders/audit stay at
   their own routes with the standard .table treatment.
   ══════════════════════════════════════════════════════════════════════ */
.admin-grid {
  display: grid; grid-template-columns: 280px 1fr; gap: 0;
  min-height: 640px;
}
.admin-rail {
  padding: 0 20px 16px 0;
  box-shadow: inset -1px 0 0 var(--color-divider);
  display: grid; gap: 6px; align-content: start;
}
@media (max-width: 960px) {
  .admin-grid { grid-template-columns: 1fr; min-height: 0; }
  .admin-rail {
    padding: 0 0 16px; box-shadow: inset 0 -1px 0 var(--color-divider);
  }
}
.admin-rail-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 6px;
}
.admin-rail-head h6 { margin: 0; }
.team-card {
  display: block; padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  text-decoration: none;
}
.team-card:hover {
  background: color-mix(in srgb, var(--color-text) 4%, transparent);
  text-decoration: none;
}
.team-card--suspended { opacity: 0.55; }
.team-card-row {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: 12.5px;
}
.team-card-name { font-weight: 500; }
.team-card-id { font-size: 11px; }
.team-card-summary {
  font-size: 10.5px; margin-top: 2px;
  color: color-mix(in srgb, var(--color-text) 42%, transparent);
}
.team-card-summary a { color: var(--color-accent); }
.team-card-delete {
  background: transparent; border: 0; padding: 0;
  color: var(--color-error-text); font: inherit; font-size: 10.5px;
  cursor: pointer;
}
.team-card-delete:hover { text-decoration: underline; }

.admin-main { padding: 0 0 16px 20px; }
.admin-empty {
  max-width: 480px; padding: 24px 0;
}
.admin-empty h4 { margin: 0 0 8px; }
.admin-empty-links { display: flex; gap: 8px; margin-top: 16px; }
.admin-section-heading { margin: 20px 0 8px; }
.admin-invite { margin: 12px 0 20px; }
.admin-invite-form {
  display: flex; gap: 8px; margin-top: 8px;
}
.admin-invite-form .input { flex: 1; }

/* ══════════════════════════════════════════════════════════════════════
   Filter-group builder (screen 3b) — 1fr / 1fr grid: rules on the left,
   preview on the right. Left column carries the divider hairline.
   ══════════════════════════════════════════════════════════════════════ */
.fg-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
}
.fg-left {
  padding: 0 20px 16px 0;
  box-shadow: inset -1px 0 0 var(--color-divider);
}
@media (max-width: 960px) {
  .fg-grid { grid-template-columns: 1fr; }
  .fg-left {
    padding: 0 0 16px; box-shadow: inset 0 -1px 0 var(--color-divider);
  }
}
.fg-right {
  padding: 0 0 16px 20px;
  display: grid; gap: 12px; align-content: start;
}
.fg-preview-head {
  display: flex; align-items: baseline; gap: 12px; margin-bottom: 8px;
}
.fg-preview-head h6 { margin: 0; }
.fg-preview-results { margin-top: 12px; font-size: 12px; }
.fg-preview-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 9px;
  margin-bottom: 12px;
}
.fg-stat {
  padding: 10px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--color-text) 4%, transparent);
}
.fg-stat-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
}
.fg-stat-value {
  font-size: 22px; margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.fg-stat-note {
  font-size: 10.5px; margin-top: 2px;
}
.fg-preview-table { font-size: 11.5px; }
.fg-preview-table .fg-event-name {
  display: inline-block; max-width: 150px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  vertical-align: bottom;
}
.fg-after-price { color: var(--color-accent-300); }

/* Condition row: column select · op select · value input · remove ×. */
.rule-row {
  display: grid; grid-template-columns: 150px 92px 1fr 24px;
  gap: 7px; align-items: end;
  margin-bottom: 7px;
}
.rule-row .form-field { margin-bottom: 0; }
.rule-row .rule-col select, .rule-row .rule-op select, .rule-row .rule-val input {
  min-height: 32px; font-size: 12px;
}
.rule-remove {
  width: 24px; height: 32px; padding: 0; margin: 0;
  background: transparent; border: 0; cursor: pointer;
  color: color-mix(in srgb, var(--color-text) 35%, transparent);
  font-size: 14px;
}
.rule-remove:hover { color: var(--color-accent); }

/* #30: the fixed 4-column grid (150px 92px 1fr 24px) can't fit a 375px
   viewport. Two columns of auto-placed children wraps the 4 fields
   (col select, op select, value input, remove ×) into 2×2 — no markup
   change needed, grid auto-flow does it for free. */
@media (max-width: 640px) {
  .rule-row { grid-template-columns: 1fr 1fr; }
}

/* ══════════════════════════════════════════════════════════════════════
   Pipeline (screen 3a) — 1fr / 380px grid: subjects/tasks on the left,
   workers + credentials rail on the right.
   ══════════════════════════════════════════════════════════════════════ */
.pipeline-grid {
  display: grid; grid-template-columns: 1fr 380px;
  gap: 0;
  min-height: 640px;
}
.pipeline-left {
  padding: 0 20px 16px 0;
  box-shadow: inset -1px 0 0 var(--color-divider);
  display: flex; flex-direction: column; gap: 16px;
}
@media (max-width: 960px) {
  .pipeline-grid { grid-template-columns: 1fr; min-height: 0; }
  .pipeline-left {
    padding: 0 0 16px; box-shadow: inset 0 -1px 0 var(--color-divider);
  }
}
.pipeline-right {
  padding: 0 0 16px 20px;
  display: grid; gap: 16px;
  align-content: start;
}
.toolbar-filters {
  display: inline-flex; align-items: center; gap: 8px; margin: 0;
}
.toolbar-filters .input {
  min-height: 32px; width: auto;
}
/* ── DLQ status board (/ops/tasks/dlq) ──────────────────────────────── */
.dlq-board { max-width: 840px; padding: 0 20px 40px; }

.dlq-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 0 12px; flex-wrap: wrap;
}
.dlq-toolbar h4 { margin: 0; flex: 1; }
.dlq-toolbar-back { font-size: 13px; color: var(--color-neutral-500); }

.dlq-verdict {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 0 18px;
  border-bottom: 1px solid var(--color-divider);
  margin-bottom: 20px;
}
.dlq-verdict-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dlq-verdict--ok  .dlq-verdict-dot  { background: #4caf84; }
.dlq-verdict--warn .dlq-verdict-dot { background: var(--color-warn); }
.dlq-verdict-text { font-size: 14px; font-weight: 500; }
.dlq-verdict--ok  .dlq-verdict-text  { color: #4caf84; }
.dlq-verdict--warn .dlq-verdict-text { color: var(--color-warn); }
.dlq-verdict-sub { font-size: 13px; color: var(--color-neutral-500); }

.dlq-cards { display: grid; gap: 12px; margin-bottom: 20px; }
.dlq-card { border: 1px solid var(--color-divider); border-radius: var(--radius-sm); overflow: hidden; }

.dlq-card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; cursor: pointer; user-select: none;
}
.dlq-card-head:hover { background: color-mix(in srgb, var(--color-text) 4%, transparent); }
.dlq-card-task { font-size: 13px; font-weight: 600; color: var(--color-text); flex: 1; }
.dlq-card-depth {
  font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px;
  background: color-mix(in srgb, var(--color-warn) 22%, transparent);
  color: var(--color-warn); white-space: nowrap;
}
.dlq-card-chevron {
  width: 16px; height: 16px; color: var(--color-neutral-500);
  transition: transform 0.15s ease; flex-shrink: 0;
}
.dlq-card-chevron.open { transform: rotate(180deg); }

.dlq-card-error-preview {
  padding: 0 14px 10px;
  border-top: 1px solid var(--color-divider);
  background: var(--color-error-surface);
}
.dlq-card-error-label {
  display: block; font-size: 10px; font-weight: 600;
  letter-spacing: 0.08em; color: var(--color-error-text-strong);
  padding-top: 8px; margin-bottom: 3px;
}
.dlq-card-error-text {
  font-size: 12px; color: var(--color-error-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dlq-card-no-error { padding: 8px 14px; font-size: 12px; border-top: 1px solid var(--color-divider); }

.dlq-msgs { padding: 0 14px 4px; border-top: 1px solid var(--color-divider); }
.dlq-msgs-heading {
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--color-neutral-500); padding: 10px 0 8px;
}
.dlq-msg-list { list-style: none; margin: 0; padding: 0 0 10px; display: grid; gap: 8px; }
.dlq-msg-item { border: 1px solid var(--color-divider); border-radius: var(--radius-sm); overflow: hidden; }

.dlq-msg-fields { display: grid; grid-template-columns: max-content 1fr; gap: 0; font-size: 12px; padding: 8px 10px; }
.dlq-field-label { color: var(--color-neutral-500); padding: 2px 10px 2px 0; font-size: 11px; white-space: nowrap; }
.dlq-field-value { color: var(--color-text); padding: 2px 0; word-break: break-all; }
.dlq-field-value a { color: var(--color-accent); text-decoration: none; }
.dlq-field-value a:hover { text-decoration: underline; }

.dlq-msg-error-strip {
  padding: 5px 10px; border-top: 1px solid var(--color-divider);
  background: var(--color-error-surface); font-size: 11px;
  color: var(--color-error-text); word-break: break-all;
}
.dlq-msg-raw-only { padding: 8px 10px; }
.dlq-raw-toggle {
  font-size: 11px; color: var(--color-accent); cursor: pointer;
  background: none; border: none; padding: 0 10px 8px; display: block; text-align: left;
}
.dlq-raw-json {
  margin: 0 10px 8px; font-size: 10px; color: var(--color-neutral-300);
  background: var(--color-bg); padding: 6px 8px; border-radius: var(--radius-sm);
  white-space: pre-wrap; word-break: break-all; max-height: 120px; overflow: auto;
}

.dlq-card-action {
  padding: 10px 14px 12px; border-top: 1px solid var(--color-divider);
  display: flex; align-items: center; gap: 10px;
}
.dlq-retry-note { font-size: 11px; }

.dlq-healthy {
  padding: 10px 14px; border: 1px solid var(--color-divider);
  border-radius: var(--radius-sm); font-size: 13px;
  color: var(--color-neutral-500); display: flex; align-items: baseline; gap: 8px;
  flex-wrap: wrap;
}
.dlq-healthy-count { font-weight: 600; color: #4caf84; white-space: nowrap; }
.dlq-healthy-names { font-size: 11px; color: var(--color-neutral-600); }

.dlq-empty { text-align: center; padding: 40px 0; color: var(--color-neutral-500); }
.dlq-empty strong { display: block; margin-bottom: 6px; color: var(--color-text); }
.dlq-fetch-error {
  padding: 14px 16px; border: 1px solid var(--color-error-border);
  border-radius: var(--radius-sm); background: var(--color-error-surface);
  color: var(--color-error-text); font-size: 13px;
}
.dlq-fetch-error code { font-size: 12px; word-break: break-all; }

/* ══════════════════════════════════════════════════════════════════════
   Watch editor (screen 2c) — header + tab strip + 340/1fr grid.
   ══════════════════════════════════════════════════════════════════════ */
.editor-header {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 0 12px;
  flex-wrap: wrap;
}
.editor-crumb {
  font-size: 11px;
  color: color-mix(in srgb, var(--color-text) 40%, transparent);
}
.editor-crumb a { color: inherit; }
.editor-crumb a:hover { color: var(--color-accent); }
.editor-title { margin: 0; }
.editor-meta { margin: 0; font-size: 11.5px; }
.editor-header .spacer { flex: 1; }

.tab-strip {
  display: flex; gap: 4px;
  padding: 0;
  box-shadow: inset 0 -1px 0 var(--color-divider);
  margin: 0 0 16px;
}
.tab-strip .tab {
  font-size: 12.5px; padding: 7px 12px;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
  text-decoration: none;
}
.tab-strip .tab:hover { color: var(--color-text); }
.tab-strip .tab.is-active {
  color: var(--color-accent);
  box-shadow: inset 0 -2px 0 var(--color-accent);
}

.editor-grid {
  display: grid; grid-template-columns: 340px 1fr;
  gap: 0;
  min-height: 640px;
}
.editor-left {
  padding: 16px 20px 16px 0;
  box-shadow: inset -1px 0 0 var(--color-divider);
  display: flex; flex-direction: column;
}
.editor-right {
  padding: 16px 0 16px 20px;
  display: grid; gap: 16px;
  align-content: start;
}
.editor-form { display: grid; gap: 14px; margin: 0; }
.field-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.field-row .field, .field-row .form-field { margin-bottom: 0; }
@media (max-width: 960px) {
  .editor-grid { grid-template-columns: 1fr; min-height: 0; }
  .editor-left {
    padding: 16px 0; box-shadow: inset 0 -1px 0 var(--color-divider);
  }
  .editor-right { padding: 16px 0; }
}
@media (max-width: 640px) {
  .field-row { grid-template-columns: 1fr; }
}
.editor-danger { margin-top: auto; padding-top: 16px; }
.editor-danger-btn {
  color: var(--color-error-text) !important;
  border-color: var(--color-error-border) !important;
}
.editor-source-hint { margin-top: auto; padding-top: 16px; font-size: 11.5px; }

.editor-card { padding: 12px; }
.editor-card > h6 { margin: 0 0 4px; }
.editor-card-note {
  margin: 0 0 8px;
  font-size: 10.5px;
  color: color-mix(in srgb, var(--color-text) 45%, transparent);
}
.seat-map-placeholder, .history-placeholder {
  min-height: 120px;
  display: grid; place-items: center;
  border: 1px dashed var(--color-divider);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
}
.if-save {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 6px;
}
.if-save li {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px;
}

/* ══════════════════════════════════════════════════════════════════════
   Legacy form-field shims — the components/form_field.html macros emit
   .form-field / .form-field-check / .err / .form-error. Alias them onto
   the DS .field / .field-error look so pre-Nocturne CRUD pages render
   correctly on dark ground.
   ══════════════════════════════════════════════════════════════════════ */
.form-field {
  display: grid; gap: 5px; margin-bottom: var(--space-3);
}
.form-field > label {
  display: block; font-size: 12px; margin-bottom: 0;
  color: color-mix(in srgb, var(--color-text) 70%, transparent);
  font-weight: 500;
}
.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="password"],
.form-field input[type="number"],
.form-field input[type="search"],
.form-field input[type="url"],
.form-field select,
.form-field textarea {
  width: 100%; min-height: 36px; padding: 6px 10px; font: inherit;
  font-size: 14px; color: var(--color-text); caret-color: var(--color-accent);
  background: var(--color-surface);
  border: 1px solid var(--color-divider); border-radius: var(--radius-md);
}
.form-field input:hover, .form-field select:hover, .form-field textarea:hover {
  border-color: color-mix(in srgb, var(--color-text) 45%, transparent);
}
.form-field input:focus-visible, .form-field select:focus-visible, .form-field textarea:focus-visible {
  border-color: var(--color-accent); outline-offset: 0;
}
.form-field-check { display: flex; align-items: center; gap: 8px; }
.form-field-check label {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 400;
  color: var(--color-text);
}
.err, .form-error, .field-error {
  color: var(--color-error-text);
  font-size: 11px;
  padding: 8px 10px;
  background: var(--color-error-surface);
  border-radius: var(--radius-sm);
  margin-top: 5px;
}

/* Pager row. */
.pager {
  display: flex; align-items: center; gap: 8px;
  padding-top: 10px;
}
.pager-meta {
  font-size: 11px;
  color: color-mix(in srgb, var(--color-text) 40%, transparent);
}
.pager .spacer { flex: 1; }

/* Auth shell (2a) — centered card on the dark ground.
   660px card, min-height 440px, padding 56px 52px per handoff. */
.auth-shell {
  min-height: 100vh; display: grid; place-items: center;
  padding: var(--space-4);
  background: var(--color-bg);
}
.auth-card {
  width: 100%; max-width: 660px; min-height: 440px;
  padding: 56px 52px;
  display: flex; flex-direction: column;
  background: var(--color-bg);
}
@media (max-width: 640px) {
  .auth-card { padding: 32px 20px; min-height: 0; }
}
.auth-brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 17px; color: var(--color-text);
}
/* Auth-shell brand bar is 6×22px (vs top nav's 5×17px). */
.auth-brand-bar {
  display: inline-block; width: 6px; height: 22px;
  background: var(--color-accent); border-radius: 2px;
}
.auth-brand-name { color: var(--color-text); }
.auth-brand-suffix { color: var(--color-neutral-600); }
/* Left-fading rule: fades to transparent 70% across (single-sided fade). */
.auth-rule {
  height: 1px; margin: 20px 0 28px;
  background: linear-gradient(to right, var(--color-divider), transparent 70%);
}
.auth-content { max-width: 340px; }
.auth-kicker {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--color-accent); margin: 0 0 var(--space-2);
}
.auth-title {
  font-size: 20px; font-weight: var(--font-heading-weight);
  margin: 0 0 var(--space-2);
}
.auth-lede {
  font-size: 13px;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
  margin: 0 0 var(--space-6);
}
.auth-form { display: block; margin: 0; }
.auth-form .input { min-height: 44px; }
.auth-form .field { margin-bottom: var(--space-4); }
.auth-submit { min-height: 44px; width: 100%; }
/* Code entry row: label+input on the left, primary button flush right. */
.auth-code-row {
  display: flex; gap: 8px; align-items: flex-end; margin: 0;
}
.auth-code-field { flex: 1; margin-bottom: 0; }
.auth-code-input {
  min-height: 44px;
  font-family: var(--font-mono); font-size: 20px;
  letter-spacing: 0.28em; text-align: center;
}
.auth-code-submit { min-height: 44px; }
.auth-error { margin-top: var(--space-3); }
.auth-links {
  display: flex; gap: 14px; margin-top: var(--space-4);
  align-items: center;
}
.auth-link {
  background: transparent; border: 0; padding: 0;
  color: var(--color-accent); font: inherit; font-size: 13px;
  text-decoration: none; cursor: pointer;
}
.auth-link:hover { text-decoration: underline; }
.auth-link-form { display: inline; margin: 0; }
.auth-footer {
  margin: auto 0 0; padding-top: 28px;
  font-size: 11px;
  color: color-mix(in srgb, var(--color-text) 35%, transparent);
}

/* ══════════════════════════════════════════════════════════════════════
   Filter-group builder v2 (#149)
   ══════════════════════════════════════════════════════════════════════ */
[x-cloak] { display: none !important; }

.fgb { max-width: 1240px; }

.fgb-top {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 0 6px;
}
.fgb-top .editor-crumb { flex-basis: 100%; }
.fgb-name {
  flex: 1 1 320px; min-width: 0;
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 20px; letter-spacing: -0.015em; color: var(--color-text);
  background: transparent; border: 0; border-radius: 0;
  border-bottom: 1px solid var(--color-divider);
  padding: 4px 0; caret-color: var(--color-accent);
}
.fgb-name:focus-visible { outline: none; border-bottom-color: var(--color-accent); }
.fgb-name::placeholder { color: color-mix(in srgb, var(--color-text) 35%, transparent); }
.fgb-name.has-error { border-bottom-color: var(--color-error-bar); }

.fgb-switch {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer; font-size: 13px; user-select: none;
}
.fgb-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.fgb-switch .track {
  width: 34px; height: 20px; border-radius: 10px; flex: none;
  background: var(--color-neutral-800); position: relative;
  transition: background 0.12s;
}
.fgb-switch .track::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--color-neutral-300); transition: transform 0.12s;
}
.fgb-switch input:checked + .track { background: var(--color-accent-600); }
.fgb-switch input:checked + .track::after {
  transform: translateX(14px); background: var(--color-accent-100);
}
.fgb-switch input:focus-visible + .track {
  outline: 2px solid var(--color-accent); outline-offset: 2px;
}

.fgb-say {
  margin: 6px 0 4px; max-width: 92ch;
  font-size: 15px; line-height: 1.5;
  color: color-mix(in srgb, var(--color-text) 60%, transparent);
}
.fgb-say b { font-weight: 500; color: var(--color-text); }
.fgb-say i { font-style: normal; color: var(--color-warn); }
.fgb-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px;
  margin: 0 0 14px; font-size: 11.5px;
}
.fgb-link {
  background: none; border: 0; padding: 0; font: inherit; cursor: pointer;
  color: var(--color-accent);
}
.fgb-link:hover { text-decoration: underline; }
.fgb-note-input { max-width: 520px; min-height: 30px; font-size: 12.5px; padding: 4px 8px; }

.fgb-banner {
  margin: 0 0 12px; padding: 9px 12px; font-size: 13px;
  color: var(--color-error-text); background: var(--color-error-surface);
  border-radius: var(--radius-md);
}

.fgb-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 392px;
  grid-template-areas: "seats out" "acts out" "del out";
  grid-template-rows: auto auto 1fr;
  column-gap: 28px; row-gap: 22px; align-items: start;
  padding-top: 16px;
  box-shadow: inset 0 1px 0 var(--color-divider);
}
.fgb-seats { grid-area: seats; min-width: 0; }
.fgb-acts  { grid-area: acts;  min-width: 0; }
.fgb-del   { grid-area: del; }
.fgb-out   { grid-area: out;   min-width: 0; position: sticky; top: 12px; }

.fgb-step { display: flex; align-items: center; gap: 9px; margin: 0 0 10px; }
.fgb-step h6 { margin: 0; }
.fgb-step .spacer { flex: 1; }
.fgb-step-n {
  width: 20px; height: 20px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 11px; color: var(--color-accent);
  box-shadow: inset 0 0 0 1px var(--color-accent-700);
}

.fgb-r {
  position: relative; margin-bottom: 6px;
  padding-left: calc(var(--d) * 22px);
}
.fgb-r::before {
  content: ''; position: absolute; left: 0; top: -3px; bottom: -3px;
  width: calc(var(--d) * 22px); pointer-events: none;
  background-image: repeating-linear-gradient(to right,
    transparent 0 8px, var(--color-divider) 8px 9px, transparent 9px 22px);
}
.fgb-ghead {
  display: flex; align-items: center; gap: 8px;
  min-height: 34px; font-size: 13px;
}
.fgb-quant {
  width: auto; min-height: 30px; padding: 3px 8px; font-size: 13px;
  color: var(--color-accent); border-color: var(--color-accent-700);
}
.fgb-cond {
  display: grid; grid-template-columns: 128px 152px minmax(0, 1fr) 28px;
  gap: 6px; align-items: start;
}
.fgb-cond .input { min-height: 34px; font-size: 13px; padding: 5px 9px; }
.fgb-cond.has-error .fgb-val .input,
.fgb-cond.has-error .fgb-chips { border-color: var(--color-error-border); }
.fgb-err {
  grid-column: 1 / -1; margin: 0; font-size: 11.5px;
  color: var(--color-error-text);
}
.fgb-gfoot { display: flex; gap: 4px; }
.fgb-x {
  width: 28px; height: 34px; padding: 0; margin: 0; flex: none;
  background: transparent; border: 0; border-radius: var(--radius-sm);
  cursor: pointer; font: inherit; font-size: 15px; line-height: 1;
  color: color-mix(in srgb, var(--color-text) 40%, transparent);
}
.fgb-x:hover { color: var(--color-error-text); }
.fgb-x-label { display: none; }

.fgb-chips {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px;
  min-height: 34px; padding: 3px 5px;
  background: var(--color-surface);
  border: 1px solid var(--color-divider); border-radius: var(--radius-md);
}
.fgb-chips:focus-within { border-color: var(--color-accent); }
.fgb-chip {
  display: inline-flex; align-items: center; gap: 2px;
  max-width: 100%; padding: 2px 2px 2px 8px; font-size: 12px;
  border-radius: var(--radius-sm); background: var(--color-neutral-800);
}
.fgb-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fgb-chip button {
  width: 20px; height: 20px; padding: 0; border: 0; cursor: pointer; flex: none;
  background: transparent; color: color-mix(in srgb, var(--color-text) 55%, transparent);
  font-size: 13px; line-height: 1; border-radius: var(--radius-sm);
}
.fgb-chip button:hover { color: var(--color-error-text); }
.fgb-chips input {
  flex: 1 1 110px; min-width: 0; min-height: 24px; padding: 0 4px;
  font: inherit; font-size: 13px; color: var(--color-text);
  background: transparent; border: 0; caret-color: var(--color-accent);
}
.fgb-chips input:focus-visible { outline: none; }

.fgb-affix { display: inline-flex; align-items: center; position: relative; }
.fgb-affix > span {
  position: absolute; left: 9px; pointer-events: none;
  color: color-mix(in srgb, var(--color-text) 50%, transparent);
}
.fgb-affix > .input { padding-left: 20px; }
.fgb-affix.is-suffix > span { left: auto; right: 9px; }
.fgb-affix.is-suffix > .input { padding-left: 9px; padding-right: 22px; }

.fgb-foot-note { margin: 10px 0 0; font-size: 12px; }
.fgb-broad {
  margin: 8px 0 0; padding: 9px 12px; font-size: 13px;
  border-radius: var(--radius-md); color: var(--color-warn);
  background: color-mix(in srgb, var(--color-warn) 12%, transparent);
}
.fgb-seats-sum p { margin: 0 0 10px; font-size: 14px; }
.fgb-only-phone { display: none; }

.fgb-mode { margin-bottom: 12px; }
.fgb-act {
  padding: 12px 14px 14px; margin-bottom: 10px;
  background: var(--color-surface); border-radius: var(--radius-md);
}
.fgb-act.has-error { box-shadow: inset 0 0 0 1px var(--color-error-border); }
.fgb-act-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.fgb-act-head h5 { margin: 0; font-size: 15px; }
.fgb-act-head .spacer { flex: 1; }
.fgb-act .input { background: var(--color-bg); }
.fgb-line {
  display: flex; flex-wrap: wrap; align-items: center; gap: 7px;
  margin: 10px 0 8px; font-size: 14px;
}
.fgb-num { width: 92px; }
.fgb-eg { margin: 0; font-size: 12.5px; }
.fgb-eg b { font-weight: 500; color: var(--color-text); }
.fgb-limits {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px; margin-bottom: 12px;
}
.fgb-limits label, .fgb-lbl {
  display: grid; gap: 5px; font-size: 12px; font-weight: 500;
  color: color-mix(in srgb, var(--color-text) 70%, transparent);
}
.fgb-keep { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 13px; }
.fgb-more { margin-top: 10px; display: grid; gap: 10px; }
.fgb-adds { display: flex; flex-wrap: wrap; gap: 8px; }
.fgb-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.fgb-suggest button {
  padding: 4px 10px; font: inherit; font-size: 12px; cursor: pointer;
  color: var(--color-text); background: transparent;
  border: 1px solid var(--color-divider); border-radius: 99px;
}
.fgb-suggest button:hover { border-color: var(--color-accent); color: var(--color-accent); }
.fgb-remove {
  padding: 4px 6px; font: inherit; font-size: 12px; cursor: pointer;
  background: transparent; border: 0; border-radius: var(--radius-sm);
  color: color-mix(in srgb, var(--color-text) 50%, transparent);
}
.fgb-remove:hover { color: var(--color-error-text); }
.fgb-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fgb-choice {
  display: grid; gap: 4px; align-content: start; text-align: left;
  padding: 14px; font: inherit; cursor: pointer; color: var(--color-text);
  background: transparent; border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
}
.fgb-choice:hover { border-color: var(--color-accent); }
.fgb-choice b { font-weight: 500; font-size: 15px; color: var(--color-accent); }
.fgb-choice span { font-size: 12.5px; color: color-mix(in srgb, var(--color-text) 60%, transparent); }

.fgb-out-card {
  padding: 14px 16px 16px;
  background: var(--color-surface); border-radius: var(--radius-md);
}
.fgb-hero { display: flex; align-items: baseline; gap: 10px; margin: 2px 0 2px; }
.fgb-hero-n { font-size: 52px; line-height: 1; font-weight: 500; letter-spacing: -0.02em; }
.fgb-hero-l { font-size: 15px; }
.fgb-out-sub { margin: 0; font-size: 12.5px; }
.fgb-stale {
  margin: 10px 0 0; padding: 7px 10px; font-size: 12px;
  border-radius: var(--radius-sm); color: var(--color-warn);
  background: color-mix(in srgb, var(--color-warn) 12%, transparent);
}
.fgb-funnel { display: grid; gap: 7px; margin: 16px 0 14px; }
.fgb-fr {
  display: grid; grid-template-columns: 58px 110px minmax(0, 1fr);
  align-items: center; gap: 8px; font-size: 12px;
}
.fgb-fr .n { text-align: right; font-variant-numeric: tabular-nums; }
.fgb-bar {
  height: 8px; min-width: 3px; border-radius: 0 4px 4px 0;
  background: var(--color-accent-500);
}
.fgb-price {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  margin: 0 0 14px; font-size: 13px;
}
.fgb-price .to { font-size: 17px; color: var(--color-text); }
.fgb-out h6 { margin: 0 0 8px; font-size: 11px; }
.fgb-secs { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.fgb-secs li { display: grid; gap: 4px; }
.fgb-sec-top { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.fgb-sec-top .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fgb-sec-top .n { font-variant-numeric: tabular-nums; }
.fgb-sec-sub { font-size: 11.5px; }
.fgb-meter {
  height: 6px; border-radius: 3px; overflow: hidden;
  background: var(--color-accent-800);
}
.fgb-meter > i { display: block; height: 100%; border-radius: 3px; background: var(--color-accent-400); }
.fgb-samples { margin-top: 14px; }
.fgb-samples table { font-size: 11.5px; }
.fgb-out-empty { margin: 6px 0 0; font-size: 13.5px; line-height: 1.55; }
.fgb-out-foot { margin: 14px 0 0; font-size: 11.5px; }
#fgb-preview-body { overflow-x: auto; }
.fgb-sheet-head, .fgb-sheet-backdrop, .fgb-savebar, .fgb-out-open { display: none; }

@media (max-width: 960px) {
  .fgb-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "seats" "acts" "out" "del";
    grid-template-rows: auto;
  }
  .fgb-out { position: static; }
}

@media (max-width: 640px) {
  .content { padding: 8px 16px 96px; }
  .fgb-top { padding-top: 8px; gap: 10px; }
  .fgb-top .btn { display: none; }
  .fgb-name { flex-basis: 100%; font-size: 19px; min-height: 44px; }
  .fgb-switch { min-height: 44px; font-size: 14px; }
  .fgb-say { font-size: 15.5px; }
  .fgb-step-n { display: none; }
  .fgb-only-phone { display: block; }

  .fgb-grid {
    grid-template-areas: "out" "acts" "seats" "del";
    row-gap: 26px; padding-top: 14px;
  }
  .fgb-grid.is-new { grid-template-areas: "seats" "acts" "out"; }

  .fgb .input, .fgb-chips input { font-size: 16px; min-height: 44px; }
  .fgb-quant { min-height: 40px; font-size: 15px; }
  .fgb-r { padding-left: calc(var(--d) * 12px); margin-bottom: 8px; }
  .fgb-r::before {
    width: calc(var(--d) * 12px);
    background-image: repeating-linear-gradient(to right,
      transparent 0 4px, var(--color-divider) 4px 5px, transparent 5px 12px);
  }
  .fgb-cond {
    grid-template-columns: minmax(0, 1fr);
    padding: 10px; border-radius: var(--radius-md);
    background: var(--color-surface);
  }
  .fgb-cond .input, .fgb-chips { background: var(--color-bg); }
  .fgb-chips { min-height: 44px; }
  .fgb-chip { font-size: 13.5px; padding: 5px 2px 5px 10px; }
  .fgb-chip button { width: 32px; height: 32px; font-size: 16px; }
  .fgb-x {
    width: auto; height: 44px; padding: 0 4px; justify-self: start;
    font-size: 13.5px; color: color-mix(in srgb, var(--color-text) 55%, transparent);
  }
  .fgb-x-glyph { display: none; }
  .fgb-x-label { display: inline; }
  .fgb-ghead { flex-wrap: wrap; font-size: 14.5px; }
  .fgb-gfoot { gap: 8px; }

  .fgb-mode, .fgb-mode .seg { display: flex; width: 100%; }
  .fgb-mode .seg-opt, .fgb-keep .seg-opt {
    flex: 1; justify-content: center; min-height: 44px; text-align: center;
  }
  .fgb-keep .seg { display: flex; width: 100%; }
  .fgb-limits { grid-template-columns: minmax(0, 1fr); }
  .fgb-num { width: 120px; }
  .fgb-line { font-size: 15px; }
  .fgb-adds .btn { flex: 1; }
  .fgb-choices { grid-template-columns: minmax(0, 1fr); }
  .fgb-choice b { font-size: 16px; } .fgb-choice span { font-size: 14px; }
  .fgb-remove { min-height: 44px; padding: 0 8px; font-size: 13.5px; }
  .fgb-suggest button { min-height: 40px; padding: 6px 14px; font-size: 14px; }

  .fgb-out-card { padding: 14px; }
  .fgb-hero-n { font-size: 48px; }
  .fgb-out-open { display: inline-flex; margin-top: 10px; }
  .fgb-out-detail {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    max-height: 82vh; overflow-y: auto;
    padding: 6px 16px calc(20px + env(safe-area-inset-bottom));
    background: var(--color-surface);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: var(--shadow-lg);
    transform: translateY(105%); transition: transform 0.2s ease-out;
  }
  .fgb-out-detail.is-open { transform: none; }
  .fgb-sheet-head {
    display: flex; align-items: center; gap: 8px;
    position: sticky; top: -6px; margin: 0 -16px 4px; padding: 10px 16px;
    background: var(--color-surface);
  }
  .fgb-sheet-head h5 { margin: 0; flex: 1; }
  .fgb-sheet-backdrop {
    display: block; position: fixed; inset: 0; z-index: 55;
    background: color-mix(in srgb, var(--color-neutral-900) 70%, transparent);
  }
  .fgb-out-foot { display: none; }

  .fgb-savebar {
    display: flex; align-items: center; gap: 10px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: var(--color-bg);
    box-shadow: inset 0 1px 0 var(--color-divider);
  }
  .fgb-savebar .btn { flex: 1; min-height: 48px; font-size: 15px; }
  .fgb-savebar .fgb-save {
    background: color-mix(in srgb, var(--color-accent) 16%, transparent);
  }
}

/* ── Home page — status overview (issue #178) ─────────────────────────── */

/* Status cards */
.status-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}
@media (max-width: 960px) { .status-cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .status-cards { grid-template-columns: 1fr; } }

.status-card {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-left: 3px solid var(--color-accent);
  border-radius: var(--radius-md);
  padding: var(--space-6);
}
.status-card--neutral { border-left-color: var(--color-divider); }
.status-card--warn    { border-left-color: var(--color-warn); }
.status-card--error   { border-left-color: var(--color-error-bar); }

.status-card__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: color-mix(in srgb, var(--color-text) 50%, transparent);
  margin-bottom: var(--space-3);
  font-weight: 600;
}
.status-card__kpi { display: flex; align-items: baseline; gap: var(--space-2); margin-bottom: var(--space-2); }
.status-card__main {
  font-size: 32px; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.status-card__main--warn  { color: var(--color-warn); }
.status-card__main--error { color: var(--color-error-text); }
.status-card__sub { font-size: 13px; color: color-mix(in srgb, var(--color-text) 55%, transparent); }
.status-card__breakdown {
  font-size: 12px;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
  margin-bottom: var(--space-4);
  line-height: 1.6;
}
.status-card__links { display: flex; gap: var(--space-4); font-size: 13px; flex-wrap: wrap; margin-top: var(--space-3); }
.status-card__links a { color: var(--color-accent); text-decoration: none; }
.status-card__links a:hover { text-decoration: underline; }
.status-card__note {
  font-size: 12px;
  color: var(--color-warn);
  margin-top: var(--space-2);
}
.status-card__note--error { color: var(--color-error-text); }

/* Section headings */
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--space-4);
}
.section-head h2 { font-size: 15px; font-weight: 600; margin: 0; }
.section-head a { font-size: 13px; color: var(--color-accent); text-decoration: none; }
.section-head a:hover { text-decoration: underline; }

/* Upcoming events table */
.upcoming-table { width: 100%; border-collapse: collapse; margin-bottom: var(--space-8); font-size: 13px; }
.upcoming-table thead th {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: color-mix(in srgb, var(--color-text) 50%, transparent);
  font-weight: 600; padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--color-divider); text-align: left;
}
.upcoming-table tbody td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-divider);
  vertical-align: middle;
}
.upcoming-table tbody tr:last-child td { border-bottom: 0; }
.upcoming-table tbody tr:hover td { background: color-mix(in srgb, var(--color-text) 3%, transparent); }
.upcoming-table td.col-tonight { color: var(--color-warn); font-weight: 600; }
.event-name-cell { display: flex; align-items: center; gap: var(--space-2); }
@media (max-width: 640px) {
  .upcoming-table thead { display: none; }
  .upcoming-table tbody td { display: block; padding: var(--space-2) var(--space-4); border-bottom: 0; }
  .upcoming-table tbody tr { display: block; border-bottom: 1px solid var(--color-divider); padding: var(--space-3) 0; }
  .upcoming-table tbody tr:last-child { border-bottom: 0; }
  .upcoming-table td[data-label]::before { content: attr(data-label) ': '; font-size: 11px; color: color-mix(in srgb, var(--color-text) 50%, transparent); }
}

/* Two-column panels */
.two-col {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: var(--space-6); margin-bottom: var(--space-8);
}
@media (max-width: 640px) { .two-col { grid-template-columns: 1fr; } }

.panel {
  background: var(--color-surface); border: 1px solid var(--color-divider);
  border-radius: var(--radius-md); overflow: hidden;
}
.panel-head {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-divider);
  font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: var(--space-2);
}
.panel-sub { font-size: 11px; color: color-mix(in srgb, var(--color-text) 50%, transparent); font-weight: 400; margin-left: auto; }
.panel-body { padding: var(--space-2) 0; }
.panel-row {
  display: flex; align-items: center; gap: var(--space-4);
  padding: var(--space-3) var(--space-6); font-size: 13px;
}
.panel-row__label { flex: 1; }
.panel-row__val { font-variant-numeric: tabular-nums; font-size: 13px; white-space: nowrap; }
.panel-row__sub { font-size: 11px; color: color-mix(in srgb, var(--color-text) 50%, transparent); }
.panel-row__dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-ok   { background: var(--color-accent); }
.dot-warn { background: var(--color-warn); }
.dot-err  { background: var(--color-error-bar); }
.dot-muted { background: color-mix(in srgb, var(--color-text) 30%, transparent); }
.panel-row--warn .panel-row__val { color: var(--color-warn); }
.panel-row--err  .panel-row__val { color: var(--color-error-text); }

/* Pipeline section (SUPER only) */
.pipeline-section {
  border-top: 1px solid var(--color-divider);
  padding-top: var(--space-8); margin-top: var(--space-4);
  margin-bottom: var(--space-8);
}
.pipeline-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: color-mix(in srgb, var(--color-text) 45%, transparent);
  font-weight: 600; margin-bottom: var(--space-6);
}
.pipeline-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4);
  margin-bottom: var(--space-6);
}
@media (max-width: 640px) { .pipeline-stats { grid-template-columns: repeat(2, 1fr); } }
.pipeline-stat {
  background: var(--color-surface); border: 1px solid var(--color-divider);
  border-radius: var(--radius-md); padding: var(--space-4) var(--space-6);
}
.pipeline-stat__val { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.pipeline-stat__val--ok   { color: var(--color-accent); }
.pipeline-stat__val--warn { color: var(--color-warn); }
.pipeline-stat__val--err  { color: var(--color-error-text); }
.pipeline-stat__label { font-size: 12px; color: color-mix(in srgb, var(--color-text) 55%, transparent); margin-top: 4px; }

/* Pipeline detail panels */
.pipeline-panels {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-6);
  margin-top: var(--space-6);
}
@media (max-width: 640px) { .pipeline-panels { grid-template-columns: 1fr; } }

/* Cookie health table */
.cookie-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cookie-table th {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: color-mix(in srgb, var(--color-text) 50%, transparent);
  font-weight: 600; padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--color-divider); text-align: right;
}
.cookie-table th:first-child { text-align: left; }
.cookie-table td { padding: var(--space-2) var(--space-4); border-bottom: 1px solid var(--color-divider);
                   text-align: right; font-variant-numeric: tabular-nums; }
.cookie-table td:first-child { text-align: left; font-family: var(--font-mono); }
.cookie-table tbody tr:last-child td { border-bottom: 0; }
.cookie-table .cell-stale--pos      { color: var(--color-error-text); font-weight: 600; }
.cookie-table .cell-refreshing--pos { color: var(--color-warn); }

/* Proxies row */
.proxy-row {
  display: flex; align-items: center; gap: var(--space-6); flex-wrap: wrap;
  padding: var(--space-4) var(--space-6); font-size: 13px;
}
.proxy-val { font-variant-numeric: tabular-nums; }
.proxy-val--failing { color: var(--color-warn); font-weight: 600; }

/* Cycle feed */
.cycle-item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-6); font-size: 13px;
  border-bottom: 1px solid var(--color-divider);
}
.cycle-item:last-of-type { border-bottom: 0; }
.cycle-status { font-weight: 500; min-width: 86px; }
.cycle-ago  { color: color-mix(in srgb, var(--color-text) 50%, transparent); font-size: 12px; flex: 1; }
.cycle-meta { font-size: 12px; color: color-mix(in srgb, var(--color-text) 55%, transparent); white-space: nowrap; }
.cycle-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.cycle-dot--completed { background: var(--color-accent); }
.cycle-dot--stalled,
.cycle-dot--failed    { background: var(--color-error-bar); }
.cycle-dot--running   { background: var(--color-warn); }
.cycle-dot--cancelled { background: color-mix(in srgb, var(--color-text) 30%, transparent); }
.cycle-status--stalled,
.cycle-status--failed { color: var(--color-error-text); }
.cycle-status--running { color: var(--color-warn); }

/* ─── watchlist redesign (#180) ─────────────────────────────── */

/* Health strip */
.health-strip {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
  flex-wrap: wrap;
}
.health-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-divider);
  background: transparent;
  color: var(--color-text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.1s;
  text-decoration: none;
  white-space: nowrap;
}
.health-chip:hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.health-chip[aria-pressed="true"] {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: color-mix(in srgb, var(--color-accent) 10%, transparent);
}
.health-chip .chip-count {
  font-weight: 600;
  font-size: 14px;
}
.health-chip.chip-failing .chip-count { color: var(--color-error-text); }
.health-chip.chip-failing[aria-pressed="true"] {
  border-color: var(--color-error-border);
  background: var(--color-error-surface);
  color: var(--color-error-text);
}
.health-chip.chip-paused .chip-count { color: var(--color-warn); }
@media (max-width: 640px) {
  .health-strip { gap: var(--space-2); }
  .health-chip { flex: 1; justify-content: center; padding: 10px 8px; }
}
.health-chip.chip-retrying .chip-count { color: var(--color-warn); }
.health-chip.chip-retrying[aria-pressed="true"] {
  border-color: var(--color-warn);
  background: color-mix(in srgb, var(--color-warn) 10%, transparent);
  color: var(--color-warn);
}

/* Pipeline pulse bar */
.pulse-bar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-6);
  border-bottom: 1px solid var(--color-divider);
  flex-wrap: wrap;
}
.pulse-spacer { flex: 1; }
.pulse-task-select {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.pulse-dlq-link {
  font-size: 13px;
  white-space: nowrap;
}

/* DLQ callout banner */
.dlq-callout {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-6);
  background: var(--color-error-surface);
  border-bottom: 1px solid var(--color-error-border);
  font-size: 13px;
  color: var(--color-error-text);
  flex-wrap: wrap;
}
.dlq-callout a { color: var(--color-error-text); font-weight: 600; }
.dlq-callout__spacer { flex: 1; }

/* Pipeline task-event table */
.task-log-wrap {
  overflow-x: auto;
}
.task-log-table {
  table-layout: fixed;
  width: 100%;
}
.task-log-table .col-when   { width: 100px; }
.task-log-table .col-task   { width: 200px; }
.task-log-table .col-status { width: 90px; }
.task-log-table .col-dur    { width: 90px; }
.task-log-table .col-error  { /* auto — fills remaining width */ }
.task-log-table td.col-error,
.task-log-table td.ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 0; /* required for ellipsis to work with table-layout: fixed */
}

/* Row state tints */
.task-row--failed  > td { background: color-mix(in srgb, var(--color-error-surface) 60%, transparent); }
.task-row--retrying > td { background: color-mix(in srgb, var(--color-warn) 6%, transparent); }


/* Search bar */
.watch-search {
  padding: 0 var(--space-6) var(--space-4);
}
.watch-search-inner {
  position: relative;
  max-width: 480px;
}
.watch-search-inner svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-neutral-500);
  pointer-events: none;
}
.watch-search input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: 13.5px;
}
.watch-search input:focus {
  outline: none;
  border-color: var(--color-accent);
}
@media (max-width: 640px) {
  .watch-search-inner { max-width: 100%; }
}

/* Watch list */
.watch-list {
  border-top: 1px solid var(--color-divider);
}
.watch-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  padding: 10px var(--space-6);
  border-bottom: 1px solid var(--color-divider);
  text-decoration: none;
  color: inherit;
  gap: 0 var(--space-4);
  transition: background 0.1s;
  min-height: 60px;
}
.watch-row:hover { background: color-mix(in srgb, var(--color-text) 4%, transparent); }
.watch-row.failing {
  background: var(--color-error-surface);
  border-color: color-mix(in srgb, var(--color-error-bar) 25%, transparent);
}
.watch-row.failing:hover { background: color-mix(in srgb, #b81a1a 22%, transparent); }
.watch-row.paused { opacity: 0.65; }

.watch-line1 {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  grid-column: 1;
  grid-row: 1;
}
.watch-name {
  font-weight: 500;
  font-size: 13.5px;
  color: var(--color-text);
}
.watch-badges {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
}

.watch-line2 {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  grid-column: 1;
  grid-row: 2;
  margin-top: 1px;
}
.watch-venue {
  font-size: 12px;
  color: var(--muted);
}
.watch-date {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.watch-date::before { content: "·"; margin-right: var(--space-2); color: var(--color-divider); }
.watch-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.watch-tag {
  font-size: 10.5px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--color-neutral-800);
  color: var(--color-neutral-300);
}

.watch-age {
  grid-column: 2;
  grid-row: 1 / span 2;
  text-align: right;
  font-size: 12px;
  white-space: nowrap;
  align-self: center;
}
.watch-age.age-ok { color: var(--muted); }
.watch-age.age-stale { color: var(--color-warn); }
.watch-age.age-error { color: var(--color-error-text); font-weight: 500; }
.watch-age.age-none { color: var(--muted); }

.watch-row .btn-edit {
  display: none;
  grid-column: 2;
  grid-row: 1;
  font-size: 11.5px;
  padding: 3px 8px;
  margin-left: auto;
}
.watch-row:hover .btn-edit { display: inline-flex; }
@media (max-width: 640px) {
  .watch-row .btn-edit { display: inline-flex; }
  .watch-age { display: none; }
  .watch-row {
    grid-template-columns: 1fr auto;
    padding: 12px 16px;
  }
}

/* Pager */
.watch-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-divider);
}
.watch-pager-info {
  font-size: 12.5px;
  color: var(--muted);
}
.watch-pager-nav { display: flex; gap: var(--space-2); }
@media (max-width: 640px) {
  .watch-pager { padding: var(--space-4) 16px; }
}

/* Empty state */
.watch-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px var(--space-6);
  text-align: center;
  color: var(--muted);
  gap: var(--space-4);
}
.watch-empty svg { color: var(--color-neutral-700); }
.watch-empty p { margin: 0; font-size: 14px; max-width: 28ch; }

/* Header actions */
.watch-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
@media (max-width: 640px) {
  .watch-header-actions .btn-bulk { display: none; }
}

/* Floating action button (mobile) */
.fab {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 16px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  font-size: 24px;
  font-weight: 300;
  text-decoration: none;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  z-index: 10;
  line-height: 1;
}
@media (max-width: 640px) {
  .fab { display: flex; }
  .watch-header-actions .btn-watch-desktop { display: none; }
}

/* ─── Ticket groups lookup (#161) ───────────────────────────────────────── */

/* Two-pane layout: sticky 340px event list left + scrollable detail right. */
.tg-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 0;
  min-height: calc(100vh - 56px); /* subtract topnav height */
  align-items: start;
}
@media (max-width: 960px) {
  /* One pane at a time on mobile — JS (Alpine) toggles which one shows. */
  .tg-layout { grid-template-columns: 1fr; }
  .tg-layout-right { display: none; }
  .tg-layout-right.is-shown { display: block; }
  .tg-layout-left.is-hidden { display: none; }
}

/* Left pane */
.tg-left {
  border-right: 1px solid var(--color-divider);
  position: sticky;
  top: 56px; /* below topnav */
  max-height: calc(100vh - 56px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
@media (max-width: 960px) {
  .tg-left { position: static; max-height: none; border-right: none; }
}

.tg-search {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-divider);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.tg-search svg { flex-shrink: 0; color: var(--muted); }
.tg-search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 13px;
  color: var(--color-text);
  font-family: var(--font-body);
}
.tg-search input::placeholder { color: var(--muted); }

/* Event list entries */
.tg-event-list { flex: 1; overflow-y: auto; }
.tg-event-item {
  display: block;
  padding: var(--space-4) var(--space-6);
  text-decoration: none;
  border-bottom: 1px solid var(--color-divider);
  cursor: pointer;
  min-height: 76px;
}
.tg-event-item:hover {
  background: color-mix(in srgb, var(--color-text) 4%, transparent);
}
.tg-event-item.is-active {
  background: color-mix(in srgb, var(--color-accent) 14%, transparent);
  border-left: 3px solid var(--color-accent);
}
.tg-event-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.tg-event-meta {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.tg-event-counts {
  font-size: 11px;
  color: var(--muted);
}
.tg-event-counts.nothing { color: var(--color-warn); }
.tg-empty-search {
  padding: var(--space-8) var(--space-6);
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

/* Right pane */
.tg-right {
  padding: 0 var(--space-6) var(--space-8);
}

/* Event header in right pane */
.tg-event-header {
  padding: var(--space-6) 0 var(--space-4);
  border-bottom: 1px solid var(--color-divider);
  margin-bottom: var(--space-6);
}
.tg-event-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 var(--space-2);
  line-height: 1.25;
}
.tg-event-datetime {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: var(--space-4);
}
.tg-event-links {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}
.tg-event-links a {
  font-size: 12px;
  color: var(--color-accent);
  text-decoration: none;
}
.tg-event-links a:hover { text-decoration: underline; }
.tg-event-summary {
  font-size: 14px;
  margin-bottom: var(--space-2);
}
.tg-event-summary strong { color: var(--color-text); }
.tg-scrape-age {
  font-size: 11px;
  color: var(--muted);
}

/* Back link (mobile only) */
.tg-back {
  display: none;
  padding: var(--space-4) var(--space-6);
  font-size: 12px;
  color: var(--color-accent);
  text-decoration: none;
  border-bottom: 1px solid var(--color-divider);
}
.tg-back:hover { text-decoration: underline; }
@media (max-width: 960px) { .tg-back { display: block; } }

/* Nothing-listed state */
.tg-nothing {
  padding: var(--space-8) 0;
  text-align: center;
  max-width: 440px;
  margin: 0 auto;
}
.tg-nothing p { font-size: 14px; color: var(--muted); line-height: 1.6; margin-bottom: var(--space-6); }
.tg-nothing-actions { display: flex; gap: var(--space-4); justify-content: center; flex-wrap: wrap; }

/* Left-panel truncation hint */
.tg-list-hint {
  padding: var(--space-2) var(--space-6);
  font-size: 11px;
  color: var(--muted);
  border-top: 1px solid var(--color-divider);
  background: color-mix(in srgb, var(--color-text) 3%, var(--color-bg));
  text-align: center;
}

/* Section wrapper */
.tg-sections { margin-top: var(--space-2); }
.tg-section { margin-bottom: var(--space-2); }

/* Section headings — clearly a band, distinct from ticket rows */
.tg-section-head {
  position: sticky;
  top: 56px;
  background: color-mix(in srgb, var(--color-text) 8%, var(--color-bg));
  border-top: 1px solid var(--color-divider);
  border-bottom: 2px solid color-mix(in srgb, var(--color-text) 18%, var(--color-bg));
  padding: var(--space-2) var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  z-index: 1;
  cursor: pointer;
  user-select: none;
}
.tg-section-head:hover {
  background: color-mix(in srgb, var(--color-text) 12%, var(--color-bg));
}
.tg-section-name {
  flex: 1;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-text);
}
.tg-section-meta {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
}
/* Expand/collapse chevron */
.tg-chevron {
  flex-shrink: 0;
  color: var(--muted);
  transition: transform .15s ease;
}
.tg-chevron.is-closed { transform: rotate(-90deg); }

/* Group table */
.tg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: var(--space-8);
}
.tg-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-divider);
  white-space: nowrap;
}
.tg-table td {
  padding: var(--space-3) var(--space-3);
  border-bottom: 1px solid color-mix(in srgb, var(--color-divider) 50%, transparent);
  vertical-align: top;
}
.tg-table .num { text-align: right; }
.tg-table .tabular { font-variant-numeric: tabular-nums; }
.tg-price { font-weight: 500; }
.tg-tag {
  display: inline-block;
  background: color-mix(in srgb, var(--color-accent) 15%, transparent);
  color: var(--color-accent-2);
  border-radius: var(--radius-sm);
  font-size: 10px;
  padding: 1px 5px;
  margin: 1px 2px 1px 0;
}
/* Mobile: hide table, show card rows */
@media (max-width: 960px) {
  .tg-table thead { display: none; }
  .tg-table td {
    display: block;
    padding: var(--space-2) 0;
    border: none;
  }
  .tg-table tr {
    display: block;
    padding: var(--space-4) 0;
    border-bottom: 1px solid color-mix(in srgb, var(--color-divider) 50%, transparent);
  }
  .tg-table td.num { text-align: left; }
  .tg-section-head { top: 56px; }
}

/* ══════════════════════════════════════════════════════════════════════
   Exports archive-direct page (issue #221)
   GET /ops/exports/archives
   ══════════════════════════════════════════════════════════════════════ */

/* date nav bar */
.date-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.date-nav-label {
  font-size: 13px;
  color: var(--muted);
  margin-right: 2px;
}
.date-preset {
  font: 500 13px var(--font-body);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-divider);
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: border-color .1s, color .1s;
}
.date-preset:hover { border-color: var(--color-accent); color: var(--color-accent); text-decoration: none; }
.date-preset.active { border-color: var(--color-accent); color: var(--color-accent); background: color-mix(in srgb, var(--color-accent) 10%, transparent); }
.date-sep  { color: var(--color-divider); font-size: 16px; }
.date-input {
  font: 400 13px var(--font-mono);
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-divider);
  background: var(--color-surface);
  color: var(--color-text);
  color-scheme: dark;
  cursor: pointer;
}
.date-input:focus { outline: none; border-color: var(--color-accent); }
.date-clear {
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
}
.date-clear:hover { color: var(--color-text); text-decoration: none; }

/* snapshot timestamp */
.snap-dt  { font: 500 13px var(--font-mono); }
.snap-rel { font: 400 11px var(--font-mono); color: var(--muted); }
.file-size { font: 400 12px var(--font-mono); color: var(--muted); }

/* download button variants */
.btn-dl {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font: 500 13px var(--font-body);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-accent);
  color: var(--color-accent);
  background: transparent;
  text-decoration: none;
  white-space: nowrap;
}
.btn-dl:hover { background: color-mix(in srgb, var(--color-accent) 14%, transparent); text-decoration: none; }
.btn-unavail { font: 400 12px var(--font-mono); color: var(--muted); }

/* result count label */
.result-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

/* responsive layout — mobile cards / desktop table */
@media (max-width: 640px) {
  .arch-table { display: none; }
  .arch-cards { display: flex; flex-direction: column; gap: 8px; }
  .arch-card {
    background: var(--color-surface);
    border: 1px solid var(--color-divider);
    border-radius: var(--radius-md);
    padding: 12px 14px;
  }
  .arch-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 8px;
  }
  .arch-card-meta {
    display: flex;
    gap: 8px 14px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 10px;
  }
  .arch-card-meta strong { color: var(--color-text); font-weight: 500; }
  .arch-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 9px;
    border-top: 1px solid color-mix(in srgb, var(--color-divider) 50%, transparent);
  }
  .arch-hash { font: 400 11px var(--font-mono); color: var(--muted); }
}
@media (min-width: 641px) {
  .arch-table { display: table; width: 100%; border-collapse: collapse; }
  .arch-cards { display: none; }
  .arch-table th {
    font: 600 11px/1 var(--font-body);
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 7px 12px;
    text-align: left;
    border-bottom: 1px solid var(--color-divider);
  }
  .arch-table th.r { text-align: right; }
  .arch-table td { padding: 8px 12px; border-bottom: 1px solid color-mix(in srgb, var(--color-divider) 45%, transparent); vertical-align: middle; }
  .arch-table tr:last-child td { border-bottom: none; }
}

/* ── Catalog browse pages (venues / performers / events) ──────────────── */

.ven-wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}
.ven-crumb {
  font-size: 12.5px;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
  margin-bottom: 20px;
}
.ven-crumb a { color: inherit; text-decoration: none; }
.ven-crumb a:hover { text-decoration: underline; }

/* Hero search input */
.ven-search-hero {
  position: relative;
  margin-bottom: 10px;
}
.ven-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: color-mix(in srgb, var(--color-text) 40%, transparent);
  pointer-events: none;
}
.ven-search-hero input[type="text"] {
  width: 100%;
  padding: 10px 14px 10px 36px;
  font-size: 15px;
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  color: var(--color-text);
  box-sizing: border-box;
}
.ven-search-hero input[type="text"]:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-accent) 20%, transparent);
}

/* Filter row */
.ven-filters {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.ven-platform, .ven-city {
  height: 34px;
  padding: 0 10px;
  font-size: 13px;
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  color: var(--color-text);
}
.ven-city { width: 140px; }

/* Platform badges */
.plat {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .03em;
  border-radius: 4px;
  padding: 2px 6px;
  line-height: 1.4;
}
.plat-tm  { background: var(--color-accent-800); color: var(--color-accent-200); }
.plat-bw  { background: var(--color-neutral-700); color: var(--color-neutral-100); }
.plat-atg { background: color-mix(in srgb, #3d7a52 40%, transparent); color: #7ecfa0; }
.plat-vs  { background: color-mix(in srgb, #4f7cac 30%, transparent); color: #7fb3e0; }

/* Results bar (performers / venues use .evt-bar, events too) */
.evt-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
}
.evt-bar .count {
  font-size: 12.5px;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
  flex-shrink: 0;
}
.sort-tabs {
  display: flex;
  gap: 2px;
  background: var(--color-neutral-900);
  padding: 3px;
  border-radius: var(--radius-md);
  margin-left: auto;
}
.sort-tab {
  padding: 5px 12px;
  border-radius: calc(var(--radius-md) - 2px);
  font-size: 12.5px;
  background: transparent;
  color: color-mix(in srgb, var(--color-text) 60%, transparent);
  text-decoration: none;
  white-space: nowrap;
}
.sort-tab.active {
  background: var(--color-surface);
  color: var(--color-text);
  font-weight: 500;
}
.sort-tab:not(.active):hover {
  color: var(--color-text);
}

/* Table */
.ven-table-wrap { overflow-x: auto; }
.ven-table {
  width: 100%;
  border-collapse: collapse;
}
.ven-table th, .ven-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--color-divider);
  font-size: 13.5px;
  text-align: left;
}
.ven-table thead th {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
  border-bottom-width: 2px;
}
.ven-name-link { text-decoration: none; color: var(--color-text); }
.ven-name-link:hover { text-decoration: underline; }
.ven-name-overflow {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}
.ven-table td.ven-plat-col { text-align: center; width: 64px; }
.ven-table td.ven-loc {
  color: color-mix(in srgb, var(--color-text) 65%, transparent);
  font-size: 12.5px;
}
.ven-table td.num { text-align: right; font-size: 13px; }
.ven-table td.tabular { font-variant-numeric: tabular-nums; }
.ven-zero { color: color-mix(in srgb, var(--color-text) 35%, transparent); }
.ven-scraped {
  font-size: 12px;
  white-space: nowrap;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
}
.ven-scraped.stale { color: var(--color-warn); }

/* Events table */
.evt-wrap {}
.evt-table .evt-name-link { text-decoration: none; color: var(--color-text); }
.evt-table .evt-name-link:hover { text-decoration: underline; }
.evt-name-overflow {
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}
.evt-table td.evt-plat-col { text-align: center; width: 64px; }
.evt-table td.evt-date {
  color: color-mix(in srgb, var(--color-text) 60%, transparent);
  font-size: 12.5px;
  white-space: nowrap;
}
.evt-table td.evt-scraped {
  font-size: 12px;
  white-space: nowrap;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
}
.evt-table td.evt-scraped.stale { color: var(--color-warn); }
.evt-table td.evt-status-col { width: 90px; }
.evt-table td.evt-watch-cell { width: 72px; text-align: right; padding-right: 8px; }
.evt-watch-btn {
  font-size: 11.5px;
  padding: 3px 10px;
  height: 26px;
  white-space: nowrap;
}
.evt-watch-form { display: inline-flex; }

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .04em;
  border-radius: 4px;
  padding: 2px 7px;
  white-space: nowrap;
}
.status-live     { background: color-mix(in srgb, #22c55e 15%, transparent); color: #4ade80; }
.status-cancelled { background: color-mix(in srgb, #ef4444 15%, transparent); color: #f87171; }
.status-other    { background: color-mix(in srgb, var(--color-text) 10%, transparent); color: color-mix(in srgb, var(--color-text) 65%, transparent); }

/* Empty state */
.ven-empty {
  padding: 40px 16px;
  text-align: center;
  color: color-mix(in srgb, var(--color-text) 60%, transparent);
}
.ven-empty strong { display: block; font-size: 15px; margin-bottom: 6px; color: var(--color-text); }
.ven-empty p { font-size: 13px; margin: 0; }

/* Mobile search + chips (hidden on desktop) */
.ven-mobile-search { display: none; }
.ven-chips         { display: none; }
.mob-sort-tabs     { display: none; }
.ven-mobile-list   { display: none; }

@media (max-width: 700px) {
  .ven-table-wrap { display: none; }

  .ven-mobile-search {
    display: block;
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--color-bg);
    padding: 8px 0 4px;
    margin-bottom: 8px;
  }
  .ven-mobile-search-inner {
    position: relative;
    display: flex;
    align-items: center;
  }
  .ven-mobile-search-inner svg {
    position: absolute;
    left: 10px;
    width: 15px;
    height: 15px;
    color: color-mix(in srgb, var(--color-text) 40%, transparent);
  }
  .ven-mobile-search input[type="text"] {
    width: 100%;
    padding: 9px 12px 9px 32px;
    font-size: 14px;
    background: var(--color-surface);
    border: 1px solid var(--color-divider);
    border-radius: var(--radius-md);
    color: var(--color-text);
    box-sizing: border-box;
  }

  .ven-chips {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 4px;
    scrollbar-width: none;
  }
  .ven-chip {
    flex-shrink: 0;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 500;
    border: 1px solid var(--color-divider);
    background: var(--color-surface);
    color: color-mix(in srgb, var(--color-text) 65%, transparent);
    display: inline-flex;
    align-items: center;
    text-decoration: none;
  }
  .ven-chip.active {
    background: color-mix(in srgb, var(--color-accent) 18%, transparent);
    border-color: color-mix(in srgb, var(--color-accent) 40%, transparent);
    color: var(--color-accent);
  }
  .ven-chip.chip-tm.active {
    background: color-mix(in srgb, var(--color-accent-800) 30%, transparent);
    border-color: color-mix(in srgb, var(--color-accent) 50%, transparent);
    color: var(--color-accent-200);
  }
  .ven-chip.chip-bw.active {
    background: color-mix(in srgb, var(--color-neutral-700) 50%, transparent);
    border-color: var(--color-neutral-600);
    color: var(--color-neutral-100);
  }
  .ven-chip.chip-atg.active {
    background: color-mix(in srgb, #3d7a52 30%, transparent);
    border-color: color-mix(in srgb, #3d7a52 60%, transparent);
    color: #7ecfa0;
  }

  .mob-sort-tabs {
    display: flex;
    gap: 2px;
    background: var(--color-neutral-900);
    padding: 3px;
    border-radius: var(--radius-md);
    margin: 6px 0 10px;
    overflow-x: auto;
  }
  .mob-sort-tab {
    flex-shrink: 0;
    padding: 5px 12px;
    border-radius: calc(var(--radius-md) - 2px);
    font-size: 12px;
    background: transparent;
    color: color-mix(in srgb, var(--color-text) 60%, transparent);
    font-family: var(--font-body);
    white-space: nowrap;
    text-decoration: none;
    display: inline-block;
  }
  .mob-sort-tab.active {
    background: var(--color-surface);
    color: var(--color-text);
    font-weight: 500;
  }

  .ven-mobile-list { display: block; }
  .ven-mobile-item {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    text-decoration: none;
    color: var(--color-text);
    border-bottom: 1px solid var(--color-divider);
  }
  .ven-mobile-item:last-child { border-bottom: none; }
  .ven-mobile-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .ven-mobile-sub {
    font-size: 12px;
    color: color-mix(in srgb, var(--color-text) 55%, transparent);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
  }
  .ven-mobile-count { text-align: right; flex-shrink: 0; }
  .ven-mobile-count .n { display: block; font-size: 18px; font-weight: 600; line-height: 1.2; }
  .ven-mobile-count .lbl { font-size: 11px; color: color-mix(in srgb, var(--color-text) 50%, transparent); }

  /* Events mobile */
  .evt-mobile-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-divider);
  }
  .evt-mobile-item:last-child { border-bottom: none; }
  .evt-mobile-link {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--color-text);
  }
  .evt-mobile-main {}
  .evt-mobile-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .evt-mobile-sub {
    font-size: 12px;
    color: color-mix(in srgb, var(--color-text) 55%, transparent);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
  }
  .evt-mobile-right { text-align: right; flex-shrink: 0; padding-top: 2px; }
  .evt-mobile-watch-form { display: flex; }
  .evt-mobile-watch-form .evt-watch-btn { width: 100%; justify-content: center; }

  .evt-bar { flex-direction: column; align-items: flex-start; gap: 6px; }
  .sort-tabs { display: none; }

  /* Hide desktop form, show mobile search */
  form#evt-search-form > .ven-search-hero,
  form#perf-search-form > .ven-search-hero,
  form#venue-search-form > .ven-search-hero,
  form#vll-search-form > .ven-search-hero,
  form#vlu-search-form > .ven-search-hero,
  .ven-filters { display: none; }
}

/* ── /ops/cycles — heartbeat card ─────────────────────────────────────── */
.hb-card {
  background: var(--color-surface);
  border-radius: var(--radius-md, 8px);
  border: 1px solid var(--color-divider);
  border-left-width: 3px;
  padding: var(--space-6) var(--space-8);
  margin-bottom: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.hb-card--running   { border-left-color: var(--color-accent); }
.hb-card--completed { border-left-color: var(--color-accent); }
.hb-card--stalled   { border-left-color: var(--color-warn); }
.hb-card--cancelled { border-left-color: var(--color-divider); }
.hb-card--empty     { border-left-color: var(--color-divider); }

.hb-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.hb-verdict__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--space-1);
}
.hb-verdict__status {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
}
.hb-verdict__status--running   { color: var(--color-accent); }
.hb-verdict__status--completed { color: var(--color-accent); }
.hb-verdict__status--stalled   { color: var(--color-warn); }
.hb-verdict__status--cancelled { color: var(--muted); }
.hb-verdict__status--none      { color: var(--muted); }
.hb-header-id {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--font-mono);
  white-space: nowrap;
  padding-top: 4px;
}

.hb-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}
.hb-metric__val {
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.hb-metric__val--ok   { color: var(--color-accent); }
.hb-metric__val--warn { color: var(--color-warn); }
.hb-metric__val--err  { color: var(--color-error-text); }
.hb-metric__val--muted { color: var(--muted); }
.hb-metric__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: var(--space-1);
}

.hb-progress__bar-wrap {
  height: 6px;
  background: var(--color-divider);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: var(--space-2);
}
.hb-progress__bar {
  height: 100%;
  border-radius: 99px;
  background: var(--color-accent);
  transition: width .4s ease;
}
.hb-progress__bar--stalled { background: var(--color-warn); }
.hb-progress__meta {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.hb-progress__meta span { white-space: nowrap; }

.hb-actions {
  display: flex;
  gap: var(--space-4);
  align-items: center;
  flex-wrap: wrap;
}

/* History section header */
.cycles-history-head {
  display: flex;
  align-items: baseline;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.cycles-history-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}
.toggle-all {
  font-size: 12px;
  color: var(--color-accent);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
}
.toggle-all:hover { text-decoration: underline; }

/* Compact history table */
.cycle-hist {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.cycle-hist th {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-divider);
}
.cycle-hist th.num { text-align: right; }
.cycle-hist td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-divider);
  vertical-align: middle;
}
.cycle-hist td.num { text-align: right; font-variant-numeric: tabular-nums; }
.cycle-hist tbody tr:hover { background: color-mix(in srgb, var(--color-text) 4%, transparent); }
.cycle-hist tbody tr:last-child td { border-bottom: 0; }

/* Mini progress bar in history rows */
.prog-cell {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  justify-content: flex-end;
}
.prog-bar-mini {
  width: 48px;
  height: 4px;
  background: var(--color-divider);
  border-radius: 99px;
  overflow: hidden;
  flex-shrink: 0;
}
.prog-bar-mini__fill {
  height: 100%;
  border-radius: 99px;
  background: var(--color-accent);
}
.prog-bar-mini__fill--stalled { background: var(--color-warn); }

@media (max-width: 640px) {
  .hb-card { padding: var(--space-4) var(--space-6); gap: var(--space-4); }
  .hb-metrics { grid-template-columns: repeat(2, 1fr); }
  .hb-metric__val { font-size: 20px; }
  .hb-verdict__status { font-size: 24px; }
  .cycle-hist .col-ts,
  .cycle-hist .col-dur { display: none; }
}

/* ================================================================
   Cookie pool page  (/ops/cookies)
   ================================================================ */

.cp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
}
.cp-header-left h4 { margin: 0 0 var(--space-1); }
.cp-header-left p  { margin: 0; font-size: 13px; color: color-mix(in srgb, var(--color-text) 55%, transparent); }

.cp-summary {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
  padding: var(--space-4) var(--space-6);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-divider);
}
.cp-summary-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 13px;
  padding-right: var(--space-6);
  border-right: 1px solid var(--color-divider);
}
.cp-summary-item:last-child { border-right: none; padding-right: 0; }
.cp-summary-platform { font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--color-text); min-width: 100px; }
.cp-summary-counts { color: color-mix(in srgb, var(--color-text) 65%, transparent); }
.cp-summary-counts .cnt-active  { color: var(--color-accent); font-weight: 600; }
.cp-summary-counts .cnt-failing { color: var(--color-error-text); font-weight: 600; }
.cp-summary-counts .cnt-zero    { color: color-mix(in srgb, var(--color-text) 35%, transparent); }

.cp-filters {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.cp-filter-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.cp-filter-label {
  font-size: 12px;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
  min-width: 54px;
  flex-shrink: 0;
}
.cp-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--color-divider);
  background: transparent;
  color: color-mix(in srgb, var(--color-text) 70%, transparent);
  cursor: pointer;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  white-space: nowrap;
  line-height: 1;
}
.cp-chip:hover { background: color-mix(in srgb, var(--color-text) 6%, transparent); }
.cp-chip.active {
  background: var(--color-accent-800);
  color: var(--color-accent-100);
  border-color: var(--color-accent-700);
}

.cp-rowcount {
  font-size: 12px;
  color: color-mix(in srgb, var(--color-text) 45%, transparent);
  margin-bottom: var(--space-3);
}

.cp-table { width: 100%; border-collapse: collapse; }
.cp-table th {
  text-align: left;
  padding: var(--space-2) var(--space-4);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--color-text) 45%, transparent);
  border-bottom: 1px solid var(--color-divider);
}
.cp-table td {
  padding: var(--space-3) var(--space-4);
  font-size: 13px;
  border-bottom: 1px solid color-mix(in srgb, var(--color-divider) 60%, transparent);
  vertical-align: middle;
}
.cp-table tr:last-child td { border-bottom: none; }
.cp-table .col-platform { font-family: var(--font-mono); font-size: 12px; }
.cp-table .col-actions { text-align: right; white-space: nowrap; }
.cp-table .col-num { text-align: right; font-variant-numeric: tabular-nums; }
.cp-table .col-size { text-align: right; font-size: 12px; color: color-mix(in srgb, var(--color-text) 55%, transparent); }

.btn-copy {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-divider);
  background: transparent;
  color: color-mix(in srgb, var(--color-text) 75%, transparent);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  white-space: nowrap;
}
.btn-copy:hover { background: color-mix(in srgb, var(--color-text) 8%, transparent); }
.btn-copy.copied {
  background: var(--color-accent-800);
  color: var(--color-accent-100);
  border-color: var(--color-accent-700);
}

.rotate-confirm {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.cp-empty {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: color-mix(in srgb, var(--color-text) 45%, transparent);
  font-size: 14px;
}

@media (max-width: 640px) {
  .cp-summary {
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-4);
  }
  .cp-summary-item {
    border-right: none;
    padding-right: 0;
    border-bottom: 1px solid var(--color-divider);
    padding-bottom: var(--space-2);
  }
  .cp-summary-item:last-child { border-bottom: none; padding-bottom: 0; }

  .cp-filters { gap: var(--space-2); }
  .cp-filter-row { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .cp-filter-row::-webkit-scrollbar { display: none; }

  .cp-table-wrap { display: none; }
  .cp-cards { display: block; }

  .cp-card {
    background: var(--color-surface);
    border: 1px solid var(--color-divider);
    border-radius: var(--radius-md);
    padding: var(--space-4) var(--space-6);
    margin-bottom: var(--space-3);
  }
  .cp-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-2);
  }
  .cp-card-platform { font-family: var(--font-mono); font-size: 14px; font-weight: 600; }
  .cp-card-meta {
    font-size: 12px;
    color: color-mix(in srgb, var(--color-text) 55%, transparent);
    margin-bottom: var(--space-4);
  }
  .cp-card-actions { display: flex; gap: var(--space-3); align-items: center; }
  .btn-copy-mobile {
    flex: 1;
    padding: 10px var(--space-4);
    font-size: 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-divider);
    background: transparent;
    color: var(--color-text);
    cursor: pointer;
    text-align: center;
    transition: background 0.1s;
  }
  .btn-copy-mobile:hover, .btn-copy-mobile:active { background: color-mix(in srgb, var(--color-text) 8%, transparent); }
  .btn-copy-mobile.copied {
    background: var(--color-accent-800);
    color: var(--color-accent-100);
    border-color: var(--color-accent-700);
  }
  .btn-rotate-mobile {
    padding: 10px var(--space-4);
    font-size: 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-error-border);
    background: var(--color-error-surface);
    color: var(--color-error-text);
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.1s;
  }
}

@media (min-width: 641px) {
  .cp-cards { display: none; }
  .cp-table-wrap { display: block; }
}

/* ================================================================
   Proxies page  (/ops/proxies)  — also shared import panel styles
   ================================================================ */

.pp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
}
.pp-header-title h4 { margin: 0; font-size: 20px; font-weight: 500; }
.pp-header-title p  { margin: var(--space-1) 0 0; font-size: 13px; color: color-mix(in srgb, var(--color-text) 55%, transparent); }
.pp-header-actions  { display: flex; gap: var(--space-3); align-items: center; flex-shrink: 0; }

.pp-summary {
  font-size: 13px;
  color: color-mix(in srgb, var(--color-text) 70%, transparent);
  margin-bottom: var(--space-6);
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  align-items: center;
}
.pp-summary-stat { display: flex; align-items: center; gap: var(--space-2); }
.pp-summary-dot  { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.pp-summary-dot--active   { background: var(--color-accent); }
.pp-summary-dot--failing  { background: var(--color-error-text); }
.pp-summary-dot--disabled { background: var(--color-neutral-600); }

.pp-filters {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}
@media (max-width: 640px) {
  .pp-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: var(--space-2);
  }
  .pp-filters::-webkit-scrollbar { display: none; }
}
.pp-chip {
  padding: var(--space-2) var(--space-4);
  border-radius: 99px;
  border: 1px solid var(--color-divider);
  background: transparent;
  color: color-mix(in srgb, var(--color-text) 65%, transparent);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.pp-chip[aria-pressed="true"],
.pp-chip.active {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: color-mix(in srgb, var(--color-accent) 10%, transparent);
}
.pp-chip:hover:not([aria-pressed="true"]):not(.active) {
  border-color: color-mix(in srgb, var(--color-text) 30%, transparent);
  color: var(--color-text);
}

/* — import panel (shared between cookies + proxies) — */
.pp-import-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
}
.pp-import-panel h6 { margin: 0; font-size: 14px; font-weight: 500; }
.pp-import-textarea {
  width: 100%;
  min-height: 120px;
  background: var(--color-bg);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: var(--space-3) var(--space-4);
  resize: vertical;
  box-sizing: border-box;
}
.pp-import-textarea:focus { outline: none; border-color: var(--color-accent); }
.pp-import-hint    { font-size: 12px; color: color-mix(in srgb, var(--color-text) 50%, transparent); margin: var(--space-2) 0 0; }
.pp-import-actions { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; margin-top: var(--space-4); }
.pp-import-note    { font-size: 12px; color: color-mix(in srgb, var(--color-text) 50%, transparent); }
.pp-import-tabs    { display: flex; border-bottom: 1px solid var(--color-divider); margin-bottom: var(--space-4); }
.pp-import-tab {
  padding: var(--space-2) var(--space-4);
  font-size: 13px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: color-mix(in srgb, var(--color-text) 60%, transparent);
  cursor: pointer;
  margin-bottom: -1px;
}
.pp-import-tab[aria-selected="true"] { color: var(--color-text); border-bottom-color: var(--color-accent); }
.pp-import-dropzone {
  border: 1.5px dashed var(--color-divider);
  border-radius: var(--radius-md);
  padding: var(--space-8) var(--space-6);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s;
}
.pp-import-dropzone:hover, .pp-import-dropzone.drag-over { border-color: var(--color-accent); }
.pp-import-dropzone input[type="file"] { display: none; }
.pp-import-dropzone-label { font-size: 13px; color: color-mix(in srgb, var(--color-text) 65%, transparent); }
.pp-import-dropzone-label strong { color: var(--color-accent); cursor: pointer; }
.pp-import-file-chosen { font-size: 13px; color: var(--color-text); margin-top: var(--space-3); }

.pp-probe-cell    { white-space: nowrap; }
.pp-probe-result  { margin-left: var(--space-2); font-size: 12px; }

.pp-delete-confirm {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 13px;
}
.pp-delete-confirm span { color: color-mix(in srgb, var(--color-text) 60%, transparent); white-space: nowrap; }

.pp-card-list { display: none; }

@media (max-width: 640px) {
  .pp-table-wrap { display: none; }
  .pp-card-list  { display: flex; flex-direction: column; gap: var(--space-3); }
}

.pp-card {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-6);
}
.pp-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}
.pp-card-id   { font-family: var(--font-mono); font-size: 12px; color: color-mix(in srgb, var(--color-text) 45%, transparent); }
.pp-card-host { font-family: var(--font-mono); font-size: 14px; font-weight: 500; word-break: break-all; }
.pp-card-meta {
  font-size: 13px;
  color: color-mix(in srgb, var(--color-text) 60%, transparent);
  margin-bottom: var(--space-4);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
}
.pp-card-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.pp-card-actions .btn { flex: 1; min-width: 72px; text-align: center; justify-content: center; }
.pp-probe-result-mobile { font-size: 12px; margin-top: var(--space-2); }

.pp-empty { text-align: center; padding: 64px var(--space-6); color: color-mix(in srgb, var(--color-text) 50%, transparent); }
.pp-empty h5 { margin: 0 0 var(--space-3); font-size: 16px; font-weight: 400; }
.pp-empty p  { margin: 0 0 var(--space-6); font-size: 14px; }

/* ── Audit feed (team_users + users_edit) ───────────────────────────── */

.audit-feed {
  margin: 0;
}

.audit-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 16px;
  padding: 9px 0;
  border-bottom: 1px solid var(--color-divider);
  font-size: 12.5px;
}
.audit-row:last-child { border-bottom: 0; }
.audit-body { min-width: 0; }
.audit-actor { font-weight: 500; color: var(--color-text); }
.audit-desc { color: var(--muted); }
.audit-time {
  font-size: 11px;
  color: var(--muted-2, color-mix(in srgb, var(--color-text) 35%, transparent));
  white-space: nowrap;
  text-align: right;
  align-self: start;
  padding-top: 2px;
}
.audit-diff {
  font-size: 11.5px;
  font-family: var(--font-mono);
  margin-top: 3px;
}
.audit-diff del {
  color: var(--color-error-text);
  background: var(--color-error-surface);
  padding: 1px 4px;
  border-radius: 3px;
  text-decoration: none;
}
.audit-diff ins {
  color: var(--ok);
  background: var(--ok-bg);
  padding: 1px 4px;
  border-radius: 3px;
  text-decoration: none;
}

/* team_users: activity section spacing */
.team-audit-section { margin-top: var(--space-8, 32px); }

/* ── User edit two-column layout ────────────────────────────────────── */

.user-edit-layout {
  display: grid;
  grid-template-columns: 520px 1fr;
  gap: 0 48px;
  align-items: start;
}
.user-edit-form-col {}
.user-audit-col {}

.user-audit-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 12px;
}
.user-audit-head h6 { margin: 0; }
.user-audit-limit { font-size: 12px; }
.user-audit-empty { font-size: 12.5px; padding: 12px 0; }

.user-account-history {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--color-divider);
}
.user-account-history h6 { margin: 0 0 12px; }

@media (max-width: 960px) {
  .user-edit-layout { grid-template-columns: 1fr; }
  .user-audit-col { margin-top: 32px; }
  .audit-row { grid-template-columns: 1fr; }
  .audit-time { text-align: left; }
}

/* ------------ teams admin ------------ */
.teams-list-header { display: flex; align-items: baseline; gap: 12px; margin-bottom: var(--space-4, 16px); flex-wrap: wrap; }
.teams-list-header h4 { margin: 0; }
.teams-summary-line { font-size: 13px; color: var(--muted); }
.teams-anomalies { color: var(--warn); }
.teams-no-members { color: var(--warn); }
.teams-edit-members { font-size: 12px; color: var(--muted); white-space: nowrap; }
.teams-suspend-warn { font-size: 12px; color: var(--warn); margin: 4px 0 0; }
.teams-next-hint { font-size: 12px; color: var(--muted); margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--color-divider); }
.team-suspended-banner {
  background: color-mix(in srgb, var(--color-warn, #f0a) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-warn, #f0a) 35%, transparent);
  color: var(--warn);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}
.team-suspended-banner a { color: inherit; text-decoration: underline; }
.team-audit-section { margin-top: 36px; }
.team-audit-section h6 { margin: 0 0 12px; }

/* ── /ops/venues/links — queue, linked-venues, unlinked-venues ─────────── */

/* KPI grid: 4 cols desktop, 2×2 phone */
.vl-kpi-grid { grid-template-columns: repeat(4, minmax(130px, 1fr)); }

/* KPI tiles that link to drill-down pages */
.kpi-link { display: block; text-decoration: none; color: inherit; }
.kpi-link:hover .kpi { box-shadow: 0 0 0 1px var(--color-accent); }
.kpi-link:hover .kpi .value { color: var(--color-accent); }

/* Score badge in the triage-queue table */
.vl-score { width: 56px; text-align: center; vertical-align: middle; padding-right: var(--space-4); }
.vl-badge {
  display: inline-block;
  padding: 3px 8px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: .02em;
}
.vl-badge.hi  { background: var(--ok-bg);      color: var(--ok); }
.vl-badge.mid { background: var(--warn-bg);     color: var(--warn); }
.vl-badge.lo  { background: var(--danger-bg);   color: var(--danger); }

/* Venue-pair layout in queue rows */
.vl-pair-cell { vertical-align: middle; }
.vl-pair { display: flex; align-items: flex-start; gap: var(--space-6); flex-wrap: wrap; }
.vl-venue { min-width: 0; flex: 1 1 180px; }
.vl-name {
  font-size: 13.5px; font-weight: 500; color: var(--color-accent);
  text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: block; max-width: 28ch;
}
.vl-name:hover { text-decoration: underline; }
.vl-city { font-size: 12px; color: var(--muted); display: block; margin-top: 1px; }
.vl-ext {
  font-size: 11.5px; color: var(--muted); font-family: var(--font-mono);
  text-decoration: none; margin-top: 2px; display: inline-block;
}
.vl-ext:hover { color: var(--color-accent); }
.vl-divider {
  flex: 0 0 auto; align-self: center; color: var(--muted); font-size: 16px;
  padding: 0 var(--space-2); user-select: none;
}
.vl-features { margin-top: var(--space-3); font-size: 11.5px; color: var(--muted); letter-spacing: .01em; }

/* Action column */
.vl-actions { white-space: nowrap; vertical-align: middle; text-align: right; width: 140px; }
.vl-actions .action-buttons { justify-content: flex-end; }

/* Mobile: queue table as cards */
@media (max-width: 640px) {
  .vl-kpi-grid { grid-template-columns: repeat(2, 1fr) !important; }

  .vl-table, .vl-table tbody, .vl-table tr { display: block; }
  .vl-table thead { display: none; }
  .vl-table tr {
    display: flex; flex-direction: column;
    margin-bottom: 10px; padding: 12px 14px;
    border-radius: var(--radius-md);
    background: var(--color-surface); box-shadow: var(--shadow-sm); gap: 0;
  }
  .vl-table td { display: block; padding: 0; border: none; background: none; width: auto; text-align: left; }
  .vl-table .vl-score { order: 0; display: flex; justify-content: flex-end; padding: 0 0 var(--space-3) 0; width: 100%; }
  .vl-table .vl-pair-cell { order: 1; }
  .vl-pair { flex-direction: column; gap: var(--space-3); }
  .vl-divider { align-self: flex-start; padding-left: 0; font-size: 12px; }
  .vl-venue { flex: 0 0 auto; }
  .vl-name { max-width: none; white-space: normal; }
  .vl-features { margin-top: var(--space-4); word-break: break-word; }
  .vl-table .vl-actions {
    order: 99; text-align: left; width: 100%;
    margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--color-divider);
  }
  .vl-actions .action-buttons { display: flex; gap: 10px; flex-direction: row; width: 100%; }
  .vl-actions .action-buttons > * { flex: 1; }
  .vl-actions .action-buttons button {
    width: 100%; display: block; text-align: center; padding: 11px 0; font-size: 14px;
    border: 1px solid var(--color-divider); border-radius: var(--radius-sm);
  }
  .vl-actions .action-buttons button.editor-danger-btn { border-color: var(--danger); color: var(--danger); }
}

/* Linked-venues page — platform chip strip */
.vll-platforms { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.vll-plat-chip {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .03em;
  border-radius: var(--radius-sm); padding: 2px 6px;
  text-decoration: none; border: none;
}
.vll-plat-chip-vs  { background: color-mix(in srgb, #4f7cac 22%, transparent); color: #7fb3e0; }
.vll-plat-chip-tm  { background: var(--color-accent-800); color: var(--color-accent-200); }
.vll-plat-chip-bw  { background: var(--color-neutral-700); color: var(--color-neutral-100); }
.vll-plat-chip-atg { background: color-mix(in srgb, #3d7a52 40%, transparent); color: #7ecfa0; }
.vll-source-mix { color: var(--muted); }

@media (max-width: 700px) {
  .vll-plat-chip { font-size: 10px; padding: 2px 5px; }
}

/* Unlinked-venues page */
.vlu-count-col { text-align: right; width: 80px; }
.vlu-count { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--color-text); }
.vlu-count.zero { color: var(--muted); font-weight: 400; font-size: 13px; }
.vlu-candidate-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 500;
  color: var(--warn); background: var(--warn-bg);
  padding: 2px 7px; border-radius: var(--radius-sm); white-space: nowrap;
}
.vlu-action-col { text-align: right; width: 100px; }
.vlu-mobile-count .n { color: var(--color-text); }
.vlu-mobile-count .n.zero { color: var(--muted); font-size: 14px; font-weight: 400; }
.vlu-intent {
  background: var(--color-surface); border-radius: var(--radius-md);
  padding: 10px 14px; margin-bottom: 16px;
  font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 10px;
}
.vlu-intent strong { color: var(--color-text); }

@media (max-width: 700px) {
  .vlu-intent { flex-direction: column; align-items: flex-start; gap: 4px; }
}
