/* ========================================================================
 *  CORE 21 — shared design system
 *  Single source of truth for tokens + reusable components.
 *  Per-screen styles live inline in their HTML file and may extend this.
 *  ====================================================================== */

/* ========================================================================
 *  DESIGN TOKENS — semantic-first, theme-swappable
 *  Light is primary. Dark is opt-in via [data-theme="dark"] on <html>.
 *  Surface-named legacy tokens (--paper, --ink, etc.) are preserved as
 *  aliases so existing per-screen styles keep working.
 *  ====================================================================== */
:root{
  --shell: #f3efe7;
  --panel: #ffffff;
  /* ---- scales ---- */
  /* spacing — 4px base, premium rhythm */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;

  /* radius — rounded but disciplined */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 12px;
  --radius-2xl: 12px;
  --radius-pill: 999px;

  /* text scale — calmer, more editorial */
  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-lg: 17px;
  --text-xl: 20px;
  --text-2xl: 28px;
  --text-3xl: 34px;
  --text-display: 34px;

  /* line-heights — paired with the scale above */
  --leading-tight: 1.15;
  --leading-snug: 1.35;
  --leading-normal: 1.5;
  --leading-relaxed: 1.6;

  /* motion */
  --ease-out: cubic-bezier(.22,.8,.32,1);
  --ease-in-out: cubic-bezier(.4,0,.2,1);
  --dur-fast: 120ms;
  --dur-base: 180ms;
  --dur-slow: 280ms;

  /* ---- semantic theme tokens — light ---- */
  /* backgrounds (deepest → most elevated) */
  --bg: var(--surface);                    /* legacy page-background alias */
  --bg-2: var(--shell);                    /* legacy recessed alias */
  --surface: #faf8f3;
  --surface-solid: var(--panel);           /* legacy opaque-card alias */
  --surface-elevated: #ffffff;            /* highest elevation */
  --surface-sunken: #f6f2ea;              /* pressed / disabled */
  --overlay: rgba(19,22,27,0.45);         /* modal scrim */

  /* borders — three weights */
  --border: rgba(19,22,27,0.08);          /* hairline */
  --border-strong: rgba(19,22,27,0.14);   /* card edge */
  --border-focus: rgba(216,31,42,0.55);   /* keyboard focus */

  /* text — three roles plus accent */
  --text: #13161b;                        /* primary ink */
  --text-2: #3a424e;                      /* secondary body */
  --text-muted: #626a78;                  /* tertiary, meta */
  --text-on-accent: #ffffff;
  --text-on-dark: #ffffff;

  /* brand accent (single accent — restraint) */
  --accent: #d81f2a;
  --accent-soft: rgba(216,31,42,0.10);
  --accent-ink: #b51a23;

  /* semantic colors — meaning, not decoration */
  --success: #1f7a4f;
  --success-soft: #e2f3ea;
  --success-ink: #1c6e47;
  --info: #1e4ca3;
  --info-soft: #e0e9fa;
  --warning: #9a5d00;
  --warning-soft: #fbefd7;
  --warning-ink: #8b5400;
  --risk: #b0321f;
  --risk-soft: #fbe7e2;

  /* platform brand dots */
  --yt: #ff0033;
  --ig: #d946a0;
  --tt: #25f4ee;

  /* shadows — three-tier, premium softness */
  --shadow-sm: 0 1px 2px rgba(19,22,27,0.04);
  --shadow-md: 0 1px 2px rgba(19,22,27,0.04), 0 8px 24px rgba(19,22,27,0.06);
  --shadow-lg: 0 2px 6px rgba(19,22,27,0.05), 0 30px 60px rgba(19,22,27,0.12);
  --shadow-xl: 0 4px 12px rgba(19,22,27,0.06), 0 50px 100px rgba(19,22,27,0.14);

  /* gradient signature — the brand */
  --brand-grad: linear-gradient(90deg,var(--accent),var(--accent)); /* deprecated: remove after one release */
  --dark-grad: linear-gradient(135deg, #18162c 0%, #2a1f4a 60%, var(--accent) 100%);
  --page-grad: linear-gradient(180deg, #fbfaf7 0%, var(--bg) 58%, #f6f1e9 100%);
  --rail-bg: rgba(250,248,243,0.72);

  /* ---- legacy aliases (keep existing per-screen CSS working) ---- */
  --paper: var(--bg);
  --paper-2: var(--bg-2);
  --card: var(--surface);
  --card-solid: var(--surface-solid);
  --ink: var(--text);
  --ink-2: var(--text-2);
  --muted: var(--text-muted);
  --line: var(--border);
  --line-2: var(--border-strong);
  --green: var(--success);
  --green-soft: var(--success-soft);
  --blue: var(--info);
  --blue-soft: var(--info-soft);
  --amber: var(--warning);
  --amber-soft: var(--warning-soft);
  --red: var(--risk);
  --red-soft: var(--risk-soft);
  --shadow: var(--shadow-md);
  --lavender: var(--accent-soft);
}

/* ---- dark theme — opt-in via [data-theme="dark"] on <html> ----
 * Deliberate, not default. The warm-paper light theme is the primary
 * experience because it's more readable for the text-heavy briefs and
 * doesn't look like every other AI dashboard. Dark is for late-night
 * creator workflows. Toggle by setting <html data-theme="dark">, or set
 * <html data-theme="auto"> on an opted-in surface to follow OS preference.
 */
[data-theme="dark"]{
  --shell: #0a0c10;
  --panel: #0e1014;
  --bg: var(--panel);
  --bg-2: #161922;
  --surface: #1a1e28;
  --surface-solid: var(--surface);
  --surface-elevated: #20242f;
  --surface-sunken: #0a0c10;
  --overlay: rgba(0,0,0,0.65);

  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.14);
  --border-focus: color-mix(in srgb,var(--accent) 65%,transparent);

  --text: #f5f3ee;
  --text-2: #c2c6cf;
  --text-muted: #8a909c;

  --accent: #f2564b;
  --accent-soft: rgba(242,86,75,0.16);
  --accent-ink: #f4746b;

  --success: #4caf85;
  --success-soft: rgba(76,175,133,0.16);
  --success-ink: #53b28a;
  --info: #6ea4ff;
  --info-soft: rgba(110,164,255,0.16);
  --warning: #e1a04a;
  --warning-soft: rgba(225,160,74,0.16);
  --warning-ink: #e1a04a;
  --risk: #ef6e5b;
  --risk-soft: rgba(239,110,91,0.16);

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 1px 2px rgba(0,0,0,0.4), 0 8px 24px rgba(0,0,0,0.5);
  --shadow-lg: 0 2px 6px rgba(0,0,0,0.5), 0 30px 60px rgba(0,0,0,0.6);
  --shadow-xl: 0 4px 12px rgba(0,0,0,0.55), 0 50px 100px rgba(0,0,0,0.65);

  --page-grad: linear-gradient(180deg, #0c0e12 0%, var(--bg) 58%, #0a0c10 100%);
  --rail-bg: rgba(14,16,20,0.72);
}

/* Respect OS preference only when a page explicitly opts into auto theme */
@media (prefers-color-scheme: dark){
  :root[data-theme="auto"]{
    --shell: #0a0c10;
    --panel: #0e1014;
    --bg: var(--panel);
    --bg-2: #161922;
    --surface: #1a1e28;
    --surface-solid: var(--surface);
    --surface-elevated: #20242f;
    --surface-sunken: #0a0c10;
    --overlay: rgba(0,0,0,0.65);
    --border: rgba(255,255,255,0.08);
    --border-strong: rgba(255,255,255,0.14);
    --border-focus: color-mix(in srgb,var(--accent) 65%,transparent);
    --text: #f5f3ee;
    --text-2: #c2c6cf;
    --text-muted: #8a909c;
    --accent: #f2564b;
    --accent-soft: rgba(242,86,75,0.16);
    --accent-ink: #f4746b;
    --success: #4caf85;
    --success-soft: rgba(76,175,133,0.16);
    --success-ink: #53b28a;
    --info: #6ea4ff;
    --info-soft: rgba(110,164,255,0.16);
    --warning: #e1a04a;
    --warning-soft: rgba(225,160,74,0.16);
    --warning-ink: #e1a04a;
    --risk: #ef6e5b;
    --risk-soft: rgba(239,110,91,0.16);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
    --shadow-md: 0 1px 2px rgba(0,0,0,0.4), 0 8px 24px rgba(0,0,0,0.5);
    --shadow-lg: 0 2px 6px rgba(0,0,0,0.5), 0 30px 60px rgba(0,0,0,0.6);
    --shadow-xl: 0 4px 12px rgba(0,0,0,0.55), 0 50px 100px rgba(0,0,0,0.65);
    --page-grad: linear-gradient(180deg, #0c0e12 0%, var(--bg) 58%, #0a0c10 100%);
    --rail-bg: rgba(14,16,20,0.72);
  }
}

/* ---------- base ---------- */
*,*::before,*::after{box-sizing:border-box;}
html,body{margin:0;padding:0;}
html{color-scheme:light dark;}
body{
  background:var(--shell);
  color:var(--text);
  font-family:"Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
  line-height:var(--leading-normal);
  transition:background-color var(--dur-slow) var(--ease-out), color var(--dur-slow) var(--ease-out);
  /* Mobile safety: prevent horizontal page scroll when a large hero word
     or wide card briefly overflows. Pages stay visually centered; any
     edge clipping reads as intentional rather than as a scroll bug. */
  overflow-x:hidden;
}
html{overflow-x:hidden;}
/* Headlines must wrap rather than push the layout wider than the viewport.
   This is a global safety net so a 72px+ gradient hero word never forces
   a horizontal scrollbar on a 390px phone. */
h1, h2, h3 { overflow-wrap:break-word; word-break:normal; }
/* Honor focus rings without breaking mouse UX */
:focus-visible{outline:2px solid var(--border-focus);outline-offset:2px;border-radius:var(--radius-sm);}
.wrap{max-width:1240px;margin:0 auto;padding:0 clamp(20px,4vw,56px);}
.display{font-family:"Schibsted Grotesk", ui-sans-serif, system-ui, sans-serif;font-weight:900;letter-spacing:0;line-height:0.86;}
.mono{font-family:"Schibsted Grotesk", ui-sans-serif, system-ui, sans-serif;}
.num{font-variant-numeric:normal;}

/* ---------- accent hero word ---------- */
.grad-word{
  font-style:normal;
  color:var(--accent);
}

/* ============================================================
 *  TOP RAIL — premium global shell
 *  Linear/PlayerZero/Supabase principles: calm typography, generous
 *  spacing, restrained active state, theme-aware contrast. Frosted-
 *  glass back via backdrop-filter; semantic tokens everywhere so
 *  light and opt-in dark stay consistent.
 *  ============================================================ */
.rail{
  display:flex;align-items:center;justify-content:space-between;
  gap:var(--space-4);
  padding:var(--space-4) clamp(20px, 4vw, 56px);
  border-bottom:1px solid var(--border);
  backdrop-filter:saturate(160%) blur(14px);
  -webkit-backdrop-filter:saturate(160%) blur(14px);
  background:var(--rail-bg);
  position:sticky;top:0;z-index:50;
  transition:border-color var(--dur-base) var(--ease-out),
             background-color var(--dur-base) var(--ease-out);
}

/* Brand — calmer presence than the prior 64-88px lockup. Still
 * readable; no longer competing with the page hero. */
.brand{
  display:flex;align-items:center;gap:var(--space-3);
  font-weight:700;letter-spacing:0.04em;
  text-decoration:none;color:inherit;
  border-radius:var(--radius-md);
}
.brand:focus-visible{outline:2px solid var(--border-focus);outline-offset:4px;}
.brand .mark{
  display:inline-flex;align-items:center;justify-content:center;
  height:clamp(56px, 6vw, 76px);margin:-12px 0;
}
.brand .mark img{height:100%;width:auto;display:block;}
.brand .mark .fallback{
  font-family:"Schibsted Grotesk", sans-serif;font-weight:900;font-size:15px;letter-spacing:0.14em;
  color:var(--accent);
}

/* Nav — Linear-style restraint. Muted by default; primary text on hover
 * or when active. Active item gets a soft underline using --accent so the
 * highlight reads as a deliberate marker, not a busy pill. */
.rail nav{
  display:flex;align-items:center;gap:var(--space-1);
  font-family:"Schibsted Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-size:var(--text-sm);font-weight:500;
  color:var(--text-muted);
}
.rail nav a{
  position:relative;
  display:inline-flex;align-items:center;
  padding:var(--space-2) var(--space-3);
  border-radius:var(--radius-md);
  color:var(--text-muted);
  text-decoration:none;
  letter-spacing:-0.005em;
  transition:color var(--dur-fast) var(--ease-out),
             background-color var(--dur-fast) var(--ease-out);
}
.rail nav a:hover{
  color:var(--text);
  background:var(--bg-2);
}
.rail nav a.active{
  color:var(--text);
  font-weight:600;
}
.rail nav a.active::after{
  content:"";
  position:absolute;
  left:var(--space-3);right:var(--space-3);bottom:-1px;
  height:2px;border-radius:var(--radius-pill);
  background:var(--accent);
}
.rail nav a:focus-visible{
  outline:2px solid var(--border-focus);outline-offset:3px;
}

/* ---- No flash-of-flat-nav ----
 * The flat inline nav is the link source + no-JS fallback, but it must never
 * PAINT before nav.js regroups it (that caused a ~2s flash of the old packed
 * nav on every navigation). Until nav.js adds .core-nav, hide the raw flat
 * links (they're the only direct <a> children of <nav>; the grouped items
 * nav.js builds are nested, so they show normally once enhanced). A small
 * min-height reserves the row so the header doesn't jump when it fills in.
 * (design_system.html doesn't load nav.js and opts back in locally.) */
header.rail nav:not(.core-nav){min-height:38px;}
header.rail nav:not(.core-nav) > a{display:none;}

/* ---- Grouped navigation (progressive enhancement; built by nav.js) ----
 * The flat .rail nav above is the no-JS fallback + link source. When nav.js
 * runs it adds .core-nav and rebuilds the children into grouped dropdowns +
 * a mobile hamburger. Styling matches the flat nav (muted links, accent
 * active-underline) so the enhancement is seamless. */
header nav.core-nav{position:relative;gap:var(--space-1);}
.core-nav-groups{display:flex;align-items:center;gap:var(--space-1);}

/* Six-destination shell. Every destination is visible at once. */
.core-nav-destinations{gap:2px;}
.core-nav--six .core-nav-top{white-space:nowrap;}

.core-nav-top,.core-nav-trigger{
  position:relative;display:inline-flex;align-items:center;gap:5px;
  padding:var(--space-2) var(--space-3);border-radius:var(--radius-md);
  font-family:"Schibsted Grotesk",ui-sans-serif,system-ui,sans-serif;font-size:var(--text-sm);font-weight:500;
  color:var(--text-muted);text-decoration:none;letter-spacing:-0.005em;line-height:1.2;
  background:none;border:none;cursor:pointer;
  transition:color var(--dur-fast) var(--ease-out),background-color var(--dur-fast) var(--ease-out);
}
.core-nav-top:hover,.core-nav-trigger:hover{color:var(--text);background:var(--bg-2);}
/* "Sign out" — a secondary account action, nudged off the primary nav items. */
.core-nav-signout{margin-left:var(--space-2);opacity:0.8;}
.core-nav-signout:hover{opacity:1;}
.core-nav-top:focus-visible,.core-nav-trigger:focus-visible{outline:2px solid var(--border-focus);outline-offset:3px;}
.core-nav-top.active,.core-nav-group.active>.core-nav-trigger{color:var(--text);font-weight:600;}
.core-nav-top.active::after,.core-nav-group.active>.core-nav-trigger::after{
  content:"";position:absolute;left:var(--space-3);right:var(--space-3);bottom:-1px;
  height:2px;border-radius:var(--radius-pill);background:var(--accent);
}
.core-nav-caret{font-size:0.7em;opacity:0.65;transition:transform var(--dur-fast) var(--ease-out);}
.core-nav-group.open>.core-nav-trigger .core-nav-caret{transform:rotate(180deg);}

.core-nav-group{position:relative;}
.core-nav-menu{
  position:absolute;top:calc(100% + 6px);left:0;z-index:60;
  min-width:224px;display:flex;flex-direction:column;gap:2px;
  padding:var(--space-2);border-radius:var(--radius-lg);
  background:var(--surface-elevated);border:1px solid var(--border);box-shadow:var(--shadow-lg);
  opacity:0;visibility:hidden;transform:translateY(-4px);
  transition:opacity var(--dur-fast) var(--ease-out),transform var(--dur-fast) var(--ease-out),visibility var(--dur-fast);
}
.core-nav-group.open>.core-nav-menu{opacity:1;visibility:visible;transform:translateY(0);}
.core-nav-item{
  display:block;padding:var(--space-2) var(--space-3);border-radius:var(--radius-md);
  font-size:var(--text-sm);font-weight:500;color:var(--text-2);text-decoration:none;white-space:nowrap;
  transition:color var(--dur-fast) var(--ease-out),background-color var(--dur-fast) var(--ease-out);
}
.core-nav-item:hover{color:var(--text);background:var(--bg-2);}
.core-nav-item.active{color:var(--accent);font-weight:600;}
.core-nav-item:focus-visible{outline:2px solid var(--border-focus);outline-offset:2px;}

.core-nav-burger{
  display:none;flex-direction:column;justify-content:center;gap:4px;
  width:40px;height:38px;padding:9px 8px;border:1px solid var(--border);border-radius:var(--radius-md);
  background:none;cursor:pointer;
}
.core-nav-burger span{display:block;height:2px;width:100%;background:var(--text-2);border-radius:2px;}
.core-nav-burger:hover{border-color:var(--accent);}
.core-nav-burger:focus-visible{outline:2px solid var(--border-focus);outline-offset:2px;}

/* Mobile: collapse the groups behind a hamburger; tapping a group expands its
 * items inline (a static panel, never an overflow-clipped overlay). */
@media (max-width:720px){
  .core-nav-burger{display:flex;}
  header nav.core-nav{overflow:visible;flex-wrap:wrap;}   /* panel wraps full-width BELOW the burger */
  .core-nav-groups{
    display:none;width:100%;flex-direction:column;align-items:stretch;gap:2px;
    margin-top:var(--space-3);padding:var(--space-2);
    border:1px solid var(--border);border-radius:var(--radius-lg);background:var(--surface-elevated);
  }
  header nav.core-nav.nav-open .core-nav-groups{display:flex;}
  .core-nav-group{width:100%;}
  .core-nav-trigger,.core-nav-top{width:100%;justify-content:space-between;}
  .core-nav-top.active::after,.core-nav-group.active>.core-nav-trigger::after{display:none;}
  .core-nav-menu{
    position:static;opacity:1;visibility:visible;transform:none;display:none;
    box-shadow:none;border:none;background:none;min-width:0;
    padding:2px 0 var(--space-2) var(--space-4);
  }
  header nav.core-nav .core-nav-group.open>.core-nav-menu{display:flex;}

  /* The six destinations are inventory, not a menu. Keep them in one visible,
   * horizontally scrollable row instead of hiding them behind a menu. */
  header nav.core-nav.core-nav--six{display:block;overflow:hidden;}
  .core-nav--six .core-nav-destinations{
    display:flex;width:100%;flex-direction:row;align-items:center;gap:2px;
    margin:0;padding:0 0 var(--space-1);border:0;background:none;
    overflow-x:auto;scrollbar-width:none;
  }
  .core-nav--six .core-nav-destinations::-webkit-scrollbar{display:none;}
  .core-nav--six .core-nav-top{width:auto;justify-content:center;padding:8px 10px;text-align:center;}
  .core-nav--six .core-nav-top.active::after{display:none;}
}

/* Meta cluster — status pills + glossary trigger.
 * All tokens, all themable. */
.rail .meta{
  display:flex;align-items:center;gap:var(--space-2);
  font-size:var(--text-sm);color:var(--text-muted);
}
.rail .live{
  display:inline-flex;align-items:center;gap:6px;
  padding:4px 10px;border-radius:var(--radius-pill);
  background:var(--success-soft);color:var(--success);font-weight:600;
}
.rail .live::before{
  content:"";width:6px;height:6px;border-radius:50%;
  background:var(--success);
  box-shadow:0 0 0 0 var(--success-soft);
  animation:pulse 2s infinite;
}
.rail .stage{
  display:inline-flex;align-items:center;gap:6px;
  padding:4px 10px;border-radius:var(--radius-pill);
  background:var(--surface);border:1px solid var(--border-strong);
  color:var(--text-2);font-weight:600;
}
.rail .stage::before{content:"";width:6px;height:6px;border-radius:50%;background:var(--accent);}

/* Theme toggle — injected into .rail .meta by core.js initTheme().
 * Tokenized so it reads correctly in both light and dark. */
.theme-toggle{
  display:inline-flex;align-items:center;gap:6px;
  padding:5px 11px;border-radius:var(--radius-pill);
  background:var(--surface);border:1px solid var(--border-strong);
  color:var(--text-2);font-family:inherit;font-weight:600;font-size:var(--text-sm);
  line-height:1;cursor:pointer;
  transition:border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.theme-toggle:hover{border-color:var(--accent);color:var(--text);}
.theme-toggle:focus-visible{outline:2px solid var(--border-focus);outline-offset:2px;}
.theme-toggle .tt-icon{display:inline-flex;align-items:center;color:var(--accent);}
.theme-toggle .tt-label{letter-spacing:0.01em;}
.rail .help{
  display:inline-flex;align-items:center;justify-content:center;
  width:30px;height:30px;border-radius:50%;
  border:1px solid var(--border-strong);
  background:var(--surface);color:var(--text-2);
  font-weight:700;font-size:13px;cursor:pointer;
  margin-left:var(--space-1);
  transition:background-color var(--dur-fast) var(--ease-out),
             color var(--dur-fast) var(--ease-out),
             border-color var(--dur-fast) var(--ease-out);
}
.rail .help:hover{
  background:var(--surface-elevated);
  color:var(--accent);
  border-color:var(--accent);
}
.rail .help:focus-visible{outline:2px solid var(--border-focus);outline-offset:2px;}

@keyframes pulse{
  0%{box-shadow:0 0 0 0 currentColor;}
  70%{box-shadow:0 0 0 8px transparent;}
  100%{box-shadow:0 0 0 0 transparent;}
}
@media (prefers-reduced-motion: reduce){
  .rail .live::before{animation:none;}
}

/* Mobile rail — stacks brand/meta on top, nav becomes a scrollable
 * row beneath. Sticky behavior dropped to keep the page tap-target
 * area generous on small screens. */
@media (max-width:720px){
  .rail{
    position:static;align-items:flex-start;gap:var(--space-3);
    flex-wrap:wrap;padding:var(--space-4) clamp(16px, 4vw, 24px);
  }
  .rail nav{
    order:3;width:100%;overflow-x:auto;
    padding-bottom:var(--space-1);
    scrollbar-width:none;
  }
  .rail nav::-webkit-scrollbar{display:none;}
  .rail .meta{margin-left:auto;}
}

/* ---------- eyebrow + kicker ---------- */
.eyebrow{
  display:inline-flex;align-items:center;gap:10px;flex-wrap:wrap;
  padding:6px 12px;border-radius:999px;background:var(--card);border:1px solid var(--line-2);
  font-size:13px;color:var(--ink-2);font-weight:500;margin-bottom:22px;
}
.eyebrow .platform{display:inline-flex;align-items:center;gap:6px;font-weight:600;}
.eyebrow .platform.yt::before{content:"";width:8px;height:8px;border-radius:2px;background:var(--yt);}
.eyebrow .platform.ig::before{content:"";width:8px;height:8px;border-radius:2px;background:var(--ig);}
.eyebrow .platform.tt::before{content:"";width:8px;height:8px;border-radius:2px;background:linear-gradient(135deg,#25f4ee 0%, #fe2c55 100%);}
.eyebrow .tick{display:inline-flex;align-items:center;gap:6px;font-weight:600;color:var(--ink);}
.eyebrow .tick::before{content:"";width:8px;height:8px;border-radius:50%;background:var(--accent);animation:pulse 2s infinite;box-shadow:0 0 0 0 color-mix(in srgb,var(--accent) 50%,transparent);}
.kicker{
  display:inline-flex;align-items:center;gap:10px;
  font-size:12px;color:var(--muted);font-weight:600;letter-spacing:0.14em;text-transform:uppercase;
  margin-bottom:14px;
}
.kicker::before{content:"";width:22px;height:1px;background:var(--line-2);}

/* ---------- engine-todo chip — flags missing engine fields ----------
 * In dev mode (body.dev), these surface fully as "ENGINE-TODO field_name"
 * for build coordination. In creator mode (default), the "ENGINE-TODO"
 * prefix is suppressed and the chip reads as a calm "this unlocks later"
 * affordance using whatever label the JS supplies.
 */
.engine-todo{
  display:inline-flex;align-items:center;gap:6px;
  padding:3px 9px;border-radius:6px;
  background:var(--amber-soft);color:var(--amber);
  font-family:"Schibsted Grotesk",sans-serif;font-size:11px;font-weight:600;
  border:1px dashed rgba(185,115,9,0.4);
  cursor:help;
}
body.dev .engine-todo::before{content:"engine-todo";font-weight:700;letter-spacing:0.06em;text-transform:uppercase;font-size:10px;}

/* ---------- creator-facing "unlock" chip ----------
 * Used on Onboarding's "What's missing without connecting" band etc.
 * Visually distinct from engine-todo: body type, no dashed border,
 * no machine vocabulary. Reads as a feature label, not a debug marker.
 */
.unlock-chip{
  display:inline-flex;align-items:center;gap:6px;
  padding:5px 11px;border-radius:8px;
  background:var(--paper-2);color:var(--ink);
  font-family:"Schibsted Grotesk",sans-serif;font-size:12.5px;font-weight:700;
  border:1px solid var(--line-2);
  letter-spacing:-0.005em;
  white-space:nowrap;
}
.unlock-chip::before{
  content:"";display:inline-block;width:6px;height:6px;border-radius:50%;
  background:var(--accent);
}

/* ---------- dev-only surfaces ----------
 * The dev line at the bottom of every wired page, the receipt IDs, the
 * raw state pills — all hidden by default. Append ?dev=1 to any URL to
 * reveal them, or click the small "dev" toggle in any footer.
 */
body:not(.dev) .dev-line{display:none !important;}
body:not(.dev) [data-dev-only]{display:none !important;}

/* ---------- color signal chips ---------- */
.signal{
  display:inline-flex;align-items:center;gap:6px;
  padding:3px 9px;border-radius:999px;
  font-size:11.5px;font-weight:700;letter-spacing:0.06em;text-transform:uppercase;
}
.signal::before{content:"";width:6px;height:6px;border-radius:50%;}
.signal.green{background:var(--green-soft);color:var(--green);}
.signal.green::before{background:var(--green);}
.signal.blue{background:var(--blue-soft);color:var(--blue);}
.signal.blue::before{background:var(--blue);}
.signal.amber{background:var(--amber-soft);color:var(--amber);}
.signal.amber::before{background:var(--amber);}
.signal.red{background:var(--red-soft);color:var(--red);}
.signal.red::before{background:var(--red);}
.signal.lavender{background:color-mix(in srgb,var(--accent) 10%,transparent);color:var(--accent);}
.signal.lavender::before{background:var(--accent);}

/* ---------- glass card ---------- */
.glass{
  background:var(--surface);backdrop-filter:blur(14px) saturate(140%);
  -webkit-backdrop-filter:blur(14px) saturate(140%);
  border:1px solid var(--border-strong);border-radius:var(--radius-2xl);
  padding:var(--space-6);box-shadow:var(--shadow-md);
}
.glass-sm{
  background:var(--surface);backdrop-filter:blur(14px) saturate(140%);
  -webkit-backdrop-filter:blur(14px) saturate(140%);
  border:1px solid var(--border-strong);border-radius:var(--radius-xl);
  padding:var(--space-5);box-shadow:var(--shadow-md);
}

/* ---------- section frame ---------- */
.block{padding:48px 0;border-top:1px solid var(--line);}
.block:first-of-type{border-top:none;}
.block-title{
  font-family:"Schibsted Grotesk",sans-serif;font-weight:900;
  font-size:clamp(34px,4.2vw,54px);line-height:1;letter-spacing:-0.01em;margin:0 0 14px;
}
.block-title em{font-style:normal;color:var(--accent);}
.block-lede{color:var(--ink-2);font-size:17px;max-width:62ch;margin:0;line-height:1.5;}

/* ---------- buttons + links ---------- */
.btn{
  display:inline-flex;align-items:center;gap:10px;
  padding:12px 18px;border-radius:14px;
  font-family:"Schibsted Grotesk",sans-serif;font-weight:700;font-size:15px;letter-spacing:-0.005em;
  text-decoration:none;border:1px solid transparent;cursor:pointer;
  transition:transform .15s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease, color .15s ease;
}
.btn-primary{background:var(--text);color:var(--bg);}
.btn-primary:hover{transform:translateY(-1px);box-shadow:var(--shadow);}
.btn-ghost{background:var(--card);color:var(--ink);border-color:var(--line-2);}
.btn-ghost:hover{border-color:var(--accent);color:var(--accent);}
.btn-dark{background:var(--dark-grad);color:#fff;}
.btn-dark:hover{transform:translateY(-1px);box-shadow:var(--shadow-lg);}
.hlink{color:var(--accent);text-decoration:none;border-bottom:1px dotted color-mix(in srgb,var(--accent) 35%,transparent);padding-bottom:1px;}
.hlink:hover{border-color:var(--accent);}

/* ---------- drawer (right-side sheet) ---------- */
.scrim{
  position:fixed;inset:0;background:rgba(19,22,27,0.45);backdrop-filter:blur(4px);
  opacity:0;pointer-events:none;transition:opacity .2s ease;z-index:100;
}
.scrim.open{opacity:1;pointer-events:auto;}
.drawer{
  position:fixed;top:0;right:0;bottom:0;width:min(520px,100%);
  background:var(--paper);border-left:1px solid var(--line-2);
  transform:translateX(100%);transition:transform .28s cubic-bezier(.2,.8,.2,1);
  z-index:110;display:flex;flex-direction:column;box-shadow:-30px 0 60px rgba(0,0,0,0.12);
}
.drawer.open{transform:translateX(0);}
@media (max-width:720px){.drawer{width:100%;}}
.drawer .dhead{
  display:flex;align-items:center;justify-content:space-between;gap:16px;
  padding:22px 26px;border-bottom:1px solid var(--line);
}
.drawer .dhead h3{font-family:"Schibsted Grotesk",sans-serif;font-weight:800;font-size:22px;margin:0;letter-spacing:-0.01em;}
.drawer .close{
  width:34px;height:34px;border-radius:50%;border:1px solid var(--line-2);background:#fff;
  cursor:pointer;font-size:16px;color:var(--ink-2);display:inline-flex;align-items:center;justify-content:center;
}
.drawer .close:hover{color:var(--accent);border-color:var(--accent);}
.drawer .dbody{flex:1;overflow-y:auto;padding:22px 26px;}
.glossary dl{margin:0;}
.glossary dt{font-family:"Schibsted Grotesk",sans-serif;font-weight:800;font-size:15px;margin-top:20px;letter-spacing:-0.005em;color:var(--ink);}
.glossary dt:first-child{margin-top:0;}
.glossary dd{margin:6px 0 0;color:var(--ink-2);font-size:14px;line-height:1.55;}

/* ---------- loading + error states ---------- */
.state-loading, .state-error{
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  min-height:60vh;padding:40px 20px;text-align:center;gap:18px;
}
.state-loading .pulse{
  width:14px;height:14px;border-radius:50%;background:var(--accent);
  box-shadow:0 0 0 0 color-mix(in srgb,var(--accent) 50%,transparent);animation:pulse 1.4s infinite;
}
.state-loading .msg, .state-error .msg{color:var(--ink-2);font-size:15px;max-width:46ch;line-height:1.5;}
.state-loading .msg b, .state-error .msg b{color:var(--ink);font-family:"Schibsted Grotesk",sans-serif;font-weight:600;}
.state-error h2{
  font-family:"Schibsted Grotesk",sans-serif;font-weight:900;font-size:32px;letter-spacing:-0.01em;margin:0;
}
.state-error .detail{
  margin-top:8px;font-family:"Schibsted Grotesk",sans-serif;font-size:12px;color:var(--muted);
  background:var(--paper-2);border:1px solid var(--line-2);border-radius:10px;padding:10px 14px;
  max-width:520px;word-break:break-all;
}

/* ============================================================
 *  FOOTER — calm secondary surface
 *  Should not feel like a second product nav. Smaller mark, calmer
 *  hover (text-2 rather than primary text), generous breathing room
 *  above. Token-driven for clean light/dark behavior.
 *  ============================================================ */
.footer{
  padding:var(--space-12) clamp(20px, 4vw, 56px) var(--space-16);
  border-top:1px solid var(--border);
  color:var(--text-muted);font-size:var(--text-sm);
  display:flex;flex-wrap:wrap;gap:var(--space-3) var(--space-8);
  align-items:center;justify-content:space-between;
  transition:border-color var(--dur-base) var(--ease-out);
}
.footer .fbrand{
  display:flex;align-items:center;gap:var(--space-3);
  color:var(--text-muted);
}
.footer .fbrand .mark{
  display:inline-flex;height:44px;margin:-6px 0;
  opacity:0.78;
  transition:opacity var(--dur-base) var(--ease-out);
}
.footer .fbrand .mark:hover{opacity:1;}
.footer .fbrand .mark img{height:100%;width:auto;display:block;}
.footer nav{
  display:flex;gap:var(--space-5);
  font-size:var(--text-sm);
}
.footer nav a{
  color:inherit;text-decoration:none;
  padding:var(--space-1) var(--space-2);
  border-radius:var(--radius-sm);
  transition:color var(--dur-fast) var(--ease-out);
}
.footer nav a:hover{color:var(--text-2);}
.footer nav a:focus-visible{outline:2px solid var(--border-focus);outline-offset:2px;}

/* ---------- a11y / utility ---------- */
.sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0,0,0,0) !important;white-space:nowrap !important;border:0 !important;}
[hidden]{display:none !important;}

/* ========================================================================
 *  PREMIUM PRIMITIVES (v2)
 *  New shared components introduced in the design-system pass. These are
 *  additive — existing classes are unchanged so per-screen styles keep
 *  working. New screens (and refactors) should prefer these.
 *  ====================================================================== */

/* ---------- card-flat: borderless calm surface ----------
 * Use when you have many supporting blocks and don't want every one to
 * compete for attention. Replaces the "wall of cards" pattern.
 */
.card-flat{
  background:var(--bg-2);
  border:1px solid transparent;
  border-radius:var(--radius-xl);
  padding:var(--space-5) var(--space-6);
  transition:border-color var(--dur-base) var(--ease-out), background-color var(--dur-base) var(--ease-out);
}
.card-flat:hover{border-color:var(--border-strong);}

/* ---------- card-elevated: a single hero surface ----------
 * Use for the one card that matters most on a page. Larger radius,
 * softer shadow, more breathing room. Don't use more than one or two.
 */
.card-elevated{
  background:var(--surface-elevated);
  border:1px solid var(--border);
  border-radius:var(--radius-2xl);
  padding:var(--space-8);
  box-shadow:var(--shadow-lg);
}

/* ---------- disclose: progressive disclosure primitive ----------
 * <details class="disclose"><summary>Show evidence</summary>...</details>
 * Use for evidence cards, build logs, advanced detail. The page shows the
 * answer first; depth is one click away. No "show details" link wiring
 * needed — native <details> handles state and a11y.
 */
.disclose{
  border:1px solid var(--border);
  border-radius:var(--radius-lg);
  background:var(--bg-2);
  padding:0;
  overflow:hidden;
  transition:border-color var(--dur-base) var(--ease-out);
}
.disclose[open]{border-color:var(--border-strong);}
.disclose > summary{
  display:flex;align-items:center;gap:var(--space-3);
  padding:var(--space-3) var(--space-5);
  cursor:pointer;list-style:none;
  font-family:"Schibsted Grotesk", sans-serif;
  font-weight:700;font-size:var(--text-sm);
  color:var(--text-2);letter-spacing:-0.005em;
  user-select:none;
  transition:color var(--dur-fast) var(--ease-out);
}
.disclose > summary:hover{color:var(--text);}
.disclose > summary::-webkit-details-marker{display:none;}
.disclose > summary::before{
  content:"";
  width:7px;height:7px;
  border-right:1.5px solid currentColor;
  border-bottom:1.5px solid currentColor;
  transform:rotate(-45deg);
  transition:transform var(--dur-base) var(--ease-out);
  flex-shrink:0;
}
.disclose[open] > summary::before{transform:rotate(45deg);}
.disclose > summary .summary-count{
  margin-left:auto;
  font-family:"Schibsted Grotesk", sans-serif;font-weight:600;font-size:var(--text-xs);
  color:var(--text-muted);
  background:var(--surface-solid);
  padding:2px 8px;border-radius:var(--radius-pill);
  border:1px solid var(--border);
}
.disclose > .disclose-body{
  padding:var(--space-4) var(--space-5) var(--space-5);
  border-top:1px solid var(--border);
  font-size:var(--text-sm);
  color:var(--text-2);
  line-height:var(--leading-relaxed);
}

/* ---------- metric: calm stat display ----------
 * The premium replacement for raw number dumps. Big number, supporting
 * label, optional change indicator and tooltip. Never shows precision
 * the engine hasn't earned.
 *
 *   <div class="metric">
 *     <span class="metric-value">2.4×</span>
 *     <span class="metric-label">avg engagement uplift</span>
 *     <span class="metric-foot">vs your last 10 clips</span>
 *   </div>
 */
.metric{
  display:flex;flex-direction:column;gap:var(--space-1);
  padding:var(--space-4) var(--space-5);
}
.metric-value{
  font-family:"Schibsted Grotesk", sans-serif;
  font-weight:800;font-size:var(--text-3xl);
  letter-spacing:-0.02em;line-height:1;
  color:var(--text);
}
.metric-value em{font-style:normal;color:var(--accent);}
.metric-label{
  font-size:var(--text-xs);font-weight:700;
  letter-spacing:0.08em;text-transform:uppercase;
  color:var(--text-muted);
}
.metric-foot{
  font-size:var(--text-sm);color:var(--text-2);
  line-height:var(--leading-snug);
}

/* metric-row: side-by-side metrics with a calm divider between them */
.metric-row{
  display:grid;gap:var(--space-1);
  grid-template-columns:repeat(auto-fit, minmax(140px, 1fr));
  background:var(--surface-solid);
  border:1px solid var(--border);
  border-radius:var(--radius-xl);
  padding:var(--space-2);
}
.metric-row > .metric + .metric{
  border-left:1px solid var(--border);
}
@media (max-width:540px){
  .metric-row > .metric + .metric{border-left:none;border-top:1px solid var(--border);}
}

/* ---------- btn-lg: hero CTA ----------
 * For the one moment on a page where you really want them to click —
 * "Build my upload kit," "Start with this clip," "Connect Analytics."
 */
.btn-lg{
  padding:var(--space-4) var(--space-6);
  border-radius:var(--radius-xl);
  font-size:var(--text-lg);
  letter-spacing:-0.01em;
  gap:var(--space-3);
}
.btn-sm{
  padding:var(--space-2) var(--space-4);
  border-radius:var(--radius-md);
  font-size:var(--text-sm);
  gap:var(--space-2);
}

/* ---------- divider: proper hairline ---------- */
.divider{
  height:1px;border:0;margin:var(--space-8) 0;
  background:var(--border);
}
.divider-soft{height:1px;border:0;margin:var(--space-6) 0;background:linear-gradient(90deg, transparent, var(--border-strong), transparent);}

/* ---------- answer-card: the page's single main answer ----------
 * One per page. Lead with the answer, then a one-line "why," then the
 * primary action. Everything else on the page supports this card.
 *
 *   <section class="answer-card">
 *     <span class="ac-eyebrow">What to publish</span>
 *     <h2 class="ac-headline">Lead with the 8s hook from clip 14.</h2>
 *     <p class="ac-because">It beats your channel median by 2.4× and matches what's winning in your topic this week.</p>
 *     <div class="ac-action"><a class="btn btn-primary btn-lg">Build my upload kit</a></div>
 *   </section>
 */
.answer-card{
  background:var(--surface-elevated);
  border:1px solid var(--border);
  border-radius:var(--radius-2xl);
  padding:clamp(24px, 3.5vw, 40px);
  box-shadow:var(--shadow-lg);
  display:flex;flex-direction:column;gap:var(--space-4);
  position:relative;overflow:hidden;
}
.answer-card::before{
  content:"";position:absolute;inset:0 0 auto 0;height:3px;
  background:var(--accent);opacity:0.9;
}
.answer-card .ac-eyebrow{
  font-size:var(--text-xs);font-weight:700;
  letter-spacing:0.1em;text-transform:uppercase;
  color:var(--accent);
}
.answer-card .ac-headline{
  font-family:"Schibsted Grotesk", sans-serif;
  font-weight:900;font-size:clamp(24px, 3vw, 36px);
  letter-spacing:-0.01em;line-height:var(--leading-tight);
  color:var(--text);margin:0;
  max-width:24ch;
}
.answer-card .ac-because{
  color:var(--text-2);font-size:var(--text-lg);
  line-height:var(--leading-relaxed);max-width:54ch;margin:0;
}
.answer-card .ac-action{display:flex;gap:var(--space-3);flex-wrap:wrap;margin-top:var(--space-2);}

/* ---------- supporting-grid: calmer secondary cards ----------
 * Use under an answer-card for supporting blocks. The grid is more
 * generous than the typical dashboard tile pack, with calmer surfaces.
 */
.supporting-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(280px, 1fr));
  gap:var(--space-4);
  margin-top:var(--space-6);
}

/* ---------- typography presets ---------- */
.t-display{
  font-family:"Schibsted Grotesk", sans-serif;
  font-weight:900;font-size:var(--text-display);
  letter-spacing:-0.02em;line-height:0.92;margin:0;
}
.t-h1{font-family:"Schibsted Grotesk",sans-serif;font-weight:900;font-size:var(--text-3xl);letter-spacing:-0.01em;line-height:var(--leading-tight);margin:0;}
.t-h2{font-family:"Schibsted Grotesk",sans-serif;font-weight:800;font-size:var(--text-2xl);letter-spacing:-0.01em;line-height:var(--leading-tight);margin:0;}
.t-h3{font-family:"Schibsted Grotesk",sans-serif;font-weight:700;font-size:var(--text-xl);letter-spacing:-0.005em;line-height:var(--leading-snug);margin:0;}
.t-body{font-size:var(--text-base);line-height:var(--leading-relaxed);color:var(--text-2);}
.t-meta{font-size:var(--text-xs);color:var(--text-muted);letter-spacing:0.04em;}

/* ---------- theme toggle (optional, for design_system.html) ---------- */
.theme-toggle{
  display:inline-flex;align-items:center;gap:var(--space-2);
  padding:var(--space-2) var(--space-3);
  border-radius:var(--radius-pill);
  background:var(--surface);
  border:1px solid var(--border-strong);
  font-size:var(--text-xs);font-weight:600;color:var(--text-2);
  cursor:pointer;font-family:inherit;
  transition:border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.theme-toggle:hover{border-color:var(--accent);color:var(--accent);}

/* ============================================================
 *  MOBILE OVERFLOW HARDENING  (shared guard, every page)
 *  A phone must never scroll sideways or clip content off the right edge.
 *  Root causes this fixes globally, so each page's inline styles don't have
 *  to re-solve them:
 *   1. A flex/grid child (a long video title, a wide chip row) refusing to
 *      shrink below its content and forcing the row wider than the screen.
 *   2. Long unbroken strings (titles, URLs, keys) not wrapping.
 *   3. Media / tables wider than the viewport.
 *  Inner scrollers (a table wrapped in overflow-x:auto) still scroll locally;
 *  only the PAGE is prevented from scrolling sideways.
 * ============================================================ */
html, body { max-width: 100%; overflow-x: clip; }
.page, .content, main.content { min-width: 0; }
/* The newer surfaces (what_wins, subscriber_machine, seasonality) put their
 * content directly in <main class="content"> instead of the established
 * <div class="wrap">. Give that main the SAME constraint as .wrap so the
 * content is inset and centered like every other page, not edge-to-edge. */
main.content { max-width: 1240px; margin: 0 auto; padding: 0 clamp(20px, 4vw, 56px); }
/* Block containers inside the content column may always shrink below their
 * content size (:where keeps specificity 0 so page rules still win). */
.content :where(section, article, div, li, a) { min-width: 0; }

@media (max-width: 640px) {
  /* Text wraps instead of forcing width. anywhere handles long unbroken
   * tokens (URLs, hashless keys) that break-word alone leaves overflowing. */
  .content :where(h1, h2, h3, h4, p, td, th, li, a, span) { overflow-wrap: anywhere; }
  /* Media and native tables cap at the column. */
  .content :where(img, svg, canvas, video, table) { max-width: 100%; }
  /* Fixed two-track "content + trailing number" rows are the most common
   * offender (a nowrap metric beside a long title): let the row wrap. */
  .content :where(img, svg) { height: auto; }
}

/* ============================================================
 *  2028 DESIGN-LANGUAGE LIFT  (research wc1vysj28, batch 2)
 *  Shared, framework-free upgrades that lift every page at once. All motion
 *  degrades to nothing under prefers-reduced-motion. No layout/color changes,
 *  so nothing existing shifts; these are additive polish + perceived speed.
 * ============================================================ */

/* Tuned spring easing (one overshoot), the "considered" alternative to the
 * browser-default ease that reads as unconsidered/templated. */
:root { --ease-spring: linear(0, 0.006, 0.25 8%, 0.9 20%, 1.06 30%, 1.02, 1); }

/* Cross-document View Transitions: kill the white-flash hard reload between
 * same-origin pages (the #1 tell of a hand-rolled multi-page app). The shared
 * top rail is named so it persists/morphs instead of hard-cutting. Firefox
 * degrades to instant navigation; cross-origin (OAuth) flows are excluded by
 * spec. */
@view-transition { navigation: auto; }
.app-rail { view-transition-name: core-rail; }

/* Tactile interaction feedback: a spring transition on hover-able chrome and a
 * compositor-cheap press on buttons. Transform-only, so no reflow. */
.btn, button, .core-nav-trigger, .theme-toggle {
  transition: transform 0.16s var(--ease-spring), box-shadow 0.16s var(--ease-spring),
    border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.btn:active, button:active, a.btn:active { transform: scale(0.97); }

/* Schibsted gives separators digit-wide spacing under tabular figures. Keep
 * proportional spacing on rendered metrics; only odometer digit boxes below
 * may use tabular figures because they cannot contain separators. */
.num, .big, .mult, .pct, .metric b, .metric .num,
[data-metric], .ps-num, .bc-stat .big, .dyk .big {
  font-variant-numeric: normal;
}

/* One shared working indicator. A spinner names the active job; a shaped
 * skeleton beneath it preserves the geometry of whatever is coming. */
.spinner{
  border-radius:50%;flex-shrink:0;
  border:2px solid color-mix(in srgb,var(--accent) 20%,transparent);
  border-top-color:var(--accent);animation:spin .9s linear infinite;
}
.spinner--sm{width:12px;height:12px;border-width:1.5px;}
.spinner--md{width:16px;height:16px;border-width:2px;}
.spinner--lg{width:22px;height:22px;border-width:3px;}
@keyframes spin{to{transform:rotate(360deg)}}

/* Skeleton loading: layout-shaped shimmer blocks sized like final content. */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-elevated) 37%, var(--surface) 63%);
  background-size: 400% 100%;
  border-radius: var(--radius-lg);
  animation: core-shimmer 1.4s ease infinite;
}
@keyframes core-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

@media (prefers-reduced-motion: reduce) {
  /* Keep instant navigation, but suppress the transition animation itself. */
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  .btn, button, .core-nav-trigger, .theme-toggle { transition: none; }
  .btn:active, button:active, a.btn:active { transform: none; }
  .spinner, .skeleton { animation: none; }
}

/* ============================================================
 *  STAT BAND + BENTO  (home density, research wc1vysj28 batch 3)
 *  A KPI stat band (4-layer tiles: label -> value -> delta-vs-baseline ->
 *  sparkline) and a 12-col priority bento. Shared so any surface can reuse.
 * ============================================================ */
.statband { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-4); margin: var(--space-6) 0 0; container-type: inline-size; }
.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: var(--space-5); display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.stat-tile .st-label { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 700; }
.stat-tile .st-value { font-family: "Schibsted Grotesk", sans-serif; font-weight: 800; font-size: clamp(24px, 2.6vw, 32px); color: var(--text); letter-spacing: -0.01em; line-height: 1; }
.stat-tile .st-delta { display: inline-flex; align-items: center; gap: 5px; font-size: var(--text-sm); font-weight: 600; min-height: 18px; }
.stat-tile .st-delta.up { color: var(--success); }
.stat-tile .st-delta.down { color: var(--risk); }
.stat-tile .st-delta.flat { color: var(--text-muted); }
.stat-tile .st-delta .win { color: var(--text-muted); font-weight: 400; }
.stat-tile .st-spark { margin-top: 2px; height: 34px; }
.stat-tile .st-spark svg { display: block; width: 100%; height: 34px; overflow: visible; }
.stat-tile .st-spark path.line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.stat-tile .st-spark path.area { fill: var(--accent-soft); stroke: none; }

/* 12-column priority bento: span = importance, not font size. */
.bento { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--space-4); margin-top: var(--space-5); }
.bento > * { grid-column: span 4; min-width: 0; }
.bento > .span-6 { grid-column: span 6; }
.bento > .span-8 { grid-column: span 8; }
.bento > .span-12 { grid-column: span 12; }
.bento > .row-2 { grid-row: span 2; }
@media (max-width: 900px) { .bento { grid-template-columns: repeat(6, 1fr); } .bento > *, .bento > .span-6 { grid-column: span 3; } .bento > .span-8, .bento > .span-12 { grid-column: 1 / -1; } }
@media (max-width: 560px) { .bento > * { grid-column: 1 / -1 !important; } .bento > .row-2 { grid-row: auto; } }


/* ============================================================
 *  RENDER-SKIP + PREFETCH  (perf polish, research wc1vysj28 batch 4)
 * ============================================================ */
/* The Library renders 300+ video rows; content-visibility skips layout+paint
 * for off-screen rows (no virtualization lib). contain-intrinsic-size:auto
 * remembers each row's real height so the scrollbar never jumps; find-in-page
 * and the a11y tree still reach hidden rows. */
.cat-row { content-visibility: auto; contain-intrinsic-size: auto 104px; }
.cv-auto { content-visibility: auto; contain-intrinsic-size: auto 120px; }

/* ============================================================================
 * CORE Card Kit v1  ·  ported 1:1 from Cleo's handoff/card_kit.css
 * Design source: "CORE Card Kit.dc.html". Cleo owns the look; this is a verbatim
 * lift. Built ONLY on existing core.css tokens above, so light + dark come free.
 * ACCENT IS THEME-SCOPED: the kit reads --accent and gets the right per-theme
 * value automatically. Do NOT introduce a single global accent.
 * JS contract (core.js, all optional; CSS holds a correct zero-JS end-state):
 *   [data-count] (+data-dec,data-suffix) -> count-in on reveal
 *   .kit-fill[data-w] / .kit-dev-fill[data-w] -> set --kit-w to data-w + '%'
 *   [data-ticks] (+data-tickcolor) -> build N <i> children, stagger in
 *   [data-spark] <polyline> -> draw via stroke-dashoffset
 * ========================================================================== */

/* ---- shared label ---- */
.kit-eyebrow{
  font-size:var(--text-xs);font-weight:700;letter-spacing:.1em;text-transform:uppercase;
  color:var(--muted);
}
.kit-eyebrow--grad{
  color:var(--accent);
}

/* ---- .kit-read, the one answer per surface (from .answer-card + .ww-verdict) ---- */
.kit-read{
  position:relative;overflow:hidden;
  background:var(--surface-elevated);border:1px solid var(--border);
  border-radius:var(--radius-2xl);box-shadow:var(--shadow-lg);
  padding:clamp(28px,3.4vw,40px) clamp(26px,3.4vw,44px);
}
.kit-read::before{
  content:"";position:absolute;left:0;top:22px;bottom:22px;width:5px;
  border-radius:6px;background:var(--accent);
  animation:kit-spine 6s linear infinite;
}
.kit-read__body{padding-left:20px;}
.kit-read__claim{
  font-family:"Schibsted Grotesk",sans-serif;font-weight:800;
  font-size:clamp(26px,3.1vw,38px);line-height:1.18;letter-spacing:-.015em;
  color:var(--text);max-width:24ch;margin:18px 0 0;
}
.kit-read__why{
  margin:20px 0 0;font-size:clamp(16px,1.5vw,18.5px);color:var(--text-2);
  line-height:1.6;max-width:52ch;
}
.kit-read__actions{display:flex;align-items:center;gap:18px;flex-wrap:wrap;margin-top:26px;}

.kit-btn{
  display:inline-flex;align-items:center;gap:10px;
  padding:14px 24px;border-radius:var(--radius-lg);
  background:var(--text);color:var(--bg);
  font-family:"Schibsted Grotesk",sans-serif;font-weight:800;font-size:16.5px;
  text-decoration:none;border:0;cursor:pointer;
}

/* ---- .kit-evidence, the trust receipt (promote renderEvidenceChip / .ev-*) ---- */
.kit-evidence{
  display:inline-flex;align-items:center;gap:9px;
  font-size:13px;color:var(--muted);max-width:34ch;
}
.kit-evidence__dot{width:8px;height:8px;border-radius:50%;flex:0 0 auto;background:var(--green);}
.kit-evidence strong{color:var(--green);font-weight:700;}

.kit-chip-conf{
  display:inline-flex;align-items:center;gap:8px;
  padding:8px 15px;border-radius:var(--radius-pill);
  font-size:13.5px;font-weight:600;
}
.kit-chip-conf::before{content:"";width:8px;height:8px;border-radius:50%;background:currentColor;}
.kit-chip-conf strong{font-weight:700;}
.kit-chip-conf.is-high{background:var(--green-soft);color:var(--green);}
.kit-chip-conf.is-directional{background:var(--blue-soft);color:var(--blue);}
.kit-chip-conf.is-early{background:var(--amber-soft);color:var(--amber);}

/* ---- .kit-compare, two labeled bars + big multiplier (the exemplar) ---- */
.kit-compare{
  background:var(--surface-sunken);border:1px solid var(--border);
  border-radius:var(--radius-xl);padding:var(--space-6);max-width:420px;
}
.kit-compare__row{margin-bottom:var(--space-4);}
.kit-compare__row:last-of-type{margin-bottom:0;}
.kit-compare__label{
  display:flex;justify-content:space-between;font-size:12.5px;
  color:var(--text);margin-bottom:6px;
}
.kit-compare__label .num{font-weight:700;}
.kit-compare__label--muted{color:var(--text-2);}
.kit-compare__label--muted .num{color:var(--muted);font-weight:400;}
.kit-compare__track{height:12px;border-radius:var(--radius-pill);background:var(--border-strong);overflow:hidden;}
.kit-fill{height:100%;width:var(--kit-w,0);border-radius:var(--radius-pill);background:var(--accent);transition:width var(--dur-slow) var(--ease-out);}
.kit-fill--muted{background:var(--muted);opacity:.55;}
.kit-compare__mult{display:flex;align-items:baseline;gap:9px;margin-top:var(--space-5);padding-top:var(--space-4);border-top:1px solid var(--border);}
.kit-mult{
  font-family:"Schibsted Grotesk",sans-serif;font-weight:900;font-size:34px;
  line-height:.9;letter-spacing:-.02em;
  color:var(--text);
}

/* ---- .kit-stat, big number with context (promote .stat-tile family) ---- */
.kit-stat{
  padding:var(--space-5) var(--space-6);border-radius:var(--radius-lg);
  background:var(--card-solid);border:1px solid var(--border);box-shadow:var(--shadow-md);
}
.kit-stat__value{
  font-family:"Schibsted Grotesk",sans-serif;font-weight:800;font-size:var(--text-3xl);
  letter-spacing:-.02em;line-height:1.1;color:var(--text);
}
.kit-stat__delta{font-size:12.5px;color:var(--text-2);margin-top:2px;}
.kit-stat__delta .up{color:var(--green);font-weight:700;}
.kit-stat--hero{display:flex;align-items:baseline;gap:10px;}
.kit-stat__hero-num{
  font-family:"Schibsted Grotesk",sans-serif;font-weight:900;font-size:40px;line-height:.85;
  letter-spacing:-.02em;
  color:var(--text);
}
.kit-stat__hero-ctx{font-family:"Schibsted Grotesk",sans-serif;font-weight:800;font-size:15px;color:var(--text);line-height:1.15;}

/* ---- .kit-deviation, distance from the creator's 1.0x baseline (promote .tp-bar) ---- */
.kit-deviation__track{position:relative;height:12px;border-radius:var(--radius-pill);background:var(--border-strong);}
.kit-deviation__center{position:absolute;left:50%;top:-4px;bottom:-4px;width:2px;background:var(--muted);opacity:.5;}
.kit-dev-fill{position:absolute;top:0;bottom:0;left:50%;width:var(--kit-w,0);border-radius:0 var(--radius-pill) var(--radius-pill) 0;background:var(--accent);transition:width var(--dur-slow) var(--ease-out);}
.kit-dev-fill--down{left:auto;right:50%;border-radius:var(--radius-pill) 0 0 var(--radius-pill);background:var(--muted);opacity:.5;}

/* ---- .kit-ticks, consistency strip (one tick / upload) ---- */
.kit-ticks{display:flex;gap:2px;align-items:flex-end;height:26px;}
.kit-ticks i{flex:1;min-width:2px;border-radius:2px;background:var(--accent);opacity:.85;}

/* ---- .kit-chips, gap / unlock objects (promote .unlock-chip) ---- */
.kit-chips{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:24px;align-items:center;padding:22px;border:1px solid var(--border);border-radius:var(--radius-xl);background:var(--surface-sunken);overflow:hidden;}
.kit-chips__copy{min-width:0;}
.kit-chips__title{margin:7px 0 0;font-family:"Schibsted Grotesk",sans-serif;font-size:20px;font-weight:800;line-height:1.25;letter-spacing:-.01em;color:var(--text);}
.kit-chips__list{display:flex;flex-wrap:wrap;gap:8px;margin-top:16px;}
.kit-chips__metric{text-align:right;max-width:24ch;}
.kit-chips__value{font-family:"Schibsted Grotesk",sans-serif;font-size:44px;font-weight:900;line-height:.9;letter-spacing:-.02em;color:var(--text);}
.kit-chips__metric p{margin:7px 0 0;color:var(--text-2);font-size:12.5px;line-height:1.45;}
.kit-chip{padding:5px 12px;border-radius:var(--radius-sm);background:var(--card-solid);border:1px solid var(--border-strong);font-size:12.5px;color:var(--text);font-weight:600;}
.kit-chip--unlock{display:inline-flex;align-items:center;gap:7px;padding:8px 14px;border-radius:var(--radius-md);font-family:"Schibsted Grotesk",sans-serif;font-weight:700;font-size:13px;text-decoration:none;}
.kit-chip--unlock::before{content:"\002B";color:var(--accent);font-size:15px;line-height:1;}
.kit-chip--lane{display:inline-flex;align-items:center;padding:8px 14px;border-radius:var(--radius-md);background:var(--accent-soft);color:var(--accent);font-family:"Schibsted Grotesk",sans-serif;font-weight:700;font-size:13px;}
@media(max-width:620px){.kit-chips{grid-template-columns:1fr;gap:20px}.kit-chips__metric{max-width:none;text-align:left}.kit-chips__value{font-size:38px}}

/* ---- .kit-curve, retention / watch-time curve (v1.1) ----
 * Inline <svg> needs two <linearGradient> defs once per page:
 *   #kitCurveArea (vertical, accent -> transparent) and
 *   #kitCurveStroke (horizontal brand gradient), shipped in a hidden SVG sprite.
 * Lines draw via stroke-dashoffset; no-JS / reduced-motion leaves them drawn. */
.kit-curve{background:var(--surface-sunken);border:1px solid var(--border);border-radius:var(--radius-xl);padding:var(--space-6);max-width:560px;}
.kit-curve svg{width:100%;height:auto;display:block;overflow:visible;}
.kit-curve__grid{stroke:var(--border);stroke-width:1;}
.kit-curve__grid--base{stroke:var(--border-strong);}
.kit-curve__area{fill:url(#kitCurveArea);animation:kit-fade 1.2s ease .45s both;}
.kit-curve__line{fill:none;stroke:url(#kitCurveStroke);stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:1000;animation:kit-draw 1.5s ease both;}
.kit-curve__line--muted{stroke:var(--muted);stroke-opacity:.55;stroke-width:2.5;animation-delay:.2s;}

/* ---- kit motion ---- */
@keyframes kit-spine{0%{background-position:50% 0%;}100%{background-position:50% 300%;}}
@keyframes kit-draw{from{stroke-dashoffset:1000;}to{stroke-dashoffset:0;}}
@keyframes kit-fade{from{opacity:0;}to{opacity:1;}}
@media (prefers-reduced-motion: reduce){
  .kit-read::before{animation:none;}
  .kit-fill,.kit-dev-fill{transition:none;}
  .kit-curve__area,.kit-curve__line{animation:none;}
}

/* ========================================================================
 *  CORE v2 application foundation
 *  Approved 2026-08-18. Shared geometry and components only; destination-
 *  specific composition remains in each screen until its mock is approved.
 *  ====================================================================== */
.app-shell{
  box-sizing:border-box;display:flex;min-height:100svh;
  padding:8px 8px 8px 0;background:var(--shell);
}
.app-rail{
  width:240px;flex:none;display:flex;flex-direction:column;min-height:calc(100svh - 16px);
  color:var(--text);background:var(--shell);view-transition-name:core-rail;
}
.app-rail__identity{display:flex;flex-direction:column;gap:12px;padding:18px 18px 16px;}
.app-rail__brand{display:inline-flex;height:40px;align-self:flex-start;margin:2px 0 6px 22px;}
.app-rail__brand img{display:block;width:auto;height:100%;}
.app-rail__channel{
  display:flex;width:100%;align-items:center;gap:10px;padding:9px;border:1px solid var(--border);
  border-radius:10px;background:color-mix(in srgb,var(--text) 2%,transparent);text-align:left;
}
.app-rail__initials{
  display:inline-flex;width:26px;height:26px;align-items:center;justify-content:center;flex:none;
  border-radius:7px;background:var(--accent);color:var(--shell);font-size:11px;font-weight:800;
}
.app-rail__channel-copy{flex:1;min-width:0;}
.app-rail__channel-copy b{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13.5px;font-weight:600;color:var(--text);}
.app-rail__channel-copy small{display:block;font-size:11.5px;color:var(--text-muted);}
.app-rail__channel svg{width:15px;height:15px;flex:none;fill:none;stroke:var(--text-muted);stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round;}
.app-rail nav{display:flex;flex:none;flex-direction:column;gap:2px;padding:8px 18px 18px;}
.app-rail__spacer{flex:1;min-height:32px;}
.app-rail__account{display:flex;flex-direction:column;gap:2px;padding:0 18px 10px;}
.app-rail__legacy-label{padding:13px 10px 4px;font-size:11px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:var(--text-muted);}
.app-rail__safety{display:flex;align-items:flex-start;gap:9px;padding:16px 18px;border-top:1px solid var(--border);}
.app-rail__safety>span{width:7px;height:7px;flex:none;margin-top:5px;border-radius:50%;background:var(--success);animation:pulse 2.6s ease-out infinite;}
.app-rail__safety p{margin:0;font-size:12px;line-height:1.45;color:var(--success);font-weight:600;}
.app-rail__safety small{display:block;color:var(--text-muted);font-size:12px;font-weight:400;}
.app-rail-toggle{display:none;width:44px;height:44px;padding:11px 10px;border:1px solid var(--border);border-radius:10px;background:transparent;cursor:pointer;}
.app-rail-toggle span{display:block;width:100%;height:2px;margin:4px 0;border-radius:2px;background:var(--text-2);}
.app-rail-backdrop{display:none;position:fixed;inset:0;z-index:70;border:0;background:var(--overlay);}
.app-panel{
  flex:1;min-width:0;background:var(--panel);border:1px solid var(--border);
  border-radius:12px;padding:0 32px 32px;
}
.app-topbar{height:64px;border-bottom:1px solid var(--border);}
.app-topbar__inner{
  max-width:1600px;height:100%;margin:0 auto;display:flex;align-items:center;
  justify-content:space-between;gap:20px;
}
.app-topbar__title{font-size:13px;font-weight:600;color:var(--text-muted);}
.app-topbar__actions{display:flex;align-items:center;justify-content:flex-end;gap:9px;}
.app-topbar__actions .theme-toggle{min-height:44px;padding:9px 12px;}
.app-content{max-width:1600px;margin:0 auto;padding-top:28px;min-width:0;}
.grid-12{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:24px;align-items:start;}
.span-12{grid-column:span 12;}.span-8{grid-column:span 8;}.span-4{grid-column:span 4;}

.card{background:var(--surface);border:1px solid var(--border);border-radius:12px;min-width:0;}
.card-hero{
  position:relative;overflow:hidden;background:var(--surface);border:1px solid var(--border);
  border-radius:12px;padding:30px 34px 32px;
  box-shadow:0 1px 2px rgba(19,22,27,.04),0 8px 24px rgba(19,22,27,.06);
}
[data-theme="dark"] .card-hero{
  box-shadow:0 2px 6px rgba(0,0,0,.5),0 30px 60px rgba(0,0,0,.35);
}
.card-hero__spine{position:absolute;left:0;top:0;bottom:0;width:3px;overflow:hidden;}
.card-hero__spine>span{display:block;width:100%;height:40%;background:linear-gradient(180deg,transparent,var(--accent),transparent);animation:sweep 7s linear infinite;}
.card-alert{border-left:3px solid var(--warning);padding:20px 22px;}

.rail-card{overflow:hidden;background:var(--surface);border:1px solid var(--border);border-radius:12px;}
.rail-card__header{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  padding:16px 18px;border-bottom:1px solid var(--border);
  font-size:13.5px;font-weight:600;color:var(--text);
}
.rail-card__header small{font-size:11.5px;font-weight:400;color:var(--text-muted);}
.rail-card__row{padding:14px 18px;border-top:1px solid var(--border);}
.rail-card__header + .rail-card__row{border-top:0;}
.rail-card__footer{
  display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:44px;
  padding:13px 18px;border-top:1px solid var(--border);color:var(--text-muted);
  font-size:12.5px;font-weight:600;text-decoration:none;
}
.rail-card__footer:hover{color:var(--text);background:color-mix(in srgb,var(--text) 3%,transparent);}

.data-row{
  display:grid;grid-template-columns:132px minmax(0,1fr) 132px 90px;gap:20px;
  align-items:center;min-height:56px;padding:16px 20px;color:inherit;text-decoration:none;
}
.data-row--two-line{min-height:88px;}
.data-row + .data-row{border-top:1px solid var(--border);}
.data-row:hover{background:color-mix(in srgb,var(--text) 3%,transparent);}
.data-row__kind{font-size:11px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:var(--accent);}
.data-row__main{min-width:0;}
.data-row__title{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14.5px;line-height:1.35;font-weight:600;color:var(--text);}
.data-row__reason{display:block;margin-top:3px;font-size:12.5px;color:var(--text-muted);}
.data-row__metric{font-size:13px;color:var(--text-2);}
.data-row__open{justify-self:end;font-size:12.5px;font-weight:600;color:var(--text-muted);white-space:nowrap;}

/* Full-width creator collections. The outer stack stays one dimensional;
 * only the decision strip and table rows establish internal columns. */
.collection-stack{display:flex;min-width:0;flex-direction:column;gap:24px;}
.state-strip{
  display:grid;grid-template-columns:repeat(4,minmax(0,1fr));overflow:hidden;
  border:1px solid var(--border);border-radius:12px;background:var(--surface);
}
.state-strip__item{
  display:grid;grid-template-columns:6px minmax(0,1fr);grid-template-rows:auto auto;
  column-gap:9px;row-gap:4px;min-height:76px;padding:16px 20px;border:0;border-left:1px solid var(--border);
  background:transparent;color:var(--text);font:inherit;text-align:left;cursor:pointer;
}
.state-strip__item:first-child{border-left:0;}
.state-strip__item:hover{background:color-mix(in srgb,var(--text) 3%,transparent);}
.state-strip__item[aria-pressed="true"]{background:color-mix(in srgb,var(--accent) 7%,transparent);}
.state-strip__dot{grid-row:1;align-self:center;width:6px;height:6px;border-radius:50%;background:var(--state-color,var(--text-muted));}
.state-strip__label{grid-row:1;align-self:center;font-size:11px;font-weight:800;letter-spacing:.09em;text-transform:uppercase;color:var(--state-color,var(--text-muted));}
.state-strip__count{grid-column:2;grid-row:2;font-size:24px;line-height:1;font-weight:700;color:var(--text);}
.state-strip__copy{grid-column:2;grid-row:3;font-size:12px;line-height:1.35;color:var(--text-muted);}
.state-strip__item--waking{--state-color:var(--accent-ink);}
.state-strip__item--fading{--state-color:var(--warning-ink);}
.state-strip__item--changes{--state-color:var(--text-2);}
.state-strip__item--breakouts{--state-color:var(--success-ink);}

.collection-table__scroller{max-width:100%;overflow-x:auto;border:1px solid var(--border);border-radius:12px;background:var(--surface);}
.collection-table{min-width:920px;overflow:hidden;}
.collection-table__head,.collection-table__row{
  display:grid;grid-template-columns:200px minmax(0,1fr) 150px 132px 96px;
  gap:20px;align-items:center;padding:0 20px;
}
.collection-table__head{min-height:44px;border-bottom:1px solid var(--border);background:color-mix(in srgb,var(--text) 2%,transparent);}
.collection-table__head>span,.collection-table__sort{
  display:inline-flex;min-height:44px;align-items:center;border:0;background:transparent;color:var(--text-muted);
  font:700 11px/1 inherit;letter-spacing:.08em;text-transform:uppercase;
}
.collection-table__sort{justify-content:flex-end;gap:6px;padding:0;cursor:pointer;}
.collection-table__sort[aria-pressed="true"]{color:var(--text);}
.collection-table__sort[aria-pressed="true"]::after{content:"↓";color:var(--accent);font-size:13px;}
.collection-table__row{min-height:88px;color:inherit;text-decoration:none;}
.collection-table__row+.collection-table__row{border-top:1px solid var(--border);}
.collection-table__row:hover{background:color-mix(in srgb,var(--text) 3%,transparent);}
.collection-table__main{min-width:0;}
.collection-table__title{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14.5px;line-height:1.35;font-weight:600;color:var(--text);}
.collection-table__detail{display:flex;min-width:0;align-items:center;gap:7px;margin-top:4px;color:var(--text-muted);font-size:12.5px;line-height:1.35;}
.collection-table__detail-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.collection-table__metric,.collection-table__date{justify-self:end;text-align:right;}
.collection-table__metric b{display:block;font-size:17px;line-height:1.15;font-weight:700;color:var(--text);}
.collection-table__metric small{display:block;margin-top:3px;font-size:11.5px;color:var(--text-muted);}
.collection-table__date{font-size:13px;color:var(--text-2);}
.collection-table__open{justify-self:end;color:var(--text-muted);font-size:12.5px;font-weight:600;white-space:nowrap;}
.collection-table__empty{padding:28px 20px;color:var(--text-muted);font-size:13px;text-align:center;}
.collection-kind{font-size:12.5px;font-weight:700;color:var(--text-2);}
.state-pill{
  display:inline-flex;max-width:100%;align-items:center;padding:4px 10px;border-radius:999px;
  font-size:11px;line-height:1.3;font-weight:800;letter-spacing:.06em;text-transform:uppercase;white-space:nowrap;
}
.state-pill--waking{background:var(--accent-soft);color:var(--accent-ink);}
.state-pill--fading{background:color-mix(in srgb,var(--warning) 16%,transparent);color:var(--warning-ink);}
.state-pill--changes{border:1px solid var(--border-strong);color:var(--text-2);}
.state-pill--breakouts{background:color-mix(in srgb,var(--success) 16%,transparent);color:var(--success-ink);}
.also-chip{display:inline-flex;flex:none;padding:1px 7px;border:1px solid var(--border-strong);border-radius:999px;color:var(--text-2);font-size:11px;font-weight:700;text-transform:lowercase;white-space:nowrap;}
.collection-skeleton-row{min-height:88px;}
.collection-skeleton-row .skeleton{height:9px;border-radius:999px;}
.collection-skeleton-row:nth-child(1) .skeleton{animation-delay:50ms;}.collection-skeleton-row:nth-child(2) .skeleton{animation-delay:110ms;}.collection-skeleton-row:nth-child(3) .skeleton{animation-delay:170ms;}.collection-skeleton-row:nth-child(4) .skeleton{animation-delay:230ms;}.collection-skeleton-row:nth-child(5) .skeleton{animation-delay:290ms;}.collection-skeleton-row:nth-child(6) .skeleton{animation-delay:350ms;}

.pill{
  display:inline-flex;align-items:center;gap:6px;padding:5px 11px;border:1px solid var(--border);
  border-radius:999px;color:var(--text-2);font-size:12px;font-weight:500;white-space:nowrap;
}
.pill--fresh::before{content:"";width:6px;height:6px;border-radius:50%;background:var(--success);}
.pill--stage{
  border:0;background:var(--accent-soft);color:var(--accent);font-size:11.5px;
  font-weight:700;letter-spacing:.06em;text-transform:uppercase;
}
.btn-primary,.btn-secondary{
  display:inline-flex;align-items:center;justify-content:center;gap:9px;min-height:44px;
  padding:12px 20px;border-radius:10px;font-family:inherit;font-size:15px;font-weight:700;
  line-height:1.25;text-decoration:none;cursor:pointer;
}
.btn-primary{background:#13161b;color:#faf8f3;border:1px solid #13161b;}
[data-theme="dark"] .btn-primary{background:var(--text);color:var(--panel);border-color:var(--text);}
.btn-secondary{background:transparent;color:var(--text);border:1px solid var(--border-strong);}
.btn-secondary:hover{background:color-mix(in srgb,var(--text) 5%,transparent);}

.nav-item{
  position:relative;display:flex;width:100%;align-items:center;justify-content:space-between;
  gap:12px;min-height:38px;padding:9px 10px;border-radius:10px;color:var(--text-2);
  font-size:14px;font-weight:500;line-height:20px;text-decoration:none;
}
.nav-item:hover{background:color-mix(in srgb,var(--text) 5%,transparent);color:var(--text);}
.nav-item.active{background:color-mix(in srgb,var(--text) 5%,transparent);color:var(--text);font-weight:600;}
.nav-item.active::before{
  content:"";position:absolute;left:-18px;top:9px;bottom:9px;width:2px;
  border-radius:999px;background:var(--accent);
}
.nav-item__count{font-size:11.5px;color:var(--text-muted);}
.nav-item__dot{width:6px;height:6px;border-radius:50%;background:var(--accent);}

.evidence{
  margin-top:22px;padding:20px 22px;border:1px solid var(--border);border-radius:12px;
  background:var(--surface-elevated);
}
.evidence__layout{display:flex;align-items:flex-start;justify-content:space-between;gap:32px;flex-wrap:wrap;}
.evidence__bars{display:flex;flex:1;min-width:300px;flex-direction:column;gap:14px;}
.evidence__row-label{display:flex;justify-content:space-between;gap:12px;margin-bottom:7px;font-size:13px;color:var(--text);}
.evidence__row-label b{font-weight:600;}.evidence__row-label span:last-child{font-weight:700;}
.evidence__row--baseline .evidence__row-label{color:var(--text-2);}
.evidence__row--baseline .evidence__row-label span:last-child{font-weight:400;color:var(--text-muted);}
.evidence__track{height:10px;overflow:hidden;border-radius:999px;background:rgba(19,22,27,.12);}
[data-theme="dark"] .evidence__track{background:rgba(255,255,255,.10);}
.evidence__fill{display:block;height:100%;width:var(--evidence-width,100%);border-radius:999px;background:var(--accent);transform-origin:left center;animation:grow 850ms cubic-bezier(.22,.8,.32,1) both;}
.evidence__row--baseline .evidence__fill{background:var(--text-muted);opacity:.6;animation-delay:150ms;}
.evidence__figure{flex:none;min-width:190px;text-align:right;}
.evidence__multiple{display:flex;align-items:baseline;justify-content:flex-end;color:var(--text);font-size:44px;line-height:1;font-weight:800;letter-spacing:-.03em;}
.evidence__caption{margin-top:8px;font-size:12.5px;line-height:1.45;color:var(--text-muted);}
.evidence__confidence{display:inline-flex;align-items:center;gap:6px;margin-top:12px;padding:3px 9px;border-radius:6px;background:var(--warning-soft);color:var(--warning);font-size:11.5px;font-weight:600;}
.evidence__confidence.is-high{background:var(--success-soft);color:var(--success);}
.evidence__subject-only{font-size:20px;font-weight:700;color:var(--text);}

.odometer{display:inline-flex;align-items:baseline;}
.odometer__digit{display:inline-block;height:1em;overflow:hidden;line-height:1;font-variant-numeric:tabular-nums;}
.odometer__strip{display:block;animation:roll 1000ms cubic-bezier(.2,.85,.25,1) both;animation-delay:var(--odometer-delay,0ms);}
.odometer__strip > span{display:block;height:1em;}

.skeleton--hero{height:340px;}.skeleton--rail{height:228px;}.skeleton--table{height:176px;}
.section-rise{animation:rise 550ms cubic-bezier(.22,.8,.32,1) both;animation-delay:var(--rise-delay,0ms);}
@keyframes rise{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}
@keyframes grow{from{transform:scaleX(.03)}to{transform:scaleX(1)}}
@keyframes roll{from{transform:translateY(0)}to{transform:translateY(-7em)}}
@keyframes sweep{from{transform:translateY(-100%)}to{transform:translateY(100%)}}

@media (max-width:1023px){
  .app-shell{padding:8px;display:block;}
  .app-panel{padding:0 20px 20px;}
  .app-rail{
    position:fixed;inset:8px auto 8px 8px;z-index:80;width:min(320px,calc(100vw - 32px));
    min-height:0;border:1px solid var(--border);border-radius:12px;background:var(--panel);
    box-shadow:var(--shadow-lg);transform:translateX(calc(-100% - 24px));visibility:hidden;
    transition:transform var(--dur-base) var(--ease-out),visibility var(--dur-base);
  }
  .app-shell[data-rail-open] .app-rail{transform:none;visibility:visible;}
  .app-shell[data-rail-open] .app-rail-backdrop{display:block;}
  .app-rail-toggle{display:block;}
  .grid-12>*{grid-column:span 12;}
  .nav-item{min-height:44px;}
  .app-topbar__actions{gap:6px;}
  .state-strip{grid-template-columns:repeat(2,minmax(0,1fr));}
  .state-strip__item:nth-child(3){border-left:0;border-top:1px solid var(--border);}
  .state-strip__item:nth-child(4){border-top:1px solid var(--border);}
}
@media (max-width:680px){
  .app-panel{padding-inline:16px;}
  .app-content{padding-top:20px;}
  .app-topbar__actions .pill--fresh{display:none;}
  .data-row{grid-template-columns:minmax(0,1fr) auto;gap:8px 14px;}
  .data-row__kind,.data-row__metric{grid-column:auto;}
  .data-row__main{grid-column:1/-1;grid-row:2;}
  .data-row__open{grid-column:2;grid-row:1;}
  .evidence__bars{min-width:0;flex-basis:100%;}.evidence__figure{min-width:0;text-align:left;}.evidence__multiple{justify-content:flex-start;}
  .state-strip{grid-template-columns:1fr;}
  .state-strip__item{border-left:0;border-top:1px solid var(--border);}
  .state-strip__item:first-child{border-top:0;}
}
@media (prefers-reduced-motion:reduce){
  *{animation:none!important;}
}
