/* ============================================================
   clippy — master stylesheet  ·  "A Work In Progress"
   Dark UI · Courier Prime (brand) + IBM Plex Mono (everything else)

   ONE stylesheet for every page (Tom, 2026-08-17: "move to a master
   CSS for all styling for consistency"). Link it FIRST in <head>:

     <link rel="stylesheet" href="/clippy.css">

   Everything derives from the tokens in :root — change a variable
   there and it flows through every page.

   ── How this was built ──────────────────────────────────────
   Tom's design system, extended to cover what the app actually
   uses. An audit found the app referencing 26 distinct tokens
   across 15 pages; the original defined 6 of them, so 1,162
   usages (--muted alone appears 703 times) would have rendered
   with no value at all. Every one is now defined here.

   Pages used to carry their own :root — 15 palettes, several
   disagreeing about the same token. Those blocks come out as
   each page is migrated; this file is the single source.
   ============================================================ */

/* Fonts — self-hosted as of 2026-09-08, which is what the note that used to
   sit here asked for: "Self-hosted would be better — Clippy runs locally and
   may be offline, in which case this @import silently does nothing and the
   fallbacks below take over."

   That was exactly the behaviour. Clippy is a local app that is regularly
   offline, so the whole UI quietly dropped to Courier New whenever the
   Google Fonts request failed — and headless Chrome, which never had the
   @import at all when rendering a PDF, ALWAYS fell back. Both families now
   load from disk, so the app looks the same offline as on, and a document
   renders in the real brand face.

   Every family still ends in a real monospace fallback rather than a bare
   name, because a missing file should degrade rather than pick something
   arbitrary. Licences (both SIL OFL 1.1) live beside the files. */

/* ── Courier Prime — the brand face ─────────────────────────────────────── */
@font-face {
  font-family: 'Courier Prime';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/courier-prime/CourierPrime-Regular.ttf') format('truetype');
}
@font-face {
  font-family: 'Courier Prime';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/assets/fonts/courier-prime/CourierPrime-Bold.ttf') format('truetype');
}
@font-face {
  font-family: 'Courier Prime';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/courier-prime/CourierPrime-Italic.ttf') format('truetype');
}
@font-face {
  font-family: 'Courier Prime';
  font-style: italic;
  font-weight: 700;
  font-display: swap;
  src: url('/assets/fonts/courier-prime/CourierPrime-BoldItalic.ttf') format('truetype');
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-mono/IBMPlexMono-Regular.ttf') format('truetype');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-mono/IBMPlexMono-Medium.ttf') format('truetype');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-mono/IBMPlexMono-SemiBold.ttf') format('truetype');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-mono/IBMPlexMono-Bold.ttf') format('truetype');
}
/* The real italic (Tom, 2026-10-28: "Get those fonts fixed"). Without it every
   italic in Clippy was a slant the browser made up from the upright face.
   IBM Plex Mono 2.3, OFL (OFL.txt beside it), from google/fonts. */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-mono/IBMPlexMono-Italic.ttf') format('truetype');
}

/* ---- 1 · Tokens ------------------------------------------------ */
:root {
  /* Neutrals — a warm ramp from #101010 up to #f5f5f5 */
  --bg:            #101010;   /* app background            */
  --bg-inset:      #0a0a0a;   /* wells, filenames, code    */
  --bg-raised:     #161616;   /* cards just above bg       */
  --surface:       #1b1b1b;
  --surface-2:     #222222;   /* inputs, hover fills       */
  --border:        #262626;   /* hairlines                 */
  --border-bright: #363636;   /* hover / focus edges       */
  --text:          #f5f5f5;   /* primary                   */
  --text-2:        #9a9a9a;   /* secondary / meta          */
  --text-3:        #5e5e5e;   /* rules, dividers, disabled — NEVER readable text */
  /* ⛔ --text-3 is 2.93:1 on --bg and FAILS AA for text. Anything a person has to
     READ — captions, keys, section heads, pills, meta — is --text-cap: 5.9:1 on
     --bg, 4.9:1 even on --surface-2. Tom, 2026-10-08: "Fix it."
     ⚠️ portal/public/portal.css carries the same token; change both or neither. */
  --text-cap:      #8f8f8f;   /* captions, keys, meta — readable, AA  */

  /* Brand accent — studio-hardware amber (VU meter / REC light) */
  --accent:        #e9a23d;
  --accent-bright: #f4b45c;
  --accent-ink:    #1a1200;   /* text that sits ON the accent */
  --accent-dim:    rgba(233, 162, 61, 0.13);

  /* Chat — whose voice is speaking.
     Clippy keeps the accent; "you" is the one COOL surface in an otherwise
     warm neutral ramp, which is the only way a surface reads as a COLOUR here
     rather than as another grey. A first pass used --surface-2 and Tom read it,
     correctly, as a lighter grey.
     ⛔ Not --blue (#818cf8 is already links and info toasts) and not the
     --cat-* family — borrowing either makes one colour mean two things.
     ⚠️ A link inside your own bubble keeps its underline: --blue on --me is
     hue-close, so the underline is what separates them. */
  --me:            #223044;

  /* ── Person colours, handed out IN THIS ORDER ──────────────────────────
     ⭐ A colour is a SLOT IN A ROOM, not a property of a person. Tom,
     2026-11-06: "always next free colour. keeping colours isn't important,
     it's the difference between them." So the ORDER is the design: the
     first ones handed out must be the most unlike each other, because
     two- and three-person rooms are nearly all of them.
     ⛔ Not chosen freely — every existing hue already means something.
     amber is yours/press, green/yellow/red are success/warning/error,
     --blue is links, and a sky-blue tint measured ΔE 2.2 from --me, your
     own bubble. That leaves the arc from teal through purple to pink.
     Every one is at least ΔE 10.2 from every semantic colour.
     ⭐ Name contrast on #101010 is 5.11:1 at worst (purple); body text on
     the 20% tint is 9.76:1 at worst. Measured, and held by
     test-chat-person-colours.js.
     Spec: Design Docs/chat-conversation-build.md §5.1. */
  --person-1:      #34b3a3;   /* teal    */
  --person-2:      #a868d8;   /* purple  */
  --person-3:      #f6b3d3;   /* pink    */
  --person-4:      #8ad9ec;   /* cyan    */
  --person-5:      #d466b8;   /* magenta */
  --person-6:      #dda6ea;   /* orchid  */
  --me-border:     #35496a;


  /* Changelog categories — color does real work when scanning history */
  --cat-new:    #5fd39b;   /* New    · added   */
  --cat-rework: #6aa6f2;   /* Rework · changed */
  --cat-fix:    #b596f2;   /* Fix    · fixed   */
  --cat-cut:    #ef8078;   /* Cut    · removed */

  /* Type roles */
  --font-brand: 'Courier Prime', 'Courier New', Courier, monospace;
  --font-ui:    'IBM Plex Mono', 'Courier New', ui-monospace, monospace;

  /* Shape & rhythm */
  --radius:      6px;
  --radius-sm:   4px;
  --radius-pill: 100px;
  --maxw:        760px;
  --s1:4px; --s2:8px; --s3:12px; --s4:16px; --s5:24px; --s6:32px; --s7:48px;
  /* ⭐ The type scale. Tom, 2026-10-10: "happy to go with your recc as well as move to 13".
     Five sizes, each chosen by the job the text does. ⛔ No half pixels; 12px is not on it.
     Rule 11 in Design Docs/clippy-ui-standards.md · test-type-scale.js */
  --fs-title:   26px;   /* a page's title */
  --fs-section: 20px;   /* a section heading */
  --fs-body:    15px;   /* body text, and a row's primary value */
  --fs-meta:    13px;   /* secondary text, captions, meta */
  --fs-label:   11px;   /* uppercase, tracked labels: the floor */

  /* ---- 1b · App tokens ----------------------------------------
     Everything the existing pages reference. Names kept EXACTLY as
     the app already spells them so no markup has to change — the
     alternative was rewriting 1,162 usages by hand, which is a lot
     of risk for a rename. New work should prefer the names above;
     these stay because they are load-bearing.                     */

  /* status — semantic, and the one place colour carries meaning */
  --success: #4ade80;
  --error:   #f87171;
  --warning: #fbbf24;
  --green:   var(--success);
  --red:     var(--error);
  --warn:    var(--warning);
  --danger:  var(--error);
  --blue:    #818cf8;

  /* neutrals under the app's own names */
  --muted:    #9a9a9a;      /* was #6b6b6b — too dim on #101010 for 703 uses */
  --surface2: var(--surface-2);
  --border2:  #1e1e1e;      /* the quieter hairline */
  --card:     var(--bg-raised);
  --hover:    var(--surface-2);
  --panel:    var(--surface);
  --fg:       var(--text);
  --acc:      var(--accent);

  /* type — --mono is referenced 74 times as the base family */
  --mono: var(--font-ui);
  --font: var(--font-ui);

  /* layout constants used by the timecode / rehearsal grids */
  --label-w: 240px;
  --track-h: 30px;
  --ruler-h: 36px;
}

/* ---- 2 · Base -------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

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

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-bright); }

/* Full-strength accent, not --accent-dim (13% opacity) — that's tuned for
   subtle backgrounds elsewhere (search-match marks, suggestion highlights)
   and was nearly invisible as a selection highlight. Same amber/ink pairing
   .btn-primary already uses, so selected text stays legible against it
   even when the selection is itself accent-coloured (e.g. a link). */
::selection { background: var(--accent); color: var(--accent-ink); }

/* ---- 3 · Empty / error states --------------------------------- */
.empty {
  border: 1px dashed var(--border-bright); border-radius: var(--radius);
  padding: 22px; text-align: center; color: var(--text-2); font-size: 13px;
}
.empty b { color: var(--text); }

/* ---- 4 · Primitives (buttons, inputs, badges) ----------------- *
   2026-08-30: extended from pure class selectors to also match the bare
   element. The audit found every page hand-rolling its own `button {}`/
   `input {}`/`select {}` instead of using these — not because anyone chose
   to skip them, but because using them meant adding a class to every single
   tag, which nobody did. Matching the bare element means a page's own
   competing rule is the only thing to remove; every button/input looks
   right with no markup changes. Any page-specific variant (.discard,
   .retry-all, .nav-menu-btn, ...) is a higher-specificity class selector
   and keeps winning exactly as before — this only fills in the default.
   Checkboxes/radios/file/range/color inputs are deliberately excluded —
   this is a *text field* default, not "every input everywhere".
 * ----------------------------------------------------------------- */
button, .btn {
  font-family: var(--font-ui); font-size: 13px; font-weight: 600;
  color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border-bright); border-radius: var(--radius);
  padding: 8px 14px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
button:hover, .btn:hover { border-color: var(--text-3); background: #282828; }
button:active, .btn:active { transform: translateY(0.5px); }

.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-bright); border-color: var(--accent-bright); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg-raised); color: var(--text); }

input[type="text"], input[type="password"], input[type="number"],
input[type="email"], input[type="search"], input[type="url"],
input[type="date"], input[type="tel"], input:not([type]),
select, textarea, .input, .select, .textarea {
  font-family: var(--font-ui); font-size: 13px; color: var(--text);
  background: var(--bg-inset); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 11px; width: 100%;
  transition: border-color .15s;
}
input::placeholder, textarea::placeholder,
.input::placeholder, .textarea::placeholder { color: var(--text-cap); }
input:focus, select:focus, textarea:focus,
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); }
textarea, .textarea { resize: vertical; min-height: 76px; line-height: 1.5; }

/* small neutral badge/chip for counts, tags, statuses */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-meta,13px); font-weight: 600; color: var(--text-2);
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius-pill); padding: 2px 9px;
}

/* Small inline spinner for a button/label mid-action — only make-cues.html
   had this; every other page's "in progress" state was plain text with no
   visual indicator at all. Use: <span class="spinner"></span> Working… */
.spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid var(--text-2); border-top-color: var(--accent);
  border-radius: 50%; animation: spinner-rotate .7s linear infinite;
}
@keyframes spinner-rotate { to { transform: rotate(360deg); } }

/* ---- 4a1b · Stat grid — "N numbers after a job runs" (shared) -- *
   make-cues.html and sampler-generator.html each reinvented this same
   tile-grid concept — see public/stat-grid.js.
 * ----------------------------------------------------------------- */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 10px; margin-bottom: 14px;
}
.stat-tile {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px; text-align: center;
}
.stat-tile-value { font-size: 20px; font-weight: 700; color: var(--accent); }
.stat-tile-label { font-size: var(--fs-label,11px); color: var(--text-2); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.8px; }

/* ---- 4a2 · Proposal status tag (shared) ------------------------ *
   index.html and proposals.html both show the same proposal-lifecycle
   status — index.html's copy had drifted (no borders, several statuses
   missing entirely). The class name is the status value itself (matches
   lib/project-states.js), so this is a pure CSS move, no JS needed.
 * ----------------------------------------------------------------- */
.status-tag {
  font-size: var(--fs-label,11px); font-weight: 700; padding: 1px 5px;
  border-radius: 3px; text-transform: uppercase; letter-spacing: 0.3px;
}
.status-tag.draft,
.status-tag.awip-draft       { background: #222; color: var(--text-2); border: 1px solid var(--border); }
.status-tag.review,
.status-tag.awip-review      { background: #2d1f00; color: var(--warning); border: 1px solid #5c3d00; }
.status-tag.sent             { background: #0a1a2a; color: #5aa9e6; border: 1px solid #1a3a5a; }
.status-tag.artist-review    { background: #2a2500; color: var(--warning); border: 1px solid #4a4500; }
.status-tag.artist-approved  { background: #0d1f0d; color: var(--success); border: 1px solid var(--success); }
.status-tag.active           { background: var(--success); color: #05130a; border: 1px solid var(--success); }
.status-tag.complete         { background: #1c1030; color: #b08ae6; border: 1px solid #3a2a5a; }
.status-tag.invoiced         { background: #0a2320; color: #4ecdc4; border: 1px solid #1a4a44; }
.status-tag.awaiting-payment { background: #2a0f00; color: #ff9f43; border: 1px solid #5c2800; }
.status-tag.closed           { background: #000; color: #888; border: 1px solid #333; }
.status-tag.signed           { background: #2a2a00; color: var(--accent); border: 1px solid #4a4a00; }
.status-tag.archived         { background: #1a1a1a; color: #555; border: 1px solid #2a2a2a; }
.status-tag.declined         { background: #2a1a2a; color: #b07ab0; border: 1px solid #4a2a4a; }
.status-tag.cancelled        { background: #3a1a1a; color: var(--error); border: 1px solid #5a2a2a; }

/* ---- 4a3 · Freelancer level badge (shared) --------------------- *
   my-projects.html had its own single-purpose `.lead-tag` — an exact
   colour duplicate of just the project-lead variant here. Promoted so
   both pages read off the one definition.
 * ----------------------------------------------------------------- */
.lvl-tag {
  font-size: var(--fs-label,11px); font-weight: 700; padding: 2px 7px;
  border-radius: 4px; text-transform: uppercase; letter-spacing: 0.5px;
  white-space: nowrap;
}
.lvl-tag.junior        { background: #222;    color: #999; }
.lvl-tag.level1        { background: #0a1a2a; color: #5aa9e6; }
.lvl-tag.level2        { background: #0a2320; color: #4ecdc4; }
.lvl-tag.operations    { background: #241a08; color: #e8a54b; }
.lvl-tag.project-lead  { background: #1c1030; color: #b08ae6; }
.lvl-tag.admin         { background: #000;    color: var(--accent); border: 1px solid var(--border); }
.lvl-tag.inactive      { background: #1a0a0a; color: var(--error); }

/* ---- 4b · Nav menu (shared, public/nav.js) --------------------- */
.nav-menu { position: relative; }
.nav-menu-btn {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); border-radius: var(--radius-sm);
  padding: 6px 11px; cursor: pointer;
  display: flex; align-items: center;
  transition: border-color .15s, color .15s;
}
.nav-menu-btn:hover { border-color: var(--text-2); color: var(--text); }
.nav-menu-btn.open { border-color: var(--accent); color: var(--accent); }
.nav-dropdown {
  display: none; flex-direction: column;
  position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); min-width: 210px; z-index: 200;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); overflow: hidden;
}
.nav-dropdown.open { display: flex; }
.nav-item {
  padding: 9px 16px; font-size: 13px; color: var(--text-2);
  text-decoration: none; display: flex; align-items: center;
  justify-content: space-between; gap: 8px;
  transition: background .1s, color .1s;
  border: none; background: none; cursor: pointer;
  font-family: var(--mono); text-align: left; width: 100%;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item-who {
  padding: 10px 16px; font-size: var(--fs-meta,13px); color: var(--text-2);
  display: flex; align-items: center; gap: 8px; cursor: default;
}
.nav-item-who strong { color: var(--text); }
.nav-item-accent { color: var(--accent); font-weight: 700; }
.nav-item-accent:hover { color: var(--accent); background: var(--accent-dim); }
.nav-item-danger { color: var(--error); }
.nav-item-danger:hover { color: var(--error); background: rgba(248, 113, 113, .08); }
.nav-divider { height: 1px; background: var(--border); }
.nav-item input[type="checkbox"] { accent-color: var(--accent); cursor: pointer; }

/* ---- 5 · Category labels (reusable) --------------------------- */
.cat { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-meta,13px); font-weight: 600; }
.cat::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.cat.new    { color: var(--cat-new); }    .cat.new::before    { background: var(--cat-new); }
.cat.rework { color: var(--cat-rework); } .cat.rework::before { background: var(--cat-rework); }
.cat.fix    { color: var(--cat-fix); }    .cat.fix::before    { background: var(--cat-fix); }
.cat.cut    { color: var(--cat-cut); }    .cat.cut::before    { background: var(--cat-cut); }

/* ---- 5a2 · Ableton track-type badge (shared, public/track-badge.js) -- */
.track-badge {
  font-size: var(--fs-label,11px); font-weight: 700; padding: 2px 5px;
  border-radius: 3px; flex-shrink: 0; letter-spacing: 0.5px;
  background: var(--border); color: var(--text-2);
}
.track-badge.m { background: #1a2e1a; color: var(--success); }
.track-badge.a { background: #1a1a2e; color: var(--blue); }
.track-badge.g { background: #2a2800; color: var(--accent); }
.track-badge.r { background: var(--border); color: var(--text-2); }
.track-badge.x { background: #2a1a1a; color: var(--error); }

/* ---- 5b · Toast notification (shared, public/toast.js) --------- *
   Fixed bottom-right, colour by kind, dwell time scales with urgency —
   proposals.html's design (the best of the three it replaced); NOT the
   same thing as index.html's `.toast` inline alert block (see toast.js).
 * ----------------------------------------------------------------- */
.toast-popup {
  position: fixed; bottom: 20px; right: 20px; z-index: 1000;
  max-width: 420px;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--border-bright);
  border-radius: var(--radius);
  padding: 12px 16px; font-size: 13px; color: var(--text);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  opacity: 0; transform: translateY(6px);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
}
.toast-popup.in { opacity: 1; transform: translateY(0); }
.toast-popup.success { border-left-color: var(--success); }
.toast-popup.warning { border-left-color: var(--warning); }
.toast-popup.error   { border-left-color: var(--error); }
.toast-popup.info    { border-left-color: var(--blue); }

/* ---- 6 · Login (shared across every page) --------------------- *
   H8b: five pages carried five different login implementations and
   forced password change worked on ONE of them. The markup and
   behaviour now live in /login.js; the styling lives here.
 * --------------------------------------------------------------- */
#loginOverlay, #pwChangeOverlay {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: var(--s4);
}
#loginOverlay.hidden, #pwChangeOverlay.hidden { display: none; }

/* B12 (2026-08-04): centre everything on the forced-password-change screen */
#pwChangeOverlay .login-box h1,
#pwChangeOverlay .login-box > p { text-align: center; }
.login-box {
  width: 100%; max-width: 340px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--s5);
}
.login-box h1 {
  font-family: var(--font-brand); font-size: 26px; font-weight: 700;
  margin-bottom: var(--s2); color: var(--text);
}
.login-box h1 span { color: var(--accent); }
.login-box p { font-size: 13px; color: var(--text-2); margin-bottom: var(--s4); }
.login-box .field { margin-bottom: var(--s3); }
.login-box label {
  display: block; font-size: 11px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-cap); margin-bottom: var(--s1);
}
.login-box input[type="text"],
.login-box input[type="password"] {
  font-family: var(--font-ui); font-size: var(--fs-body,15px); color: var(--text);
  background: var(--bg-inset); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 9px 11px; width: 100%;
}
.login-box input:focus { outline: none; border-color: var(--accent); }
.login-box button {
  width: 100%; font-family: var(--font-ui); font-size: 13px; font-weight: 600;
  background: var(--accent); color: var(--accent-ink);
  border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 9px 14px; cursor: pointer; margin-top: var(--s2);
}
.login-box button:hover { background: var(--accent-bright); }
.login-box button.secondary {
  background: transparent; color: var(--text-2); border-color: var(--border-bright);
}
.login-error { color: var(--error); font-size: var(--fs-meta,13px); min-height: 16px; margin-top: var(--s2); }
.pw-wrap { position: relative; }

/* H9g (Tom: "the show password button covers the whole password field").
   `.login-box button` is (0,1,1) — one class plus one type — and a bare
   `.pw-toggle` is only (0,1,0), so the full-width amber primary-button rule
   won on width, background, padding AND margin, and the eye icon became a
   block covering the input. Scoping it to `.login-box .pw-toggle` makes it
   (0,2,0), which wins cleanly. Order in the file was never going to fix this;
   specificity beats source order. */
.login-box .pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; border-radius: 0; cursor: pointer;
  padding: 2px 4px; width: auto; margin: 0; opacity: .55; line-height: 0;
}
.login-box .pw-toggle:hover { opacity: .9; background: none; }
.pw-show-row {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: var(--fs-meta,13px); color: var(--text-2); margin: 6px 0 10px;
  cursor: pointer; user-select: none;
}
.pw-show-row input { width: auto; }

/* ---- 7 · Progress modal (shared, public/progress.js) ----------- */
#progressModal {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0, 0, 0, 0.6);
  display: none; align-items: center; justify-content: center;
  padding: var(--s4);
}
#progressModal.open { display: flex; }
.progress-card {
  width: 100%; max-width: 380px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--s5);
}
.progress-label { font-size: 13px; color: var(--text); margin-bottom: var(--s3); }
.progress-bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); width: 0%; transition: width 0.3s; }
.progress-fill.indeterminate { width: 40%; animation: progress-sweep 1.2s ease-in-out infinite; }
@keyframes progress-sweep {
  0%   { margin-left: -40%; }
  100% { margin-left: 100%; }
}
.progress-percent { font-size: 11px; color: var(--text-2); text-align: right; margin-top: var(--s1); }
.progress-log {
  font-size: 11px; color: var(--text-2); font-family: var(--mono);
  max-height: 200px; overflow-y: auto; margin-top: var(--s3); line-height: 1.7;
}
.progress-actions { margin-top: var(--s3); text-align: right; }
.progress-error { font-size: var(--fs-meta,13px); color: var(--error); margin-top: var(--s3); line-height: 1.5; }

/* ---- 8 · Responsive ------------------------------------------- */
@media (max-width: 560px) {
  .wrap { padding: 0 var(--s4); }
}

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

/* ---- 9 · Later: light theme ----------------------------------- *
   Every color is a token, so a light mode is just an override —
   redefine the neutrals (and re-check accent contrast) under:
     @media (prefers-color-scheme: light) { :root { ... } }
   No component CSS needs to change.
 * --------------------------------------------------------------- */

/* ── Callouts — drawing attention, anywhere in Clippy ─────────────────────────
   Tom, 2026-10-05: "We just discovered them and we LOVE them … We should use
   them for adding notes to draw attention across the app."

   The same boxes as Obsidian's `> [!warning] Title` callouts, so a note in a
   file and a notice on a screen look like one thing. Build them with
   Callout.html() in public/callout.js — or by hand:

     <div class="callout callout-warning">
       <div class="callout-title"><span class="callout-icon">⚠</span>Heads up</div>
       <div class="callout-body">…</div>
     </div>

   The class is the TONE, not the Obsidian type: error, warning, success, info,
   quiet. callout.js maps each Obsidian type to one. Rules in
   Design Docs/callouts-build.md. ⛔ No new colours — these are the palette's own
   tokens, and not the --cat-* family, which already means added/changed/fixed/cut. */
.callout { --c: var(--blue); margin: var(--s3) 0; padding: 10px 14px; border-radius: var(--radius);
           border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); border-left: 3px solid var(--c);
           background: color-mix(in srgb, var(--c) 8%, transparent); color: var(--text); font-size: 15px; line-height: 1.5; }
.callout-error   { --c: var(--error); }
.callout-warning { --c: var(--warning); }
.callout-success { --c: var(--success); }
.callout-info    { --c: var(--blue); }
.callout-quiet   { --c: var(--text-2); }
.callout-title { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; color: var(--c);
                 font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.callout-title:only-child { margin-bottom: 0; }
.callout-icon { width: 1.2em; text-align: center; }
.callout-body > :first-child { margin-top: 0; }
.callout-body > :last-child { margin-bottom: 0; }
details.callout > summary { cursor: pointer; list-style: none; }
details.callout > summary::-webkit-details-marker { display: none; }

/* ── Bounce AWIP Stems — the "One stem" picker ───────────────────────────────
   Built to the Clippy UI Standards board (clippy-ui-canvas/png/Bounce.png).
   Spec: Design Docs/stem-rerender-build.md + bounce-stems-ui-build.md

   ⛔ SINGLE select, not a checklist: the board shows ◉/○ and a button reading
   "Replace 1 stem". One stem is the whole point of the scope.

   ⛔ No new colours. --accent for the chosen row (the board uses its 13% tint,
   which is --accent-dim), --warning for "never bounced", --danger for the
   overwrite callout. ⛔ The --cat-* family is NOT borrowed — --cat-rework
   reads like the obvious pick for "changed" and taking it would make one
   colour mean two things. */
.scope-pills        { display: flex; gap: var(--s1); margin-bottom: var(--s3); }
.scope-pills button { font: var(--fs-meta) var(--font-ui); color: var(--text-2);
                      background: var(--surface); border: 1px solid var(--border);
                      border-radius: var(--radius-sm); padding: 3px 10px; cursor: pointer; }
.scope-pills button[data-on]    { color: var(--accent); border-color: var(--accent);
                                  background: var(--accent-dim); }
.scope-pills button:disabled    { cursor: default; }
.scope-pills button:not(:disabled):hover { border-color: var(--border-bright); color: var(--text); }

/* 🔴 Without this the @container rule below never fires. Nothing in the app
   declared a container-type — mine was the first `@container` in the sheet, so
   it was dead CSS that LOOKED right. A query needs an ancestor that is one.
   ⭐ Declared on the component, not the pane: responsive-build.md owns giving
   the pane itself a container, and when it does, the nearest ancestor still
   wins and this keeps working. */
.stem-pick          { container-type: inline-size; }

.stem-pick__head    { display: flex; gap: var(--s2); align-items: baseline;
                      margin-bottom: var(--s2); font: var(--fs-meta) var(--font-ui); color: var(--text); }
.stem-pick__head span { font-size: var(--fs-meta); color: var(--text-cap); }

.stem-pick__filter  { width: 100%; box-sizing: border-box; margin-bottom: var(--s2);
                      font: var(--fs-meta) var(--font-ui); color: var(--text);
                      background: var(--bg-inset); border: 1px solid var(--border);
                      border-radius: var(--radius-sm); padding: 6px 9px; }
.stem-pick__filter:focus { outline: none; border-color: var(--border-bright); }

.stem-pick__list    { display: flex; flex-direction: column; gap: 2px; }
.stem-pick__row     { display: flex; gap: 9px; align-items: baseline; width: 100%;
                      text-align: left; padding: 5px 9px; cursor: pointer;
                      font: var(--fs-meta) var(--font-ui); color: var(--text);
                      background: none; border: 1px solid transparent;
                      border-radius: var(--radius-sm); }
.stem-pick__row:not(:disabled):hover { background: var(--surface-2); }
.stem-pick__row[data-selected]       { background: var(--accent-dim);
                                       border-color: var(--accent); }
.stem-pick__row:disabled             { color: var(--text-cap); cursor: default; }
.stem-pick__dot     { flex: none; color: var(--accent); }
.stem-pick__row:disabled .stem-pick__dot { color: var(--text-cap); }
.stem-pick__name    { flex: 1; }
.stem-pick__when    { flex: none; font-size: var(--fs-label); color: var(--text-cap); }
.stem-pick__when[data-never] { color: var(--warning); }
.stem-pick__empty   { padding: var(--s3); font-size: var(--fs-meta); color: var(--text-cap); }

/* The overwrite warning. Red because this one destroys something. */
.callout-danger     { margin-top: var(--s3); padding: 8px 11px;
                      font: var(--fs-meta)/1.6 var(--font-ui); color: var(--text-2);
                      background: color-mix(in srgb, var(--danger) 8%, transparent);
                      border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
                      border-left: 3px solid var(--danger);
                      border-radius: var(--radius-sm); }
.callout-danger strong { color: var(--text); }

/* ⛔ @container, not @media — the breakpoint belongs to the PANE, not the
   window (Resize board, measured 2026-10-07). One rule covers both a four-up
   desktop pane and a 358px pane on a phone; a @media rule fixes the phone and
   leaves the four-up broken.

   ⚠️ 684px is the NARROW END of a pane, not "the" pane width — it measures
   960px at 1920 and 720px at a 1440 laptop. Testing at 684 is right; quoting
   it as the width is not.

   ⭐ Under ~420px the row stops being columns and becomes the house pattern —
   standards rule 2, "a list is rows, not a table: title, then a second line of
   meta." ⛔ The date is NOT dropped: a 103px column is not a column, but an
   undated stem is a stem you cannot tell from its neighbour. */
@container (max-width: 420px) {
  .stem-pick__row  { flex-wrap: wrap; row-gap: 1px; }
  .stem-pick__name { flex: 1 1 auto; }
  .stem-pick__when { flex: 1 0 100%; padding-left: calc(1em + 9px); }
}

/* ── Bounce AWIP Stems — the pre-flight (three counts + a row per song) ──────
   Built to clippy-ui-canvas/png/Bounce.png. Spec: bounce-stems-ui-build.md §1.

   ⛔ No new colours. The three states are the three status tokens the board
   draws them in — --success / --warning / --error — tinted with color-mix
   rather than a new hex. ⛔ The --cat-* family is not borrowed. */
.pf            { container-type: inline-size; margin-bottom: var(--s3); }
.pf-tiles      { display: flex; gap: 14px; margin-bottom: var(--s3); }
.pf-tile       { flex: 1; background: var(--bg-inset); border-radius: var(--radius-sm);
                 padding: 9px 11px; border: 1px solid color-mix(in srgb, var(--pf-c) 20%, transparent); }
.pf-tile b     { display: block; font: var(--fs-section) var(--font-ui); color: var(--pf-c);
                 font-variant-numeric: tabular-nums; }
.pf-tile span  { font-size: var(--fs-label); color: var(--text-2); }
.pf-tile[data-kind="ready"],          .pf-row[data-state="ready"]          { --pf-c: var(--success); }
.pf-tile[data-kind="not-downloaded"], .pf-row[data-state="not-downloaded"] { --pf-c: var(--warning); }
.pf-tile[data-kind="no-session"],     .pf-row[data-state="no-session"]     { --pf-c: var(--error); }
.pf-tile[data-kind="link-broken"],    .pf-row[data-state="link-broken"]    { --pf-c: var(--error); }

.pf-row        { display: grid; grid-template-columns: 22px 1.25fr 128px 1fr; gap: 10px;
                 align-items: center; padding: 7px 12px; border-top: 1px solid var(--bg-raised); }
.pf-head       { border-top: 0; padding: 4px 12px 5px; font-size: var(--fs-label); letter-spacing: .12em;
                 text-transform: uppercase; color: var(--text-cap); }
.pf-dot        { color: var(--pf-c); font-size: var(--fs-label); }
.pf-song       { font-size: var(--fs-meta); color: var(--text); white-space: nowrap;
                 overflow: hidden; text-overflow: ellipsis; }
.pf-row[data-state="no-session"] .pf-song { color: var(--text-2); }
.pf-pill       { font-size: var(--fs-label); padding: 2px 8px; border-radius: var(--radius-pill);
                 white-space: nowrap; color: var(--pf-c);
                 border: 1px solid color-mix(in srgb, var(--pf-c) 27%, transparent);
                 background: color-mix(in srgb, var(--pf-c) 8%, transparent); }
.pf-where      { font-size: var(--fs-meta); color: var(--text-cap); white-space: nowrap;
                 overflow: hidden; text-overflow: ellipsis; }
.pf-note       { margin-top: var(--s2); font-size: var(--fs-meta); color: var(--text-2); }

/* ⛔ @container, not @media — the PANE decides (Resize board). Under ~420px
   the table becomes the house rows pattern (standards rule 2): the song on
   one line, its state and session on the next. ⛔ The session is NOT dropped —
   it is the thing the pre-flight exists to show. */
@container (max-width: 420px) {
  .pf-tiles  { gap: var(--s2); }
  /* A fourth tile (Bounce's "link broken", only when there is one) ran 7 px off a 320 px pane: four wrap
     two by two. Three keep their row, as before. */
  .pf-tiles:has(> :nth-child(4)) { flex-wrap: wrap; }
  .pf-tiles:has(> :nth-child(4)) > .pf-tile { flex: 1 1 40%; min-width: 0; }
  .pf-head   { display: none; }
  .pf-row    { grid-template-columns: 22px 1fr; row-gap: 2px; }
  .pf-row > :nth-child(3), .pf-row > :nth-child(4) { grid-column: 2; }
}

/* ── Bounce Player Parts — the pre-flight and the results ─────────────────────────────────
   Built to clippy-ui-canvas/png/BandParts.png. Spec: player-part-bounce-build.md §7, §12.
   ⛔ No new colours: --success / --warning / --error for the three states, tinted with
   color-mix as the Bounce pre-flight's .pf rows are. ⛔ Nothing faded: secondary words are
   --text-cap. ⛔ The five sizes only. */
.bp-root           { container-type: inline-size; }
.bp-label          { margin: var(--s3) 0 var(--s2); font-size: var(--fs-label); letter-spacing: .12em;
                     text-transform: uppercase; color: var(--text-cap); }
.bp-input          { display: block; width: 100%; box-sizing: border-box; font-size: var(--fs-body); }
.bp-quiet, .bp-cap { font-size: var(--fs-meta); color: var(--text-cap); }
.bp-lead           { font-size: var(--fs-body); color: var(--text); margin: 0 0 var(--s2); }
.bp-players        { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s3); }
.bp-player         { flex: 1 1 200px; display: flex; gap: var(--s2); align-items: flex-start; cursor: pointer;
                     padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
                     background: var(--bg-inset); font-size: var(--fs-body); color: var(--text); }
.bp-player .bp-cap { display: block; margin-top: 2px; }
.bp-player input   { margin-top: 3px; }
.bp-outside, .bp-ask { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: var(--s3);
                     background: color-mix(in srgb, var(--warning) 6%, transparent);
                     border: 1px solid color-mix(in srgb, var(--warning) 25%, transparent);
                     border-left: 3px solid var(--warning); }
.bp-ask            { background: var(--bg-inset); border-color: var(--border); border-left-color: var(--accent); }
.bp-ask-q          { font-size: var(--fs-body); color: var(--text); margin: 0 0 var(--s2); }
.bp-ask-row        { font-size: var(--fs-meta); margin: 2px 0; color: var(--text); }
.bp-detail         { font-size: var(--fs-meta); color: var(--text-2); margin: 4px 0 8px; }
/* A sample's own name can be one 40-character word; on a phone it must break, not push the pane wide. */
.bp-outside, .bp-row { overflow-wrap: anywhere; }
.bp-choice         { display: flex; margin-top: var(--s2); }
.bp-choice button  { font-size: var(--fs-meta); min-height: 44px; padding: 0 14px; cursor: pointer;
                     color: var(--text); background: var(--surface); border: 1px solid var(--border); }
.bp-choice button[aria-pressed="true"] { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.bp-row            { padding: 10px 0; border-top: 1px solid var(--bg-raised); }
.bp-row p          { margin: 3px 0; }
.bp-row-head       { display: flex; gap: var(--s2); align-items: baseline; font-size: var(--fs-body); color: var(--text); }
.bp-num            { font-size: var(--fs-meta); color: var(--text-cap); }
.bp-count          { margin-left: auto; font-size: var(--fs-meta); color: var(--text); }
.bp-writes         { font-size: var(--fs-body); color: var(--text); }
.bp-hand           { font-size: var(--fs-meta); color: var(--text); }
.bp-pill           { --bp-c: var(--success); font-size: var(--fs-label); text-transform: uppercase; letter-spacing: .06em;
                     padding: 2px 8px; border-radius: var(--radius-pill); color: var(--bp-c);
                     border: 1px solid color-mix(in srgb, var(--bp-c) 27%, transparent);
                     background: color-mix(in srgb, var(--bp-c) 8%, transparent); }
.bp-pill[data-kind="some"] { --bp-c: var(--warning); }
.bp-pill[data-kind="fail"] { --bp-c: var(--error); }
.bp-warn-line      { font-size: var(--fs-meta); color: var(--warning); }
.bp-warn-line::before { content: '! '; font-weight: 600; }
.bp-fail-line      { font-size: var(--fs-meta); color: var(--error); }
.bp-fail-line::before { content: '✗ '; }
.bp-foot           { margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--border); font-size: var(--fs-body); color: var(--text); }
.bp-go             { display: flex; gap: var(--s3); align-items: center; justify-content: space-between; margin-top: var(--s2); }
.bp-title          { font-size: var(--fs-section); font-weight: 600; color: var(--text); margin: 0 0 var(--s1); }
/* Timecode Bounce (public/bounce-timecode.js) shares the .bp-* look; these three are its own. */
.bp-warn-text      { color: var(--warning); }
.tcb-buttons       { display: flex; gap: var(--s2); align-items: center; justify-content: flex-start; }
.tcb-tc            { color: var(--text); font-weight: 600; }
/* Bounce Reference Tracks (public/bounce-reference-tracks.js): a linked song's row carries its
   Keep the release / Use the session's choice beside it; "can't yet" is said in red, in full. */
.ref-choice-row    { display: flex; gap: var(--s3); align-items: center; justify-content: space-between; }
.ref-choice-row .bp-choice { flex: none; margin-top: 0; }
.bp-fail-text      { font-size: var(--fs-body); color: var(--error); }
.bp-pill[data-kind="linked"] { --bp-c: var(--text-cap, #8f8f8f); }
/* The bounces' four tiles, on a phone: two by two rather than four squeezed into a row (round 3:
   Bounce Timecode's "74:16 · full show, first marker to end" pushed a 320 px pane sideways). */
@container (max-width: 420px) {
  .bp-root .pf-tiles { flex-wrap: wrap; }
  .bp-root .pf-tile  { flex: 1 1 40%; min-width: 0; overflow-wrap: anywhere; }
}
@container (max-width: 560px) {
  .ref-choice-row  { flex-direction: column; align-items: stretch; }
}
/* ⛔ @container, not @media — the pane decides. Narrow: the count drops under the name. */
@container (max-width: 420px) {
  .bp-row-head { flex-wrap: wrap; }
  .bp-count    { margin-left: 0; flex: 1 0 100%; }
  .bp-go       { flex-direction: column; align-items: stretch; }
  /* Bounce Timecode's "Bounce 27 songs + full show" ran off a 320 px pane (round 3). */
  .tcb-buttons { flex-wrap: wrap; }
  .tcb-buttons button { white-space: normal; }
}
