/* =====================================================================
   Creative Desk — shared design system (ui.css)  ·  v6 "Atelier"
   ---------------------------------------------------------------------
   Loaded AFTER each page's own <style>; restyles tokens and the shared
   component classes, visual properties only — no control moves, no flow
   changes. Kill switch: ?classic=1 (shell.js).

   One language, many rooms. The language: warm paper and ink, an editorial
   serif for the headline moments (Instrument Serif), Geist for the working
   type, Geist Mono for every number, a fine grain over the ground. The
   rooms: each screen is composed for what it does, not dressed in one card —
     Library ........ a gallery wall: matted prints on an ink-rail studio
     Launchers ...... a flight deck in the network's own colour
     Cost ........... a ledger: ruled columns, figures set like a terminal
     Scoreboard ..... a podium: gold, silver, bronze leaders
     States ......... an atlas: contour lines under the table
     Research ....... field notes on graph paper, cards pinned with tape
     Log ............ a timeline with a live spine
     Links .......... a switchboard console
     Rules .......... blueprints
     Templates ...... magazine spreads
     1-Click ........ ticket stubs, perforated
   ===================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Geist:wght@300..800&family=Geist+Mono:wght@400..700&family=Instrument+Serif:ital@0;1&display=swap");

/* ---- tokens: light (paper) ----------------------------------------- */
:root, :root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f0e8; --surface: #fffdf8; --surface-2: #efe9dd; --elevated: #fffdf8;
  --paper: #fffdf8;
  --line: #e3dccd; --line-strong: #cfc5b2;
  --text: #16130e; --text-dim: #625a4c; --text-faint: #978d7b;
  --ink: #16130e; --dim: #625a4c; --faint: #978d7b;
  --inkbar: #16130e; --inkbar-text: #f4efe4; --inkbar-dim: #a39a88;
  --accent: #ff4d1a; --accent-soft: #ffe8de; --accent-text: #c9360c;
  --accent-2: #ffb21a;
  --grad: linear-gradient(120deg, #ff4d1a, #ff7a1a 55%, #ffb21a);
  --primary-bg: #16130e; --primary-text: #f7f2e7;
  --live: #1f8a4c;   --live-bg: #dff3e4;
  --approved: #2350c8; --approved-bg: #e1e8fb;
  --review: #b86a00; --review-bg: #fcefd4;
  --rejected: #d23a1f; --rejected-bg: #fde3dc;
  --draft: #6f6758;  --draft-bg: #ebe5d8;
  --archived: #7d766a; --archived-bg: #e7e1d5;
  --adplexity: #0b7285; --adplexity-bg: #d6f1f4;
  --crawler: #6741d9; --crawler-bg: #ebe4fd;
  --ok: #1f8a4c; --okbg: #dff3e4; --okink: #1f6b3d;
  --badbg: #fde3dc; --badink: #a52a14;
  --warnbg: #fcefd4; --warnline: #f0cf86; --warnink: #7a4a00;
  --infobg: #f7ede2; --infoline: #ead6bf; --infoink: #5a3a1c;
  --shadow: 0 1px 0 rgba(22,19,14,.04), 0 1px 3px rgba(22,19,14,.06), 0 12px 28px -14px rgba(22,19,14,.18);
  --shadow-lg: 0 2px 4px rgba(22,19,14,.06), 0 18px 40px -12px rgba(22,19,14,.22), 0 44px 90px -30px rgba(22,19,14,.28);
  --radius: 18px; --radius-sm: 12px; --r: 18px;
  --sans: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --shell-h: 54px;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}
/* ---- tokens: dark (ink) --------------------------------------------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0c0a; --surface: #171512; --surface-2: #211e19; --elevated: #1c1a16;
  --paper: #171512;
  --line: #2b2721; --line-strong: #3d372e;
  --text: #f3eee4; --text-dim: #b3aa99; --text-faint: #7f7768;
  --ink: #f3eee4; --dim: #b3aa99; --faint: #7f7768;
  --inkbar: #070605; --inkbar-text: #f3eee4; --inkbar-dim: #8f8676;
  --accent: #ff6a3d; --accent-soft: #3a1c10; --accent-text: #ff9d7a;
  --accent-2: #ffc24a;
  --grad: linear-gradient(120deg, #ff5a26, #ff8a2a 55%, #ffc24a);
  --primary-bg: #f3eee4; --primary-text: #12100c;
  --live: #57d68d;   --live-bg: #12291b;
  --approved: #7ea2ff; --approved-bg: #172342;
  --review: #ffc24a; --review-bg: #33260b;
  --rejected: #ff7a5c; --rejected-bg: #3a1710;
  --draft: #b3aa99;  --draft-bg: #2b2721;
  --archived: #9a9282; --archived-bg: #26221d;
  --adplexity: #4fd4e6; --adplexity-bg: #0e3036;
  --crawler: #b197fc; --crawler-bg: #261d45;
  --ok: #57d68d; --okbg: #12291b; --okink: #7ee2a8;
  --badbg: #3a1710; --badink: #ffab96;
  --warnbg: #33260b; --warnline: #5c4512; --warnink: #ffd98a;
  --infobg: #241b12; --infoline: #3f3020; --infoink: #f1d5b5;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 2px 6px rgba(0,0,0,.45), 0 16px 34px -16px rgba(0,0,0,.7);
  --shadow-lg: 0 2px 6px rgba(0,0,0,.5), 0 22px 48px -14px rgba(0,0,0,.7), 0 50px 100px -30px rgba(0,0,0,.8);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d0c0a; --surface: #171512; --surface-2: #211e19; --elevated: #1c1a16;
    --paper: #171512;
    --line: #2b2721; --line-strong: #3d372e;
    --text: #f3eee4; --text-dim: #b3aa99; --text-faint: #7f7768;
    --ink: #f3eee4; --dim: #b3aa99; --faint: #7f7768;
    --inkbar: #070605; --inkbar-text: #f3eee4; --inkbar-dim: #8f8676;
    --accent: #ff6a3d; --accent-soft: #3a1c10; --accent-text: #ff9d7a;
    --accent-2: #ffc24a;
    --grad: linear-gradient(120deg, #ff5a26, #ff8a2a 55%, #ffc24a);
    --primary-bg: #f3eee4; --primary-text: #12100c;
    --live: #57d68d;   --live-bg: #12291b;
    --approved: #7ea2ff; --approved-bg: #172342;
    --review: #ffc24a; --review-bg: #33260b;
    --rejected: #ff7a5c; --rejected-bg: #3a1710;
    --draft: #b3aa99;  --draft-bg: #2b2721;
    --archived: #9a9282; --archived-bg: #26221d;
    --adplexity: #4fd4e6; --adplexity-bg: #0e3036;
    --crawler: #b197fc; --crawler-bg: #261d45;
    --ok: #57d68d; --okbg: #12291b; --okink: #7ee2a8;
    --badbg: #3a1710; --badink: #ffab96;
    --warnbg: #33260b; --warnline: #5c4512; --warnink: #ffd98a;
    --infobg: #241b12; --infoline: #3f3020; --infoink: #f1d5b5;
    --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 2px 6px rgba(0,0,0,.45), 0 16px 34px -16px rgba(0,0,0,.7);
    --shadow-lg: 0 2px 6px rgba(0,0,0,.5), 0 22px 48px -14px rgba(0,0,0,.7), 0 50px 100px -30px rgba(0,0,0,.8);
  }
}

/* ---- base ---------------------------------------------------------- */
html { background: var(--bg); }
body {
  color: var(--text); font-family: var(--sans); -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
  background: var(--grain), var(--bg);
  background-attachment: fixed;
}
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }
a { color: var(--accent-text); text-underline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
@keyframes cd-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- type: serif for the moments, mono for the numbers ------------- */
h1, h2, #pageTitle, .topbar .brand > span:last-child, .modal-head b, .grid-head h2,
.sheet > header b, .authcard h2 {
  font-family: var(--serif); font-weight: 400; letter-spacing: -.01em;
}
#pageTitle, .topbar .brand > span:last-child { font-size: 24px; line-height: 1; }
.card > header h2 { font-size: 22px; line-height: 1.1; }
.modal-head b, .sheet > header b { font-size: 22px; }
td.num, th.num, .num, .stat .value, .stat b, .mono, .mono b, code, kbd {
  font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em;
}
label.f, .f, .lbl {
  font-size: 10px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--text-faint);
}
.help, .faint, .muted { color: var(--text-dim); }

/* ---- buttons: ink pills; the network colour only where it means "go" - */
.btn {
  border-radius: 999px; font-weight: 550; font-family: var(--sans);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  box-shadow: none; transition: background .14s, border-color .14s, color .14s, transform .08s, box-shadow .14s;
}
.btn:hover { border-color: var(--text); color: var(--text); background: var(--surface); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary, .btn.btn-primary, button.btn-primary {
  background: var(--primary-bg); color: var(--primary-text); border-color: transparent;
  box-shadow: 0 1px 0 rgba(255,255,255,.12) inset, 0 10px 24px -10px color-mix(in srgb, var(--accent) 70%, transparent);
  position: relative;
}
.btn-primary:hover { color: var(--primary-text); background: var(--primary-bg); border-color: transparent;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent), 0 12px 28px -10px color-mix(in srgb, var(--accent) 80%, transparent); }
.btn-ghost, .btn.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: transparent; }
.btn-danger, .btn.btn-danger { background: transparent; color: var(--rejected); border-color: color-mix(in srgb, var(--rejected) 45%, transparent); box-shadow: none; }
.btn-danger:hover { background: var(--rejected); color: #fff; border-color: var(--rejected); }
.btn-sm { border-radius: 999px; }

/* ---- inputs: quiet until touched ----------------------------------- */
.input, input.input, select.input, textarea.input {
  border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font-family: var(--sans); transition: border-color .14s, box-shadow .14s, background .14s;
}
.input:hover, select.input:hover { border-color: color-mix(in srgb, var(--text) 35%, var(--line-strong)); }
.input:focus, select.input:focus, textarea.input:focus {
  border-color: var(--text); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); outline: none;
}
.input::placeholder { color: var(--text-faint); }

/* ---- surfaces ------------------------------------------------------ */
html:not(.page-index) .card, .panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
html:not(.page-index) .card > header { border-bottom: 1px solid var(--line); background: transparent; }
.note { border-radius: 12px; border: 1px solid transparent; }
.note-info, .note.info { background: var(--infobg); color: var(--infoink); border-color: var(--infoline); }
.note-warn, .note.warn { background: var(--warnbg); color: var(--warnink); border-color: var(--warnline); }
.note-err,  .note.err  { background: var(--badbg);  color: var(--badink); border-color: color-mix(in srgb, var(--rejected) 30%, transparent); }
.note-ok,   .note.ok   { background: var(--okbg);   color: var(--okink); border-color: color-mix(in srgb, var(--live) 30%, transparent); }

/* ---- pills / chips / segments -------------------------------------- */
.pill { border-radius: 999px; font-weight: 600; letter-spacing: .02em; border: 1px solid transparent; font-family: var(--sans); }
.pill.on  { background: var(--live-bg); color: var(--live); }
.pill.off { background: var(--draft-bg); color: var(--draft); }
.pill.err { background: var(--rejected-bg); color: var(--rejected); }
.pill.pend{ background: var(--review-bg); color: var(--review); }
.tag, .chip { border-radius: 999px; }
.seg { border-radius: 999px; background: var(--surface-2); padding: 3px; border: 1px solid var(--line); }
.seg button { border-radius: 999px; font-weight: 550; color: var(--text-dim); transition: background .14s, color .14s; }
html:not(.page-index) .seg button.on { background: var(--primary-bg); color: var(--primary-text); box-shadow: none; }
html.page-index .seg button.on { color: #fff; border-color: transparent; }
.typeseg { border-radius: 999px; }
.typeseg button.on { background: var(--primary-bg); color: var(--primary-text); }

/* ---- tiles (launcher creative pickers) ----------------------------- */
.tile { border-radius: 14px; border-color: var(--line); transition: transform .18s, box-shadow .18s, border-color .18s; }
.tile:hover { transform: translateY(-3px) rotate(-.4deg); box-shadow: var(--shadow-lg); border-color: var(--line-strong); }
.tile.sel { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent), var(--shadow); }
.vbadge { border-radius: 6px; font-family: var(--mono); }
.cardlet { border-radius: 14px; }

/* ---- sheets, modals, drawers: paper sliding over ink --------------- */
.sheet, .modal, .drawer {
  border-radius: 22px; border: 1px solid var(--line); background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.sheet > header, .modal-head { border-bottom: 1px solid var(--line); }
.scrim { background: rgba(13, 11, 8, .55); -webkit-backdrop-filter: blur(4px) grayscale(.4); backdrop-filter: blur(4px) grayscale(.4); }
.drawer { border-radius: 0; }

/* ---- tables -------------------------------------------------------- */
th { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-faint); font-weight: 600; }
tr:hover td { background: color-mix(in srgb, var(--accent) 5%, transparent); }

/* ---- stat tiles ----------------------------------------------------- */
.stat { border-radius: var(--radius); box-shadow: none; border: 1px solid var(--line); background: var(--surface); }
.stat b { font-weight: 500; }

/* ---- the shell bar: an ink strip, the brand in italic serif --------- */
.ui-nav {
  position: sticky; top: 0; z-index: 200; height: var(--shell-h);
  display: flex; align-items: center; gap: 2px; padding: 0 16px;
  background: var(--inkbar); border-bottom: 0; font-family: var(--sans);
  box-shadow: 0 1px 0 rgba(255,255,255,.05) inset, 0 8px 24px -16px rgba(0,0,0,.6);
}
.ui-nav .ui-brand {
  display: flex; align-items: center; gap: 9px; margin-right: 18px;
  font-size: 23px; font-weight: 400; text-decoration: none; white-space: nowrap;
  font-family: var(--serif); font-style: italic; letter-spacing: -.01em;
}
.ui-nav .ui-brand span { color: var(--inkbar-text); background: none; -webkit-text-fill-color: currentColor; }
.ui-nav .ui-brand span::after { content: "."; color: var(--accent); font-style: normal; }
html.page-index .ui-nav .ui-brand { display: none; }
.ui-nav a.ui-link {
  position: relative; padding: 8px 11px; border-radius: 8px; font-size: 12.5px; font-weight: 500;
  color: var(--inkbar-dim); text-decoration: none; white-space: nowrap; transition: color .14s, background .14s;
}
.ui-nav a.ui-link:hover { color: var(--inkbar-text); background: rgba(255,255,255,.06); }
.ui-nav a.ui-link.on { color: var(--inkbar-text); background: none; box-shadow: none; }
.ui-nav a.ui-link.on::after {
  content: ""; position: absolute; left: 11px; right: 11px; bottom: 2px; height: 2px; border-radius: 2px;
  background: var(--grad);
}
.ui-nav .ui-spacer { flex: 1; }
.ui-nav button.ui-ico {
  border: 1px solid transparent; background: transparent; color: var(--inkbar-dim); cursor: pointer;
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font: inherit;
}
.ui-nav button.ui-ico:hover { background: rgba(255,255,255,.08); color: var(--inkbar-text); }
.ui-nav .ui-classic { font-size: 11px; color: var(--inkbar-dim); text-decoration: none; padding: 4px 8px; border-radius: 6px; }
.ui-nav .ui-classic:hover { color: var(--inkbar-text); }

/* ---- page bars: seated under the shell, paper-translucent ----------- */
html.ui-shell .topbar, html.ui-shell header.top, html.ui-shell .top { top: var(--shell-h); }
html.ui-shell .rail { top: var(--shell-h); }
html.ui-shell.page-index .rail { height: calc(100vh - var(--shell-h)); }
html.ui-shell.page-tiktok .rail {
  top: calc(var(--shell-h) + 62px);
  max-height: calc(100vh - var(--shell-h) - 74px);
  overflow-y: auto;
}
html.ui-shell table th { top: calc(60px + var(--shell-h)); }
html.ui-shell table thead th { background: var(--surface); }
html.ui-shell .topbar, html.ui-shell:not(.page-snapchat) .top {
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
html.ui-shell a.btn[href="index.html"], html.ui-shell a.btn[href="launch.html"],
html.ui-shell a.btn[href^="logs.html"], html.ui-shell a.btn[href^="links.html"],
html.ui-shell a.btn[href^="research.html"], html.ui-shell a.btn[href^="score.html"] { display: none; }

/* ---- the sign-in: a poster --------------------------------------------- */
.authgate {
  background: var(--grain), radial-gradient(1200px 700px at 110% 110%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 60%),
              radial-gradient(900px 600px at -10% -10%, color-mix(in srgb, var(--accent-2) 22%, transparent), transparent 60%), var(--bg);
  overflow: hidden;
}
.authgate::before {
  content: "Creative Desk"; position: absolute; left: -2vw; bottom: -6vw; z-index: 0; pointer-events: none;
  font-family: var(--serif); font-style: italic; font-size: 22vw; line-height: .8; letter-spacing: -.04em;
  color: color-mix(in srgb, var(--text) 7%, transparent); white-space: nowrap;
}
.authcard {
  position: relative; z-index: 1; border-radius: 26px; background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow-lg);
}
.authcard h2 { font-size: 40px; line-height: 1; }
.authcard .btn-primary { border-radius: 999px; }

/* =====================================================================
   THE ROOMS
   ===================================================================== */

/* ---- 1 · LIBRARY — a gallery wall -------------------------------------
   An ink rail (the studio's wall of drawers), matted prints on paper. */
html.page-index .rail {
  background: var(--inkbar); color: var(--inkbar-text); border-right: 0;
  -webkit-backdrop-filter: none; backdrop-filter: none;
}
html.page-index .rail * { border-color: rgba(255,255,255,.08); }
html.page-index .rail .brand, html.page-index .rail .brand * { color: var(--inkbar-text); }
html.page-index .rail .brand-name, html.page-index .rail .brand b { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 24px; letter-spacing: -.01em; }
html.page-index .brand-mark { background: var(--grad); border-radius: 50%; box-shadow: 0 0 0 4px rgba(255,255,255,.06); }
html.page-index .nav-head { color: var(--inkbar-dim); letter-spacing: .14em; font-size: 10px; }
html.page-index .nav-item { border-radius: 10px; color: var(--inkbar-dim); background: transparent; }
html.page-index .nav-item:hover { background: rgba(255,255,255,.06); color: var(--inkbar-text); }
html.page-index .nav-item.active {
  background: rgba(255,255,255,.1); color: var(--inkbar-text); font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent);
}
html.page-index .nav-item .count { background: rgba(255,255,255,.08); color: var(--inkbar-dim); border-radius: 999px; padding: 1px 7px; font-size: 10.5px; font-family: var(--mono); }
html.page-index .nav-item.active .count { background: var(--accent); color: #fff; }
html.page-index .add-board { border-radius: 10px; color: var(--inkbar-dim); border-color: rgba(255,255,255,.14); background: transparent; }
html.page-index .add-board:hover { color: var(--inkbar-text); border-color: var(--accent); }
html.page-index .rail .btn, html.page-index .rail-foot button, html.page-index .rail-foot a { color: var(--inkbar-dim); background: transparent; border-color: rgba(255,255,255,.12); }
html.page-index .rail .btn:hover, html.page-index .rail-foot button:hover { color: var(--inkbar-text); border-color: rgba(255,255,255,.3); }
html.page-index .search { border-radius: 999px; background: var(--surface); border-color: var(--line-strong); }
html.page-index .search:focus-within { border-color: var(--text); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
/* the grid is the wall: generous, airy, prints on a mat */
html.page-index .grid { grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 26px 22px; }
html.page-index .card {
  border-radius: 6px; background: var(--surface); border: 0; padding: 9px 9px 0;
  box-shadow: 0 1px 1px rgba(22,19,14,.06), 0 10px 24px -14px rgba(22,19,14,.22);
  transition: transform .28s cubic-bezier(.2,.8,.2,1), box-shadow .28s;
  animation: cd-rise .45s both;
}
html.page-index .card:nth-child(3n+1):hover { transform: translateY(-6px) rotate(-.9deg); }
html.page-index .card:nth-child(3n+2):hover { transform: translateY(-6px) rotate(.7deg); }
html.page-index .card:nth-child(3n):hover   { transform: translateY(-6px) rotate(-.4deg); }
html.page-index .card:hover { box-shadow: 0 2px 2px rgba(22,19,14,.06), 0 30px 50px -20px rgba(22,19,14,.4); border: 0; }
html.page-index .card.selected { box-shadow: 0 0 0 3px var(--accent), 0 20px 40px -20px rgba(22,19,14,.4); }
html.page-index .thumb { border-radius: 2px; }
html.page-index .thumb img, html.page-index .thumb video { transition: transform .6s cubic-bezier(.2,.8,.2,1), filter .4s; }
html.page-index .card:hover .thumb img, html.page-index .card:hover .thumb video { transform: scale(1.05); }
html.page-index .card-body { padding: 11px 3px 12px; }
html.page-index .card-name { font-family: var(--serif); font-size: 19px; font-weight: 400; line-height: 1.12; letter-spacing: -.005em; }
html.page-index .card-meta .tag { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; background: transparent; border: 1px solid var(--line-strong); color: var(--text-dim); }
html.page-index .card-foot { border-top: 1px dashed var(--line-strong); font-family: var(--mono); font-size: 11px; }
html.page-index .type-badge { border-radius: 4px; background: rgba(12,10,8,.72); letter-spacing: .12em; font-family: var(--mono); font-size: 9.5px; }
html.page-index .status-pill { border-radius: 4px; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; font-weight: 700; }
html.page-index .ver-count { border-radius: 4px; font-family: var(--mono); }
html.page-index .ctag { border: 0; border-radius: 3px; background: var(--surface-2); font-size: 10.5px; }
html.page-index .grid-head h2 { font-size: 38px; line-height: 1; letter-spacing: -.02em; }
html.page-index .grid-head h2 em, html.page-index .grid-head .n { font-family: var(--mono); font-size: 13px; color: var(--text-faint); }
/* status filters read as an index of tabs, not a pile of pills */
html.page-index .chip { border-radius: 999px; background: transparent; border-color: var(--line-strong); font-weight: 550; }
html.page-index .chip:hover { border-color: var(--text); }
html.page-index .chip.active { background: var(--primary-bg); color: var(--primary-text); border-color: transparent; box-shadow: none; }
html.page-index .chip .n, html.page-index .chip small, html.page-index .chip b { font-family: var(--mono); }
/* the stat strip: one ruled line, numbers in mono */
html.page-index .stats { gap: 0; margin-bottom: 18px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  border-top: 1px solid var(--text); border-bottom: 1px solid var(--line-strong); }
html.page-index .stat { padding: 10px 14px; border-radius: 0; border: 0; border-right: 1px solid var(--line); background: transparent;
  display: flex; align-items: baseline; gap: 9px; min-width: 0; }
html.page-index .stat:last-child { border-right: 0; }
html.page-index .stat .label { font-size: 9.5px; letter-spacing: .14em; flex: none; }
html.page-index .stat .value { font-family: var(--mono); font-size: 17px; margin-top: 0; flex: none; color: var(--text); -webkit-text-fill-color: currentColor; background: none; }
html.page-index .stat .meta { font-size: 10.5px; margin-top: 0; margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.page-index .topbar { padding: 10px 26px; gap: 10px; }
html.page-index .content { padding: 18px 28px 70px; }
html.page-index .tb-pop, html.page-index .selmore-menu { border-radius: 14px; box-shadow: var(--shadow-lg); background: var(--elevated); border: 1px solid var(--line); }
html.page-index .selbar { border-radius: 18px; background: var(--inkbar); color: var(--inkbar-text); border: 0; box-shadow: var(--shadow-lg); }
html.page-index .selbar .btn-ghost, html.page-index .selbar b { color: var(--inkbar-text); }
html.page-index .selbar .btn-ghost:hover { background: rgba(255,255,255,.1); }
html.page-index .modal { border-radius: 22px; }
html.page-index .drawer { background: var(--surface); }
html.page-index .drawer h2, html.page-index .drawer input#dName { font-family: var(--serif); font-size: 28px; font-weight: 400; }

/* ---- 2 · LAUNCHERS — a flight deck in the network's colour -------------
   Steps are cockpit panels on a colour-washed ground: a thick spine in the
   network colour, a big outlined numeral, and the review rail as a
   boarding pass with a perforated edge. */
html.page-launch body, html.page-tiktok body, html.page-snapchat body, html.page-smartnews body {
  background:
    var(--grain),
    radial-gradient(1100px 520px at 100% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 62%),
    repeating-linear-gradient(135deg, color-mix(in srgb, var(--accent) 7%, transparent) 0 1px, transparent 1px 22px),
    var(--bg);
  background-attachment: fixed;
}
html.page-launch .card, html.page-tiktok .card, html.page-snapchat .card, html.page-smartnews .card {
  border-radius: 20px; border: 1px solid var(--line);
  box-shadow: inset 4px 0 0 var(--accent), var(--shadow);
}
html.page-launch .card > header, html.page-tiktok .card > header, html.page-snapchat .card > header, html.page-smartnews .card > header {
  padding-top: 16px; padding-bottom: 14px;
}
html.page-launch .card > header h2, html.page-tiktok .card > header h2, html.page-snapchat .card > header h2, html.page-smartnews .card > header h2,
html.page-launch .card > header b, html.page-tiktok .card > header b { font-family: var(--serif); font-weight: 400; font-size: 26px; letter-spacing: -.01em; }
.step-no {
  background: transparent !important; color: var(--accent) !important; border-radius: 0;
  font-family: var(--serif); font-style: italic; font-size: 34px; font-weight: 400; line-height: .8;
  width: auto !important; height: auto !important; min-width: 0; box-shadow: none;
  -webkit-text-stroke: 0; margin-right: 4px;
}
html.page-launch .rail .card, html.page-tiktok .rail .card, html.page-snapchat .rail .card, html.page-smartnews .rail .card {
  box-shadow: var(--shadow-lg);
  background:
    radial-gradient(circle at 0 64px, var(--bg) 9px, transparent 9.5px),
    radial-gradient(circle at 100% 64px, var(--bg) 9px, transparent 9.5px),
    var(--surface);
}
html.page-launch .rail .card > header, html.page-tiktok .rail .card > header {
  border-bottom: 2px dashed var(--line-strong);
}
html.page-launch .btn-primary, html.page-tiktok .btn-primary, html.page-snapchat .btn-primary, html.page-smartnews .btn-primary,
html.page-rules .btn-primary, html.page-tt_rules .btn-primary, html.page-sc_rules .btn-primary {
  background: var(--grad); color: #fff;
}
html.page-launch #btnLaunch, html.page-tiktok #btnLaunch {
  font-size: 15px; letter-spacing: .01em; padding-top: 13px; padding-bottom: 13px;
  box-shadow: 0 16px 34px -14px color-mix(in srgb, var(--accent) 90%, transparent);
}
html.page-launch .secthead, html.page-tiktok .sect > summary { font-family: var(--serif); font-size: 19px; font-weight: 400; letter-spacing: 0; text-transform: none; }
html.page-launch .seg button.on, html.page-tiktok .seg button.on, html.page-snapchat .seg button.on, html.page-smartnews .seg button.on {
  background: var(--accent); color: #fff;
}

/* ---- 3 · COST — a ledger -------------------------------------------------
   Ruled like an account book: a heavy ink rule under the headings, hairline
   rows, figures in mono, the totals line double-ruled. */
html.page-cost .stats { gap: 0; border-top: 2px solid var(--text); border-bottom: 1px solid var(--text); }
html.page-cost .stat { border: 0; border-right: 1px solid var(--line-strong); border-radius: 0; background: transparent; padding: 14px 16px; }
html.page-cost .stat:last-child { border-right: 0; }
html.page-cost .stat b { font-family: var(--mono); font-size: 26px; font-weight: 500; letter-spacing: -.03em; }
html.page-cost .stat span { letter-spacing: .14em; }
html.page-cost .card { border-radius: 4px; box-shadow: none; border: 1px solid var(--line-strong); }
html.page-cost th { border-bottom: 2px solid var(--text) !important; color: var(--text); }
html.page-cost td { border-bottom: 1px solid var(--line); }
html.page-cost td.num { font-family: var(--mono); }
html.page-cost tr.tot td { border-top: 3px double var(--text); background: transparent; font-family: var(--mono); }
html.page-cost .cname, html.page-cost .acctlink { font-weight: 550; }
html.page-cost #pfTabs .btn.on, html.page-cost #viewTabs .btn.on { background: var(--primary-bg); color: var(--primary-text); border-color: transparent; }
html.page-cost .vert { border-radius: 4px; box-shadow: none; border: 1px solid var(--line-strong); background:
  linear-gradient(var(--surface), var(--surface)) padding-box; position: relative; }
html.page-cost .vert::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--grad); border-radius: 4px 0 0 4px; }
html.page-cost .vert b { font-family: var(--mono); font-weight: 600; }
html.page-cost .vert.on { background: var(--primary-bg); border-color: transparent; }
html.page-cost .vert.on * { color: var(--primary-text); }
html.page-cost .dayhead { font-family: var(--serif); font-size: 18px; font-weight: 400; background: var(--surface-2); }

/* ---- 4 · SCOREBOARD — a podium --------------------------------------- */
html.page-score .card { border-radius: 24px; overflow: hidden; }
html.page-score tbody tr:nth-child(1) td:first-child { box-shadow: inset 4px 0 0 #d4a017; }
html.page-score tbody tr:nth-child(2) td:first-child { box-shadow: inset 4px 0 0 #a7adb8; }
html.page-score tbody tr:nth-child(3) td:first-child { box-shadow: inset 4px 0 0 #b87333; }
html.page-score tbody tr:nth-child(-n+3) td { background: color-mix(in srgb, #d4a017 5%, transparent); }
html.page-score tbody tr:nth-child(1) .nm { font-family: var(--serif); font-size: 18px; }
html.page-score .stat { border-radius: 999px; padding-left: 18px; padding-right: 18px; }
html.page-score .pfchip { border-radius: 999px; }

/* ---- 5 · STATES — an atlas --------------------------------------------- */
html.page-states body {
  background:
    var(--grain),
    repeating-radial-gradient(circle at 18% 30%, transparent 0 22px, color-mix(in srgb, var(--accent) 12%, transparent) 22px 23px),
    repeating-radial-gradient(circle at 82% 78%, transparent 0 30px, color-mix(in srgb, var(--accent-2) 14%, transparent) 30px 31px),
    var(--bg);
  background-attachment: fixed;
}
html.page-states .card { border-radius: 10px; }
html.page-states .legend { font-family: var(--mono); }

/* ---- 6 · RESEARCH — field notes on graph paper ------------------------- */
html.page-research body {
  background:
    var(--grain),
    linear-gradient(color-mix(in srgb, var(--approved) 13%, transparent) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, color-mix(in srgb, var(--approved) 13%, transparent) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--bg);
  background-attachment: fixed;
}
html.page-research .card { border-radius: 4px; box-shadow: 3px 3px 0 color-mix(in srgb, var(--text) 12%, transparent); border: 1px solid var(--line-strong); }
html.page-research #results .card, html.page-research .cardlet { position: relative; overflow: visible; transform: rotate(-.35deg); transition: transform .2s; }
html.page-research #results .card:nth-child(even), html.page-research .cardlet:nth-child(even) { transform: rotate(.4deg); }
html.page-research #results .card:hover, html.page-research .cardlet:hover { transform: rotate(0) translateY(-3px); }
html.page-research #results .card::before, html.page-research .cardlet::before {
  content: ""; position: absolute; top: -9px; left: 50%; width: 70px; height: 20px; margin-left: -35px; z-index: 2;
  background: color-mix(in srgb, var(--accent-2) 45%, rgba(255,255,255,.4)); transform: rotate(-3deg); opacity: .8;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
html.page-research .card .media { border-radius: 2px; }
html.page-research .ttl { font-family: var(--serif); font-size: 18px; font-weight: 400; line-height: 1.15; }
html.page-research .chip.hot { background: var(--accent); color: #fff; }
html.page-research .winbadge { border-radius: 3px; background: var(--primary-bg); color: var(--primary-text); letter-spacing: .08em; }

/* ---- 7 · LOG — a timeline -------------------------------------------- */
html.page-logs .grp { position: relative; padding-left: 26px; border: 0; background: transparent; box-shadow: none; }
html.page-logs .grp::before { content: ""; position: absolute; left: 7px; top: 0; bottom: -12px; width: 2px; background: linear-gradient(var(--accent), color-mix(in srgb, var(--accent) 10%, transparent)); }
html.page-logs .grp::after { content: ""; position: absolute; left: 1px; top: 14px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 3px solid var(--accent); }
html.page-logs .grp .hd { font-family: var(--serif); font-size: 18px; }
html.page-logs .grp .rows { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
html.page-logs .stat { border-radius: 14px; }

/* ---- 8 · LINKS — a switchboard ---------------------------------------- */
html.page-links .cfcard {
  background: var(--inkbar); color: var(--inkbar-text); border-radius: 20px; border: 0; box-shadow: var(--shadow-lg);
}
html.page-links .cfcard .muted, html.page-links .cfcard .lbl { color: var(--inkbar-dim); }
html.page-links .cfcard .input { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.14); color: var(--inkbar-text); }
html.page-links .cfhead b { font-family: var(--serif); font-weight: 400; font-size: 24px; }
html.page-links .url, html.page-links .urllink { font-family: var(--mono); font-size: 12px; }

/* ---- 9 · RULES — blueprints ------------------------------------------- */
html.page-rules body, html.page-tt_rules body, html.page-sc_rules body {
  background:
    var(--grain),
    linear-gradient(rgba(47,111,214,.16) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(90deg, rgba(47,111,214,.16) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(rgba(47,111,214,.06) 1px, transparent 1px) 0 0 / 8px 8px,
    linear-gradient(90deg, rgba(47,111,214,.06) 1px, transparent 1px) 0 0 / 8px 8px,
    color-mix(in srgb, #2f6fd6 5%, var(--bg));
  background-attachment: fixed;
}
html.page-rules .card, html.page-tt_rules .card, html.page-sc_rules .card {
  border: 1.5px dashed rgba(47,111,214,.45); box-shadow: 0 0 0 6px color-mix(in srgb, var(--surface) 70%, transparent); border-radius: 10px;
}
html.page-rules .croncmd, html.page-tt_rules .croncmd, html.page-sc_rules .croncmd { font-family: var(--mono); }
html.page-rules .formsec-head, html.page-tt_rules .formsec-head { font-family: var(--serif); font-size: 19px; font-weight: 400; }

/* ---- 10 · TEMPLATES — magazine spreads ------------------------------- */
html.page-templates .vcard { border-radius: 0; box-shadow: none; border: 0; border-top: 3px solid var(--text); background: transparent; }
html.page-templates .vcard h2, html.page-templates .vcard .nm { font-family: var(--serif); font-size: 34px; font-weight: 400; }
html.page-templates .pcell { border-radius: 10px; }

/* ---- 11 · 1-CLICK — ticket stubs ------------------------------------- */
html.page-oneclick .tpl {
  border-radius: 18px; border: 1px solid var(--line);
  background:
    radial-gradient(circle at calc(100% - 172px) 0, var(--bg) 11px, transparent 11.5px),
    radial-gradient(circle at calc(100% - 172px) 100%, var(--bg) 11px, transparent 11.5px),
    linear-gradient(90deg, transparent calc(100% - 173px), var(--line-strong) calc(100% - 173px), var(--line-strong) calc(100% - 172px), transparent calc(100% - 172px)),
    var(--surface);
  box-shadow: var(--shadow);
  animation: cd-rise .4s both;
}
html.page-oneclick .tpl .nm { font-family: var(--serif); font-size: 26px; font-weight: 400; letter-spacing: -.01em; }
html.page-oneclick .tpl .acts { width: 150px; flex-direction: column; align-items: stretch; }
html.page-oneclick .tpl .facts b { letter-spacing: .14em; }
html.page-oneclick .tpl .copy { border-left: 3px solid var(--accent); font-family: var(--serif); font-size: 16px; color: var(--text); }
html.page-oneclick .topbar h1 { font-family: var(--serif); font-weight: 400; font-size: 30px; }
@media (max-width: 760px) {
  html.page-oneclick .tpl { background: var(--surface); }
  html.page-oneclick .tpl .acts { width: auto; flex-direction: row; }
}

/* ---- the Library's 1-click sheet & corner notes wear the new skin --- */
.qlrow { border-radius: 14px; }
.qlrow.on { border-color: var(--text) !important; background: var(--surface-2) !important; }
.qldock .qlitem { border-radius: 14px; }

/* =====================================================================
   Phones — measured on a 375px viewport, not guessed
   ---------------------------------------------------------------------
   Two faults made every page look broken on a phone:
     · every page bar is `height: <n>px` WITH `flex-wrap: wrap`. On a
       desktop row the controls fit; on a phone they wrap onto three
       lines while the box stays one line tall, so they spilled out and
       painted over the content beneath.
     · the filter strips were laid out to wrap, so eleven status chips
       became five stacked rows and pushed the creatives off the screen
       entirely — and the shape row simply overflowed, scrolling the
       whole page sideways by 126px.
   ===================================================================== */
@media (max-width: 760px) {
  /* a bar sizes to what is in it */
  html.ui-shell .topbar, html.ui-shell .top, html.ui-shell header.top {
    height: auto; row-gap: 8px;
    padding-top: 8px; padding-bottom: 8px;
  }
  /* and stays opaque: a translucent bar with no working blur is just
     content showing through content */
  html.ui-shell .topbar, html.ui-shell:not(.page-snapchat) .top,
  html.ui-shell:not(.page-snapchat) header.top {
    background: var(--bg);
  }
  /* filter strips scroll sideways instead of stacking or overflowing */
  html.page-index #statusFilters,
  html.page-index #typeFilter,
  html.page-index #sortSeg {
    flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
    max-width: 100%; padding-bottom: 2px;
  }
  html.page-index #statusFilters::-webkit-scrollbar,
  html.page-index #typeFilter::-webkit-scrollbar,
  html.page-index #sortSeg::-webkit-scrollbar { display: none; }
  html.page-index #statusFilters > *,
  html.page-index #typeFilter > *,
  html.page-index #sortSeg > * { flex: none; }
  /* the header had grown to 497px — half a phone screen before a single
     creative — so the stack tightens up */
  html.page-index .topbar { padding-top: 8px; padding-bottom: 8px; gap: 8px; }
  html.page-index .filter-row { gap: 8px; row-gap: 8px; }
  html.page-index .stats { grid-template-columns: 1fr 1fr; }
}
/* the hover preview is already off on touch, so its sound switch was a row
   of header spent on a control that cannot do anything here */
@media (hover: none) and (max-width: 760px) {
  html.page-index #hoverSound { display: none; }
}

/* ---- desktop is the product; small screens get the essentials ----- */
@media (max-width: 760px) {
  .ui-nav { overflow-x: auto; scrollbar-width: none; padding: 0 8px; }
  .ui-nav::-webkit-scrollbar { display: none; }
  .ui-nav .ui-brand { display: none; }
  .ui-nav .ui-classic { display: none; }
  .card, .panel { border-radius: 13px; }
  .sheet, .modal { border-radius: 15px; }
}

/* =====================================================================
   Launcher identities — each launcher wears its traffic source's colour.
   launch.html flips .nbtheme on <html> itself (its native mechanism):
   red when it is on NewsBreak, Meta blue otherwise. Placed last so these
   win the token ties; the dark variants follow each page's own pattern.
   ===================================================================== */

/* ---- NewsBreak: red (launch.html with .nbtheme, and the NB rules page) */
:root.nbtheme, :root.page-rules {
  --accent: #e52d27; --accent-2: #ff5f57; --accent-text: #c81f1a; --accent-soft: #fdeae9;
  --grad: linear-gradient(135deg, #f0413a, #e52d27 55%, #c81f1a);
}
:root.nbtheme[data-theme="dark"], :root.page-rules[data-theme="dark"] {
  --accent: #f04a43; --accent-2: #ff8a84; --accent-text: #ff8f89; --accent-soft: #3a1615;
  --grad: linear-gradient(135deg, #ff5f57, #f04a43 55%, #d83730);
}
@media (prefers-color-scheme: dark) {
  :root.nbtheme:not([data-theme="light"]), :root.page-rules:not([data-theme="light"]) {
    --accent: #f04a43; --accent-2: #ff8a84; --accent-text: #ff8f89; --accent-soft: #3a1615;
    --grad: linear-gradient(135deg, #ff5f57, #f04a43 55%, #d83730);
  }
}

/* ---- Meta: blue (launch.html when it is NOT on NewsBreak) ---- */
:root.page-launch:not(.nbtheme) {
  --accent: #0866ff; --accent-2: #00c2ff; --accent-text: #0653cc; --accent-soft: #e7f0ff;
  --grad: linear-gradient(135deg, #0866ff, #0a8cff 55%, #00c2ff);
}
:root.page-launch:not(.nbtheme)[data-theme="dark"] {
  --accent: #4d94ff; --accent-2: #4dd6ff; --accent-text: #8ab8ff; --accent-soft: #0e2a56;
  --grad: linear-gradient(135deg, #4d94ff, #38aaff 55%, #4dd6ff);
}
@media (prefers-color-scheme: dark) {
  :root.page-launch:not(.nbtheme):not([data-theme="light"]) {
    --accent: #4d94ff; --accent-2: #4dd6ff; --accent-text: #8ab8ff; --accent-soft: #0e2a56;
    --grad: linear-gradient(135deg, #4d94ff, #38aaff 55%, #4dd6ff);
  }
}

/* ---- TikTok: pink to cyan (the launcher and its rules page) ---- */
:root.page-tiktok, :root.page-tt_rules {
  --accent: #fe2c55; --accent-2: #1c1c22; --accent-text: #d81b45; --accent-soft: #ffe9ee;
  --grad: linear-gradient(135deg, #1c1c22, #e6294b 60%, #fe2c55);
}
:root.page-tiktok[data-theme="dark"], :root.page-tt_rules[data-theme="dark"] {
  --accent: #ff3b5c; --accent-2: #2a2a33; --accent-text: #ff9fb2; --accent-soft: #43121f;
  --grad: linear-gradient(135deg, #fe2c55, #99173a 60%, #1c1c22);
}
@media (prefers-color-scheme: dark) {
  :root.page-tiktok:not([data-theme="light"]), :root.page-tt_rules:not([data-theme="light"]) {
    --accent: #ff3b5c; --accent-2: #2a2a33; --accent-text: #ff9fb2; --accent-soft: #43121f;
    --grad: linear-gradient(135deg, #fe2c55, #99173a 60%, #1c1c22);
  }
}

/* ---- SmartNews: crimson ---- */
:root.page-smartnews {
  --accent: #d6001c; --accent-2: #ff4d6d; --accent-text: #a80016; --accent-soft: #fde8eb;
  --grad: linear-gradient(135deg, #d6001c, #ef2649 55%, #ff4d6d);
}
:root.page-smartnews[data-theme="dark"] {
  --accent: #ff3b5c; --accent-2: #ff8aa1; --accent-text: #ff8fa5; --accent-soft: #40101a;
  --grad: linear-gradient(135deg, #ff3b5c, #ff5c7c 55%, #ff8aa1);
}
@media (prefers-color-scheme: dark) {
  :root.page-smartnews:not([data-theme="light"]) {
    --accent: #ff3b5c; --accent-2: #ff8aa1; --accent-text: #ff8fa5; --accent-soft: #40101a;
    --grad: linear-gradient(135deg, #ff3b5c, #ff5c7c 55%, #ff8aa1);
  }
}

/* ---- Snapchat: its yellow, worn properly (launcher and rules page) ----
   Yellow cannot carry white text, so everything the gradient fills flips
   to near-black ink on these two pages. */
:root.page-snapchat, :root.page-sc_rules {
  --accent: #f2c200; --accent-2: #ffe600; --accent-text: #8a6d00; --accent-soft: #fff6c9;
  --grad: linear-gradient(135deg, #ffdd00, #ffc400);
}
:root.page-snapchat[data-theme="dark"], :root.page-sc_rules[data-theme="dark"] {
  --accent: #ffd60a; --accent-2: #fff066; --accent-text: #ffe14d; --accent-soft: #3a3305;
  --grad: linear-gradient(135deg, #ffdd00, #ffc400);
}
@media (prefers-color-scheme: dark) {
  :root.page-snapchat:not([data-theme="light"]), :root.page-sc_rules:not([data-theme="light"]) {
    --accent: #ffd60a; --accent-2: #fff066; --accent-text: #ffe14d; --accent-soft: #3a3305;
    --grad: linear-gradient(135deg, #ffdd00, #ffc400);
  }
}
:root.page-snapchat .btn-primary, :root.page-sc_rules .btn-primary,
:root.page-snapchat .btn-primary:hover, :root.page-sc_rules .btn-primary:hover {
  color: #16160f; text-shadow: none;
}

/* ---- phones: the Library -----------------------------------------------
   The page header stacks to half a phone screen, so it scrolls away rather
   than staying pinned; the action row and the filters each keep to one
   swipeable line. The selection bar -- which wrapped into four rows and,
   rounded, became a black disc over the grid -- is a one-line dock at the
   bottom, swiped sideways, with its More menu opening above it. */
@media (max-width: 760px) {
  html.page-index .topbar { position: relative; top: auto; }
  html.page-index .topbar-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 8px; padding-bottom: 2px; }
  html.page-index .topbar-row::-webkit-scrollbar { display: none; }
  html.page-index .topbar-row > * { flex: none; }
  html.page-index .topbar-row .search-lead { flex: 1 0 100%; max-width: none; order: 10; }
  html.page-index .topbar-row:has(.search-lead) { flex-wrap: wrap; overflow: visible; }
  html.page-index .filter-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  html.page-index .filter-row::-webkit-scrollbar { display: none; }
  html.page-index .filter-row > * { flex: none; }
  html.page-index .datefilter input { min-width: 128px; color: var(--text); }
  html.page-index .selbar {
    position: fixed; top: auto; left: 8px; right: 8px; bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 160; margin: 0; padding: 8px 10px; gap: 6px; border-radius: 18px;
    flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  html.page-index .selbar::-webkit-scrollbar { display: none; }
  html.page-index .selbar > * { flex: none !important; }
  html.page-index .selbar .spacer { display: none; }
  html.page-index .selbar .btn, html.page-index .selbar .selstatus { padding: 7px 12px; font-size: 13px; }
  html.page-index .selbar b { color: var(--inkbar-text); padding-right: 4px; }
  html.page-index .selbar select, html.page-index .selbar .selstatus { background: rgba(255,255,255,.08); color: var(--inkbar-text); border-color: rgba(255,255,255,.14); max-width: 170px; }
  html.page-index .selmore { position: static; }
  html.page-index .selmore-menu { position: fixed; left: 8px; right: 8px; bottom: calc(74px + env(safe-area-inset-bottom)); top: auto; z-index: 161; }
  html.page-index .content { padding-bottom: 110px; }
}

/* ---- narrow desktop windows (761px and up) ----
   The Library's header and bulk bar only reflowed below 860/760px; in a half-screen
   window the rail still takes its column, so Upload, Download and Delete ran off the
   right edge and the nav's links widened the whole page into a sideways scroll. */
.ui-nav { overflow-x: auto; scrollbar-width: none; }
.ui-nav::-webkit-scrollbar { display: none; }
.ui-nav > * { flex: none; }
@media (min-width: 761px) {
  html.page-index .topbar-row { flex-wrap: wrap; row-gap: 10px; }
  html.page-index .selbar { flex-wrap: wrap; row-gap: 8px; }
  html.page-index .main { min-width: 0; }
}
