/* PKB Group Ads Dashboard — v2 design system
   "The leaderboard, not the spreadsheet." Warm graphite base, one gold accent
   reserved exclusively for marking winners, everything else stays neutral. */

/* Part 57 §8.2 — global fix for the recurring [hidden] specificity bug. Any
   component that sets `display: flex/grid` beats the UA default
   `[hidden] { display: none }` on specificity, so `hidden` fails silently on
   whichever component gets the treatment next. Fourteen per-class overrides
   had accumulated (two with comments saying "same issue already fixed
   elsewhere") — plus the idle-jobstrip artefact behind the Ask AI launcher
   (§8.1) and a left-edge phantom (§8.4). One high-specificity rule closes
   all of them and stops the file from accumulating any more. */
[hidden] { display: none !important; }

@font-face {
  font-family: 'Big Shoulders';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('./fonts/big-shoulders-var.woff2') format('woff2-variations'),
       url('./fonts/big-shoulders-var.woff2') format('woff2');
}

.viz-root {
  color-scheme: light;
  --surface-1:      #fcfaf6;
  --surface-2:      #f3efe7;
  --page-plane:     #f1eee7;
  --text-primary:   #201c16;
  --text-secondary: #5c5648;
  --text-muted:     #8c8575;
  --border:         rgba(20,16,8,0.10);
  --gridline:       rgba(20,16,8,0.08);
  --baseline:       rgba(20,16,8,0.20);

  --accent:         #9c6b00;
  --accent-strong:  #7a5300;
  --accent-ink:     #ffffff;
  --accent-wash:    rgba(156,107,0,0.10);

  /* Part 17 Item 2 — discrete heatmap intensity scale (4 real color stops,
     not one hue at 4 opacity levels): opacity-only steps blend into the
     surface differently in light vs dark mode, so equal alpha jumps don't
     give equal PERCEIVED jumps — hand-picked stops guarantee the same
     "clearly one step darker" read in both themes. --heat-0 (empty) reuses
     --gridline, already themed. */
  --heat-1: #f0e0bb;
  --heat-2: #dcb974;
  --heat-3: #c2933a;
  --heat-4: #9c6b00;

  --neutral-strong: #4a4438;
  --neutral-mid:    #847c6c;
  --neutral-soft:   #c4bcaa;

  /* Categorical identity palette — one color per creative/series, so
     different data actually looks different (validated CVD-safe adjacency
     against this surface, see dataviz skill validator). Gold accent above
     is layered ON TOP of these (a border/badge on the #1 row) to mark rank,
     not used as a substitute for identity color. */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #4a3aa7;
  --series-8: #e34948;
  /* Extended for Item I (Part 3 spec) — re-validated as a 10-slot set via the
     dataviz skill's validator against this exact surface (all checks pass,
     same pre-existing contrast WARN as the original 8, already mitigated by
     direct name labels next to every swatch). Beyond 10 simultaneous
     creatives, dashboard.js falls back to a neutral swatch rather than
     cycling back and re-using a color for a different creative. */
  --series-9: #0a95ab;
  --series-10: #a83fd1;

  --critical:       #b23b27;
  --critical-wash:  rgba(178,59,39,0.10);

  --font-display: 'Big Shoulders', system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", sans-serif;

  /* ---------- Part 44: tokens ---------- */
  --elev-1: 0 1px 2px rgba(20,16,8,0.04), 0 1px 3px rgba(20,16,8,0.06);
  --elev-2: 0 2px 4px rgba(20,16,8,0.05), 0 4px 12px rgba(20,16,8,0.08);
  --elev-3: 0 4px 8px rgba(20,16,8,0.06), 0 12px 28px rgba(20,16,8,0.12);
  --elev-4: 0 8px 16px rgba(20,16,8,0.08), 0 24px 48px rgba(20,16,8,0.16);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-pill: 999px;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .viz-root {
    color-scheme: dark;
    --surface-1:      #201e1b;
    --surface-2:      #29261f;
    --page-plane:     #141210;
    --text-primary:   #f7f4ee;
    --text-secondary: #beb6a8;
    --text-muted:     #8b8377;
    --border:         rgba(255,255,255,0.09);
    --gridline:       rgba(255,255,255,0.07);
    --baseline:       rgba(255,255,255,0.18);

    --accent:         #ffc53d;
    --accent-strong:  #ffd873;
    --accent-ink:     #201400;
    --accent-wash:    rgba(255,197,61,0.12);

    --heat-1: #4a3d1f;
    --heat-2: #7a611f;
    --heat-3: #b8901f;
    --heat-4: #ffc53d;

    --neutral-strong: #c9c0af;
    --neutral-mid:    #948c7c;
    --neutral-soft:   #4a4438;

    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #008300;
    --series-7: #9085e9;
    --series-8: #e66767;
    --series-9: #0090a8;
    --series-10: #c060e0;

    --critical:       #e8604f;
    --critical-wash:  rgba(232,96,79,0.12);

    /* ---------- Part 44: dark elevation ---------- */
    --elev-1: 0 1px 2px rgba(0,0,0,0.20), 0 1px 3px rgba(0,0,0,0.24);
    --elev-2: 0 2px 4px rgba(0,0,0,0.24), 0 4px 12px rgba(0,0,0,0.32);
    --elev-3: 0 4px 8px rgba(0,0,0,0.28), 0 12px 28px rgba(0,0,0,0.40);
    --elev-4: 0 8px 16px rgba(0,0,0,0.32), 0 24px 48px rgba(0,0,0,0.52);
  }
}
:root[data-theme="dark"] .viz-root {
  color-scheme: dark;
  --surface-1:      #201e1b;
  --surface-2:      #29261f;
  --page-plane:     #141210;
  --text-primary:   #f7f4ee;
  --text-secondary: #beb6a8;
  --text-muted:     #8b8377;
  --border:         rgba(255,255,255,0.09);
  --gridline:       rgba(255,255,255,0.07);
  --baseline:       rgba(255,255,255,0.18);

  --accent:         #ffc53d;
  --accent-strong:  #ffd873;
  --accent-ink:     #201400;
  --accent-wash:    rgba(255,197,61,0.12);

  --heat-1: #4a3d1f;
  --heat-2: #7a611f;
  --heat-3: #b8901f;
  --heat-4: #ffc53d;

  --neutral-strong: #c9c0af;
  --neutral-mid:    #948c7c;
  --neutral-soft:   #4a4438;

  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-7: #9085e9;
  --series-8: #e66767;
  --series-9: #0090a8;
  --series-10: #c060e0;

  --critical:       #e8604f;
  --critical-wash:  rgba(232,96,79,0.12);

  /* ---------- Part 44: dark elevation ---------- */
  --elev-1: 0 1px 2px rgba(0,0,0,0.20), 0 1px 3px rgba(0,0,0,0.24);
  --elev-2: 0 2px 4px rgba(0,0,0,0.24), 0 4px 12px rgba(0,0,0,0.32);
  --elev-3: 0 4px 8px rgba(0,0,0,0.28), 0 12px 28px rgba(0,0,0,0.40);
  --elev-4: 0 8px 16px rgba(0,0,0,0.32), 0 24px 48px rgba(0,0,0,0.52);
}

* { box-sizing: border-box; }

body.viz-root {
  margin: 0;
  min-height: 100vh;
  background: var(--page-plane);
  color: var(--text-primary);
  font-family: var(--font-body);
}

a { color: var(--text-primary); }
.muted { color: var(--text-secondary); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

.eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
}

/* ---------- Login ---------- */
.login-body { display: flex; align-items: center; justify-content: center; }
.login-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px;
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-card h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  letter-spacing: 0.01em;
  margin: 0;
}
.login-card input {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--page-plane);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
}
.login-card button {
  padding: 10px 12px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.login-card button:hover { background: var(--accent-strong); }
.login-card .error { color: var(--critical); font-size: 13px; margin: 0; }

/* ---------- Client picker ---------- */
.page-header {
  display: flex;
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
}
.page-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 960px;
}
.page-header h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.01em;
  margin: 0;
}
.logout-link { font-size: 13px; color: var(--text-secondary); text-decoration: none; }
.logout-link:hover { text-decoration: underline; }

.client-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  padding: 28px;
  max-width: 960px;
}
.client-card {
  display: block;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease;
}
.client-card:hover { border-color: var(--accent); }
.client-card h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  margin: 0 0 6px;
}
.client-card--stub { opacity: 0.7; }

/* ---------- Dashboard shell ---------- */
.dash-header {
  display: flex;
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
}
.dash-header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
}
.dash-header h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.01em;
  margin: 0;
}
.dash-header .back-link { font-size: 13px; text-decoration: none; color: var(--text-secondary); }
.dash-meta { font-size: 12px; color: var(--text-muted); }

.range-select {
  display: flex;
  gap: 4px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
}
.range-select button {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.range-select button.active {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.range-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* ---------- Date range picker (Part 8 Item B) ---------- */
.date-range-picker { position: relative; }
.drp-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.drp-trigger:hover { border-color: var(--accent); }
.date-range-picker.drp-open .drp-trigger { border-color: var(--accent); color: var(--accent); }
.drp-trigger-icon { color: var(--text-muted); flex-shrink: 0; }

/**
 * Part 12 Item 2 — `position: fixed` (not `absolute`) so left/top set by
 * date-range-picker.js's positionPopover() are plain viewport pixels from
 * getBoundingClientRect(), matching this element's own coordinate space
 * exactly — no ancestor-offset math, no anchor-toggle guessing. JS sets
 * left/top inline on open and on every re-render/resize; top/left here are
 * just an unclamped fallback for the instant before JS runs.
 */
.drp-popover {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  width: 300px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(20,16,8,0.18);
  padding: 14px;
}
:root[data-theme="dark"] .drp-popover { box-shadow: 0 12px 32px rgba(0,0,0,0.45); }
@media (prefers-color-scheme: dark) {
  .drp-popover { box-shadow: 0 12px 32px rgba(0,0,0,0.45); }
}
.drp-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.drp-month-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.01em;
}
.drp-nav-btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-secondary);
  width: 26px;
  height: 26px;
  border-radius: 6px;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.drp-nav-btn:hover:not(:disabled) { color: var(--text-primary); border-color: var(--accent); }
.drp-nav-btn:disabled { opacity: 0.35; cursor: default; }

.drp-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 2px;
}
.drp-weekdays span {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 0;
}

.drp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.drp-day {
  position: relative;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  aspect-ratio: 1;
  border-radius: 6px;
  cursor: pointer;
}
.drp-day--empty { cursor: default; }
.drp-day:hover:not(:disabled) { background: var(--surface-2); }
.drp-day:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.drp-day--disabled { color: var(--text-muted); opacity: 0.35; cursor: default; }
.drp-day--today { font-weight: 700; }
.drp-day--in-range { background: var(--accent-wash); border-radius: 0; }
.drp-day--selected { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.drp-day--start.drp-day--in-range,
.drp-day--start { border-radius: 6px 0 0 6px; }
.drp-day--end { border-radius: 0 6px 6px 0; }
.drp-day--start.drp-day--end { border-radius: 6px; }

.drp-summary {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  min-height: 16px;
}
.drp-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.drp-btn {
  border: none;
  background: var(--surface-2);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}
.drp-btn:hover { color: var(--text-primary); }
.drp-btn--primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.drp-btn--primary:hover { background: var(--accent-strong); color: var(--accent-ink); }
.drp-btn--primary:disabled { opacity: 0.45; cursor: default; }

/**
 * Part 12 Item 2.3 — genuine full-screen modal on mobile, not a cramped
 * dropdown (the old version was a bottom sheet with no max-height/scroll
 * guard, so a 6-row month could still overflow off the top of a short
 * viewport). date-range-picker.js's positionPopover() explicitly no-ops
 * under this same breakpoint, leaving positioning entirely to this rule —
 * every left/top set inline by JS is irrelevant here (inset:0 wins).
 */
@media (max-width: 560px) {
  .drp-popover {
    position: fixed;
    inset: 0;
    left: 0 !important;
    top: 0 !important;
    width: auto;
    max-width: none;
    border-radius: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow-y: auto;
  }
  .drp-popover .drp-grid { flex-shrink: 0; }
}
/* [hidden] handled by the global rule at the top of the file (Part 57 §8.2). */

.drp-popover { animation: drp-fade-in 0.12s ease-out; }
@keyframes drp-fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.show-more-btn {
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  width: 100%;
}
.show-more-btn:hover { color: var(--text-primary); border-color: var(--neutral-mid); }

main.dash-body {
  padding: 24px 28px 64px;
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

section.dash-section h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  font-weight: 600;
  margin: 0 0 12px;
}

.section-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-head-row h2 { margin: 0 0 12px; }

/* ---------- Winner hero — the signature element ---------- */
.winner-hero {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-left: 5px solid var(--accent);
  border-radius: 14px;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow 0.2s ease;
}
.winner-hero .eyebrow { color: var(--accent); display: flex; align-items: center; gap: 6px; }
.winner-hero .winner-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(24px, 4vw, 38px);
  line-height: 1.05;
  margin: 0;
  letter-spacing: 0.01em;
}
.winner-hero .winner-why {
  font-size: 15px;
  color: var(--text-secondary);
}
.winner-hero .winner-why strong { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.winner-hero .winner-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 8px;
}
.winner-hero .winner-stats .stat { display: flex; flex-direction: column; gap: 2px; }
.winner-hero .winner-stats .stat .label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.winner-hero .winner-stats .stat .value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}
.winner-video-why {
  font-size: 14px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}
.winner-video-why .hookhold { margin-top: 6px; }
.winner-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 10px;
}
.winner-note--caveat { color: var(--accent); }

/* ---------- Part 36: AI Brain "why this wins" in the Winner Hero ---------- */
.ai-why {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.ai-why-eyebrow { font-size: 11px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: 0.03em; }
.ai-why-pattern { font-family: var(--font-display); font-weight: 600; font-size: 13px; margin-top: 2px; }
.ai-why-evidence { font-size: 12px; color: var(--text-secondary); margin-top: 4px; line-height: 1.4; }
.ai-why-ideas { margin-top: 8px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ai-why-ideas-label { font-size: 11px; color: var(--text-muted); }
.ai-why-idea-chip { font-size: 11px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; }
.ai-why-open-link { font-size: 11px; color: var(--accent); text-decoration: none; margin-left: auto; }
.ai-why-open-link:hover { text-decoration: underline; }
/* flex-shrink: 0 — added beyond spec: sits inside .top5-name-wrap (a flex
   container alongside .name, which DOES shrink/truncate) so a long pattern
   name never gets squeezed instead of the ad name it's labeling. */
.ai-why-tag { flex-shrink: 0; font-size: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px; color: var(--text-secondary); cursor: default; }

.top5-list {
  display: flex;
  flex-direction: column;
  margin-top: 14px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.top5-row {
  display: grid;
  grid-template-columns: 22px 12px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  font-size: 13px;
}
.top5-row .rank { font-family: var(--font-display); font-weight: 700; color: var(--text-muted); text-align: center; }
.top5-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.top5-row .stat { font-variant-numeric: tabular-nums; color: var(--text-secondary); font-size: 12px; text-align: right; }
.top5-row .stat strong { color: var(--text-primary); font-weight: 600; }
/* Part 36 — .ai-why-tag is conditionally rendered per row (only rows with
   pattern evidence get one), so it can't be a direct .top5-row grid child:
   that would leave rows without it one grid item short, misaligning every
   .stat column against rows that DO have it. Wrapping .name + the optional
   tag in a flex container that occupies the single grid-template-columns
   "name" slot (1fr) keeps the grid at a constant 5 items on every row. */
.top5-name-wrap { display: flex; align-items: center; gap: 6px; min-width: 0; }
.top5-name-wrap .name { flex-shrink: 1; }

.format-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 3px 8px;
  border-radius: 100px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: fit-content;
}
.format-badge--video { color: var(--text-primary); border-color: var(--neutral-mid); }
/* PATCH GIF-FORMAT-01 — GIF badge uses a dashed border so it reads distinctly
   from video at a glance while sharing the same neutral tint. */
.format-badge--gif { color: var(--text-primary); border-color: var(--neutral-mid); border-style: dashed; }

/* ---------- Part 7: recency tag, status badge, landing-page month select, WoW deltas ---------- */
.recency-tag { font-size: 11px; color: var(--text-muted); }
.recency-tag--new { color: var(--accent); font-weight: 600; }

.status-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 3px 8px;
  border-radius: 100px;
  width: fit-content;
}
.status-badge--active { color: var(--series-3); background: rgba(27,175,122,0.12); }
.status-badge--paused { color: var(--text-muted); background: var(--surface-2); }

.ad-count-note { font-size: 12px; color: var(--text-muted); }

.avg-watch-time { font-size: 13px; color: var(--text-secondary); margin-top: 6px; }

.lp-month-select { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--text-secondary); }
/* [hidden] handled by the global rule at the top of the file (Part 57 §8.2). */
.lp-month-select select {
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
  border-radius: 6px;
  padding: 5px 8px;
  font-family: inherit;
  font-size: 13px;
}

.wow-delta { font-size: 11px; margin-left: 6px; white-space: nowrap; }
.wow-delta--good { color: var(--series-3); }
.wow-delta--bad { color: var(--critical); }
.wow-delta--flat { color: var(--text-muted); }
.wow-tag {
  display: inline-block;
  margin-left: 8px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 7px;
  border-radius: 100px;
}
.wow-tag--best { color: var(--series-3); background: rgba(27,175,122,0.12); }
.wow-tag--worst { color: var(--critical); background: var(--critical-wash); }

/* ---------- Overview strip ---------- */
.overview-strip {
  display: flex;
  flex-wrap: wrap;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.overview-strip .unit {
  flex: 1 1 140px;
  padding: 16px 20px;
  border-right: 1px solid var(--border);
}
.overview-strip .unit:last-child { border-right: none; }
.overview-strip .unit .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.overview-strip .unit .value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  font-variant-numeric: tabular-nums;
}

/* Legacy 3-card stat row, still used in funnel section */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.stat-tile {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}
.stat-tile .label { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.stat-tile .value { font-family: var(--font-display); font-weight: 700; font-size: 26px; font-variant-numeric: tabular-nums; }

/* Chart card */
.chart-card {
  position: relative;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
}
.chart-card h3 { font-size: 13px; margin: 0 0 12px; color: var(--text-secondary); font-weight: 500; padding-right: 28px; }
.chart-card canvas { max-width: 100%; }

/* PATCH CHART-MOTION-01 — first-paint entrance. Applied once via a class the
   JS adds on initial render only; subsequent range changes tween the chart
   data instead (see chart-engine updateLineChart) and must NOT re-run this. */
@keyframes chart-card-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.chart-card--enter {
  animation: chart-card-in 0.42s var(--ease-spring) both;
}
.chart-grid .chart-card--enter:nth-child(1) { animation-delay: 0ms; }
.chart-grid .chart-card--enter:nth-child(2) { animation-delay: 60ms; }
.chart-grid .chart-card--enter:nth-child(3) { animation-delay: 120ms; }
.chart-grid .chart-card--enter:nth-child(4) { animation-delay: 180ms; }
.chart-grid .chart-card--enter:nth-child(5) { animation-delay: 240ms; }
.chart-grid .chart-card--enter:nth-child(6) { animation-delay: 300ms; }

.chart-grid {
  display: grid;
  /* min(420px, 100%) — not a bare 420px — so the minimum never exceeds the
     viewport itself. A bare 420px here forced every chart-card wider than a
     390px mobile viewport, causing page-level horizontal scroll (confirmed:
     document scrollWidth 448 vs a 390px viewport before this fix). */
  grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
  gap: 16px;
}

/* Combined reach & engagement module — two mini panels, one visual unit */
.combo-chart-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
}
.combo-chart-card h3 { font-size: 13px; margin: 0 0 12px; color: var(--text-secondary); font-weight: 500; }
.combo-chart-card .combo-panels { display: flex; flex-direction: column; }
.combo-chart-card .combo-panels canvas { max-width: 100%; }
.combo-chart-card .combo-panel-top { margin-bottom: -4px; }

/* ---------- Creative leaderboard ---------- */
.leaderboard-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  width: fit-content;
  margin-bottom: 14px;
}
.leaderboard-tabs button {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.leaderboard-tabs button.active {
  background: var(--surface-1);
  color: var(--text-primary);
  font-weight: 600;
}

.leaderboard { display: flex; flex-direction: column; gap: 8px; }
/* [hidden] handled by the global rule at the top of the file. */
/**
 * Part 12 Item 1 — mobile-first flexbox card, not a fixed-column grid.
 * The old grid declared exactly 4 columns (`40px 40px 1fr auto`) but the
 * row markup renders 5 children on ad tabs (checkbox, rank, thumbnail,
 * main, numbers) and only 4 on By-Landing-Page (no checkbox — landing pages
 * aren't individually selectable for compare mode) — a real mismatch that
 * left the checkbox falling into unpredictable implicit grid placement.
 * Flexbox sidesteps this entirely: items just flow in whatever order is
 * actually present, present-or-absent, no column count to keep in sync with
 * the markup. `flex-wrap` also means the numbers block naturally drops to
 * its own full-width line on narrow viewports without a separate
 * grid-template-columns re-declaration at the breakpoint (the old mobile
 * override rewrote the template outright — a sign the base layout wasn't
 * actually mobile-first).
 */
.leaderboard-row {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px 14px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}
.leaderboard-row--winner {
  border-color: var(--accent);
  background: linear-gradient(to right, var(--accent-wash), var(--surface-1) 40%);
}
.leaderboard-row .compare-checkbox { flex: 0 0 auto; margin-top: 11px; }
.leaderboard-rank {
  flex: 0 0 28px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  color: var(--neutral-mid);
  text-align: center;
  margin-top: 6px;
}
.leaderboard-row--winner .leaderboard-rank { color: var(--accent); }
.rank-change {
  display: block;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-body);
  margin-top: 2px;
}
.rank-change--up { color: var(--series-3); }
.rank-change--down { color: var(--critical); }
.rank-change--steady { color: var(--text-muted); }
.rank-change--new { color: var(--accent); font-size: 9px; letter-spacing: 0.02em; }

.leaderboard-main { flex: 1 1 260px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.leaderboard-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.creative-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}
.leaderboard-name {
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.efficiency-bar-track {
  height: 6px;
  border-radius: 100px;
  background: var(--gridline);
  overflow: hidden;
  max-width: 320px;
}
.efficiency-bar-fill {
  height: 100%;
  border-radius: 100px;
  background: var(--neutral-mid);
}
.leaderboard-row--winner .efficiency-bar-fill { background: var(--accent); }

/* Hook/Hold — printed %, account-average baseline tick, optional verdict (Part 4) */
.hookhold {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  max-width: 260px;
}
.hookhold .hh-row { display: flex; align-items: center; gap: 8px; }
.hookhold .hh-label { width: 30px; flex-shrink: 0; }
.hookhold .hh-bar-track {
  position: relative;
  flex: 1;
  min-width: 48px;
  height: 7px;
  border-radius: 100px;
  background: var(--gridline);
}
.hookhold .hh-bar-fill {
  display: inline-block;
  height: 100%;
  min-width: 3px;
  background: var(--neutral-strong);
  border-radius: 100px;
}
.hookhold .hh-baseline-tick {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  background: var(--text-primary);
  opacity: 0.45;
  transform: translateX(-50%);
}
.hookhold .hh-value {
  width: 36px;
  flex-shrink: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  font-weight: 600;
}
.hh-verdict {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
}
.winner-video-why .hh-verdict { font-size: 14px; color: var(--text-primary); font-weight: 500; }

/* Expand toggle for leaderboard rows — click/tap reveals the verdict + retention detail */
.leaderboard-expand-toggle {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 0;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.leaderboard-expand-toggle:hover { color: var(--text-primary); }
.leaderboard-expand-detail {
  grid-column: 1 / -1;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--gridline);
}

/* Part 17 Items 4 & 5 — compact row (Currently Active section, and a
 * landing-page row's expanded ad breakdown): same visual language as
 * .leaderboard-row, minus the rank/checkbox/sparkline chrome, so it reads
 * as "the same leaderboard" rather than a different component. */
.leaderboard-row--compact { padding: 10px 14px; }
.leaderboard--compact { gap: 6px; }
.lp-expand-toggle {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 0;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.lp-expand-toggle:hover { color: var(--text-primary); }
.lp-expand-detail {
  grid-column: 1 / -1;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--gridline);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* "Why did this page win?" — visual language matches .ai-why (Part 36):
   same surface-2 card, same accent eyebrow-less trigger, so it reads as
   one consistent "AI explanation" pattern across the dashboard rather than
   a new one-off look. */
.lp-why { margin-top: 10px; }
.lp-why-trigger {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-secondary);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}
.lp-why-trigger:hover:not(:disabled) { color: var(--text-primary); border-color: var(--accent); }
.lp-why-trigger:disabled { opacity: 0.6; cursor: default; }
.lp-why-result {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 8px;
  border: 1px solid var(--border);
}
/* [hidden] handled by the global rule at the top of the file. */
.lp-why-text { font-size: 12px; color: var(--text-secondary); line-height: 1.5; white-space: pre-wrap; }
.lp-why-loading { font-size: 12px; color: var(--text-muted); }
.lp-why-error { font-size: 12px; color: var(--critical-ink, var(--critical)); }
.lp-why-caveat { font-size: 11px; color: var(--accent); margin-top: 6px; }

/* Retention curve mini-chart — 4 bars (25/50/75/100%), CSS only, no extra canvas */
.retention-curve { display: flex; align-items: flex-end; gap: 8px; height: 48px; margin-top: 4px; }
.retention-curve .rc-bar-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 36px; }
.retention-curve .rc-bar-track { width: 14px; height: 36px; border-radius: 4px; background: var(--gridline); display: flex; align-items: flex-end; overflow: hidden; }
.retention-curve .rc-bar-fill { width: 100%; background: var(--neutral-strong); border-radius: 4px 4px 0 0; }
.retention-curve .rc-label { font-size: 10px; color: var(--text-muted); }

/* Creative thumbnails (Part 4) */
.creative-thumb {
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-2);
  flex-shrink: 0;
  cursor: pointer;
  border: 1px solid var(--border);
}
.creative-thumb--hero { width: 80px; height: 80px; }
.creative-thumb--row { width: 76px; height: 76px; } /* Part 12 Item 1 — up from 40px; Part 28 — up again from 64px per S's request */
.creative-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  flex-shrink: 0;
  font-size: 18px;
}
.creative-thumb-placeholder.creative-thumb--hero { font-size: 26px; }
.creative-thumb[data-ad-id], .creative-thumb-placeholder[data-ad-id] { cursor: pointer; }
.creative-thumb[data-ad-id]:focus-visible, .creative-thumb-placeholder[data-ad-id]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.winner-hero-top { display: flex; align-items: flex-start; gap: 16px; }
.winner-hero-top .winner-hero-body { flex: 1; min-width: 0; }


.leaderboard-numbers {
  flex: 1 1 240px;
  display: grid;
  grid-template-columns: repeat(4, minmax(56px, 1fr));
  gap: 4px 18px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}
.leaderboard-numbers .num-item .label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  display: block;
}
.leaderboard-numbers .num-item .value { font-weight: 600; }

@media (max-width: 720px) {
  /* Part 12 Item 1 — same flexbox structure as desktop, just tighter gaps
     and a full-width numbers block, not a different column template. */
  .leaderboard-row { gap: 8px 10px; }
  .leaderboard-numbers { flex-basis: 100%; grid-template-columns: repeat(2, 1fr); text-align: left; margin-top: 4px; }
  .leaderboard-rank { flex-basis: 20px; font-size: 16px; }
  .leaderboard-row .compare-checkbox { margin-top: 8px; }

  /* Part 4 — thumbnails/hero shrink to fit narrow viewports instead of forcing
     horizontal scroll or overflow. Part 12 — row thumbnail bumped from
     32px to 48px (still meaningfully smaller than desktop's 64px). */
  .creative-thumb--hero, .creative-thumb-placeholder.creative-thumb--hero { width: 64px; height: 64px; font-size: 22px; }
  .creative-thumb--row, .creative-thumb-placeholder:not(.creative-thumb--hero) { width: 56px; height: 56px; font-size: 19px; }
  .winner-hero-top { gap: 12px; }
  .hookhold { max-width: none; }
}

/* Tables (WoW table keeps this) */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-1); }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 500px; }
table.data-table th, table.data-table td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--gridline);
  white-space: nowrap;
}
table.data-table th {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
table.data-table td.num, table.data-table th.num { font-variant-numeric: tabular-nums; text-align: right; }
table.data-table tbody tr:last-child td { border-bottom: none; }
table.data-table tbody tr:hover { background: var(--page-plane); }

/* Changelog */
.changelog-list { display: flex; flex-direction: column; gap: 10px; }
.changelog-entry { display: flex; gap: 12px; font-size: 13px; padding: 10px 0; border-bottom: 1px solid var(--gridline); }
.changelog-entry:last-child { border-bottom: none; }
.changelog-entry .date { color: var(--text-muted); min-width: 90px; font-variant-numeric: tabular-nums; }
.changelog-entry .channel {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-secondary);
  min-width: 70px;
  font-weight: 600;
}

/* ---------- Calm state callouts (info / disabled / error) ---------- */
.callout {
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 13px;
  line-height: 1.5;
}
.callout--info {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-secondary);
}
.callout--error {
  border: 1px solid var(--critical);
  background: var(--critical-wash);
  color: var(--text-primary);
}
.callout--warning {
  border: 1px solid var(--accent);
  background: var(--accent-wash);
  color: var(--text-primary);
}
.callout code {
  background: var(--page-plane);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}
/* Legacy alias so any un-migrated markup still reads sanely */
.banner { border-radius: 12px; padding: 14px 18px; font-size: 13px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-secondary); }

/* Admin form */
.admin-form {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 480px;
}
.admin-form label { font-size: 12px; color: var(--text-secondary); }
.admin-form input, .admin-form select, .admin-form textarea {
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--page-plane);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
}
.admin-form button {
  padding: 10px 12px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.admin-form button:hover { background: var(--accent-strong); }
.admin-form .success { color: var(--text-primary); font-size: 13px; }

/* ---------- Part 21: AI Brain pilot ---------- */
.status-badge--queued { color: var(--text-muted); background: var(--surface-2); }
.status-badge--processing { color: var(--accent); background: var(--accent-wash); }
.status-badge--done { color: var(--series-3); background: rgba(27,175,122,0.12); }
.status-badge--error { color: var(--critical); background: var(--critical-wash); }

/* ---- Part 22: feature card (dashboard entry point) ---- */
.feature-card {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 20px 24px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.feature-card-title { font-size: 18px; margin: 0 0 4px; }
.feature-card-desc { font-size: 14px; color: var(--text-secondary); margin: 0 0 8px; max-width: 60ch; }
.feature-card-status { font-size: 13px; color: var(--text-muted); margin: 0; }
.feature-card-cta {
  flex: 0 0 auto;
  display: inline-flex; align-items: center;
  padding: 10px 18px; border-radius: 8px;
  background: var(--text-primary); color: var(--surface-1);
  font-size: 14px; font-weight: 600; text-decoration: none;
}
.feature-card-cta:hover { background: var(--accent-strong); color: var(--accent-ink); }
.feature-card-cta:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Part 22 §17: Currently Active collapse — reuses .show-more-btn as-is ---- */
.active-creatives-more { margin-top: 10px; }

/* ---- Part 23: pattern scorecard (verdict pane) — color discipline
   unchanged from Part 22 §3: series-3/series-2/critical, gold stays
   reserved for winners. ---- */
.ai-brain-scorecard { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 24px; }
.ai-brain-scorecard-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 14px; border-radius: 10px; background: var(--surface-2);
}
.ai-brain-scorecard-icon { flex: 0 0 auto; font-size: 15px; line-height: 1.5; }
.ai-brain-scorecard-icon[data-status="present"] { color: var(--series-3); }
.ai-brain-scorecard-icon[data-status="partial"] { color: var(--series-2); }
.ai-brain-scorecard-icon[data-status="absent"]  { color: var(--critical); }
.ai-brain-scorecard-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ai-brain-scorecard-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.ai-brain-scorecard-evidence { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.ai-brain-scorecard-unavailable { font-size: 13px; color: var(--text-muted); margin: 8px 0 24px; }

/* ---- forecast strip ---- */
.ai-brain-forecast { margin: 0 0 24px; padding: 16px 20px; border-radius: 10px; background: var(--surface-2); }
.ai-brain-forecast-score { font-size: 15px; font-weight: 600; color: var(--text-primary); margin: 0 0 6px; }
.ai-brain-forecast-ranges { font-size: 13px; color: var(--text-secondary); margin: 0 0 4px; }
.ai-brain-forecast-confidence {
  display: inline-block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); border: 1px solid var(--border); border-radius: 100px;
  padding: 2px 8px; margin-top: 2px;
}
.ai-brain-forecast-cold { font-size: 13px; color: var(--text-muted); margin: 0; }

/* ---- beats timeline ---- */
.ai-brain-beats { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 24px; }
.ai-brain-beat { display: flex; gap: 12px; }
.ai-brain-beat-time {
  flex: 0 0 auto; width: 92px; font-size: 12px; font-variant-numeric: tabular-nums;
  color: var(--text-muted); padding-top: 2px;
}
.ai-brain-beat-body { flex: 1; min-width: 0; }
.ai-brain-beat-label {
  display: inline-block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted); margin-bottom: 2px;
}
.ai-brain-beat-what { font-size: 14px; color: var(--text-primary); line-height: 1.5; margin: 0; }

/* ---- strengths / risks two-column ---- */
.ai-brain-sr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 8px 0 24px; }
.ai-brain-sr-col ul { margin: 6px 0 0; padding-left: 20px; font-size: 14px; line-height: 1.6; }
.ai-brain-sr-col li { margin-bottom: 6px; }

/* ---- fix-these-N-things, priority + why ---- */
.ai-brain-fix-why { display: block; font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

@media (max-width: 900px) {
  .ai-brain-sr-grid { grid-template-columns: 1fr; gap: 4px; }
}

/* ---- Part 23: Pattern Library page (admin/ai-brain-patterns.php) ---- */
.ai-brain-patterns-body { max-width: 900px; }
.ai-brain-pattern-card {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px 20px; margin-bottom: 14px;
}
/* Part 24 §3 — rule is now the headline (the instruction someone can act on
   immediately), name is a small reference label beneath it, proof sits
   behind a collapsed evidence toggle. */
.ai-brain-pattern-card-rule {
  font-size: 17px; font-weight: 700; line-height: 1.4; color: var(--text-primary);
  margin: 0 0 6px;
}
.ai-brain-pattern-card-name {
  font-size: 12px; font-weight: 500; color: var(--text-muted); margin: 0 0 12px;
}
.ai-brain-pattern-card-evidence-toggle {
  border: none; background: none; padding: 0; font-family: inherit; font-size: 12px;
  color: var(--accent); text-decoration: underline; cursor: pointer;
}
.ai-brain-pattern-card-evidence-toggle:hover { color: var(--accent-strong); }
.ai-brain-pattern-card-evidence { margin-top: 10px; }
.ai-brain-pattern-card-evidence p { font-size: 13px; color: var(--text-secondary); margin: 0; line-height: 1.5; }

/* ---- Part 25 §3b: pattern-card evidence thumbnails — small row of tiles
   that turn an abstract rule into something visibly grounded. ---- */
.ai-brain-pattern-card-evidence-thumbs { display: flex; gap: 6px; margin: 0 0 10px; flex-wrap: wrap; }
.creative-thumb--evidence,
.creative-thumb-placeholder.creative-thumb--evidence { width: 44px; height: 44px; font-size: 14px; cursor: default; }
.creative-thumb--source,
.creative-thumb-placeholder.creative-thumb--source { width: 48px; height: 48px; font-size: 16px; cursor: default; }

/* ---- Part 25 §1b: adoption strip — 10 dots, honest about what's actually
   measured (present / scored-but-absent / not-yet-scored are 3 distinct
   states, never conflated). Colour band on the wrapper, read by dot fill via
   currentColor so there's one source of truth per band. ---- */
.ai-brain-pattern-adoption { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; flex-wrap: wrap; }
.ai-brain-pattern-adoption--unmeasured { font-size: 12px; color: var(--text-muted); margin: 0 0 10px; }
.ai-brain-adoption-dots { display: flex; gap: 3px; }
.ai-brain-adoption-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gridline); display: inline-block; }
.ai-brain-pattern-adoption[data-band="low"] .ai-brain-adoption-dot.is-present { background: var(--critical); }
.ai-brain-pattern-adoption[data-band="mid"] .ai-brain-adoption-dot.is-present { background: var(--series-2); }
.ai-brain-pattern-adoption[data-band="high"] .ai-brain-adoption-dot.is-present { background: var(--series-3); }
.ai-brain-adoption-dot.is-absent { background: var(--border); }
.ai-brain-adoption-dot.is-unscored { background: var(--gridline); opacity: 0.4; }
.ai-brain-adoption-label { font-size: 12px; color: var(--text-secondary); }

/* ---- Part 25 §2: per-pattern performance rollup — real numbers, no AI ---- */
.ai-brain-pattern-card-rollup { font-size: 12px; color: var(--text-muted); margin: 0 0 10px; line-height: 1.5; }

/* ---- §5: "Built from these creatives" — heading + one-line explainer are
   always visible (no expanding needed); only the actual row list sits
   behind a collapsed disclosure, so it's supporting material that doesn't
   compete visually with the pattern cards above it. ---- */
.ai-brain-source-header { margin: 20px 0 0; }
.ai-brain-source-header h2 { margin: 0 0 4px; }
.ai-brain-source-explainer { margin: 0 0 10px; }
.ai-brain-source-panel { margin: 0 0 24px; padding: 4px 0; }
.ai-brain-source-panel summary {
  cursor: pointer; font-size: 12px; color: var(--accent);
  text-decoration: underline; padding: 4px 0; list-style: revert;
}
.ai-brain-source-panel summary:hover { color: var(--accent-strong); }
.ai-brain-source-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 0; }
.ai-brain-source-row {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 13px; padding: 8px 12px; background: var(--surface-2); border-radius: 8px;
}
.ai-brain-source-row-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.ai-brain-source-row-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ai-brain-source-name { color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-brain-source-stats { color: var(--text-muted); flex: 0 0 auto; }
.ai-brain-source-evidence { color: var(--text-secondary); margin: 0; line-height: 1.5; }

/* ---- §6: pattern-library / concepts version history ---- */
.ai-brain-history-panel { margin: 0 0 24px; }
.ai-brain-history-panel > summary {
  cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text-primary);
  padding: 8px 0; list-style: revert;
}
.ai-brain-history-version {
  margin: 10px 0 0 4px; padding: 12px 16px; background: var(--surface-1);
  border: 1px solid var(--border); border-radius: 10px;
}
.ai-brain-history-version summary {
  cursor: pointer; font-size: 13px; color: var(--text-primary); list-style: revert;
}
.ai-brain-history-active-badge {
  display: inline-block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--series-3); border: 1px solid var(--series-3); border-radius: 100px;
  padding: 1px 8px; margin-left: 8px;
}
.ai-brain-history-cards { margin-top: 12px; }
.ai-brain-history-cards .ai-brain-pattern-card,
.ai-brain-history-cards .ai-brain-idea-card { background: var(--surface-2); }
.ai-brain-history-actions { display: flex; gap: 10px; margin-top: 10px; }
.ai-brain-history-restore, .ai-brain-history-delete {
  font-family: inherit; font-size: 12px; padding: 6px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-1); color: var(--text-secondary);
  cursor: pointer;
}
.ai-brain-history-restore:hover:not(:disabled) { color: var(--text-primary); border-color: var(--neutral-mid); }
.ai-brain-history-restore:disabled { opacity: 0.5; cursor: default; }
.ai-brain-history-delete:hover { color: var(--critical); border-color: var(--critical); }
.ai-brain-rebuild-panel {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px 24px; margin-bottom: 24px;
}
/* Part 25 §4 item 5 — rebuild panel is now a <details>, collapsed by
   default (it's monthly maintenance, not a per-visit action); its <summary>
   carries the same visual weight the old plain <h2> had. */
details.ai-brain-rebuild-panel > summary {
  cursor: pointer; font-size: 18px; font-weight: 700; color: var(--text-primary);
  list-style: revert;
}
details.ai-brain-rebuild-panel[open] > summary { margin-bottom: 12px; }

/* ---- Part 25 §1c: adoption sort toolbar ---- */
.ai-brain-pattern-cards-toolbar { display: flex; justify-content: flex-end; margin: 0 0 10px; }
.ai-brain-pattern-cards-toolbar button {
  font-family: inherit; font-size: 12px; padding: 6px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-1); color: var(--text-secondary);
  cursor: pointer;
}
.ai-brain-pattern-cards-toolbar button:hover { color: var(--text-primary); border-color: var(--neutral-mid); }

/* ---- Part 25 §4 item 1: action strip — reuses .stat-row/.stat-tile, adds a
   critical variant for "under-used" (the headline number) and clickable
   link tiles that jump to the relevant section. ---- */
.ai-brain-action-strip { margin: 0 0 24px; }
a.ai-brain-action-tile { text-decoration: none; display: block; transition: border-color .15s; }
a.ai-brain-action-tile:hover { border-color: var(--neutral-mid); }
.ai-brain-action-tile--critical { border-color: var(--critical); }
.ai-brain-action-tile--critical .value { color: var(--critical); }
.ai-brain-action-tile-value--compact { font-size: 14px; font-weight: 600; line-height: 1.4; font-variant-numeric: tabular-nums; }

/* ---- Part 25 §0: dismissable legacy-Chinese notice ---- */
.callout.ai-brain-dismissable { position: relative; padding-right: 40px; }
.ai-brain-notice-dismiss {
  position: absolute; top: 10px; right: 10px; width: 24px; height: 24px;
  border: none; background: none; color: var(--text-muted); font-size: 18px;
  line-height: 1; cursor: pointer; border-radius: 6px;
}
.ai-brain-notice-dismiss:hover { color: var(--text-primary); background: var(--surface-2); }
.ai-brain-target-list { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.ai-brain-target-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  background: var(--surface-2); border-radius: 10px; flex-wrap: wrap;
}
.ai-brain-target-meta { flex: 1 1 220px; min-width: 0; }
.ai-brain-target-name {
  font-size: 13px; color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block;
}
.ai-brain-target-stats { font-size: 12px; color: var(--text-muted); }

/* ---- Hotfix #2: per-row upload state (sequential per-file uploads) ---- */
.ai-brain-target-upload { display: flex; align-items: center; gap: 10px; flex: 1 1 220px; flex-wrap: wrap; }
.ai-brain-target-file-input { max-width: 220px; font-size: 12px; }
.ai-brain-target-progress { flex: 1 1 120px; min-width: 90px; }
.ai-brain-target-row-status { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.ai-brain-target-row[data-status="uploaded"] .ai-brain-target-row-status { color: var(--series-3); font-weight: 600; }
.ai-brain-target-row[data-status="error"] .ai-brain-target-row-status { color: var(--critical); }
.ai-brain-target-row[data-status="uploading"] { opacity: 0.85; }

.ai-brain-idea-card {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px 20px; margin-bottom: 14px;
}
.ai-brain-idea-title {
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .04em; margin: 0 0 6px;
}
.ai-brain-idea-hook {
  font-family: 'Big Shoulders', system-ui, sans-serif; font-size: 22px; font-weight: 700;
  color: var(--text-primary); margin: 0 0 10px; line-height: 1.25;
}
.ai-brain-idea-card h4 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); margin: 14px 0 4px;
}
.ai-brain-idea-card p, .ai-brain-idea-card li { font-size: 13px; line-height: 1.6; color: var(--text-primary); margin: 0; }
.ai-brain-idea-card ul, .ai-brain-idea-card ol { margin: 4px 0 0; padding-left: 18px; }
.ai-brain-patterns-nav-link { font-size: 13px; text-decoration: none; color: var(--text-secondary); }
.ai-brain-patterns-nav-link:hover { color: var(--text-primary); }

@media (max-width: 900px) {
  .ai-brain-target-row { flex-direction: column; align-items: stretch; }
}

/* ==========================================================================
   Part 26 — weekly brief layout (admin/ai-brain-patterns.php rebuild)
   ========================================================================== */

/* ========== Part 51: AI Brain v3 (abx-) ==========
   Single contiguous block. No hex values — tokens only. New `abx-` namespace
   so a surviving legacy rule cannot reach the new markup. See spec §10.
   ------------------------------------------------------------------------ */

.abx-body { background: var(--page-plane); }

/* Part 51 Patch 1 §1 — one shared column for the whole page. */
.abx-col { width: 100%; max-width: 720px; margin: 0 auto; padding-inline: 16px; box-sizing: border-box; }
.abx-header-inner { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; }
.abx-daterow-inner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Part 51 Patch 1 §2 — single sticky parent; both bands render static. */
.abx-topbar { position: sticky; top: 0; z-index: 20; background: var(--page-plane); }

.abx-header { position: static; background: transparent; border-bottom: 1px solid var(--border); }
.abx-h1 { font-family: var(--font-display); font-size: 30px; font-weight: 700; line-height: 1.1; margin: 0; }
.abx-sub { font-size: 13px; color: var(--text-secondary); margin: 4px 0 0; }
.abx-batch-line { font-size: 12px; color: var(--text-secondary); margin: 6px 0 0; border-top: 3px solid var(--neutral-strong); padding-top: 6px; }

.abx-daterow { position: static; padding-block: 10px; background: transparent; border-bottom: 1px solid var(--border); }
.abx-presets { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; }
.abx-preset { min-height: 44px; padding: 8px 14px; border-radius: 100px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-secondary); font-size: 13px; font-weight: 500; cursor: pointer; }
.abx-preset.is-active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.abx-preset:disabled { opacity: 0.5; cursor: default; }
.abx-range-btn { margin-left: auto; min-height: 44px; padding: 8px 14px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-secondary); font-size: 13px; cursor: pointer; }
.abx-range-clamped { flex-basis: 100%; font-size: 12px; color: var(--critical); margin: 4px 0 0; }
@media (prefers-reduced-motion: no-preference) {
  .abx-preset { transition: background-color 120ms ease-out, color 120ms ease-out; }
}

.abx-main { padding-block: 20px 80px; }
@media (prefers-reduced-motion: no-preference) {
  #abx-list-wrap { transition: opacity 120ms ease-out; }
}

.abx-stale { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 7px; margin: 0 0 16px; font-size: 13px; }
.abx-stale--quiet { background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--neutral-mid); }
.abx-stale--critical { background: var(--critical-wash); border: 1px solid var(--critical); }
.abx-stale a { color: var(--text-primary); font-weight: 600; text-decoration: none; margin-left: auto; }

.abx-list { border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: var(--surface-1); box-shadow: var(--elev-1); }
.abx-row + .abx-row { border-top: 1px solid var(--border); }
.abx-row-head { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas:
  "n title chev"
  "n from  chev"; align-items: center; column-gap: 12px; row-gap: 2px;
  width: 100%; padding: 14px 16px; min-height: 68px; text-align: left;
  background: transparent; border: none; cursor: pointer; color: var(--text-primary); }
.abx-row-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.abx-row-n { grid-area: n; font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--text-muted); line-height: 1; padding-right: 6px; }
.abx-row.is-open .abx-row-n { color: var(--accent); }
.abx-row-title { grid-area: title; font-family: var(--font-display); font-size: 21px; font-weight: 600; line-height: 1.2; }
.abx-row-from { grid-area: from; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); overflow: hidden; }
.abx-row-from-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.abx-from-thumb { width: 22px; height: 22px; border-radius: 4px; flex: 0 0 auto; object-fit: cover; }
.abx-from-thumb.creative-thumb-placeholder { background: var(--surface-2); display: inline-block; }
.abx-row-chev { grid-area: chev; font-size: 20px; color: var(--text-muted); }
@media (prefers-reduced-motion: no-preference) {
  .abx-row-chev { transition: transform 180ms ease-out; display: inline-block; }
}
.abx-row.is-open .abx-row-chev { transform: rotate(90deg); }

.abx-row-body { display: grid; grid-template-rows: 0fr; }
@media (prefers-reduced-motion: no-preference) {
  .abx-row-body { transition: grid-template-rows 200ms ease-out; }
}
.abx-row.is-open .abx-row-body { grid-template-rows: 1fr; }
.abx-row-body-inner { overflow: hidden; }
.abx-row.is-open .abx-row-body-inner { padding: 8px 16px 20px; }

.abx-block { margin: 12px 0; }
.abx-block-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.abx-block-h { margin: 0; font-size: 10.5px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-muted); }

.abx-say-line { background: var(--accent-wash); border-left: 3px solid var(--accent); padding: 12px 14px; margin: 0;
  font-size: 16px; line-height: 1.55; border-radius: 0 7px 7px 0; color: var(--text-primary); }

.abx-beats { list-style: none; padding: 0; margin: 0; display: grid; row-gap: 6px; }
.abx-beat { display: grid; grid-template-columns: 58px 1fr; column-gap: 10px; font-size: 13.5px; line-height: 1.55; }
.abx-beat-time { font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 500; color: var(--text-muted); }
.abx-beat-text { color: var(--text-primary); }

.abx-watch { background: var(--surface-2); border-radius: 7px; padding: 12px 14px; }
.abx-watch-body { display: grid; grid-template-columns: 104px 1fr; gap: 12px; align-items: start; }
.abx-watch-thumb { width: 104px; height: 104px; border-radius: 6px; object-fit: cover; }
.abx-watch-thumb.creative-thumb-placeholder { background: var(--surface-1); display: block; }
.abx-watch-name { font-size: 13px; color: var(--text-muted); margin: 0 0 4px; overflow: hidden; text-overflow: ellipsis; }
.abx-watch-stat { font-size: 15px; font-weight: 600; color: var(--accent-strong); margin: 0 0 6px; }
.abx-watch-desc { font-size: 13.5px; line-height: 1.55; color: var(--text-primary); margin: 0 0 8px; }
.abx-openad { font-size: 13px; color: var(--text-primary); text-decoration: none; font-weight: 600; }
.abx-openad:hover { color: var(--accent-strong); }
@media (max-width: 560px) {
  .abx-watch-body { grid-template-columns: 1fr; }
  .abx-watch-thumb { width: 100%; height: 150px; }
}

.abx-aim { background: var(--surface-2); border-radius: 7px; padding: 10px 14px; font-size: 13px; color: var(--text-secondary); margin: 12px 0; }

.abx-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.abx-btn { min-height: 44px; padding: 9px 14px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-primary); font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.abx-btn:hover { border-color: var(--accent); }
.abx-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.abx-btn--primary { background: var(--text-primary); color: var(--surface-1); border-color: var(--text-primary); }
.abx-btn:disabled { opacity: 0.5; cursor: default; }
.abx-btn.is-copied { color: var(--accent-strong); }

.abx-variations { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.abx-variation { background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px; padding: 10px 12px; }
.abx-variation-title { font-size: 14px; font-weight: 600; margin: 0 0 4px; }
.abx-variation-hook { font-size: 13.5px; margin: 0; color: var(--text-secondary); }

.abx-jobstrip { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 7px;
  background: var(--surface-2); font-size: 13px; margin-top: 10px; }
.abx-jobstrip--global { position: fixed; bottom: 88px; right: 24px; z-index: 1250; box-shadow: var(--elev-3); }
@media (max-width: 640px) {
  .abx-jobstrip--global { left: 12px; right: 12px; bottom: 88px; }
}
.abx-jobstrip-icon { width: 12px; height: 12px; border-radius: 50%; background: var(--neutral-mid); flex: 0 0 auto; }
.abx-jobstrip[data-state="run"] .abx-jobstrip-icon { background: var(--accent); }
.abx-jobstrip[data-state="done"] .abx-jobstrip-icon { background: var(--accent-strong); }
.abx-jobstrip[data-state="fail"] .abx-jobstrip-icon { background: var(--critical); }
.abx-jobstrip-msg { flex: 1 1 auto; }
.abx-jobstrip-timer { font-variant-numeric: tabular-nums; color: var(--text-muted); }
@media (prefers-reduced-motion: no-preference) {
  .abx-jobstrip[data-state="run"] .abx-jobstrip-icon { animation: abx-spin 900ms linear infinite; }
}
@keyframes abx-spin { to { transform: rotate(360deg); } }

.abx-section-label { font-size: 11px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-muted); margin: 28px 0 10px; }
.abx-winning { margin-top: 32px; }
.abx-win-list { border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: var(--surface-1); }
.abx-win-row + .abx-win-row { border-top: 1px solid var(--border); }
.abx-win-row { display: grid; grid-template-columns: 46px 1fr auto; column-gap: 12px; padding: 12px 14px; align-items: center; }
.abx-win-thumb { width: 46px; height: 46px; border-radius: 4px; object-fit: cover; }
.abx-win-thumb.creative-thumb-placeholder { background: var(--surface-2); display: block; }
.abx-win-desc { font-size: 13.5px; margin: 0; color: var(--text-primary); }
.abx-win-name { font-size: 12px; color: var(--text-muted); margin: 2px 0 0; }
.abx-noideas-tag { display: inline-block; margin-top: 4px; font-size: 11px; color: var(--text-muted); border: 1px solid var(--border); border-radius: 100px; padding: 1px 8px; }
.abx-win-cpa { text-align: right; }
.abx-win-cpa-val { display: block; font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--accent); }
.abx-win-cpa-lbl { font-size: 11px; color: var(--text-muted); }
@media (max-width: 560px) {
  .abx-win-cpa { display: none; }
}

.abx-batches { margin-top: 24px; }
.abx-batches summary { font-size: 13px; color: var(--text-muted); cursor: pointer; }
.abx-batches ul { list-style: none; padding: 8px 0 0; margin: 0; }
.abx-batches a { font-size: 13px; color: var(--text-secondary); text-decoration: none; }
.abx-batches a:hover { color: var(--text-primary); }

.abx-state { background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 44px 20px; text-align: center; }
.abx-state-h { font-family: var(--font-display); font-size: 20px; margin: 0 0 8px; }
.abx-state-p { font-size: 14px; line-height: 1.55; color: var(--text-secondary); max-width: 340px; margin: 0 auto 16px; }
.abx-state-action { min-height: 44px; }

.abx-inline-error { background: var(--critical-wash); border: 1px solid var(--critical); color: var(--text-primary); padding: 10px 12px; border-radius: 7px; margin-bottom: 12px; font-size: 13px; }

@media (max-width: 560px) {
  .abx-row-title { font-size: 19px; }
  .abx-daterow { padding-block: 10px; }
  .abx-range-btn { flex-basis: 100%; margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .abx-row-chev, .abx-row-body, .abx-preset, #abx-list-wrap, .abx-jobstrip-icon { transition: none !important; animation: none !important; }
}

/* Batches selector — replaces the retired <details> disclosure. */
.abx-batches { display: flex; align-items: center; gap: 8px; margin-block: 20px; }
.abx-batches-label { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--text-muted); }
.abx-batches-select { min-height: 44px; padding: 6px 10px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface-1); color: var(--text-primary); font-size: 13px; }
.abx-batches-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Part 55 §2.4 — Check-an-ad modal removed. The header slot is now used by
   the §3.3 Ask AI entry; the modal CSS is intentionally deleted. */

/* ---------- Home: Monthly Report entry — deliberately NOT another
   client-card in the client-grid, so it reads as a separate tool sharing
   the page shell, not a bolted-on extra client (spec Part 5B). ---------- */
.home-section-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 28px;
  margin: 8px 0 -4px;
}
.monthly-report-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 20px 28px 8px;
  max-width: 904px;
  background: var(--surface-1);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 20px 24px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease;
}
.monthly-report-entry:hover { border-color: var(--accent-strong); }
.monthly-report-entry h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  margin: 0 0 4px;
}
.monthly-report-entry .muted { font-size: 13px; }
.monthly-report-entry .arrow { font-size: 22px; color: var(--accent); flex-shrink: 0; }

/* ---------- Monthly Report page ---------- */
.mr-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.mr-tabs button {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.02em;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 12px 18px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s ease;
}
.mr-tabs button:hover { color: var(--text-primary); }
.mr-tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }

.mr-panel { display: none; }
.mr-panel.active { display: block; }

.mr-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.mr-kpi-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  position: relative;
}
.mr-kpi-badge {
  position: absolute; top: 14px; right: 14px;
  font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--accent-wash); color: var(--accent);
  padding: 3px 8px; border-radius: 4px;
}
.mr-kpi-card .label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.mr-kpi-card .value { font-family: var(--font-display); font-weight: 700; font-size: 24px; font-variant-numeric: tabular-nums; color: var(--text-primary); }
.mr-kpi-card .sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.mr-compare-selector {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px; font-size: 12px; color: var(--text-muted);
}
.mr-compare-selector select {
  padding: 7px 10px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--page-plane); color: var(--text-primary); font-size: 13px;
}
.mr-compare-selector .vs { color: var(--accent); font-weight: 700; font-size: 11px; letter-spacing: 0.06em; }

.mr-compare-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 32px;
}
.mr-compare-col {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}
.mr-compare-col.wins { border-top: 2px solid var(--series-3); }
.mr-compare-col.watch { border-top: 2px solid var(--critical); }
.mr-compare-head {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 12px; font-weight: 600;
}
.mr-compare-col.wins .mr-compare-head { color: var(--series-3); }
.mr-compare-col.watch .mr-compare-head { color: var(--critical); }
.mr-compare-item {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 8px 0; border-bottom: 1px solid var(--gridline); gap: 10px;
}
.mr-compare-item:last-child { border-bottom: none; }
.mr-compare-item .name { font-size: 13px; }
.mr-compare-item .detail { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.mr-compare-item .delta { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; white-space: nowrap; }
.mr-compare-col.wins .delta { color: var(--series-3); }
.mr-compare-col.watch .delta { color: var(--critical); }
.mr-empty { font-size: 12px; color: var(--text-muted); font-style: italic; }

.mr-delta-chip { font-size: 10px; font-variant-numeric: tabular-nums; }
.mr-delta-chip.good { color: var(--series-3); }
.mr-delta-chip.bad { color: var(--critical); }
.mr-delta-chip.placeholder { visibility: hidden; }
.mr-cell { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
td.mr-empty-cell { color: var(--neutral-soft); font-size: 12px; }
td.mr-overall-col, th.mr-overall-col { background: var(--accent-wash); font-weight: 600; }
td.mr-active-col { background: var(--page-plane); }

.mr-brand-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.mr-brand-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
}
.mr-brand-card h3 { font-family: var(--font-display); font-weight: 700; font-size: 17px; margin: 0 0 2px; }
.mr-brand-card .sub { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 12px; }
.mr-brand-card-row {
  display: flex; justify-content: space-between; padding: 6px 0;
  border-bottom: 1px solid var(--gridline); font-size: 13px;
}
.mr-brand-card-row:last-child { border-bottom: none; }
.mr-brand-card-row .k { color: var(--text-muted); }
.mr-brand-card-row .v { font-weight: 600; font-variant-numeric: tabular-nums; }

.mr-lead { font-weight: 700; }
.mr-lead.good { color: var(--series-3); }
.mr-lead.tie { color: var(--text-muted); font-weight: 400; }
th.mr-brand-a { color: var(--series-1); }
th.mr-brand-b { color: var(--accent); }

/* ---------- Part 6: "This Month's Story" hero, mirroring winner-hero's
   information hierarchy (headline first, everything else in support). ---------- */
.mr-story {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-left: 5px solid var(--accent);
  border-radius: 14px;
  padding: 20px 24px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mr-story-eyebrow {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.mr-story-text {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(18px, 3vw, 26px);
  line-height: 1.25;
  color: var(--text-primary);
}

/* "What Moved" synthesized headline, above the Improved/Declined lists */
.mr-headline { margin-bottom: 16px; }
.mr-headline-text {
  font-size: 15px;
  color: var(--text-primary);
  background: var(--accent-wash);
  border-radius: 10px;
  padding: 12px 16px;
  margin: 0;
}
.mr-headline-text.mr-empty {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text-muted);
  font-style: italic;
}

/* ---------- Part 10: deeper Acuity analytics (funnel section) ---------- */
.funnel-note { font-size: 12px; color: var(--text-muted); margin: 4px 0 20px; }
.funnel-subsection { margin-top: 24px; }
.funnel-subsection h3 { margin-bottom: 10px; }
.funnel-subnote { font-size: 12px; font-weight: 400; color: var(--text-muted); }

.proportion-bar {
  display: flex;
  height: 14px;
  border-radius: 100px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.proportion-segment { height: 100%; }
.proportion-segment--new { background: var(--series-3); }
.proportion-segment--returning { background: var(--series-1); }
.proportion-segment--unknown { background: var(--neutral-mid); }

.heatmap-caption { font-size: 12px; color: var(--text-secondary); margin: 0 0 10px; }
.heatmap-scroll { overflow-x: auto; padding-bottom: 4px; }
.heatmap-grid {
  display: grid;
  grid-template-columns: 44px repeat(24, minmax(26px, 1fr));
  gap: 2px;
  width: max-content;
  min-width: 100%;
}
.heatmap-corner { }
.heatmap-hour-label, .heatmap-day-label {
  font-size: 10px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Part 17 Item 1 — every hour still gets its own gridline (so the grid
   stays 24 real columns, unambiguous), but only every 3rd is LABELED
   (12am/3am/6am/... ), matching the spec's "lighter gridlines at the
   unlabeled columns" — the label text itself is just empty for those,
   still occupying its column so nothing shifts. */
.heatmap-hour-label--minor { color: var(--gridline); font-size: 14px; }
.heatmap-day-label { justify-content: flex-start; padding-right: 4px; }
.heatmap-cell {
  aspect-ratio: 1;
  min-width: 26px;
  border-radius: 3px;
  background: var(--gridline);
  box-shadow: inset 0 0 0 1px var(--border);
}
.heatmap-cell.heat-1 { background: var(--heat-1); }
.heatmap-cell.heat-2 { background: var(--heat-2); }
.heatmap-cell.heat-3 { background: var(--heat-3); }
.heatmap-cell.heat-4 { background: var(--heat-4); }

/* ---------- Part 17 Item 2: shared heatmap intensity legend ---------- */
.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  margin: 8px 0 0;
}
.heatmap-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px var(--border);
  background: var(--gridline);
}
.heatmap-legend-swatch.heat-1 { background: var(--heat-1); }
.heatmap-legend-swatch.heat-2 { background: var(--heat-2); }
.heatmap-legend-swatch.heat-3 { background: var(--heat-3); }
.heatmap-legend-swatch.heat-4 { background: var(--heat-4); }

/* ---------- Part 11 Item 1: anomaly alert banners ---------- */
.anomaly-alerts { display: flex; flex-direction: column; gap: 8px; margin: 0 28px 4px; max-width: 904px; }
.anomaly-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--critical);
  background: var(--critical-wash);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.5;
}
.anomaly-icon { color: var(--critical); flex-shrink: 0; }
.anomaly-text { flex: 1; }
.anomaly-dismiss {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
}
.anomaly-dismiss:hover { color: var(--text-primary); }

/* ---------- Part 20 §4: stale-data banner ---------- */
/* Client dashboards use .dash-body's centered 1180px column, not
   index.php's narrower left-aligned 960px scheme that .anomaly-alerts was
   originally sized for. */
.dash-anomaly-alerts { max-width: 1180px; margin: 0 auto 4px; padding: 0 28px; box-sizing: border-box; }
/* Calm/informational, not the red "something broke" tone of a real anomaly —
   this is a heads-up about timing, not a metric spike. */
.stale-data-banner { border-color: var(--accent); background: var(--accent-wash); }
.stale-data-banner .anomaly-icon { color: var(--accent); }

/* ---------- Part 11 Item 7: general CSV/PNG export ---------- */
.chart-export-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 24px;
  height: 24px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-secondary);
  border-radius: 6px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}
.chart-export-btn:hover { color: var(--text-primary); border-color: var(--accent); }

.table-export-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-secondary);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}
.table-export-btn:hover { color: var(--text-primary); border-color: var(--accent); }

/* ---------- Part 11 Item 4: ad-level notes ---------- */
.note-indicator {
  border: none;
  background: transparent;
  color: var(--text-muted);
  opacity: 0.35;
  font-size: 13px;
  cursor: pointer;
  padding: 2px;
  line-height: 1;
}
/* Part 16 Item 2 — matches .row-share-btn/.tag-editor-btn's hover exactly
   (opacity 0.9 + color var(--text-primary)); this one previously stopped at
   opacity 0.8 with no color change, a visible mismatch among three icons
   that sit in the same row. */
.note-indicator:hover { opacity: 0.9; color: var(--text-primary); }
.note-indicator--has-note { opacity: 1; color: var(--accent); }

.notes-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,8,4,0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.notes-modal-overlay.open { display: flex; }
.notes-modal {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  width: min(90vw, 420px);
}
.notes-modal h3 { margin: 0 0 12px; font-size: 15px; }
.notes-modal textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 10px;
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
  box-sizing: border-box;
}
.notes-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

/* ---------- Part 11 Item 5: compare mode ---------- */
.compare-checkbox { align-self: flex-start; margin-top: 6px; width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.compare-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--accent-wash);
  border: 1px solid var(--accent);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-primary);
}
/* [hidden] handled by the global rule at the top of the file (Part 57 §8.2). */
.compare-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,8,4,0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.compare-modal-overlay.open { display: flex; }
.compare-modal {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  width: min(94vw, 1000px);
  max-height: 88vh;
  overflow-y: auto;
}
.compare-modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.compare-modal-header h3 { margin: 0; }
.compare-modal-close { border: none; background: transparent; font-size: 20px; color: var(--text-secondary); cursor: pointer; line-height: 1; }
.compare-modal-close:hover { color: var(--text-primary); }
.compare-modal-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.compare-col { border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.compare-col .creative-thumb, .compare-col .creative-thumb-placeholder { width: 64px; height: 64px; margin-bottom: 10px; }
.compare-col .compare-name { font-family: var(--font-display); font-weight: 700; font-size: 16px; margin: 0 0 10px; }
.compare-col .stat-row { grid-template-columns: 1fr 1fr; margin-bottom: 10px; }

/* ---------- Part 11 Item 3: shareable creative card export ---------- */
.row-share-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  opacity: 0.35;
  font-size: 13px;
  cursor: pointer;
  padding: 2px;
  line-height: 1;
}
.row-share-btn:hover { opacity: 0.9; color: var(--text-primary); }

/* ---------- Part 11 Item 6: quick-jump search ---------- */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,8,4,0.55);
  display: none;
  align-items: flex-start;
  justify-content: center;
  z-index: 1100;
  padding: 12vh 20px 20px;
}
.search-overlay.open { display: flex; }
.search-panel {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: min(94vw, 560px);
  max-height: 70vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(20,16,8,0.25);
}
.search-input {
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text-primary);
  padding: 16px 18px;
  font-family: inherit;
  font-size: 15px;
}
.search-input:focus { outline: none; }
.search-results { overflow-y: auto; padding: 6px; }
.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-primary);
}
.search-result-item .search-result-type { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; margin-left: auto; }
.search-result-item.active { background: var(--accent-wash); }
.search-empty { padding: 14px 12px; color: var(--text-muted); font-size: 13px; }
.search-hint { padding: 10px 12px; color: var(--text-muted); font-size: 11px; border-top: 1px solid var(--border); }
.search-highlight { animation: search-flash 2s ease-out; }
@keyframes search-flash {
  0%, 40% { box-shadow: inset 0 0 0 2px var(--accent); }
  100% { box-shadow: inset 0 0 0 2px transparent; }
}

/* ---------- Part 15: language toggle ---------- */
.lang-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}
.lang-toggle-btn {
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface-1);
  text-decoration: none;
  line-height: 1.3;
}
.lang-toggle-btn:hover { color: var(--text-primary); background: var(--surface-2); }
.lang-toggle-btn.active { background: var(--accent); color: var(--accent-ink); }
.lang-toggle-btn + .lang-toggle-btn { border-left: 1px solid var(--border); }

.page-header-actions { display: flex; align-items: center; gap: 14px; }

/* dash-header's .range-controls already positions the lang toggle inline
   with the range picker; login is a centered card with nothing else in its
   header row, so the toggle floats in the page corner instead. */
.login-body .lang-toggle { position: fixed; top: 20px; right: 20px; }

/* ---------- Part 13 Item 3: dark/light theme toggle ---------- */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-1);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}
.theme-toggle-btn:hover { border-color: var(--accent); }
.theme-toggle-icon--sun { display: none; }
:root[data-theme="dark"] .theme-toggle-icon--moon { display: none; }
:root[data-theme="dark"] .theme-toggle-icon--sun { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .theme-toggle-icon--moon { display: none; }
  :root:where(:not([data-theme="light"])) .theme-toggle-icon--sun { display: inline; }
}
.login-body .theme-toggle-btn { position: fixed; top: 20px; right: 106px; }

/* ---------- Part 13 Item 2: Export Center ---------- */
.export-center-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-secondary);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.export-center-btn:hover { color: var(--text-primary); border-color: var(--accent); }
/* [hidden] handled by the global rule at the top of the file. */
.export-center-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10,8,4,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.export-center-panel {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  width: min(94vw, 520px);
  max-height: 88vh;
  overflow-y: auto;
}
.export-center-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.export-center-head h3 { margin: 0; font-family: var(--font-display); font-size: 19px; }
.export-center-close { border: none; background: transparent; font-size: 20px; color: var(--text-secondary); cursor: pointer; line-height: 1; }
.export-center-close:hover { color: var(--text-primary); }
.export-center-help { font-size: 13px; color: var(--text-secondary); margin: 0 0 14px; }
.export-center-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  cursor: pointer;
  border-bottom: 1px solid var(--gridline);
}
.export-center-select-all { border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.export-center-list .export-center-item:last-child { border-bottom: none; }
.export-center-item-label { flex: 1; font-size: 13px; }
.export-center-item-type { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.02em; }
.export-center-error { color: var(--critical); font-size: 13px; margin: 10px 0 0; }
/* [hidden] handled by the global rule at the top of the file. */
.export-center-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* ---------- Part 14: Cross-Brand Insights ---------- */
.xbrand-gap-item {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  background: var(--surface-1);
}
.xbrand-gap-item:last-child { margin-bottom: 0; }
.xbrand-gap-item.good { border-color: var(--series-3); background: rgba(27,175,122,0.08); }
.xbrand-gap-item.watch { border-color: var(--critical); background: var(--critical-wash); }
.xbrand-suggestion-item {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 8px;
  border: 1px solid var(--accent);
  background: var(--accent-wash);
}
.xbrand-suggestion-item:last-child { margin-bottom: 0; }
.xbrand-suggestion-item .xbrand-suggestion-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--accent-strong);
  margin-right: 6px;
}
.xbrand-suggestion-item.possible { border-color: var(--border); background: var(--surface-2); }
.xbrand-suggestion-item.possible .xbrand-suggestion-tag { color: var(--text-muted); }

/* ---------- Part 14: creative tag badges (leaderboard rows) ---------- */
.tag-badge-list { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.tag-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 100px;
  background: var(--neutral-soft);
  color: var(--neutral-strong);
  white-space: nowrap;
}
:root[data-theme="dark"] .tag-badge { background: var(--surface-2); color: var(--text-secondary); }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .tag-badge { background: var(--surface-2); color: var(--text-secondary); }
}
.tag-badge--guessed { border: 1px dashed var(--neutral-mid); background: transparent; color: var(--text-muted); }
.tag-editor-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  opacity: 0.35;
  font-size: 13px;
  cursor: pointer;
  padding: 2px;
  line-height: 1;
}
.tag-editor-btn:hover { opacity: 0.9; color: var(--text-primary); }
.tag-picker-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.tag-picker-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}
.tag-picker-option.selected { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.tag-picker-guessed-note { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.tag-confirm-btn {
  border: 1px solid var(--accent);
  background: var(--accent-wash);
  color: var(--accent-strong);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 10px;
  cursor: pointer;
  margin-left: 4px;
}

/* ---------- Part 16 Item 1: client switcher ---------- */
.client-switcher-select {
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  margin-top: 4px;
  max-width: 160px;
  cursor: pointer;
}
.client-switcher-select:hover { color: var(--text-primary); border-color: var(--accent); }

/* ---------- Part 16 Item 8: funnel shape ---------- */
.funnel-shape { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 14px auto; max-width: 440px; }
.funnel-stage {
  width: 100%;
  padding: 12px 16px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 8px;
  text-align: center;
  box-sizing: border-box;
}
.funnel-stage-value { font-family: var(--font-display); font-weight: 700; font-size: 22px; line-height: 1.1; }
.funnel-stage-label { font-size: 11px; margin-top: 2px; opacity: 0.9; text-transform: uppercase; letter-spacing: 0.03em; }
.funnel-dropoff { font-size: 11px; color: var(--text-muted); }

/* ---------- Part 16 Item 6: changelog markers on trend charts ---------- */
.changelog-marker {
  position: absolute;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  transform: translateY(-100%);
  cursor: pointer;
  z-index: 5;
  outline: none;
}
.changelog-marker::before {
  content: '';
  display: block;
  margin: 0 auto;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 7px solid var(--neutral-mid);
  opacity: 0.5;
}
.changelog-marker:hover::before,
.changelog-marker:focus-visible::before,
.changelog-marker.active::before {
  opacity: 1;
  border-top-color: var(--accent);
}
.changelog-marker-tip {
  display: none;
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 11px;
  color: var(--text-primary);
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 10;
}
.changelog-marker:hover .changelog-marker-tip,
.changelog-marker:focus-visible .changelog-marker-tip,
.changelog-marker.active .changelog-marker-tip {
  display: block;
}

/* ---------- Part 16 Item 4: leaderboard row sparklines ---------- */
.leaderboard-sparklines { display: flex; align-items: center; gap: 14px; margin-top: 2px; }
.sparkline-item { display: flex; align-items: center; gap: 5px; }
.sparkline-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.sparkline { display: block; flex-shrink: 0; opacity: 0.85; }
.sparkline-empty { font-size: 10px; color: var(--text-muted); }

/* ---------- Part 16 Item 7: calendar heatmap ---------- */
.cal-heatmap-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.cal-heatmap-head h3 { margin: 0; }
.cal-heatmap-metric {
  font-family: inherit;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
}
.cal-heatmap-scroll { overflow-x: auto; padding-bottom: 4px; }
.cal-heatmap-wrap { width: max-content; min-width: 100%; }
.cal-heatmap-months { display: grid; gap: 2px; margin-bottom: 2px; }
.cal-heatmap-month-label { font-size: 10px; color: var(--text-muted); }
.cal-heatmap-grid { display: grid; gap: 2px; }
.cal-heatmap-daylabel { font-size: 9px; color: var(--text-muted); display: flex; align-items: center; }
.cal-heatmap-cell {
  width: 13px;
  height: 13px;
  border-radius: 2px;
  background: var(--gridline);
  box-shadow: inset 0 0 0 1px var(--border);
  position: relative;
  cursor: pointer;
  outline: none;
}
.cal-heatmap-cell.heat-1 { background: var(--heat-1); }
.cal-heatmap-cell.heat-2 { background: var(--heat-2); }
.cal-heatmap-cell.heat-3 { background: var(--heat-3); }
.cal-heatmap-cell.heat-4 { background: var(--heat-4); }
.cal-heatmap-cell--outside { background: transparent; box-shadow: none; cursor: default; }
.cal-heatmap-cell:hover, .cal-heatmap-cell:focus-visible, .cal-heatmap-cell.active {
  box-shadow: inset 0 0 0 1.5px var(--text-primary);
}
.cal-heatmap-tip {
  display: none;
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 11px;
  color: var(--text-primary);
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 10;
}
.cal-heatmap-cell:hover .cal-heatmap-tip,
.cal-heatmap-cell:focus-visible .cal-heatmap-tip,
.cal-heatmap-cell.active .cal-heatmap-tip {
  display: block;
}

/* ---------- Part 16 Item 5: scatter view ---------- */
.leaderboard-view-controls { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.view-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}
/* Part 16 Item 2 — this is the same segmented-toggle pattern as
   .lang-toggle-btn (border-radius/border on the container already matched
   it), so its buttons should match that family's rest/hover treatment too:
   surface-1 at rest (not surface-2, which belongs to the separate button/
   select family — .table-export-btn, .client-switcher-select, etc.),
   12px text (was 13px), and an explicit hover background shift. */
.view-toggle button {
  border: none;
  background: var(--surface-1);
  color: var(--text-secondary);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1;
}
.view-toggle button:hover { color: var(--text-primary); background: var(--surface-2); }
.view-toggle button.active { background: var(--accent); color: var(--accent-ink); }
.view-toggle button + button { border-left: 1px solid var(--border); }
.scatter-view { min-height: 420px; position: relative; }
.scatter-view canvas { max-width: 100%; }
.scatter-tooltip {
  position: absolute;
  transform: translate(-50%, calc(-100% - 12px));
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s ease;
  z-index: 20;
  max-width: 240px;
}
.scatter-tooltip-thumb { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.scatter-tooltip-thumb--placeholder { display: flex; align-items: center; justify-content: center; background: var(--surface-2); font-size: 16px; }
.scatter-tooltip-name { font-size: 12px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.scatter-tooltip-line { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.scatter-quadrant-label {
  position: absolute;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  pointer-events: none;
  max-width: 42%;
  line-height: 1.3;
}

/**
 * Part 16 Item 3 — mobile bottom sheets. One shared pattern (comma-grouped
 * selectors, identical rule bodies — not three copy-drifted blocks) applied
 * to the three named surfaces: Export Center, the tag picker (shares
 * .notes-modal-overlay/.notes-modal with the ad-notes modal, which is
 * deliberately NOT in scope here — targeted by #tag-modal-overlay's own ID
 * so the plain notes modal stays a centered dialog, unchanged), and compare
 * mode. Desktop behavior (centered dialog) is completely untouched — this
 * block only exists inside the media query. Same 560px breakpoint as Part
 * 12's calendar modal, for one consistent "mobile changes shape here"
 * threshold across the app. Slide animation already respects
 * prefers-reduced-motion for free via the global rule further up this file
 * (animation-duration forced to ~0 for every animated element site-wide);
 * Escape-to-close, click-outside-to-close, and role="dialog"/aria-modal are
 * all pre-existing behavior on every one of these three, untouched by a
 * pure-CSS layout change.
 */
@media (max-width: 560px) {
  #export-center-modal .export-center-backdrop,
  #tag-modal-overlay,
  .compare-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  #export-center-modal .export-center-panel,
  #tag-modal-overlay .notes-modal,
  .compare-modal {
    width: 100%;
    max-width: none;
    max-height: 85vh;
    border-radius: 16px 16px 0 0;
    padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
    animation: sheet-slide-up 0.22s ease-out;
    position: relative;
  }
  #export-center-modal .export-center-panel::before,
  #tag-modal-overlay .notes-modal::before,
  .compare-modal::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
  }
  #export-center-modal .export-center-panel,
  .compare-modal {
    overflow-y: auto;
  }
}
@keyframes sheet-slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* ---------- Part 30: AI chat box ---------- */
/* z-index 1200 — above everything else on the page; current highest in use
   elsewhere is 1100 (.export-center-modal). */
/* ---- Part 55: sparkle Ask AI launcher ---- */
.ai-chat-toggle{
  position:fixed; right:24px; bottom:24px; z-index:1200;
  display:inline-flex; align-items:center; gap:9px;
  height:52px; padding:0 19px 0 15px;
  border:1px solid var(--border); border-radius:var(--r-pill);
  background:var(--surface-1); color:var(--text-primary);
  font:600 14px/1 var(--font-body); cursor:pointer;
  box-shadow:var(--elev-3);
  transition:transform .22s var(--ease-spring), box-shadow .22s var(--ease),
             border-color .22s var(--ease);
}
.ai-chat-toggle:hover{
  transform:translateY(-2px);
  box-shadow:var(--elev-4);
  border-color:var(--accent);
}
.ai-chat-toggle:focus-visible{ outline:2px solid var(--accent); outline-offset:3px; }

.ai-chat-toggle-icon{
  display:block; width:22px; height:22px; flex:none;
  color:var(--accent); overflow:visible;
}
.ai-chat-toggle-icon .spark-lg,
.ai-chat-toggle-icon .spark-sm{
  fill:currentColor;
  transform-box:fill-box;
  transform-origin:center;
}

@media (prefers-reduced-motion:no-preference){
  .ai-chat-toggle-icon .spark-lg{ animation:abx-tw-lg var(--abx-tw,2.6s) var(--ease) infinite; }
  .ai-chat-toggle-icon .spark-sm{ animation:abx-tw-sm var(--abx-tw,2.6s) var(--ease) infinite;
                                  animation-delay:calc(var(--abx-tw,2.6s) / 5); }
}
.ai-chat-toggle[data-state="hover"]{ --abx-tw:1.6s; }
.ai-chat-toggle[data-state="think"]{ --abx-tw:1.05s; }

@keyframes abx-tw-lg{
  0%,100%{ transform:scale(1) rotate(0deg);      opacity:1; }
  45%    { transform:scale(.72) rotate(38deg);   opacity:.72; }
}
@keyframes abx-tw-sm{
  0%,100%{ transform:scale(.6);   opacity:.35; }
  45%    { transform:scale(1.25); opacity:1; }
}

.ai-chat-toggle[data-state="think"] .ai-chat-toggle-icon{ color:var(--accent-strong); }

@media (max-width:640px){
  .ai-chat-toggle{ right:16px; bottom:16px; height:48px; padding:0 16px 0 13px; font-size:13.5px; }
  .ai-chat-toggle-icon{ width:20px; height:20px; }
}

/* ---------- Part 44: chat nudge + starters ---------- */
@keyframes ai-chat-nudge-in {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.ai-chat-nudge {
  position: fixed;
  right: 24px;
  bottom: 84px;
  z-index: 1199;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 248px;
  padding: 12px 14px;
  background: var(--surface-1);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13.5px;
  line-height: 1.45;
  box-shadow: var(--elev-3);
  transform-origin: bottom right;
  animation: ai-chat-nudge-in 0.32s var(--ease-spring) both;
}
.ai-chat-nudge::after {
  content: '';
  position: absolute;
  right: 22px;
  bottom: -6px;
  width: 11px;
  height: 11px;
  background: var(--surface-1);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transform: rotate(45deg);
}
.ai-chat-nudge-x {
  flex: 0 0 auto;
  border: 0;
  background: none;
  color: var(--text-muted);
  font-size: 17px;
  line-height: 1;
  padding: 0 0 0 2px;
  cursor: pointer;
  transition: color 0.14s var(--ease);
}
.ai-chat-nudge-x:hover { color: var(--text-primary); }

.ai-chat-starters-intro {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 2px 0 10px;
  line-height: 1.45;
}
.ai-chat-starter {
  display: block;
  width: 100%;
  text-align: left;
  margin: 0 0 7px;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.4;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease),
              transform 0.15s var(--ease-spring);
}
.ai-chat-starter:hover {
  background: var(--surface-1);
  border-color: var(--accent);
  transform: translateX(3px);
}
.ai-chat-starter:active { transform: translateX(1px) scale(0.99); }
@keyframes ai-chat-starter-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ai-chat-starter { animation: ai-chat-starter-in 0.3s var(--ease) both; }
.ai-chat-starter:nth-of-type(1) { animation-delay: 0.06s; }
.ai-chat-starter:nth-of-type(2) { animation-delay: 0.13s; }
.ai-chat-starter:nth-of-type(3) { animation-delay: 0.20s; }

/* ---------- Part 44: chat panel + message motion ---------- */
@keyframes ai-chat-panel-in {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.ai-chat-panel {
  transform-origin: bottom right;
  animation: ai-chat-panel-in 0.26s var(--ease-spring) both;
  border-radius: var(--r-lg);
  box-shadow: var(--elev-4);
}

@keyframes ai-chat-msg-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ai-chat-msg {
  font-size: 13.5px;
  line-height: 1.5;
  padding: 9px 13px;
  animation: ai-chat-msg-in 0.26s var(--ease-spring) both;
}
.ai-chat-msg--user  { border-radius: var(--r-md) var(--r-md) 4px var(--r-md); }
.ai-chat-msg--model { border-radius: var(--r-md) var(--r-md) var(--r-md) 4px; }

.ai-chat-msg--thinking {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 13px;
}
.ai-chat-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-muted);
  animation: ai-chat-bounce 1.3s var(--ease) infinite;
}
.ai-chat-dot:nth-child(2) { animation-delay: 0.16s; }
.ai-chat-dot:nth-child(3) { animation-delay: 0.32s; }
@keyframes ai-chat-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30%           { transform: translateY(-5px); opacity: 1; }
}

.ai-chat-input {
  border-radius: var(--r-sm);
  font-size: 13.5px;
  padding: 9px 12px;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.ai-chat-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}
.ai-chat-send {
  border-radius: var(--r-sm);
  width: 36px;
  transition: background 0.15s var(--ease), transform 0.15s var(--ease-spring);
}
.ai-chat-send:hover:not(:disabled) { background: var(--accent-strong); transform: scale(1.06); }
.ai-chat-send:active:not(:disabled) { transform: scale(0.94); }

.ai-chat-elapsed {
  font-size: 11.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  align-self: flex-start;
  padding: 0 4px;
}

@media (prefers-reduced-motion: reduce) {
  .ai-chat-toggle,
  .ai-chat-starter,
  .ai-chat-send { transition: none; }
  .ai-chat-toggle:hover,
  .ai-chat-starter:hover,
  .ai-chat-send:hover:not(:disabled) { transform: none; }
  .ai-chat-panel,
  .ai-chat-msg,
  .ai-chat-nudge,
  .ai-chat-starter { animation: none; }
  .ai-chat-dot { animation: ai-chat-bounce 1.3s var(--ease) infinite; }
  /* PATCH CHART-MOTION-01 — kill the first-paint stagger under reduced motion. */
  .chart-card--enter { animation: none; }
}

.ai-chat-panel {
  position: fixed;
  right: 20px;
  bottom: 84px;
  z-index: 1200;
  width: 340px;
  max-width: calc(100vw - 40px);
  height: 460px;
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(20,16,8,0.18);
  animation: drp-fade-in 0.12s ease-out;
}
:root[data-theme="dark"] .ai-chat-panel { box-shadow: 0 12px 32px rgba(0,0,0,0.45); }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .ai-chat-panel { box-shadow: 0 12px 32px rgba(0,0,0,0.45); }
}
/* [hidden] handled by the global rule at the top of the file. */

.ai-chat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ai-chat-panel-title { font-family: var(--font-display); font-weight: 600; font-size: 14px; }
.ai-chat-panel-close { border: none; background: transparent; font-size: 20px; color: var(--text-secondary); cursor: pointer; line-height: 1; }
.ai-chat-panel-close:hover { color: var(--text-primary); }

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ai-chat-empty-hint { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.ai-chat-msg {
  max-width: 85%;
  padding: 8px 11px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.ai-chat-msg--user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--accent-ink);
  border-bottom-right-radius: 2px;
}
.ai-chat-msg--model {
  align-self: flex-start;
  background: var(--surface-2);
  color: var(--text-primary);
  border-bottom-left-radius: 2px;
}
.ai-chat-msg--thinking { color: var(--text-muted); }

.ai-chat-input-row {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.ai-chat-input {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
}
.ai-chat-input:focus { outline: none; border-color: var(--accent); }
.ai-chat-input:disabled { opacity: 0.6; }
.ai-chat-send {
  border: none;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 8px;
  width: 34px;
  flex-shrink: 0;
  font-size: 16px;
  cursor: pointer;
}
.ai-chat-send:hover:not(:disabled) { background: var(--accent-strong); }
.ai-chat-send:disabled { opacity: 0.45; cursor: default; }

@media (max-width: 560px) {
  .ai-chat-panel {
    right: 12px;
    bottom: 80px;
    width: calc(100vw - 24px);
  }
}

/* ---------- Part 45 §D1: chat copy-reply button ---------- */
.ai-chat-msg--model { position: relative; }
.ai-chat-msg-copy {
  position: absolute; top: 5px; right: 5px;
  width: 26px; height: 26px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 6px;
  background: var(--surface-1); color: var(--text-muted);
  opacity: 0; cursor: pointer;
  transition: opacity 0.15s var(--ease), color 0.15s var(--ease);
}
.ai-chat-msg--model:hover .ai-chat-msg-copy,
.ai-chat-msg-copy:focus-visible { opacity: 1; }
.ai-chat-msg-copy:hover { color: var(--text-primary); }
.ai-chat-msg-copy.is-copied { color: var(--series-3); opacity: 1; }
@media (hover: none) {
  .ai-chat-msg-copy { opacity: 1; }
}

/* ---------- Part 45 §D2: follow-up chips ---------- */
.ai-chat-followups {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 4px 0 8px;
  padding: 0 4px;
}
.ai-chat-followups-intro {
  flex: 1 0 100%;
  margin: 0 0 2px;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ai-chat-followup { /* inherits .ai-chat-starter styling */ }

/* ---------- Part 45 §D3: expanded chat panel ---------- */
.ai-chat-panel {
  transition: width 0.22s var(--ease), height 0.22s var(--ease);
}
.ai-chat-panel--expanded { width: 560px; height: min(720px, 80vh); }
@media (max-width: 620px) {
  .ai-chat-panel--expanded {
    right: 0; bottom: 0; width: 100vw; height: 88vh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ai-chat-panel { transition: none; }
}

/* ---------- Part 45 §D5: header actions + context meta ---------- */
.ai-chat-header-actions {
  display: inline-flex; align-items: center; gap: 4px;
}
.ai-chat-header-btn {
  width: 26px; height: 26px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 6px;
  background: transparent; color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.ai-chat-header-btn:hover { background: var(--surface-1); color: var(--text-primary); }
.ai-chat-header-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ai-chat-header-meta {
  padding: 4px 14px 8px;
  font-size: 11px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

/* ---------- Part 45 §D6: textarea input ---------- */
.ai-chat-input {
  resize: none;
  min-height: 36px;
  max-height: 200px;
  overflow-y: hidden;
  font-family: inherit;
  line-height: 1.4;
}

/* Part 50 — creative scorecard, prepended to a model reply. Sits inside the
   Part 49 §A2 answer card, so it inherits that card's width and padding. */
.ai-chat-scorecard {
  margin: 0 0 12px;
  padding: 0 0 2px;
}
.ai-chat-sc-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
}
.ai-chat-sc-thumb,
.ai-chat-sc-glyph {
  width: 52px; height: 52px;
  flex: 0 0 auto;
  border-radius: 6px;
  object-fit: cover;
  background: var(--surface-1);
}
.ai-chat-sc-glyph {
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: var(--text-muted);
}
.ai-chat-sc-meta { min-width: 0; }   /* required — lets the name ellipsis */
.ai-chat-sc-name {
  margin: 0;
  font-size: 13px; font-weight: 600;
  color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ai-chat-sc-stats {
  margin: 2px 0 0;
  font-size: 12px; color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.ai-chat-sc-strip {
  background: var(--surface-1);
  border-radius: 8px;
  padding: 10px 11px;
}
.ai-chat-sc-leg {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 6px;
}
.ai-chat-sc-leg:last-of-type { margin-bottom: 0; }
.ai-chat-sc-leg-label { width: 34px; flex: 0 0 auto; font-size: 11px; color: var(--text-secondary); }
.ai-chat-sc-track { flex: 1; height: 16px; position: relative; min-width: 0; }
.ai-chat-sc-centre {
  position: absolute; left: 50%; top: 0;
  width: 1px; height: 16px; background: var(--border-strong);
}
.ai-chat-sc-fill { position: absolute; top: 5px; height: 6px; }
.ai-chat-sc-fill--better { left: 50%; border-radius: 0 3px 3px 0; background: var(--series-3); }
.ai-chat-sc-fill--worse  { right: 50%; border-radius: 3px 0 0 3px; background: var(--series-2); }
.ai-chat-sc-leg-value {
  width: 38px; flex: 0 0 auto; text-align: right;
  font-size: 12px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.ai-chat-sc-caption { margin: 8px 0 0; font-size: 11px; color: var(--text-muted); }

/* ---- Part 52 (AI Brain, winner-led generation) — additive rules only.
 * Reuses Part 51 --surface-1/2 tokens; no new hex. */
.abx-winning--selectable .abx-win-row { display: grid; grid-template-columns: 44px auto 1fr auto auto; align-items: center; gap: 12px; cursor: pointer; }
.abx-winner-check { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; cursor: pointer; }
.abx-winner-check-input { position: absolute; opacity: 0; pointer-events: none; }
.abx-winner-check-box { width: 22px; height: 22px; border: 1.5px solid var(--border); border-radius: 5px; background: var(--surface-1); display: inline-block; position: relative; }
.abx-winner-check-input:checked + .abx-winner-check-box { background: var(--accent); border-color: var(--accent); }
.abx-winner-check-input:checked + .abx-winner-check-box::after { content: ''; position: absolute; left: 6px; top: 2px; width: 6px; height: 12px; border: solid var(--surface-1); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.abx-winner-check-input:disabled + .abx-winner-check-box { opacity: .4; cursor: not-allowed; }
.abx-needs-video-tag { display: inline-block; font-size: 11px; color: var(--text-muted); padding: 2px 8px; border: 1px solid var(--border); border-radius: 999px; margin-top: 4px; }
.abx-win-openad { font-size: 12px; color: var(--text-secondary); text-decoration: none; }
.abx-win-openad:hover { color: var(--text-primary); }

.abx-action-bar { position: sticky; bottom: 0; left: 0; right: 0; background: var(--surface-1); border-top: 1px solid var(--border); box-shadow: var(--elev-2); z-index: 40; margin-top: 12px; }
/* [hidden] handled by the global rule at the top of the file. */
.abx-action-bar-inner { display: flex; align-items: center; gap: 16px; padding: 12px 0; flex-wrap: wrap; }
.abx-action-count { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.abx-mode { display: inline-flex; gap: 12px; border: none; padding: 0; margin: 0; }
/* [hidden] handled by the global rule at the top of the file. */
.abx-mode-opt { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); cursor: pointer; }
#abx-generate-btn { margin-left: auto; min-height: 44px; }
#abx-generate-btn:disabled { opacity: .5; cursor: not-allowed; }

.abx-upload-panel { background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 16px; margin-top: 12px; }
/* [hidden] handled by the global rule at the top of the file. */
.abx-upload-h { margin: 0 0 10px; font-size: 14px; color: var(--text-primary); }
.abx-upload-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; font-size: 13px; }
.abx-upload-name { flex: 1; color: var(--text-secondary); }
.abx-upload-choose { min-height: 44px; cursor: pointer; }
.abx-upload-status { font-size: 12px; color: var(--text-muted); min-width: 20px; }

.abx-idea-mount:empty { display: none; }
/* Part 57 polish §1 — cap the card width instead of dividing the pane. The
 * pane is fluid and can be 2000px wide; `1fr 1fr` inherited the old fixed
 * 600px column and blew each image to 1240px tall on wide viewports, pushing
 * title/one-liner/script link entirely below the fold. */
.abx-idea-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 300px)); gap: 16px; margin: 20px 0; }
.abx-idea-group-h { font-family: var(--font-display); font-size: 15px; color: var(--text-secondary); margin: 20px 0 8px; }
@media (max-width: 620px) { .abx-idea-grid { grid-template-columns: 1fr; } }
.abx-idea-card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
/* Part 57 polish 2 §1 — max-height removed. The image is now bounded by its
 * column: 320px in .abx-idea-detail, whatever the grid gives it in
 * .abx-idea-grid. A max-height on top of a fixed column distorts the
 * aspect ratio rather than protecting the layout. */
.abx-idea-image { aspect-ratio: 4 / 5; background: var(--surface-2); overflow: hidden; }
.abx-idea-image .creative-thumb { border: 0; border-radius: 0; cursor: default; }
.abx-idea-image img, .abx-idea-image .abx-idea-thumb-fallback { width: 100%; height: 100%; object-fit: cover; display: block; }
.abx-idea-image .abx-idea-thumb-fallback { opacity: .82; }
.abx-idea-body { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
/* Part 57 polish §8 — hierarchy reconciliation. Was 19px display / weight 600. */
.abx-idea-title { font-family: var(--font-display); font-size: 17px; font-weight: 600; margin: 0; color: var(--text-primary); }
.abx-idea-line { font-size: 14px; line-height: 1.5; color: var(--text-secondary); margin: 0; }
.abx-idea-source { font-size: 12px; color: var(--text-muted); margin: 0; }
.abx-idea-script-link { align-self: flex-start; min-height: 44px; display: inline-flex; align-items: center; text-decoration: none; }

.abx-script-view { margin: 24px 0; }
.abx-script-back { font-size: 13px; color: var(--text-secondary); text-decoration: none; }
.abx-script-title { font-family: var(--font-display); font-size: 24px; margin: 8px 0 20px; }
.abx-script-h { font-family: var(--font-display); font-size: 16px; margin: 20px 0 8px; color: var(--text-primary); }
.abx-script-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.abx-script-table th, .abx-script-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.abx-script-table th { font-weight: 600; color: var(--text-muted); background: var(--surface-2); }
.abx-script-dir { font-size: 14px; line-height: 1.6; color: var(--text-secondary); background: var(--surface-2); border-radius: 8px; padding: 14px; }
.abx-script-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

.abx-saved-sets { margin-top: 32px; }
.abx-saved-sets-list { display: flex; flex-direction: column; gap: 8px; }
.abx-saved-set { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }
.abx-saved-set-meta { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.abx-saved-set-date { font-weight: 600; color: var(--text-primary); }
.abx-saved-set-mode, .abx-saved-set-count { color: var(--text-muted); }
.abx-saved-set-source { color: var(--text-secondary); }
.abx-saved-set-actions { display: flex; gap: 8px; }

/* Part 55 §2.7 — replaces the retired <details> disclosure with the button
   + grid-template-rows pattern used by idea rows. */
.abx-last-monday { margin-top: 32px; }
.abx-last-monday-toggle { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 8px 0; cursor: pointer; font-size: 13px; color: var(--text-muted); }
.abx-last-monday-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.abx-last-monday-toggle .abx-lm-chev { display: inline-block; }
@media (prefers-reduced-motion: no-preference) {
  .abx-last-monday-toggle .abx-lm-chev { transition: transform 180ms ease-out; }
}
.abx-last-monday.is-open .abx-lm-chev { transform: rotate(90deg); }
.abx-last-monday-body { display: grid; grid-template-rows: 0fr; }
@media (prefers-reduced-motion: no-preference) {
  .abx-last-monday-body { transition: grid-template-rows 200ms ease-out; }
}
.abx-last-monday.is-open .abx-last-monday-body { grid-template-rows: 1fr; }
.abx-last-monday-body > div { overflow: hidden; }

/* Part 55 §1.3 — cold start panel above winners. */
.abx-cold { margin: 0 0 16px; }

/* Part 55 §2.5 — Change selection quiet link at top of the idea set. */
.abx-change-selection { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 4px 0; font-size: 13px; color: var(--text-secondary); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.abx-change-selection:hover { color: var(--text-primary); }

/* Part 55 §2.6 — per-idea dismiss + show-dismissed toggle. */
.abx-idea-card { position: relative; }
.abx-idea-dismiss { position: absolute; top: 8px; right: 8px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 999px; padding: 3px 9px; font-size: 11px; color: var(--text-muted); cursor: pointer; opacity: 0; transition: opacity .15s var(--ease); }
.abx-idea-card:hover .abx-idea-dismiss,
.abx-idea-card:focus-within .abx-idea-dismiss { opacity: 1; }
@media (max-width: 620px) { .abx-idea-dismiss { opacity: 1; } }
.abx-idea-card.is-dismissed { display: none; }
.abx-idea-set.is-showing-dismissed .abx-idea-card.is-dismissed { display: flex; opacity: 0.6; }
.abx-show-dismissed { display: inline-block; margin-top: 12px; background: none; border: 0; padding: 6px 0; font-size: 13px; color: var(--text-secondary); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.abx-show-dismissed:hover { color: var(--text-primary); }

/* Part 55 §3.1 — contextual "Ask about this" affordances. Hover/focus on
   desktop, always visible on mobile. */
.abx-ctx-ask { background: none; border: 0; padding: 4px 0; font-size: 12px; color: var(--text-secondary); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; opacity: 0; transition: opacity .15s var(--ease); }
.abx-ctx-ask:hover { color: var(--text-primary); }
.abx-win-row:hover .abx-ctx-ask,
.abx-win-row:focus-within .abx-ctx-ask,
.abx-idea-card:hover .abx-ctx-ask,
.abx-idea-card:focus-within .abx-ctx-ask,
.abx-script-view .abx-ctx-ask { opacity: 1; }
@media (max-width: 620px) { .abx-ctx-ask { opacity: 1; } }

/* Part 55 §3.3 — header Ask AI entry, secondary button styling. */
.abx-hdr-ask { font-size: 13px; color: var(--text-secondary); text-decoration: none; padding: 6px 10px; border: 1px solid var(--border); border-radius: 7px; background: transparent; cursor: pointer; font-family: inherit; }
.abx-hdr-ask:hover { color: var(--text-primary); border-color: var(--accent); }

/* Part 55 §2.2 — set heading is focusable for the post-render focus move. */
.abx-idea-set-heading { font-family: var(--font-display); font-size: 15px; color: var(--text-secondary); margin: 0 0 8px; }
.abx-idea-set-heading:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.abx-live-announce { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Part 54 §1.4 / §3 — trends section notes */
.trends-note { margin: 4px 0 8px; font-size: 13px; color: var(--text-secondary); }
.trends-note--footnote { color: var(--text-muted); font-size: 12px; }
/* [hidden] handled by the global rule at the top of the file. */

/* ---- Part 56 §5 — Market Intelligence ---- */
#market-table th, #market-table td { padding: 8px 10px; }
.market-delta { font-weight: 600; font-variant-numeric: tabular-nums; }
.market-delta--up { color: #158a4b; }
.market-delta--down { color: #b1341e; }
.market-delta--flat, .market-delta--null { color: var(--text-muted); font-weight: 400; }
.market-est { font-size: 10px; color: var(--text-muted); cursor: help; margin-left: 2px; }
.market-caveat { color: var(--text-muted); cursor: help; }
.market-dark-badge { display: inline-block; padding: 2px 6px; border-radius: 4px; background: var(--border); color: var(--text-secondary); font-size: 11px; font-weight: 600; letter-spacing: 0.04em; }
.market-error { color: #b1341e; cursor: help; }
.market-role-badge { display: inline-block; padding: 1px 5px; border-radius: 3px; font-size: 10px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }
.market-role-badge--client { background: var(--accent); color: #fff; }
.market-muted { color: var(--text-muted); font-size: 13px; }
.market-deadline { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.market-deadline--urgent { color: #b1341e; font-weight: 600; }
.market-quote { color: var(--text-muted); font-size: 12px; }
.market-movers-list { list-style: none; padding: 0; margin: 0; }
.market-movers-list li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.market-tag { display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 11px; margin-right: 4px; }
.market-tag--warning { background: #fbe6df; color: #7a2010; }
.market-tag--info { background: #dceffc; color: #114b73; }
.market-client-card { border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.market-audit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 800px) { .market-audit-grid { grid-template-columns: 1fr; } }
.market-tiers { margin: 6px 0; padding-left: 20px; font-size: 13px; }
.market-claim-check { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 10px; }
.market-claim-url { font-size: 12px; word-break: break-all; margin-bottom: 6px; }
.market-mismatches { margin: 8px 0; }
.market-mismatches--high { border-left: 3px solid #b1341e; padding-left: 10px; background: #fdf5f3; }
.market-mismatches--medium { border-left: 3px solid #d18a1e; padding-left: 10px; }
.market-mismatches--low { border-left: 3px solid var(--border); padding-left: 10px; }
.market-mismatches h5 { margin: 0 0 6px; font-size: 13px; }
.market-mismatches ul { margin: 0; padding-left: 18px; font-size: 13px; }
.market-mismatch-kind { font-family: var(--font-mono, monospace); font-size: 11px; color: var(--text-muted); text-transform: uppercase; }
.market-new-brand { padding: 8px 0; border-bottom: 1px solid var(--border); }
.market-new-brand h4 { margin: 0 0 4px; font-size: 14px; }
#market-footer { margin-top: 24px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-muted); }

/* ---- Part 54 Fix 7 — cross-brand ops strip ---- */
.ops-strip { margin: 12px 0 20px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--card-bg, transparent); }
.ops-strip h3 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary); }
.ops-strip-fallback { color: var(--text-muted); font-weight: 400; }
.ops-strip-list { list-style: none; padding: 0; margin: 0; }
.ops-strip-item { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--border); font-size: 13px; }
.ops-strip-item:first-child { border-top: 0; }
.ops-strip-kind { display: inline-block; min-width: 92px; padding: 2px 6px; border-radius: 3px; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-align: center; }
.ops-strip-item--fail .ops-strip-kind { background: #b1341e; color: #fff; }
.ops-strip-item--date_gap .ops-strip-kind { background: #d18a1e; color: #fff; }
.ops-strip-item--skip_ratelimit .ops-strip-kind { background: var(--border); color: var(--text-secondary); }
.ops-strip-detail { color: var(--text-muted); flex: 1; }
.ops-strip-dismiss { margin-left: auto; background: transparent; border: 0; color: var(--text-muted); cursor: pointer; font-size: 16px; padding: 0 6px; }

/* ---- Part 56 (SPEC filename Part 55) — verdict-list leaderboard ----
   All new rules scoped through .leaderboard-row--verdict and .leaderboard--verdict
   so shared classes (.leaderboard-row, .leaderboard-main, .leaderboard-name-row,
   .leaderboard-numbers, .num-item .label, .num-item .value) stay unchanged —
   the Currently Active section and the landing-page expand detail must still
   render identically (spec §2.1). */
.leaderboard-header-row--verdict {
  display: grid;
  grid-template-columns: 24px 40px 56px 1fr auto auto;
  gap: 12px;
  padding: 0 12px 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.leaderboard-header-row--verdict .lb-header-col-name { grid-column: 4; }
.leaderboard-header-row--verdict .lb-header-col-metric { text-align: right; min-width: 56px; }
.verdict-group-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 14px 12px 6px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.verdict-group-header:first-child { border-top: 0; margin-top: 0; }
.verdict-group-label { font-weight: 700; font-size: 13px; letter-spacing: 0.04em; }
.verdict-group-count { color: var(--text-secondary); font-weight: 600; }
.verdict-group-spend { color: var(--text-muted); margin-left: auto; letter-spacing: 0; text-transform: none; font-size: 12px; }
.verdict-group-header--scaling .verdict-group-label { color: #158a4b; }
.verdict-group-header--steady .verdict-group-label { color: var(--text-secondary); }
.verdict-group-header--too_early .verdict-group-label { color: #6b6b6b; }
.verdict-group-header--cut .verdict-group-label { color: #b1341e; }
.verdict-reason {
  font-size: 12px;
  color: var(--text-muted);
  padding: 2px 0 4px;
}
.verdict-reason--scaling { color: #158a4b; }
.verdict-reason--cut { color: #b1341e; }
.verdict-reason--too_early { color: var(--text-muted); }
/* 52px thumbnail — under Meta's 64px signed-url ceiling, no upscaling, no
   thumbnail-pipeline change needed. */
.creative-thumb--verdict-row {
  width: 52px;
  height: 52px;
  min-width: 52px;
  border-radius: 6px;
  object-fit: cover;
}
/* Numbers block — two figures, no labels (labels moved to the header row). */
.leaderboard-row--verdict .leaderboard-numbers--verdict {
  display: flex;
  gap: 16px;
  align-items: baseline;
}
.leaderboard-row--verdict .leaderboard-numbers--verdict .num-item {
  display: block;
  min-width: 56px;
  text-align: right;
}
.leaderboard-row--verdict .leaderboard-numbers--verdict .num-item .value {
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
/* Impressions/clicks/CTR/CPC block inside the expand detail. */
.verdict-extra-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.verdict-extra-stats .num-item { display: block; }
.verdict-extra-stats .num-item .label { display: block; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.verdict-extra-stats .num-item .value { display: block; font-size: 13px; font-variant-numeric: tabular-nums; }
.verdict-guessed-tag-wrap { padding: 6px 0; }
/* Mobile — verdict rows get their own two-column numbers grid (scoped, so
   the shared .leaderboard-numbers mobile rule stays untouched — spec §2.1). */
@media (max-width: 620px) {
  .leaderboard-row--verdict .leaderboard-numbers--verdict {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 12px;
  }
  .leaderboard-header-row--verdict { grid-template-columns: 20px 40px 40px 1fr auto auto; gap: 8px; font-size: 10px; }
  .verdict-group-header { flex-wrap: wrap; }
  .verdict-extra-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ---- Part 58 UI brief §C/§D — Build Visual action + shot strip ---- */
.visual-action-wrap { display: inline-flex; align-items: center; gap: 8px; }
.visual-action-hint { color: var(--text-muted); font-size: 12px; }
.visual-strip-mount { margin-top: 16px; }
.visual-strip-header { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.visual-strip-state { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 8px; border-radius: 3px; background: var(--border); color: var(--text-secondary); }
.visual-strip-state--running { background: #dceffc; color: #114b73; }
.visual-strip-state--awaiting_approval { background: #fef2c7; color: #7a4d10; }
.visual-strip-state--done { background: #d3f0e0; color: #14522f; }
.visual-strip-state--failed, .visual-strip-state--abandoned { background: #fbe6df; color: #7a2010; }
.visual-strip-remaining { color: var(--text-muted); font-size: 12px; }
.visual-strip-warning { padding: 6px 10px; margin: 6px 0; background: #fdf5f3; border-left: 3px solid #b1341e; color: #7a2010; font-size: 13px; }
.visual-strip-loading, .visual-strip-error { padding: 16px; color: var(--text-muted); font-size: 13px; }
.visual-strip-error-inline { padding: 6px 10px; margin-bottom: 8px; background: #fdf5f3; color: #7a2010; font-size: 12px; border-radius: 4px; }
/* §11.6 — horizontal scroll on mobile. */
.visual-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 260px); gap: 12px; overflow-x: auto; padding: 8px 0 12px; }
.visual-shot { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--card-bg, transparent); }
.visual-shot--must { border-left: 3px solid #d18a1e; }
.visual-shot--gen { border-left: 3px solid #158a4b; }
.visual-shot.is-blocked { border-left-color: #b1341e; }
.visual-shot.is-approved { box-shadow: 0 0 0 2px #158a4b40 inset; }
.visual-shot.is-dropped { opacity: 0.55; }
.visual-shot-img, .visual-shot-placeholder { display: block; width: 100%; aspect-ratio: 9/16; object-fit: cover; background: var(--border); }
.visual-shot-placeholder { display: flex; align-items: center; justify-content: center; font-size: 28px; color: var(--text-muted); }
.visual-shot-placeholder--must-shoot { background: #fef7ec; }
.visual-shot-body { padding: 10px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.visual-shot-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.visual-shot-n { font-weight: 700; color: var(--text-secondary); }
.visual-shot-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; padding: 1px 6px; border-radius: 3px; }
.visual-shot-label--gen { background: #d3f0e0; color: #14522f; }
.visual-shot-label--must { background: #fef2c7; color: #7a4d10; }
.visual-shot-block-reason { font-size: 11px; color: #b1341e; }
.visual-shot-time { color: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.visual-shot-camera { color: var(--text-primary); font-size: 12px; }
.visual-shot-dialogue { color: var(--text-secondary); font-size: 12px; font-style: italic; }
.visual-shot-foot { display: flex; justify-content: flex-end; }
.visual-shot-state { font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; padding: 1px 6px; border-radius: 3px; background: var(--border); color: var(--text-secondary); }
.visual-shot-state--completed { background: #d3f0e0; color: #14522f; }
.visual-shot-state--blocked, .visual-shot-state--nsfw, .visual-shot-state--failed { background: #fbe6df; color: #7a2010; }
.visual-shot-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.abx-btn--sm { font-size: 11px; padding: 3px 8px; }
.abx-btn--secondary { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
/* §B — reference-frame modal + gallery */
.visual-ref-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 900; }
.visual-ref-modal-inner { background: var(--body-bg, #fff); padding: 16px; border-radius: 10px; max-width: 640px; width: 90vw; display: flex; flex-direction: column; gap: 10px; }
.visual-ref-video { width: 100%; max-height: 60vh; background: #000; }
.visual-ref-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.visual-ref-status { color: var(--text-muted); font-size: 12px; min-height: 16px; }
#visual-reference-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin: 12px 0; }
.visual-ref-thumb { position: relative; margin: 0; }
.visual-ref-thumb img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 6px; background: var(--border); }
.visual-ref-thumb figcaption { font-size: 11px; padding-top: 4px; color: var(--text-secondary); }
.visual-ref-delete { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,0.6); color: #fff; border: 0; border-radius: 50%; width: 20px; height: 20px; cursor: pointer; font-size: 12px; }
/* Part 58 addendum §B3 — keyframe preview in the promote modal (image, not video). */
.visual-ref-keyframe { width: 100%; max-height: 60vh; object-fit: contain; background: #000; }

/* ---- Part 57 §3 — one page, two panes ---- */
.abx-body--shell .abx-main.abx-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  max-width: none;
  margin: 0;
  padding: 16px 20px;
  align-items: start;
}
.abx-body--shell .abx-topbar { max-width: none; }
.abx-body--shell .abx-topbar .abx-col.abx-header-inner { max-width: none; padding: 0 20px; }
.abx-body--shell .abx-stale {
  grid-column: 1 / -1;
  margin: 0 0 8px;
}
.abx-body--shell .abx-cold {
  grid-column: 1 / -1;
}
.abx-body--shell .abx-live-announce { grid-column: 1 / -1; }
.abx-rail { display: block; }
.abx-rail-group { border: 1px solid var(--border); border-radius: 8px; background: var(--surface-1, transparent); margin-bottom: 12px; overflow: hidden; }
.abx-rail-group[open] > .abx-rail-group-header,
.abx-rail-group > details > summary.abx-rail-group-header { padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.abx-rail-group-header { padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; }
.abx-rail-group-label { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary); }
.abx-rail-group-count { color: var(--text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.abx-rail-group-actions { padding: 6px 12px 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.abx-rail-list-wrap { padding: 0 8px 8px; }
.abx-rail-list { display: flex; flex-direction: column; gap: 2px; }
.abx-rail-row {
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 10px; border-radius: 6px;
  text-decoration: none; color: inherit;
  cursor: pointer;
  min-height: 44px;
}
.abx-rail-row:hover { background: var(--surface-2, rgba(0,0,0,0.04)); }
.abx-rail-row.is-selected { background: var(--accent-tint, rgba(0,120,200,0.08)); border-left: 3px solid var(--accent); padding-left: 7px; }
.abx-rail-row-title { font-size: 13px; font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.abx-rail-row-sub { font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.abx-rail-row--winner { flex-direction: row; align-items: center; gap: 10px; padding: 6px 10px; }
.abx-rail-row--winner .abx-rail-row-body { flex: 1; background: transparent; border: 0; text-align: left; padding: 0; cursor: pointer; display: flex; flex-direction: column; gap: 2px; color: inherit; }
.abx-rail-row--winner .abx-rail-row-body:hover { background: transparent; }
.abx-rail-drawer-link { padding: 8px 12px 12px; }
.abx-pane { min-width: 0; }
.abx-pane-empty { padding: 40px 20px; text-align: center; color: var(--text-muted); font-size: 13px; }
.abx-hdr-admin { font-size: 13px; color: var(--text-secondary); text-decoration: none; padding: 6px 10px; border: 1px solid var(--border); border-radius: 7px; margin-right: 8px; }
.abx-hdr-admin:hover { color: var(--text-primary); border-color: var(--accent); }
.abx-batches { padding: 10px 12px; }
.abx-batches-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; display: block; margin-bottom: 4px; }
.abx-batches-select { width: 100%; }
/* Below 900px — rail full width. No back affordance built this pass. */
@media (max-width: 900px) {
  .abx-body--shell .abx-main.abx-shell { grid-template-columns: minmax(0, 1fr); }
  .abx-rail { order: 1; }
  .abx-pane { order: 2; }
}

/* Part 57 — batch-idea preview inside the pane (no set_id yet). */
.abx-batch-idea-preview { padding: 20px; max-width: 640px; }
.abx-batch-idea-preview-title { margin: 0 0 8px; font-size: 20px; }
.abx-batch-idea-preview-line { color: var(--text-secondary); font-size: 15px; margin: 0 0 10px; }
.abx-batch-idea-preview-source { color: var(--text-muted); font-size: 13px; margin: 0 0 16px; }
.abx-batch-idea-preview-hint { color: #b1341e; font-size: 12px; margin: 6px 0 16px; }
.abx-batch-idea-generate { padding: 8px 14px; font-size: 13px; font-weight: 600; }
.abx-jobstrip-preview { min-height: 20px; margin-top: 10px; font-size: 12px; color: var(--text-muted); }
button.abx-rail-row { background: transparent; border: 0; text-align: left; font: inherit; color: inherit; width: 100%; cursor: pointer; }

/* ---- Part 57 polish pass ---- */

/* §3b — one left edge for header, daterow, rail and pane. The prior override
 * only widened the header inner; the daterow-inner still capped at 720px and
 * centred, which visually detached the chips from the 20px shell inset below.
 * Both now share `padding: 0 20px; max-width: none`. */
.abx-body--shell .abx-topbar .abx-daterow-inner {
  max-width: none;
  padding: 0 20px;
  margin: 0;
}
/* Daterow container itself — remove the auto centring margin so the whole
 * row aligns with the shell. */
.abx-body--shell .abx-daterow { padding: 0; }

/* §4 — job strip goes to the left so the Ask AI launcher (bottom-right) does
 * not cover it. Do NOT raise the strip's z-index above the launcher — that
 * just swaps which one is unusable. */
.abx-jobstrip--global { right: auto; left: 16px; }

/* §5 — action bar padding was 12px 0. Inside the 320px rail that's flush
 * against both borders. Add horizontal inset matching the rest of the rail. */
.abx-action-bar-inner { padding: 12px; }
/* One horizontal inset for the whole rail. Rail groups already use 10px 12px
 * on their header; the list wrap was 0 8px 8px which put rows 4px off. Use
 * 12px everywhere so header + rows share one edge. */
.abx-rail-list-wrap { padding: 0 12px 12px; }
.abx-rail-group-actions { padding: 8px 12px 10px; }
.abx-rail-drawer-link { padding: 10px 12px 12px; }
.abx-batches { padding: 12px; }

/* §7 — empty pane state now reads as an instruction, not a rendering failure. */
.abx-pane-empty {
  max-width: 420px;
  padding: 24px;
  margin: 0;
  text-align: left;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.5;
}

/* §8 — rail typography: three emphasis mechanisms on the group label
 * (weight 700 + uppercase + letter-spacing) outweighed the content. Drop the
 * weight; keep the uppercase and letter-spacing for the "index" affordance.
 * Row title drops from 600 to 500 so the pane content leads. */
.abx-rail-group-label { font-weight: 600; }
.abx-rail-row-title { font-weight: 500; }

/* §9b — Patterns / Reviews are external links to Admin, not collapsibles. */
.abx-rail-external-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  background: var(--surface-1, transparent);
}
.abx-rail-external-link:hover { border-color: var(--accent); color: var(--text-primary); }
.abx-rail-external-label { font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary); }
.abx-rail-external-arrow { color: var(--text-muted); font-size: 13px; }

/* ---- Part 57 polish 2 §1 — single-idea detail layout ---- */
/* Two presentations, two rules, no shared CSS between them:
 *   .abx-idea-detail — one idea filling the pane (image left, body right,
 *                       storyboard strip full width beneath)
 *   .abx-idea-grid   — multi-card "Suggest concepts" preview (unchanged from
 *                       polish 1: repeat(auto-fill, minmax(240px, 300px)))
 * The card structure is identical in both — the wrapper decides layout. */
.abx-idea-detail {
  display: block;
  margin: 8px 0 24px;
}
.abx-idea-detail .abx-idea-card {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  grid-template-areas:
    "image body"
    "storyboard storyboard";
  gap: 20px;
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
}
.abx-idea-detail .abx-idea-image { grid-area: image; aspect-ratio: 4 / 5; }
.abx-idea-detail .abx-idea-body {
  grid-area: body;
  padding: 20px 20px 20px 0;
  gap: 12px;
  align-content: start;
}
.abx-idea-detail .abx-idea-title { font-size: 22px; font-weight: 600; }
.abx-idea-detail .abx-idea-line { font-size: 16px; line-height: 1.55; }
.abx-idea-detail .abx-idea-source { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.abx-idea-detail .abx-idea-script-link {
  align-self: flex-start;
  margin-top: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
}
.abx-idea-detail .abx-idea-storyboard-strip {
  grid-area: storyboard;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 12px;
  padding: 16px 20px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.abx-idea-detail .abx-idea-beat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  min-width: 0;
}
.abx-idea-detail .abx-idea-beat-time {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
}
.abx-idea-detail .abx-idea-beat-text {
  color: var(--text-primary);
  line-height: 1.4;
}
/* Multi-card grid mode: storyboard is redundant — the compact stacked card
 * has no room for it. Hidden here so the single card renderer can emit it
 * unconditionally without polluting the preview. */
.abx-idea-grid .abx-idea-storyboard-strip { display: none; }
/* Below 900px, detail card falls back to stacked (image top, body below). */
@media (max-width: 900px) {
  .abx-idea-detail .abx-idea-card {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "image" "body" "storyboard";
  }
  .abx-idea-detail .abx-idea-image { aspect-ratio: 16 / 9; }
  .abx-idea-detail .abx-idea-body { padding: 16px; }
}

/* Part 57 polish 2 §3 — rail subheadings between the batch and set ideas. */
.abx-rail-subheading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 4px 6px;
  border-top: 1px solid var(--border);
}
.abx-rail-subheading:first-child { border-top: 0; padding-top: 6px; }
.abx-rail-subheading-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.abx-rail-subheading-close {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 16px;
  line-height: 1;
  padding: 0 4px;
}
.abx-rail-subheading-close:hover { color: var(--text-primary); }
.abx-rail-subheading--secondary { border-top-style: dashed; }

/* Part 57 polish 2 §2 — saved-set row now carries a first-idea title for distinction. */
.abx-saved-set-first-title { display: block; color: var(--text-muted); font-size: 12px; font-style: italic; margin-top: 4px; }
