/* ===========================
   Single-page conversation stage
   =========================== */
.stage {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(var(--space-6), 4vw, var(--space-10)) var(--space-6) var(--space-8);
  min-height: calc(100dvh - 76px);
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

/* Halo dims significantly once the conversation begins so messages take the eye. */
.has-conversation .halo {
  opacity: 0.18;
  transition: opacity 700ms ease;
}

/* Halo — three nested halos representing user, community, and global experience.
   The viewBox is 400x120 (3.33:1, very flat) so the cluster occupies little
   vertical space. Outer halo is sized to about the width of the “Gabriel” wordmark. */
.halo {
  position: fixed;
  /* Halo lifted to sit just under the sticky header so the wordmark + halo +
     intro note read as one stacked hero unit. Removes the dead band of empty
     wings that used to sit above the note on tall viewports.
     (Doug 5/15/26.) */
  top: clamp(96px, 11vh, 128px);
  left: 50%;
  transform: translateX(-50%);
  width: clamp(280px, 32vw, 460px);
  height: auto;
  color: var(--color-primary);
  opacity: 0.95;
  z-index: 1;       /* above wings (z:0), below interactive content */
  pointer-events: none;
  /* Clip the SVG bloom so painted strokes can't extend past the SVG box and
     cause horizontal page overflow on mobile. */
  overflow: hidden;
  /* Subtle glow so the halos feel luminous, not flat. */
  filter: drop-shadow(0 0 6px rgba(245, 198, 74, 0.30));
}
@media (max-width: 720px) {
  .halo {
    /* Mobile: header is shorter, so halo can sit a touch higher. */
    top: clamp(80px, 9vh, 108px);
    width: clamp(240px, 70vw, 360px);
  }
}

/* Wordmark */
.wordmark {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  user-select: none;
}
.wordmark__name {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.25rem, 1.5rem + 3.5vw, 3.5rem);
  letter-spacing: 0.42em;       /* spacious: G a b r i e l */
  padding-left: 0.42em;          /* compensate so the wordmark stays optically centered */
  line-height: 1;
  color: var(--color-text);
}

/* Chat box — the "horizon" (Doug 5/30/26 PM round 3).
   No card, no border, no shadow, no rounded corners. The textarea floats on
   the endless white realm of the user; Gabriel's wings fill the sky above,
   the user's space flows down to the viewport floor. The mic + voice caret
   sit on the right; no visible send button — Enter sends, Shift+Enter
   newlines. Width is constrained to the stage so the writing line lines up
   with everything else, but the surface itself is the dock (which already
   paints white edge-to-edge and down through the safe-area). */
.chatbox {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  background: transparent;
  border: 0;
  border-radius: 0;
  /* c165 (Doug 6/19/26): "perplexity is positioned tight to save screen
     space, Gabriel seems to waste space". Compare image: Perplexity's
     dock packs text top edge near bubble top, toolbar right under text;
     Gabriel had ~24px above + 24px between + 24px below. Tighten outer
     padding (12px -> 4px) and inter-row gap (8px -> 4px) so the dock
     matches Perplexity's density. The chatbox already sits inside a dock
     container with its own breathing room; the doubled padding was
     redundant. */
  padding: var(--space-1) 0;
  /* c151 (Doug 6/19/26): stacked layout -- textarea on top (full width),
     toolbar row below (icons left + right). Replaces the c142-era flex-row
     where mic and send flanked a single-line textarea. */
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-1);
  box-shadow: none;
  transition: none;
  position: relative;             /* anchor for the voice-command hint */
}
.chatbox:focus-within {
  border-color: transparent;
  box-shadow: none;
}

/* Voice command hint — a soft, italic prompt that fades in only while the
   mic is listening. Sits just above the chatbox so it never overlaps Gabriel's
   thread above or the dock below. Doug 5/16/26: "users will need to know what
   words trigger what actions — a simple reference, not a manual." */
.chatbox__voice-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% - var(--space-1));
  text-align: center;
  font-family: var(--font-app);
  font-size: 0.78rem;
  color: var(--color-text-faint);
  letter-spacing: 0.02em;
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 220ms ease, transform 220ms ease;
}
.chatbox__voice-hint em {
  font-style: italic;
  color: var(--color-text-muted, var(--color-text-faint));
}
.chatbox.is-listening .chatbox__voice-hint {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .chatbox__voice-hint { transition: none; }
}
.chatbox textarea {
  flex: 1;
  border: none;
  background: transparent;
  resize: none;
  /* Match the message-body typography so what you type reads as the same
     voice as what Gabriel replies. Previously Inter at clamp(16–18px)
     against the message body's system-sans at flat 16px — the composer
     came out larger and chunkier, abrasive in the dock. Doug 5/17/26. */
  font-family: var(--font-app);
  font-size: 1rem;
  line-height: 1.65;
  letter-spacing: -0.003em;
  outline: none;
  /* Doug 5/30/26 PM round 3: composer is back to edge-to-edge horizon
     (no enclosing card), so restore the original roomy vertical padding
     and zero horizontal padding — the writing line sits flush with the
     stage edges and the mic on the right. */
  /* c165 (Doug 6/19/26): tighten internal vertical padding to match
     Perplexity's compact dock. Was --space-3 (12px each side = 24px of
     wasted vertical) which doubled with the chatbox padding above/below.
     --space-1 (4px each side = 8px) keeps the text breathing without
     bloating the dock. */
  padding: var(--space-1) 0;
  /* Doug 5/30/26 PM round 5: now that the white realm fills all the way
     down to the viewport floor there's room to breathe. Open the composer
     to two visible lines from the start (line-height 1.65 × 1rem ≈ 26.4px,
     so ~56px holds two lines comfortably). Autogrow still expands up to
     max-height when the user types more; it shrinks back to two lines, not
     one. The empty composer feels like an open invitation, not a tight slot. */
  /* c151 (Doug 6/19/26): icons moved to a toolbar row BELOW the textarea,
     so the textarea owns the full width and can grow much taller. */
  /* c153 (Doug 6/19/26): grew the cap to min(50vh, 480px) so a long
     message wouldn't clip. But that's ~18 lines of growth, which on tall
     viewports lets the dock swallow the thread. */
  /* c165 (Doug 6/19/26): "Max 6 lines on perplexity, suggest same for
     Gabriel." Cap growth at 6 lines exactly (line-height 1.65em × 6 ≈
     158px, plus the 8px padding = ~166px). Past 6 lines, internal scroll
     kicks in -- the dock stops growing and the textarea scrolls inside
     its own frame. This matches Perplexity's behavior in the reference
     screenshots: text at 2, 3, 4 lines visibly grew the dock; at the cap
     it would scroll instead. */
  min-height: calc(1.65em * 2);
  max-height: calc(1.65em * 6 + var(--space-2));
  /* c155 (Doug 6/19/26): "only accepts 2 rows of text (text doesn't
     grow as you planned)" on iPhone Firefox. c153 left overflow-y:auto
     on the resting state -- combined with min-height: 2 lines, the
     browser scrolled internally past line 2 instead of letting the
     textarea grow. Removed: when content exceeds max-height, textareas
     enable internal scroll by default; we don't need to declare it
     here. Now the dock grows row by row up to min(50vh, 480px) and
     only then starts scrolling internally. */
  color: var(--color-text);
}
.chatbox textarea::placeholder {
  /* --color-placeholder, not --color-text-faint: on dark theme the faint
     value (#5a574e) sat too close to the input background and the hint
     text was barely visible (Doug 5/21/26). */
  color: var(--color-placeholder);
  font-style: italic;
}
/* Doug 5/30/26 PM: send button hidden — Enter sends, Shift+Enter newlines.
   The <button type="submit"> stays in the DOM as a no-op submit target so
   chat.js's setSending(sendBtn.disabled = v) and the form's native submit
   event continue to fire without null-guarding. Just visually removed. */
/* c151 (Doug 6/19/26): send button is BACK as a visible affordance. Lives
   on the right side of the new .chatbox__toolbar row alongside the mic.
   Filled disc, primary-tinted dark, white arrow pointing up -- visual rhyme
   with Perplexity's send button so the affordance reads immediately. The
   5/30/26 "Enter sends" behavior on desktop is preserved by chat.js's
   submit handler; mobile native keyboard return inserts a newline (so
   users can structure paragraphs) and Send is the explicit commit. */
.chatbox__send {
  /* c153 (Doug 6/19/26): "the icons are too big for Gabriel. Can we make
     them less obtrusive like perplexity and close to the frame." Send disc
     shrunk 38px -> 32px to read as a quiet affordance, not a hero CTA. */
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  border: 0;
  background: color-mix(in oklab, var(--color-text) 88%, var(--color-primary) 12%);
  color: var(--color-text-inverse);
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition:
    background var(--transition-interactive),
    box-shadow var(--transition-interactive),
    transform var(--transition-interactive);
}
.chatbox__send:hover {
  background: var(--color-text);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-primary) 18%, transparent);
}
.chatbox__send:focus-visible {
  outline: 2px solid color-mix(in oklab, var(--color-primary) 70%, transparent);
  outline-offset: 2px;
}
.chatbox__send:active { transform: scale(0.96); }

/* Jump-to-latest (Claude Code 2026-08-17, Doug). Appears only while the reader
   has scrolled away from the newest message, which is exactly when tail-
   following is suspended for them; chat.js owns the show/hide. Built in JS and
   appended to <body> so index.html and space.html cannot drift apart on it.

   position:fixed, NOT absolute inside the dock. The obvious placement -- a
   child of .compose-dock at top:-44px -- renders and hit-tests as nothing at
   all, because the dock carries `clip-path: inset(0 -1200px)`: zero vertical
   inset clips everything above its own top edge, while the -1200px horizontal
   lets the background bleed. Verified in Chromium, where elementFromPoint over
   the button returned the message bubble behind it. Fixed positioning leaves
   that clip entirely; chat.js sets bottom/right from the dock's live rect each
   frame so the button still tracks the dock as the composer grows.

   z-index 25 clears the dock's 20. Deliberately quieter than .chatbox__send:
   this is a way back, not an action. */
.jump-to-latest {
  position: fixed;
  z-index: 25;
  bottom: 96px;   /* replaced from the dock's rect on first refresh */
  right: 24px;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.10);
  transition:
    background var(--transition-interactive),
    color var(--transition-interactive),
    box-shadow var(--transition-interactive),
    transform var(--transition-interactive);
}
.jump-to-latest svg { width: 16px; height: 16px; display: block; }
.jump-to-latest:hover {
  color: var(--color-text);
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.16);
}
.jump-to-latest:focus-visible {
  outline: 2px solid color-mix(in oklab, var(--color-primary) 70%, transparent);
  outline-offset: 2px;
}
.jump-to-latest:active { transform: scale(0.96); }
/* [hidden] needs restating: the display:inline-grid above would otherwise win
   on specificity and the button would stay visible when chat.js hides it. */
.jump-to-latest[hidden] { display: none; }
.chatbox__send[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  background: color-mix(in oklab, var(--color-text) 60%, transparent);
  box-shadow: none;
}

/* c151 toolbar: dedicated icon row below the textarea. [+] attach on the
   left, mic + send cluster on the right. The toolbar exists on BOTH mobile
   and desktop -- the c142 flex-order shuffle of voice/field/send is gone. */
/* Two action banks pushed to the outer edges: [+] + Reckoning on the LEFT,
   voice + send on the RIGHT. (2026-07-31: removed the centred debug "H" dot and
   the 3-col grid + empty left spacer that only existed to balance it — a simple
   right-aligned flex is all the remaining controls needed then.)
   2026-08-04: split back apart, for a different reason than the old spacer.
   Reckoning sat directly beside the mic, so during long voice sessions a thumb
   reaching for the mic was firing it by accident — and Reckoning sends a turn,
   which is not something a mis-tap should be able to do. The gap between the
   banks is now the safety margin; a slip off the mic hits dead toolbar. */
.chatbox__toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
}
.chatbox__toolbar-left,
.chatbox__toolbar-right {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

/* [+] attach button: ghost circle, plus glyph at 20px. Sits beside the
   mic + send cluster as the quietest control in the toolbar.
   c153 (Doug 6/19/26): "icons are too big...make them less obtrusive
   like perplexity and close to the frame." Border removed and frame
   shrunk 38px -> 30px so [+] reads as a soft hint, not a hard chip. */
.chatbox__attach {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  border: 0;
  background: transparent;
  color: var(--color-text-muted);
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition:
    color var(--transition-interactive),
    background var(--transition-interactive),
    transform var(--transition-interactive);
}
.chatbox__attach:hover {
  color: var(--color-text);
  background: color-mix(in oklab, var(--color-surface-offset) 70%, transparent);
}
.chatbox__attach:focus-visible {
  outline: 2px solid color-mix(in oklab, var(--color-primary) 70%, transparent);
  outline-offset: 2px;
}
.chatbox__attach:active { transform: scale(0.96); }
.chatbox__attach[disabled] { opacity: 0.45; cursor: not-allowed; }

/* c162 (Doug 6/19/26): Reckoning button reshaped from a labeled pill (above
   the dock) into an icon-only 32x32 chip inside the toolbar. Visually rhymes
   with .chatbox__attach -- ghost circle, currentColor stroke, soft hover.
   Geometry: 32x32 frame, 18x18 SVG centered. Sits to the right of the [+]
   attach button so the action order reads left-to-right: witness, attach,
   reckon, then voice + send on the right side. The .reckoning-trigger /
   .reckoning-trigger--compose classes are kept on the button for backward
   compatibility with existing JS event delegation, but the visual styling
   below WINS over the original .reckoning-trigger pill styles because
   .chatbox__reckon is more specific within the toolbar context. */
.chatbox__reckon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  border: 0;
  background: transparent;
  color: var(--color-text-muted);
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  cursor: pointer;
  padding: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition:
    color var(--transition-interactive),
    background var(--transition-interactive),
    transform var(--transition-interactive);
}
.chatbox__reckon:hover {
  color: var(--color-text);
  background: color-mix(in oklab, var(--color-surface-offset) 70%, transparent);
}
.chatbox__reckon:focus-visible {
  outline: 2px solid color-mix(in oklab, var(--color-primary) 70%, transparent);
  outline-offset: 2px;
}
.chatbox__reckon:active { transform: scale(0.96); }
.chatbox__reckon[hidden] { display: none !important; }
/* The reckoning-trigger--compose class historically gave the button pill
   geometry (height: 32px, padding 0 12px, etc). Inside the toolbar we
   override those with the icon-chip dimensions above, but the rule is
   only safe if we kill any leftover padding/min-width that bled in. */
.chatbox__reckon.reckoning-trigger,
.chatbox__reckon.reckoning-trigger--compose {
  padding: 0;
  min-width: 0;
  gap: 0;
  height: 32px;
  width: 32px;
  border: 0;
  background: transparent;
  /* Doug 2026-07-23 "the reckoning pill is always invisible": a LEGACY
     .chatbox__reckon block further down (the 5/17 dark-disc styling) sets
     color: var(--color-text-inverse) -- a near-white glyph meant for a dark
     filled disc. This compose override makes the background transparent (ghost
     icon, like [+]) but the inverse colour still won on the cascade, so the
     scales rendered white-on-white -> invisible. Pin a dark muted glyph here
     (higher specificity than the legacy single-class rule) so Reckoning reads
     as a visible ghost icon consistent with the attach [+] beside it. */
  color: var(--color-text-muted);
}
.chatbox__reckon.reckoning-trigger--compose:hover {
  /* Match the ghost-icon hover (soft tint), overriding the legacy dark-disc
     hover so the compose Reckoning stays consistent with [+] and the mic. */
  color: var(--color-text);
  background: color-mix(in oklab, var(--color-surface-offset) 70%, transparent);
}
.chatbox__reckon .mobile-nav__row-label,
.chatbox__reckon .mobile-nav__row-icon {
  /* The pre-c162 markup wrapped the SVG in a .mobile-nav__row-icon span
     and showed a .mobile-nav__row-label next to it. The c162 markup
     drops both wrappers, but if older markup ever rehydrates we keep
     the icon-only appearance by force. */
  display: none;
}


/* Unified voice control inside the chatbox — mic + voice-settings caret.
   Doug 5/30/26 PM round 2: voice block moved to the RIGHT of the textarea
   (where the old paperclip used to live) via flex order. Mic visually sits
   to the right of the cursor instead of left, leaving a clean intro at the
   left edge of the card. */
.chatbox__voice {
  /* c151 (Doug 6/19/26): no more flex order shuffle -- voice now lives
     inside .chatbox__toolbar-right (with mic + send), so it inherits the
     toolbar's flex order naturally. The order:2 from c142 is gone. */
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
/* The field column is the textarea wrapper; it owns the full row width
   in the c151 stacked layout (no sibling controls beside it). */
.chatbox__field { width: 100%; }

/* Mic button — ghost on the left of the chatbox.
   c153 (Doug 6/19/26): "icons are too big for Gabriel." Mic shrunk
   40px -> 32px to match the send disc and read as a quiet glyph. */
/* 10-17 (Doug: "if so, can we remove it from the screen now?"): the talk
   mic is off the screen; the ear (Off, Listen, Speak) is the voice control.
   The button stays in the page: listening switches capture on through it,
   the pop-out mirrors it, and gabriel.talkMic=show brings it back (chat.js). */
.chatbox__mic[data-talk-hidden] { display: none !important; }
.chatbox__mic {
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  display: inline-grid; place-items: center;
  flex-shrink: 0;
  background: transparent;
  transition: color var(--transition-interactive), background var(--transition-interactive);
}

/* Tiny caret next to mic — opens the voice settings menu.
   c153 (Doug 6/19/26): height down 40px -> 32px to match the new
   shorter mic; width 18px -> 14px to stay proportional. */
.chatbox__voice-caret {
  width: 14px; height: 32px;
  border: 0;
  background: transparent;
  color: var(--color-text-faint);
  display: inline-grid; place-items: center;
  cursor: pointer;
  border-radius: 6px;
  margin-left: -2px;
  transition: color var(--transition-interactive), background var(--transition-interactive);
}
@media (hover: hover) {
  .chatbox__voice-caret:hover {
    color: var(--color-text);
    background: color-mix(in oklab, var(--color-surface-offset) 70%, transparent);
  }
}
.chatbox__voice-caret[aria-expanded="true"] {
  color: var(--color-text);
}
.chatbox__voice-caret svg { transition: transform var(--transition-interactive); }
.chatbox__voice-caret[aria-expanded="true"] svg { transform: rotate(180deg); }

/* When voice is on, give the mic a subtle glow even when not listening,
   so the user can see at a glance that Gabriel will speak. */
body.gabriel-voice-on .chatbox__mic:not([aria-pressed="true"]) {
  color: var(--color-primary);
}
/* 2026-10-13 (Doug: "mic off and ear off should not have that black aura").
   On a phone, :hover sticks to the last button tapped, so the hover disc
   stayed behind the mic after turning it off. Hover only where there is a
   real pointer. */
@media (hover: hover) {
  .chatbox__mic:hover {
    color: var(--color-text);
    background: color-mix(in oklab, var(--color-surface-offset) 70%, transparent);
  }
}
.chatbox__mic[aria-pressed="true"] {
  color: var(--color-primary);
  background: color-mix(in oklab, var(--color-primary) 14%, transparent);
  animation: mic-pulse 1.6s ease-in-out infinite;
}
.chatbox__voice:has(.chatbox__mic[aria-pressed="true"]) .chatbox__voice-caret {
  color: var(--color-primary);
}
.chatbox__mic[disabled] { opacity: 0.35; cursor: not-allowed; }
.chatbox__mic[disabled]:hover { background: transparent; color: var(--color-text-muted); }

/* Mic / stop icon swap — mic by default, stop while listening */
.chatbox__mic .mic-icon-stop { display: none; }
.chatbox__mic[aria-pressed="true"] .mic-icon { display: none; }
.chatbox__mic[aria-pressed="true"] .mic-icon-stop { display: inline-block; }

/* 2026-10-12 (Doug): the button says when you are being heard (__voiceCue in
   js/voice.js). Off: the mic. On and waiting: the mic with a steady halo. From
   the moment your voice is heard until Gabriel's reply ends: the trumpet, with
   the pulsing halo. The stop square is retired; a tap on the lit button still
   stops listening. */
/* 2026-10-12 (+localpreview): the phone's on-device words, shown greyed until
   AWS's first words replace them. */
.chatbox textarea.is-provisional { color: var(--color-text-muted); }
.chatbox__mic .mic-icon-horn { display: none; }
.chatbox__mic[aria-pressed="true"] {
  animation: none;
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-primary) 22%, transparent);
}
.chatbox__mic[aria-pressed="true"] .mic-icon { display: inline-block; }
.chatbox__mic[aria-pressed="true"] .mic-icon-stop { display: none; }
.chatbox__mic[data-voice-cue="turn"] {
  color: var(--color-primary);
  background: color-mix(in oklab, var(--color-primary) 14%, transparent);
  animation: mic-pulse 1.6s ease-in-out infinite;
}
.chatbox__mic[data-voice-cue="turn"] .mic-icon,
.chatbox__mic[data-voice-cue="turn"] .mic-icon-stop { display: none; }
.chatbox__mic[data-voice-cue="turn"] .mic-icon-horn { display: inline-block; }
@media (prefers-reduced-motion: reduce) {
  .chatbox__mic[data-voice-cue="turn"] {
    animation: none;
    box-shadow: 0 0 0 4px color-mix(in oklab, var(--color-primary) 30%, transparent);
  }
}

@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--color-primary) 25%, transparent); }
  50%      { box-shadow: 0 0 0 10px color-mix(in oklab, var(--color-primary) 0%, transparent); }
}

/* When the chatbox is listening, the border glows softly */
.chatbox.is-listening {
  border-color: color-mix(in oklab, var(--color-primary) 50%, var(--color-border));
  box-shadow:
    var(--shadow-lg),
    0 0 0 4px color-mix(in oklab, var(--color-primary) 16%, transparent);
}

/* While transcribing, the mic shows a quiet pulsing ring so users know
   their speech is being processed. */
.chatbox.is-transcribing .chatbox__mic {
  animation: mic-transcribing 1.2s ease-in-out infinite;
  opacity: 0.7;
}
@keyframes mic-transcribing {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--color-primary) 35%, transparent); }
  50%      { box-shadow: 0 0 0 8px color-mix(in oklab, var(--color-primary) 0%, transparent); }
}

/* Voice-toggle button when speaking is enabled */
.icon-btn[aria-pressed="true"] {
  color: var(--color-primary);
  background: color-mix(in oklab, var(--color-primary) 12%, transparent);
}

/* ===========================
   Thread
   =========================== */
.thread {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  flex: 1;                       /* fills space between header and chatbox */
  /* Soft mask at the top so messages fade into the wings as they scroll up */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, rgba(0,0,0,0.15) 4%, rgba(0,0,0,0.55) 10%, #000 22%, #000 100%);
          mask-image: linear-gradient(to bottom, transparent 0, rgba(0,0,0,0.15) 4%, rgba(0,0,0,0.55) 10%, #000 22%, #000 100%);
  /* Modest breathing room above the first message — enough that the halo
     reads, not so much that the thread feels detached from the top.
     (Doug 5/15/26: "tighter to top would still be better.") */
  padding-top: clamp(90px, 12vh, 140px);
  /* Just enough clearance below the last message to clear the fixed
     composer dock plus a comfortable gap. The previous value
     (calc(100dvh - 280px)) reserved nearly a full viewport, which created
     a phantom "second thread" zone the messages could scroll into. */
  padding-bottom: 200px;
}
@media (max-width: 720px) {
  .thread {
    padding-top: clamp(70px, 9vh, 100px);
    /* Mobile dock is taller (~162px) + a comfortable gap */
    padding-bottom: 220px;
  }
}

.message {
  display: flex;
  max-width: 100%;
  animation: message-rise 360ms ease both;
}

/* Journal-style date header. Sits between days in the thread.

   Design philosophy (Doug 5/17/26): "I do like the default transparency —
   these are like ideas that the user is now letting go of. They don't need
   to hold on to them, Gabriel does." So the in-thread date header is
   intentionally quiet — part of the thread's fading texture, not a loud
   signal. The readable here-and-now anchor lives in the top chrome
   (.journal-date badge); this in-thread version is purely for sequencing
   when the user reaches back through prior days.

   On time-filter / archive mode (.thread:has([data-archive-readonly])), the
   user has explicitly chosen to read the past — so these headers lift
   along with the bubbles to a legible weight. Lift rule lives below.) */
.date-header {
  text-align: center;
  font-family: var(--font-app);
  font-size: 0.8125rem;     /* 13px — subordinate to message body */
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  text-transform: uppercase;
  margin: var(--space-6) auto var(--space-4);
  padding: 0 var(--space-4);
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-width: 64ch;
}
.date-header::before,
.date-header::after {
  content: "";
  flex: 1;
  height: 1px;
  background: color-mix(in oklab, var(--color-text-muted) 22%, transparent);
}
/* Lift on archive mode: when the user has opened a previous-day or range
   filter, in-thread date headers become readable so they can actually
   serve as section markers. Body color, slightly heavier dividers. */
.thread:has(.message[data-archive-readonly]) .date-header {
  color: var(--color-text);
  font-weight: 600;
}
.thread:has(.message[data-archive-readonly]) .date-header::before,
.thread:has(.message[data-archive-readonly]) .date-header::after {
  background: color-mix(in oklab, var(--color-text-muted) 45%, transparent);
}
/* First date header in the thread has no top margin so it doesn't push the
   first message down. */
.date-header:first-child {
  margin-top: var(--space-2);
}
.message--ai   { justify-content: flex-start; }
.message--user { justify-content: flex-end; }

/* Computer/system voice: not Gabriel, not the user. A third register used
   for ceremonial server-delivered lines (e.g. the verbatim onboarding
   greeting on first Journal landing). Modeled on .date-header --
   centered, muted, italic, flanked by thin horizon dividers. Deliberately
   NOT a chat bubble; this is a threshold marker, not a turn. Doug 5/30/26 */
.message--system {
  justify-content: center;
  margin: var(--space-6) auto;
  padding: 0 var(--space-4);
  max-width: 64ch;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.message--system::before,
.message--system::after {
  content: "";
  flex: 1;
  height: 1px;
  background: color-mix(in oklab, var(--color-text-muted) 22%, transparent);
}
.message--system .message__body {
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
  margin: 0;
  text-align: center;
  font-style: italic;
  font-weight: 400;
  color: var(--color-text-muted);
  font-size: 0.9375rem;     /* 15px -- slightly softer than body */
  line-height: 1.5;
  letter-spacing: 0.01em;
  max-width: none;
}

.message__body {
  /* Claude-style chat typography: clean system sans, comfortable measure */
  font-family: var(--font-app);
  font-size: 1rem;                /* 16px */
  line-height: 1.65;
  letter-spacing: -0.003em;       /* subtle, Claude-like crispness */
  color: var(--color-text);
  max-width: 64ch;
}
.message--ai .message__body {
  /* Gabriel — bare prose, left-aligned, no bubble */
  color: var(--color-text);
  padding: 0;
}
/* Doug 2026-07-15: thinking indicator. Shown as the AI bubble's initial
   content (before any text has streamed) and re-appended after any
   already-streamed text during a tool-use/pause_turn gap, so Doug has a
   visible "still working" signal instead of silence he might interrupt.
   Removed implicitly whenever the next 'delta' repaints the bubble from
   real content -- no separate hide state to track. */
.thinking-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  vertical-align: middle;
}
/* Doug 2026-07-15 (2nd pass): "star drift." Replaces the first pass's
   synchronized pulsing dots -- Doug's own reference is the image of Gabriel
   meeting Mohammed, wings stretched to the horizon, stars twinkling in the
   feathers. Three points of soft light, each on its own independent rhythm
   (different duration + delay per dot, not a shared stagger), so they never
   pulse in unison the way a mechanical loading indicator would. Chosen over
   two other concepts explored the same session: a single-point "feather
   light" (read as ambiguous/glitch-like at chat-bubble scale) and a
   sequential "constellation trace" (the discrete on/off/on rhythm per dot
   read as mechanical again, the exact thing this is moving away from). */
.thinking-indicator .dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--color-text);
  box-shadow: 0 0 6px 1px color-mix(in srgb, var(--color-text) 55%, transparent);
  animation: thinking-star-twinkle 1.7s ease-in-out infinite;
}
.thinking-indicator .dot:nth-child(2) { animation-duration: 2.3s; animation-delay: 0.6s; }
.thinking-indicator .dot:nth-child(3) { animation-duration: 2.9s; animation-delay: 1.1s; }
@keyframes thinking-star-twinkle {
  0%, 100% { opacity: 0.18; transform: scale(0.7); }
  50%      { opacity: 1;    transform: scale(1.15); }
}
@media (prefers-reduced-motion: reduce) {
  .thinking-indicator .dot { animation: none; opacity: 0.6; box-shadow: none; }
}
/* Doug 5/30/26 PM: the Computer greeting renders inside an .message--ai
   article (since Commit 7) but carries [data-system-greeting] as its
   idempotency key. Force the color explicitly here so the greeting reads
   in the same dark prose weight as Gabriel's first reply -- defeats any
   cached-CSS leak from the prior .message--system muted color and any
   future selector that might try to fade it.

   Doug 5/30/26 PM round 6: bumped specificity with .thread ancestor +
   !important on color/opacity/font-weight. Despite the earlier rule, the
   greeting was still rendering faded in screenshots. Belt-and-brace from
   every angle so this can never look like 'yesterday data'. Match
   font-weight to the .message--ai default (no italic, no muted weight). */
.message--ai[data-system-greeting] .message__body,
.thread .message[data-system-greeting] .message__body,
[data-system-greeting] .message__body {
  color: var(--color-text) !important;
  opacity: 1 !important;
  font-weight: 400 !important;
  font-style: normal !important;
  filter: none !important;
}
.message--user .message__body {
  /* User — soft bubble on the right, italicized prompt */
  font-style: italic;
  background: color-mix(in oklab, var(--color-primary) 14%, var(--color-surface));
  border: 1px solid color-mix(in oklab, var(--color-primary) 22%, var(--color-border));
  border-radius: 20px 20px 6px 20px;
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-sm);
}
[data-theme='dark'] .message--user .message__body {
  background: color-mix(in oklab, var(--color-primary) 18%, var(--color-surface));
  border-color: color-mix(in oklab, var(--color-primary) 32%, var(--color-border));
}
/* Gabriel's *text* markdown renders as <em>. Treat it as EMPHASIS, not
   aside/inner-monologue. Doug 5/17/26: "so I notice gabriel is doing a
   lot of * in their chat. that seems like internal dialogue." Diagnosis
   was right — italic + muted reads like mumbling. Switched to body color
   + semibold via theme-aware CSS variables so light and dark both work
   without duplication. font-style stays normal; the weight does the
   emphasis work.

   NOTE: this does NOT affect illuminate-mode rendering. Illuminations
   use .message[data-illumination] .message__body p (paragraph-level
   italic + muted), which is independent of this <em> rule. So Gabriel's
   illumination paragraphs keep their aside-feel while inline *...*
   emphasis in regular replies now reads as a clear marker. */
.message__body em {
  font-style: normal;
  font-weight: var(--font-weight-emphasis);
  color: var(--color-text-emphasis);
}
.message__body p { margin: 0 0 var(--space-3) 0; }
.message__body p:last-child { margin-bottom: 0; }
/* 2026-10-29 (Doug: "should they have their own bubbles?"): a reply with
   the member's characters in the room, one part per speaker (js/chat.js
   speakerParts). Gabriel keeps his bare prose with his name on top; each
   character gets a bubble tinted by their own hue (--speaker-h), the
   mirror of the member's bubble. */
.speaker-part { margin: 0 0 var(--space-4) 0; }
.speaker-part:last-child { margin-bottom: 0; }
.speaker-part__name {
  font-family: var(--font-app);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--color-text-muted);
  margin: 0 0 var(--space-1) 0;
}
.speaker-part__body p:last-child { margin-bottom: 0; }
.speaker-part:not(.speaker-part--gabriel) { --speaker-c: hsl(var(--speaker-h, 205) 55% 50%); }
.speaker-part:not(.speaker-part--gabriel) .speaker-part__name {
  color: color-mix(in oklab, var(--speaker-c) 65%, var(--color-text));
  padding: 0 var(--space-2);
}
.speaker-part:not(.speaker-part--gabriel) .speaker-part__body {
  background: color-mix(in oklab, var(--speaker-c) 9%, var(--color-surface));
  border: 1px solid color-mix(in oklab, var(--speaker-c) 24%, var(--color-border));
  border-radius: 20px 20px 20px 6px;
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-sm);
}
/* 2026-10-30: his inside voice (Participant) -- what the member hears in their head. */
.speaker-part--inside .speaker-part__body { font-style: italic; color: var(--color-text-muted); }
[data-theme='dark'] .speaker-part:not(.speaker-part--gabriel) .speaker-part__body {
  background: color-mix(in oklab, var(--speaker-c) 15%, var(--color-surface));
  border-color: color-mix(in oklab, var(--speaker-c) 34%, var(--color-border));
}

/* Markdown tags added 5/17/26 alongside formatBody's extended renderer.
   <strong> matches the same emphasis variables as <em> so a bold word
   in either source form (**foo** or *foo*) reads consistently across
   themes. Lists get tight, indented bullets/numbers. Code uses a quiet
   monospace surface tone, not the harsh light-on-dark you see in IDEs. */
.message__body strong {
  font-weight: var(--font-weight-emphasis);
  color: var(--color-text-emphasis);
}
.message__body ul,
.message__body ol {
  margin: 0 0 var(--space-3) 0;
  padding-left: 1.4em;
}
.message__body ul:last-child,
.message__body ol:last-child { margin-bottom: 0; }
.message__body li { margin: 0.15em 0; }
.message__body code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92em;
  padding: 0.08em 0.32em;
  border-radius: 4px;
  background: var(--color-surface-offset, rgba(0,0,0,0.05));
  color: var(--color-text);
}
.message__body pre {
  margin: 0 0 var(--space-3) 0;
  padding: var(--space-3);
  border-radius: 8px;
  background: var(--color-surface-offset, rgba(0,0,0,0.05));
  overflow-x: auto;
  font-size: 0.92em;
  line-height: 1.5;
}
.message__body pre:last-child { margin-bottom: 0; }
.message__body pre code {
  padding: 0;
  background: transparent;
  border-radius: 0;
  font-size: 1em;
}

/* v=22: Ghost-bubble experiment removed. Live transcription now writes
   directly to the composer textarea — same destination typing would land
   in. The .chatbox.is-listening glow above is the only visual indicator
   that the mic is hot. */

@keyframes message-rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Chatbox docks at the bottom of the stage */
.stage .chatbox { margin-top: auto; }

/* ===========================
   Sign-in (only when user clicks Sign in)
   =========================== */
.signin-stage {
  display: grid;
  place-items: center;
  padding: clamp(var(--space-10), 8vw, var(--space-20)) var(--space-6);
}
.signin-card {
  width: 100%;
  max-width: 380px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 24px;
  padding: var(--space-10) var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  box-shadow: var(--shadow-md);
  text-align: center;
}
.signin-card__title {
  font-family: var(--font-app);
  font-weight: 400;
  font-size: var(--text-xl);
  color: var(--color-text);
}
.signin-card__sub {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-2);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  border: 1px solid transparent;
  width: 100%;
}
/* Doug 5/27/26: "+ new playground is black... kinda harsh, suggest green,
   like a lawn." Swapped from --color-text (near-black) to a spring-lawn
   green that harmonizes with the sage Journal scope token. The lighter
   green reads as a warm primary action without dominating the page; the
   slightly-deeper hover keeps the same hue family. Text inverse stays
   readable on either tone. */
.btn--primary { background: #7aa86a; color: var(--color-text-inverse); }
.btn--primary:hover { background: #5e8e52; }
.btn--google {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn--google:hover { border-color: var(--color-text); }

.signin-divider {
  display: flex; align-items: center; gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.signin-divider::before, .signin-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--color-divider);
}

.field { display: flex; flex-direction: column; gap: var(--space-2); text-align: left; }
.field[hidden] { display: none; }
.field__label {
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  color: var(--color-text);
}
.input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-primary) 15%, transparent);
}
.signin-card__foot {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-top: var(--space-2);
}
.signin-card__foot a { color: var(--color-text-muted); border-bottom: 1px dotted var(--color-text-faint); }

/* Segmented Sign in / Create account toggle */
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: color-mix(in oklab, var(--color-text) 6%, transparent);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
}
.auth-tabs__btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--color-text-muted);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.auth-tabs__btn[aria-selected="true"] {
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,0.06));
}

.auth-form { display: flex; flex-direction: column; gap: var(--space-4); text-align: left; }
.auth-form__error {
  font-size: var(--text-xs);
  color: #b54040;
  background: color-mix(in oklab, #b54040 8%, transparent);
  border: 1px solid color-mix(in oklab, #b54040 25%, transparent);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  text-align: left;
}
.auth-form__error[hidden] { display: none; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* ============================================================
   About page
   ============================================================ */
.about-stage {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(var(--space-6), 4vw, var(--space-10)) var(--space-6) var(--space-10);
  min-height: calc(100dvh - 76px);
}
.about {
  background: var(--color-surface);
  border: 1px solid color-mix(in oklab, var(--color-text) 8%, transparent);
  border-radius: var(--radius-xl, 18px);
  padding: clamp(1.75rem, 3vw, 2.5rem);
  box-shadow: 0 8px 40px -24px rgba(0, 0, 0, 0.18);
}
.about__head {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 1.75rem);
  padding-bottom: 1.5rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid color-mix(in oklab, var(--color-text) 7%, transparent);
}
.about__portrait {
  margin: 0;
  flex: 0 0 auto;
}
.about__portrait img {
  width: clamp(110px, 18vw, 160px);
  height: clamp(110px, 18vw, 160px);
  border-radius: 50%;
  object-fit: cover;
  display: block;
  box-shadow: 0 6px 28px -12px rgba(0, 0, 0, 0.35);
}
.about__intro { min-width: 0; }
.about__kicker {
  font-family: var(--font-serif, Georgia, serif);
  font-style: italic;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin: 0 0 0.4rem;
}
.about__title {
  font-family: var(--font-display, var(--font-serif, Georgia, serif));
  font-weight: 400;
  font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.1rem);
  letter-spacing: 0.04em;
  margin: 0;
  line-height: 1.1;
  color: var(--color-text);
}
.about__role {
  margin: 0.35rem 0 0;
  font-size: 0.92rem;
  color: var(--color-text-muted);
  letter-spacing: 0.02em;
}
.about__body {
  font-family: var(--font-serif, Georgia, serif);
  font-size: 1.04rem;
  line-height: 1.7;
  color: var(--color-text, rgba(0, 0, 0, 0.82));
}
.about__body p {
  margin: 0 0 1.1rem;
}
.about__signoff {
  margin-top: 1.5rem !important;
  color: var(--color-text-muted);
  font-style: italic;
}
.about__signature {
  font-family: var(--font-display, var(--font-serif, Georgia, serif));
  font-style: normal;
  font-size: 1.25rem;
  color: var(--color-text);
  letter-spacing: 0.02em;
}
.about__back {
  margin: 2rem 0 0;
  text-align: center;
  font-size: 0.92rem;
}
.about__back a {
  color: var(--color-text-muted);
  text-decoration: none;
  letter-spacing: 0.02em;
}
.about__back a:hover {
  color: var(--color-text);
}
@media (max-width: 560px) {
  .about__head {
    flex-direction: column;
    text-align: center;
    align-items: center;
  }
}

/* Membership variant — no portrait, centered intro */
.about__head--centered {
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.membership__heading {
  font-family: var(--font-display, var(--font-serif, Georgia, serif));
  font-weight: 400;
  font-size: 1.25rem;
  letter-spacing: 0.04em;
  margin: 1.75rem 0 0.9rem;
  color: var(--color-text);
}

/* ----- Project switcher (header dropdown on index.html) ----- */
.project-switcher {
  position: relative;
  display: inline-flex;
  align-items: center;
}
/* Honor the HTML `hidden` attribute; the inline-flex above would otherwise
   override it and leak the chip onto the page for signed-out visitors. */
.project-switcher[hidden] { display: none; }
.project-switcher__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--color-text-faint);
  background: transparent;
  color: var(--color-text-muted);
  font: inherit;
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.project-switcher__btn:hover {
  border-color: var(--color-text-muted);
  color: var(--color-text);
}
.project-switcher.is-active .project-switcher__btn {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.project-switcher__label {
  max-width: 14ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project-switcher__menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 220px;
  max-width: 280px;
  padding: 6px;
  background: var(--color-surface);
  border: 1px solid var(--color-text-faint);
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  z-index: 50;
  flex-direction: column;
  gap: 2px;
}
/* Only display the menu when it's not hidden. Without this, the CSS `display`
   rule would override the HTML `hidden` attribute and leak the menu onto the
   page on load. */
.project-switcher__menu:not([hidden]) { display: flex; }
.project-switcher__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: none;
  border: 0;
  text-align: left;
  font: inherit;
  font-size: var(--text-sm);
  color: var(--color-text);
  cursor: pointer;
}
.project-switcher__item:hover { background: color-mix(in srgb, var(--color-text) 6%, transparent); }
.project-switcher__item.is-current { color: var(--color-primary); }
.project-switcher__item .role {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.project-switcher__divider {
  height: 1px;
  background: var(--color-text-faint);
  margin: 4px 0;
}
.project-switcher__link {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.project-switcher__link:hover {
  background: color-mix(in srgb, var(--color-text) 6%, transparent);
  color: var(--color-text);
}

/* On very narrow screens the project chip drops its label and shows just the
   active dot + chevron. The chip itself stays so users can still switch. */
@media (max-width: 540px) {
  .project-switcher__label {
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* ----- Journal strip (above the chatbox on index.html) ------------------
   Single row tucked tight to the top of the chatbox, with a faint rule above
   to separate it from the conversation:
     ─────────────────────────────────────────
     Tuesday, May 12 · Journal · Today  Last 7 days  Last 30 days  All time
   Small, subdued font — the chatbox is the focal point. */
.journal-strip {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  margin: 0;
  padding: 0;
  font-family: var(--font-app);
  font-size: var(--text-xs, 0.75rem);
  font-weight: 400;
  color: var(--color-text-faint);
  letter-spacing: 0.01em;
}
.journal-strip__rule {
  height: 1px;
  width: 100%;
  background: var(--color-text-faint);
  opacity: 0.25;
  margin-bottom: 0.3rem;
}
.journal-strip[hidden] { display: none; }
/* Strip sits tight against the top edge of the chatbox inside the dock. */
.journal-strip:not([hidden]) + .chatbox { margin-top: 0.25rem; }

/* ----- Compose dock --------------------------------------------------
   The horizon: a pure-white strip pinned to the bottom of the viewport,
   running edge-to-edge across the page. The chatbox lives inside it,
   centered and constrained to the stage width. */
.compose-dock {
  position: sticky;
  bottom: 0;
  /* z-index bumped from 5 -> 20 so the thread's masked compositing layer
     can't paint message bubbles ON TOP of the dock as they scroll past.
     Bug #13 (5/17/26): chat bubbles were visibly bleeding through the
     white dock at the bottom — the -webkit-mask-image on .thread forces
     it into its own composited layer, and the previous z:5 wasn't enough
     to keep the sticky dock above that layer in the stacking order.
     isolation:isolate locks the dock into its own stacking context so
     anything inside it (mic, send button, future overlays) can't escape
     and end up rendering behind the thread. */
  z-index: 20;
  isolation: isolate;
  margin-top: auto;
  /* No top padding — the image background bleeds right up against the top
     edge of the chatbox (Doug 5/13/26: "the top where the image bleeds into
     gabriel is nice. should do the same with the bottom where it bleeds into
     the horizon. Crop as tight to the chatbox as possible"). Bottom is tight
     too; safe-area-inset-bottom keeps the iOS home indicator clear. */
  padding:
    0
    var(--space-6)
    calc(var(--space-1) + env(safe-area-inset-bottom, 0px));
  background: #ffffff;          /* the horizon is always white, even in dark mode */
  /* Outward bleed so the white strip extends to the viewport edges no matter
     how wide the page is. box-shadow paints outside the box without affecting
     layout; clip-path widens the visible region without enabling horizontal
     scroll. The previous ::before approach was clipped by overflow:clip and
     never actually painted past the dock's edges. */
  box-shadow: 0 0 0 100vmax #ffffff;
  /* IMPORTANT: clip-path MUST stay 0 on the top inset. The box-shadow above
     paints a 100vmax white ring around the dock; if we open the clip
     vertically, that white shadow floods the entire viewport above the dock
     and the page goes blank. This bit me on 5/16/26 when I tried to use
     vertical overflow to escape clipping for the .voice-menu--above popover.
     The popover fix lives elsewhere (see .voice-menu position:fixed override
     below). */
  clip-path: inset(0 -100vmax 0 -100vmax);
}
/* Cancel the stage's row-gap so the dock hugs the bottom edge. */
.stage > .compose-dock { margin-top: auto; }

/* Doug 5/30/26 PM round 4: the .stage has padding-bottom: var(--space-8)
   which leaves a ~32px band of wings visible BELOW the dock (between dock
   bottom and viewport floor). Pull the dock down past that padding with a
   matching negative margin, and add equivalent bottom padding to the dock
   so the white surface extends through to the actual viewport bottom.
   Net effect: the user's white realm now runs from the input line all the
   way to the bottom of the viewport — no wings band underneath. */
.stage > .compose-dock {
  margin-bottom: calc(var(--space-8) * -1);
  /* 2026-10-30 (Doug: "textarea not all the way down by default"): the
     padding was the stage's 32px plus 4px, to paint white through the band
     under the dock. But the dock is sticky at bottom:0, so its bottom edge is
     the viewport's bottom either way, and those 32px were a blank white strip
     under the toolbar. The home indicator plus 4px is all it needs. */
  padding-bottom: calc(var(--space-1) + env(safe-area-inset-bottom, 0px));
}

/* ----- Empty-thread centered composer (Doug 5/30/26 PM) ----------------
   When the user has not yet spoken in this scope, .stage carries
   .is-empty-thread (toggled by chat.js's updateThreadEmptyState). In that
   state the thread collapses to size-to-content (so it doesn't push the
   composer to the floor) and .stage centers its children vertically, so
   the greeting bubble + composer cluster sit in the middle of the viewport
   instead of marooned at the bottom over empty wings. The instant the user
   submits their first message the class drops and the dock returns to its
   normal sticky-bottom position.

   Mechanism notes:
   - .thread normally has flex:1 to fill the space between the wordmark and
     the dock. In empty state we override to flex:0 0 auto so it sizes to
     its content (the greeting, or nothing).
   - .stage normally has justify-content unset (default is flex-start); the
     dock's auto top-margin is what pinned it to the bottom. In empty state
     we set justify-content: center so the (now-short) thread + dock
     cluster center together.
   - The dock's sticky positioning stays intact, so when the user does send
     a message and the class drops, the dock naturally re-anchors to the
     bottom and the thread expands to fill above it.
   - Top padding on the thread is also relaxed in empty state so the
     greeting can sit close to the composer without a 90-140px gap.

   This is the DEFAULT for every session (not gated on first-session
   pending). Returning users with an empty Journal also see the centered
   layout until they speak. */
.stage.is-empty-thread {
  justify-content: center;
}
.stage.is-empty-thread > .thread {
  flex: 0 0 auto;
  padding-top: var(--space-4);
  /* Cancel the top mask in this state -- nothing is scrolling, the mask
     just dims the greeting unnecessarily. */
  -webkit-mask-image: none;
          mask-image: none;
}
.stage.is-empty-thread > .compose-dock {
  /* In centered state the dock is no longer at the viewport floor, so the
     negative margin-bottom that exists to bleed white through the stage's
     bottom padding isn't doing useful work -- and the dock's white
     box-shadow would otherwise flood the centered viewport. Neutralize
     both so the dock reads as a free-floating composer surface.

     Doug 5/30/26 PM round 5: also neutralize margin-top: auto. The default
     rule .stage > .compose-dock { margin-top: auto; } consumes all free
     space above the dock, which DEFEATS justify-content: center on the
     parent (flexbox: auto margins win over justify-content). Without this
     override the centered state never actually centers -- the dock stays
     pinned to the bottom and the greeting is marooned at the top. */
  margin-top: 0;
  margin-bottom: 0;
  padding-bottom: var(--space-3);
  box-shadow: none;
  background: transparent;
}
/* Same auto-margin issue with the legacy .chatbox rule (line ~504).
   Neutralize it in empty state so the centering works regardless of whether
   the composer is a .chatbox or wrapped in a .compose-dock. */
.stage.is-empty-thread .chatbox {
  margin-top: 0;
}

/* Doug 5/30/26 PM round 6: empty-state composer needs to LOOK like an input.
   In the dock state (post-first-message) the composer is intentionally
   edge-to-edge with no surface (it's the bottom of the page, the dock
   already paints white). In the empty centered state there IS no dock
   surface around it -- the composer floats in the middle of wings
   background and reads as "nothing here, where do I type?" Make it
   obvious: white card, rounded border, two-line min-height, soft shadow.
   The instant the user submits and .is-empty-thread drops, this surface
   disappears and the composer returns to its low-key dock state. */
.stage.is-empty-thread .chatbox {
  background: var(--color-surface, #ffffff);
  border: 1px solid color-mix(in oklab, var(--color-primary) 22%, var(--color-border));
  border-radius: 18px;
  padding: var(--space-3) var(--space-4);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 8px 24px rgba(0, 0, 0, 0.06);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}
.stage.is-empty-thread .chatbox:focus-within {
  border-color: color-mix(in oklab, var(--color-primary) 45%, var(--color-border));
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.05),
    0 12px 32px rgba(0, 0, 0, 0.08);
}
.stage.is-empty-thread .chatbox textarea {
  /* Two lines tall by default, autogrow up to the existing max-height when
     the user types more. The min-height already lives on the textarea
     baseline (line 153) but we restate it here at higher specificity in case
     anything tries to override it in this state. */
  min-height: calc(1.65em * 2);
}
[data-theme='dark'] .stage.is-empty-thread .chatbox {
  background: var(--color-surface);
  border-color: color-mix(in oklab, var(--color-primary) 32%, var(--color-border));
}
@media (prefers-reduced-motion: reduce) {
  .stage,
  .stage > .thread,
  .stage > .compose-dock { transition: none; }
}

.journal-strip__row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: nowrap;
}
.journal-strip__row--main {
  justify-content: flex-start;
  padding-bottom: 0.15rem;
  gap: 0.35rem;
}
.journal-strip__times {
  display: inline-flex;
  align-items: center;
  gap: 0.05rem;
  flex-wrap: nowrap;
  margin-left: auto;   /* push the four buttons to the far right of the strip */
}

/* Mobile-only compact time picker. Hidden on desktop -- the segmented row
   shows instead. The picker lives at the far right of the strip; tapping it
   opens an upward menu with the four ranges. */
.journal-strip__time-picker {
  position: relative;
  display: none;            /* desktop: hidden */
  align-items: center;
  margin-left: auto;        /* push to far right */
}
.journal-strip__time-toggle {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 2px 8px;
  border: 1px solid var(--color-text-faint);
  border-radius: 999px;
  background: transparent;
  color: var(--color-text-muted);
  font: inherit;
  font-size: var(--text-xs);
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
  white-space: nowrap;
}
.journal-strip__time-toggle:hover,
.journal-strip__time-toggle[aria-expanded="true"] {
  color: var(--color-text);
  border-color: var(--color-text-muted);
  background: color-mix(in srgb, var(--color-text) 4%, transparent);
}
.journal-strip__time-icon { opacity: 0.7; }
.journal-strip__date,
.journal-strip__name {
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  color: var(--color-text-muted);
}
.journal-strip__name { font-style: italic; }
.journal-strip__sep {
  color: var(--color-text-faint);
  font-weight: 400;
  user-select: none;
}
/* Segmented timeframe buttons (left → right). One pressed at a time. */
.journal-strip__seg {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-text-faint);
  font: inherit;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}
.journal-strip__seg:hover {
  color: var(--color-text-muted);
}
.journal-strip__seg.is-current,
.journal-strip__seg[aria-pressed="true"] {
  color: var(--color-text-muted);
  border-color: var(--color-text-faint);
  background: color-mix(in srgb, var(--color-text) 4%, transparent);
}
.journal-strip__pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-text-muted);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}
.journal-strip__pill:hover {
  border-color: var(--color-text-faint);
  color: var(--color-text);
}
.journal-strip__pill[aria-expanded="true"] {
  border-color: var(--color-text-muted);
  color: var(--color-text);
}
.journal-strip.is-playground .journal-strip__pill--name {
  color: var(--color-primary);
}
.journal-strip.is-playground .journal-strip__pill--name:hover,
.journal-strip.is-playground .journal-strip__pill--name[aria-expanded="true"] {
  border-color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 8%, transparent);
}
.journal-strip__switcher {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.journal-strip__name--button {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0 2px;
  cursor: pointer;
  border-bottom: 1px dotted transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.journal-strip__name--button:hover {
  color: var(--color-text);
  border-bottom-color: var(--color-text-faint);
}
.journal-strip__name--button[aria-expanded="true"] {
  color: var(--color-text);
  border-bottom-color: var(--color-text-muted);
}
.journal-strip__menu {
  position: absolute;
  top: 100%;
  /* Anchor under the name pill, which sits at the right of the strip. */
  right: 0;
  margin-top: 4px;
  min-width: 240px;
  max-width: 320px;
  padding: 6px;
  background: var(--color-surface);
  border: 1px solid var(--color-text-faint);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
  z-index: 60;
  flex-direction: column;
  gap: 2px;
}
/* Upward variant — anchored above the trigger, opens toward the top. Pure
   switcher: type mirrors the strip itself (xs / 400 / faint / non-italic),
   tight vertical rhythm, narrower min-width. */
.journal-strip__menu--up {
  top: auto;
  bottom: 100%;
  right: auto;
  left: 0;
  margin-top: 0;
  margin-bottom: 6px;
  min-width: 160px;
  padding: 3px;
  box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.22);
}
/* Time-picker menu sits at the right edge of the strip on mobile; anchor it
   to the right of its trigger so it doesn't overflow past the viewport. */
.journal-strip__menu--time {
  left: auto;
  right: 0;
  min-width: 140px;
}
.journal-strip__menu--up .journal-strip__item {
  padding: 3px 8px;
  font-size: var(--text-xs);
  font-weight: 400;
  font-style: normal;
  color: var(--color-text-faint);
  justify-content: flex-start;
}
.journal-strip__menu--up .journal-strip__item:hover {
  color: var(--color-text-muted);
  background: color-mix(in srgb, var(--color-text) 5%, transparent);
}
/* Active playground in the strip switcher: dark navy, matching the header
   menu's is-current treatment so the user sees the same color in both. */
.journal-strip__menu--up .journal-strip__item.is-current {
  color: var(--color-accent);
  font-weight: 500;
}
/* Match the project-switcher pattern: only render as flex when not hidden. */
.journal-strip__menu:not([hidden]) { display: flex; }
.journal-strip__menu--time { min-width: 180px; }
.journal-strip__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: none;
  border: 0;
  text-align: left;
  font: inherit;
  font-size: var(--text-sm);
  color: var(--color-text);
  cursor: pointer;
}
.journal-strip__item:hover { background: color-mix(in srgb, var(--color-text) 6%, transparent); }
.journal-strip__item.is-current { color: var(--color-primary); font-weight: 500; }
.journal-strip__item--new {
  color: var(--color-primary);
  font-weight: 500;
}
.journal-strip__item--new:hover {
  background: color-mix(in srgb, var(--color-primary) 10%, transparent);
}
.journal-strip__role {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.journal-strip__check {
  color: var(--color-primary);
  font-size: var(--text-sm);
}
.journal-strip__divider {
  height: 1px;
  background: var(--color-text-faint);
  margin: 4px 0;
}
.journal-strip__link {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.journal-strip__link:hover {
  background: color-mix(in srgb, var(--color-text) 6%, transparent);
  color: var(--color-text);
}
@media (max-width: 540px) {
  .journal-strip {
    padding: 0 var(--space-3);
    font-size: var(--text-xs);
    gap: 0.3rem;
  }
  .journal-strip__pill { padding: 3px 8px; }
  .journal-strip__seg { padding: 2px 6px; }
  .journal-strip__row--main {
    min-width: 0;
    flex-wrap: nowrap;       /* keep the strip a single row */
    row-gap: 0;
  }
  /* On mobile, hide the inline 4-button row and show the compact picker. */
  .journal-strip__times { display: none; }
  .journal-strip__time-picker { display: inline-flex; }
  /* The Journal name popover should anchor under its trigger and be wide
     enough that long playground names don't wrap. Cap to the strip width. */
  .journal-strip__switcher .journal-strip__menu--up {
    left: 0;
    right: auto;
    min-width: 200px;
    max-width: calc(100vw - var(--space-3) * 2);
  }
}

/* ============ New Playground modal ============================ */
.np-overlay {
  position: fixed; inset: 0;
  background: rgba(20, 16, 12, 0.42);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  padding: var(--space-4);
  backdrop-filter: blur(2px);
}
.np-overlay[hidden] { display: none; }
.np-modal {
  position: relative;
  width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  background: var(--color-surface);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.4);
  padding: var(--space-6);
}
.np-modal__close {
  position: absolute; top: 10px; right: 14px;
  border: 0; background: transparent;
  font-size: 1.6rem; line-height: 1;
  color: var(--color-text-muted);
  cursor: pointer;
}
.np-modal__close:hover { color: var(--color-text); }
.np-modal__title {
  font-family: var(--font-app);
  font-size: 1.45rem;
  font-weight: 500;
  margin: 0 0 var(--space-4);
  text-align: center;
}
.np-modal__sub {
  margin: 0 0 var(--space-4);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}
.np-form { display: flex; flex-direction: column; gap: var(--space-4); }
.np-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.np-field__label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
}
.np-field__optional {
  font-weight: 400;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}
.np-field__hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.np-field input[type="text"],
.np-field input[type="email"],
.np-field textarea,
.np-collab input,
.np-collab select {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: var(--text-sm);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.np-field textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
.np-field input:focus,
.np-field textarea:focus,
.np-collab input:focus,
.np-collab select:focus {
  border-color: color-mix(in oklab, var(--color-primary) 50%, var(--color-border));
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-primary) 14%, transparent);
}

.np-tasks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.np-task {
  display: grid;
  grid-template-columns: 14px 1fr 26px;
  align-items: center;
  gap: 0.5rem;
}
.np-task__bullet {
  color: var(--color-text-muted);
  font-size: 1.1rem;
  line-height: 1;
  text-align: center;
}
.np-task__remove {
  width: 24px; height: 24px;
  border: 0;
  background: transparent;
  color: var(--color-text-faint);
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}
.np-task__remove:hover { color: var(--color-text); background: color-mix(in srgb, var(--color-text) 6%, transparent); }

.np-collabs { display: flex; flex-direction: column; gap: 0.5rem; }
.np-collab {
  display: grid;
  grid-template-columns: 1fr 1.2fr 110px 26px;
  gap: 0.4rem;
  align-items: center;
}
.np-collab__remove {
  width: 24px; height: 24px;
  border: 0;
  background: transparent;
  color: var(--color-text-faint);
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
}
.np-collab__remove:hover { color: var(--color-text); background: color-mix(in srgb, var(--color-text) 6%, transparent); }

.np-add {
  align-self: flex-start;
  border: 1px dashed var(--color-text-faint);
  background: transparent;
  color: var(--color-text-muted);
  padding: 6px 12px;
  border-radius: 999px;
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease;
}
.np-add:hover { color: var(--color-text); border-color: var(--color-text-muted); }

.np-form__error {
  padding: 8px 12px;
  border-radius: 8px;
  background: color-mix(in srgb, #c0392b 12%, transparent);
  color: #8e1f15;
  font-size: var(--text-sm);
}
.np-form__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: var(--space-2);
}
@media (max-width: 540px) {
  .np-modal { padding: var(--space-4); }
  .np-collab { grid-template-columns: 1fr 1fr; }
  .np-collab__role { grid-column: 1 / 2; }
  .np-collab__remove { grid-column: 2 / 3; justify-self: end; }
}

/* ===========================
   Historical Archive (B3 / B4)
   Spec: docs/historical-archive-spec.md

   There is no dedicated controls bar. The hamburger Time filter
   (Day / Week / Custom) drives BOTH live chat scope AND archive
   retrieval via js/journal.js. Retrieved blocks render here, ABOVE
   [data-thread] but in a separate node so chat.js's history builder
   never walks them. Structural guard: scripts/check-archive-isolation.mjs.
   (Doug 5/16/26: "One control surface, two functions underneath.")
   =========================== */

/* When archive blocks are present above the thread, the thread no longer
   needs its own halo-clearance padding — the first block takes that role. */
.historical-display:not(:empty) ~ .thread {
  padding-top: var(--space-6);
}

/* The display area itself — flex column so multiple blocks stack with
   breathing room. Empty state is invisible (no blocks → no layout). */
.historical-display {
  /* Halo clearance lives here when blocks are present. When empty, the
     :empty rule below collapses this entirely and .thread keeps its own
     padding-top, so signed-out / fresh-load views look unchanged. */
  margin-top: clamp(90px, 12vh, 140px);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}
.historical-display:empty {
  display: none;
}

/* One retrieved block. Visually distinct from the live thread so Doug
   never confuses an archive read with an ongoing conversation: soft
   sepia surface, subtle border, monospace body. */
.historical-block {
  background: var(--color-surface-offset);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  /* A faint inner glow on top so the eye registers "different layer". */
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.historical-header {
  font-size: 0.8rem;
  color: var(--color-text-faint);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: var(--space-2);
}
.historical-meta {
  font-family: var(--font-app);
}
/* The clarification banner sits UNDER the meta line, ABOVE the body —
   so Doug can't miss the "Gabriel isn't reading this" reminder while
   scrolling through retrieved content. */
.historical-banner {
  background: color-mix(in srgb, var(--color-primary) 10%, transparent);
  border-left: 3px solid var(--color-primary);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}
.historical-content {
  /* Raw verbatim markdown — render as code so whitespace + line breaks
     are preserved exactly. textContent in JS guarantees no HTML escape
     surprises; pre + monospace + wrap keep it readable. */
  font-family: ui-monospace, "SF Mono", "Menlo", Consolas, "Liberation Mono", monospace;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--color-text);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin: 0;
}
.historical-separator {
  margin-top: var(--space-3);
  text-align: center;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  color: var(--color-text-faint);
}

@media (max-width: 720px) {
  .historical-display { margin-top: clamp(70px, 9vh, 100px); }
  .historical-display:not(:empty) ~ .thread { padding-top: var(--space-4); }
  .historical-block { padding: var(--space-3); }
  .historical-content { max-height: 50vh; font-size: 0.8rem; }
}

/* ===========================
   Read-only thread messages (Yesterday / Week / Custom modes)
   Spec: docs/historical-archive-spec.md + Doug 5/16/26

   When the Time filter is anything other than Day (today), chat.js
   rehydrates messages into the thread with [data-archive-readonly] and
   keeps the in-memory `history` array empty so Gabriel's context isn't
   polluted on the user's next send. The CSS below makes that visual:
   muted, sepia, italicized-ish — clearly browsing-not-living.

   Why this matters: if read-only messages looked normal, the user could
   mistakenly believe Gabriel saw them. The visual treatment is the
   user-facing half of the structural contract.
   =========================== */
.message[data-archive-readonly] {
  /* Doug 5/17/26: when the user has explicitly toggled into a previous day
     or range, they want to READ — not glance. Lifted from 0.62 to 0.88 so
     the archived content is comfortably legible while still feeling distinct
     from live (today) bubbles. The "letting go" / "looking back" model:
     default thread is ghostly (the past dissolving), archive mode brings
     it back into focus on demand. */
  opacity: 0.88;
}
.message[data-archive-readonly] .message__body {
  /* Same sepia surface as historical blocks above, so the two read-only
     surfaces feel like one continuous browsing context. */
  color: var(--color-text-muted);
}
.message[data-archive-readonly].message--user .message__body {
  /* The user-bubble keeps its right-aligned italic shape but loses its
     warm tone. */
  background: var(--color-surface-offset);
  border: 1px dashed var(--color-divider);
}
.message[data-archive-readonly].message--ai .message__body {
  /* Gabriel's bare prose just dims. */
  font-style: italic;
}
/* The FIRST read-only message in the thread gets a tiny inline label so
   the user sees exactly where the read-only band starts. Implemented as
   a CSS-only marker so chat.js doesn't have to inject extra DOM.

   The selector ".thread > .message[data-archive-readonly]:first-child"
   targets the first child of the thread when it's read-only — which is
   exactly the rehydrated case (read-only messages always sit at the top
   of the thread; any new live messages get appended after them). */
.thread > .message[data-archive-readonly]:first-child::before {
  content: 'Read-only — Gabriel isn\2019t seeing this. Copy + paste to bring it into the conversation.';
  display: block;
  font-family: var(--font-app);
  font-size: 0.72rem;
  font-style: normal;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  margin-bottom: var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 1px dotted var(--color-divider);
  opacity: 1;
}

/* ===========================
   ILLUMINATE — entry gate + delivered paragraph + feedback pills
   (Doug 5/16/26, objective #2)

   The entry gate is a Gabriel-styled message with two action buttons.
   The delivered paragraph (marked [data-illumination]) sits in the
   live thread (NOT read-only — illuminations are part of the
   conversation, unlike archive blocks). It carries a subtle accent
   border + the feedback pills below it.
   =========================== */

/* Gate: the entry warning + Continue/Not now buttons. */
.illuminate-gate__actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
  flex-wrap: wrap;
}
.illuminate-gate__btn {
  font-family: var(--font-app);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--color-border, var(--color-divider));
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text);
  cursor: pointer;
  transition: opacity 120ms ease, background 120ms ease;
}
.illuminate-gate__btn:hover { background: var(--color-surface-offset); }

/* --illuminate variant: the confirm CTA mirrors the drawer's Illuminate
   row — same luminous label-on-bloom hover treatment. Idle state is a
   quiet outlined button; on hover the label brightens (theme-aware) and
   a warm bloom rises behind it. Doug 5/16/26. */
.illuminate-gate__btn--illuminate {
  position: relative;
  background: transparent;
  border: 1px solid var(--color-border, var(--color-divider));
  color: var(--color-text-muted, var(--color-text));
  transition: background 380ms ease, border-color 380ms ease;
  overflow: visible;
}
.illuminate-gate__btn--illuminate .illuminate-gate__btn-label {
  position: relative;
  display: inline-block;
  transition: color 380ms ease, text-shadow 380ms ease, letter-spacing 380ms ease;
}
.illuminate-gate__btn--illuminate .illuminate-gate__btn-label::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 240%;
  height: 360%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: -1;
  background: radial-gradient(
    ellipse at center,
    rgba(255, 226, 168, 0.32),
    rgba(255, 226, 168, 0) 65%
  );
  opacity: 0;
  transition: opacity 420ms ease;
}
[data-theme='dark'] .illuminate-gate__btn--illuminate .illuminate-gate__btn-label::before {
  background: radial-gradient(
    ellipse at center,
    rgba(255, 226, 168, 0.55),
    rgba(255, 226, 168, 0) 65%
  );
}
.illuminate-gate__btn--illuminate:hover,
.illuminate-gate__btn--illuminate:focus-visible {
  background: transparent;
  border-color: color-mix(in oklab, var(--color-border, var(--color-divider)) 50%, #f4d58a 50%);
}
.illuminate-gate__btn--illuminate:hover .illuminate-gate__btn-label::before,
.illuminate-gate__btn--illuminate:focus-visible .illuminate-gate__btn-label::before {
  opacity: 1;
}
/* Light theme: dark burnt-amber letters over the warm wash. */
.illuminate-gate__btn--illuminate:hover .illuminate-gate__btn-label,
.illuminate-gate__btn--illuminate:focus-visible .illuminate-gate__btn-label {
  color: #7a4a0c;
  letter-spacing: 0.22em;
  text-shadow: 0 0 1px rgba(122, 74, 12, 0.45);
}
.illuminate-gate__btn--illuminate:active .illuminate-gate__btn-label {
  color: #5e3608;
}
/* Dark theme: warm gold letters with halo glow. */
[data-theme='dark'] .illuminate-gate__btn--illuminate:hover .illuminate-gate__btn-label,
[data-theme='dark'] .illuminate-gate__btn--illuminate:focus-visible .illuminate-gate__btn-label {
  color: #f4d58a;
  text-shadow:
    0 0 6px rgba(255, 222, 150, 0.55),
    0 0 18px rgba(255, 208, 120, 0.30);
}
[data-theme='dark'] .illuminate-gate__btn--illuminate:active .illuminate-gate__btn-label {
  text-shadow:
    0 0 8px rgba(255, 222, 150, 0.75),
    0 0 24px rgba(255, 208, 120, 0.45);
}
@media (prefers-reduced-motion: reduce) {
  .illuminate-gate__btn--illuminate,
  .illuminate-gate__btn--illuminate .illuminate-gate__btn-label,
  .illuminate-gate__btn--illuminate .illuminate-gate__btn-label::before {
    transition: none;
  }
}

.illuminate-gate__btn--quiet { color: var(--color-text-muted); }
.illuminate-gate--committed .illuminate-gate__actions { display: none; }
.illuminate-gate__error {
  margin-top: var(--space-2);
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-style: italic;
}

/* The delivered illumination should be visually indistinguishable from a
   normal Gabriel turn — same italic + muted color treatment that
   .message__body em gives Gabriel's *...* markdown-wrapped replies.
   We force it at the paragraph level here so even if the model forgets
   to wrap the output in *...*, the styling stays consistent. No left
   rule, no indent, no blockquote feel. Doug 5/16/26: "the blockquote
   styling doesn't match Gabriel's conversation font. Needs to be
   consistent."
   The [data-illumination] attribute remains for DB/traceability. */
.message[data-illumination] .message__body p {
  font-style: italic;
  color: var(--color-text-muted);
}

/* Bug #18 (Doug 5/17/26): illumination <em> override. Bug #14 made the
   generic .message__body em rule bold + emphasis-colored so inline *foo*
   in regular replies reads as a clear marker. But illuminations wrap the
   ENTIRE paragraph in *...*, so the whole turn started rendering bold —
   "a bit like yelling". Doug wants it to feel special, not shouty:
   "like wow, I've never thought of it that way before special". Override
   the em rule only inside [data-illumination] (and the entry gate, which
   uses .illuminate-gate as the article class) so illuminations stay
   italic serif, normal weight, muted. The Cormorant Garamond face is
   already loaded in index.html. Slight size + tracking bumps give the
   text a held, considered cadence without going precious. */
.message[data-illumination] .message__body em,
.illuminate-gate .message__body em {
  font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-weight: 400;
  color: var(--color-text-muted);
  font-size: 1.08em;
  letter-spacing: 0.005em;
}

/* Feedback affordance removed 5/16/26 (Doug): the conversation itself is
   the feedback signal. If it landed they respond, if it missed they
   respond. No pills, no textarea — zero friction. The illumination row in
   the DB is still created with verdict left null so future logic can
   infer a verdict from the user's next turn. */

/* ILLUMINATE drawer row CSS removed 5/17/26. The drawer button is gone;
   the trigger surface is the composer only (type or say "illuminate").
   Entry-gate styles (.illuminate-gate__*) above remain untouched — they
   render inside the thread when the flow fires from voice or typed input. */

/* =============================================================================
   Brief-suggestion delivery pills (Memory Phase 5, Claude Code 2026-07-23)
   -----------------------------------------------------------------------------
   Pills appended under a server-delivered suggestion-summary bubble
   (js/brief-suggestion.js). Approve/Disregard reuse .illuminate-gate__btn
   styling directly. The Edit pill opens a self-contained modal (its own
   markup + attribute namespace, brief-suggestion-pill-*, so it never
   collides with the separately-built settings-panel modal in space.html
   which shares similar visual language but a different DOM instance).
   ========================================================================== */
.brief-suggestion-pills {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
  flex-wrap: wrap;
}
.brief-suggestion-pills__note {
  margin-top: var(--space-2);
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-style: italic;
}

.brief-suggestion-pill-modal { position: fixed; inset: 0; z-index: 900; display: flex; align-items: center; justify-content: center; }
.brief-suggestion-pill-modal[hidden] { display: none; }
.brief-suggestion-pill-modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.45); }
.brief-suggestion-pill-modal__panel {
  position: relative;
  width: min(760px, 94vw);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--color-bg-elevated, var(--color-surface, #fff));
  border: 1px solid var(--color-divider, #ddd);
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}
.brief-suggestion-pill-modal__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.brief-suggestion-pill-modal__header h3 { margin: 0; font-size: 1.05rem; }
.brief-suggestion-pill-modal__close { background: none; border: none; font-size: 1.3rem; line-height: 1; cursor: pointer; padding: 2px 6px; color: inherit; }
.brief-suggestion-pill-entry { border-left: 3px solid var(--color-divider, #ccc); padding: 8px 12px; margin-bottom: 10px; border-radius: 4px; background: rgba(127,127,127,0.06); }
.brief-suggestion-pill-entry[data-priority="high"] { border-left-color: #c0392b; background: rgba(192,57,43,0.08); }
.brief-suggestion-pill-entry[data-priority="medium"] { border-left-color: #b8860b; }
.brief-suggestion-pill-entry__row1 { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.brief-suggestion-pill-entry__type { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em; padding: 1px 6px; border-radius: 3px; }
.brief-suggestion-pill-entry__type--add { background: #d4edda; color: #1e5c2b; }
.brief-suggestion-pill-entry__type--remove { background: #f8d7da; color: #7a1f27; }
.brief-suggestion-pill-entry__priority { font-size: 0.68rem; opacity: 0.7; text-transform: uppercase; letter-spacing: 0.03em; }
/* Doug 2026-07-24: the × is the one action that matters here -- discard a
   change so it won't be applied. Make it read as a clear red delete, not a
   faint dismiss. (Apply then keeps everything you didn't discard.) */
.brief-suggestion-pill-entry__remove {
  margin-left: auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  background: color-mix(in oklab, #c0392b 10%, transparent);
  border: 1px solid color-mix(in oklab, #c0392b 40%, transparent);
  border-radius: var(--radius-full, 999px);
  cursor: pointer;
  font-size: 1.05rem; line-height: 1;
  color: #c0392b;
  padding: 0;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.brief-suggestion-pill-entry__remove:hover {
  background: color-mix(in oklab, #c0392b 20%, transparent);
  border-color: color-mix(in oklab, #c0392b 65%, transparent);
}
.brief-suggestion-pill-entry__remove:focus-visible { outline: 2px solid color-mix(in oklab, #c0392b 70%, transparent); outline-offset: 2px; }
.brief-suggestion-pill-entry__content { width: 100%; box-sizing: border-box; font: inherit; font-size: 0.95rem; line-height: 1.5; padding: 8px 10px; border: 1px solid var(--color-divider, #ccc); border-radius: 6px; resize: vertical; overflow: hidden; background: var(--color-bg, #fff); color: inherit; }
/* Doug 2026-07-24: usage hint under the header so the keep/remove/apply model
   is obvious at a glance (the × removes just that change; Save applies the rest). */
.brief-suggestion-pill-modal__hint { margin: 0 0 12px; font-size: 0.82rem; line-height: 1.4; color: var(--color-text-muted, var(--color-text-faint)); }
.brief-suggestion-pill-entry__meta { margin-top: 6px; font-size: 0.75rem; opacity: 0.7; }
.brief-suggestion-pill-entry__meta em { font-style: italic; }
.brief-suggestion-pill-modal__footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.brief-suggestion-pill-modal__empty { opacity: 0.65; font-size: 0.9rem; }

/* =============================================================================
   Task-review pop-up (Doug 2026-07-23) — task-review.js
   -----------------------------------------------------------------------------
   Shown after Gabriel adds a task: the member's task list with a keep/delete
   toggle on each row. Auto-keep default; only Save applies removals. Mirrors
   the brief-suggestion modal's shell so the two read as one family.
   ========================================================================== */
.task-review-modal { position: fixed; inset: 0; z-index: 950; display: flex; align-items: center; justify-content: center; }
.task-review-modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.45); }
.task-review-modal__panel {
  position: relative;
  width: min(460px, 92vw);
  max-height: 82vh;
  overflow-y: auto;
  background: var(--color-bg-elevated, var(--color-surface, #fff));
  border: 1px solid var(--color-divider, #ddd);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}
.task-review-modal__header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.task-review-modal__header h3 { margin: 0; font-size: 1.05rem; color: var(--color-text); }
.task-review-modal__close { background: none; border: none; font-size: 1.4rem; line-height: 1; cursor: pointer; padding: 2px 6px; color: var(--color-text-muted, inherit); border-radius: 6px; }
.task-review-modal__close:hover { color: var(--color-text); background: color-mix(in oklab, var(--color-text) 8%, transparent); }
.task-review-modal__sub { margin: 0 0 14px; font-size: 0.85rem; line-height: 1.4; color: var(--color-text-muted, var(--color-text-faint)); }

.task-review-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.task-review-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--color-divider, #e2e2e2);
  border-radius: 9px;
  background: color-mix(in oklab, var(--color-surface-offset, #f6f6f4) 60%, transparent);
}
.task-review-row.is-new { border-color: color-mix(in oklab, var(--color-primary) 45%, var(--color-divider, #ddd)); }
.task-review-row.is-removing { opacity: 0.6; }
.task-review-row.is-removing .task-review-row__text { text-decoration: line-through; }

/* Explicit keep (✓) + toss (✗) buttons per row. The active choice is filled;
   the other sits as a quiet outline. Keep is the default. */
.task-review-row__actions { flex: 0 0 auto; display: flex; gap: 6px; }
.task-review-row__keep,
.task-review-row__toss {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-full, 999px);
  border: 1.5px solid var(--color-divider, #ccc);
  background: transparent;
  color: color-mix(in oklab, var(--color-text) 40%, transparent);
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.task-review-row__keep:hover  { border-color: color-mix(in oklab, var(--color-primary) 55%, transparent); color: var(--color-primary); }
.task-review-row__toss:hover  { border-color: color-mix(in oklab, #c0392b 55%, transparent); color: #c0392b; }
.task-review-row__keep.is-active {
  border-color: color-mix(in oklab, var(--color-primary) 60%, transparent);
  background: color-mix(in oklab, var(--color-primary) 16%, transparent);
  color: var(--color-primary);
}
.task-review-row__toss.is-active {
  border-color: color-mix(in oklab, #c0392b 60%, transparent);
  background: color-mix(in oklab, #c0392b 14%, transparent);
  color: #c0392b;
}
.task-review-row__keep:focus-visible,
.task-review-row__toss:focus-visible { outline: 2px solid color-mix(in oklab, var(--color-primary) 70%, transparent); outline-offset: 2px; }
.task-review-row__text { flex: 1 1 auto; font-size: 1rem; line-height: 1.5; color: var(--color-text); word-break: break-word; padding-top: 1px; }
.task-review-row__badge {
  margin-left: 8px;
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 1px 6px; border-radius: var(--radius-full, 999px);
  background: color-mix(in oklab, var(--color-primary) 16%, transparent);
  color: var(--color-primary);
  vertical-align: middle;
}

.task-review-modal__footer { display: flex; align-items: center; gap: 8px; margin-top: 18px; }
.task-review-modal__status { flex: 1 1 auto; font-size: 0.8rem; color: var(--color-text-muted, var(--color-text-faint)); }
.task-review-btn {
  font: inherit; font-size: 0.9rem; font-weight: 600;
  padding: 8px 16px; border-radius: var(--radius-full, 999px);
  cursor: pointer; border: 1px solid transparent;
  touch-action: manipulation;
}
.task-review-btn--quiet { background: none; border-color: var(--color-divider, #ddd); color: var(--color-text-muted, var(--color-text)); }
.task-review-btn--quiet:hover { background: color-mix(in oklab, var(--color-text) 7%, transparent); color: var(--color-text); }
.task-review-btn--primary { background: var(--color-primary); color: var(--color-text-inverse, #fff); }
.task-review-btn--primary:hover { background: color-mix(in oklab, var(--color-primary) 85%, black); }
/* Delete all (proposal mode): discard the whole proposal. Red to signal the
   destructive intent, matching the red discard on the brief-suggestion modal. */
.task-review-btn--danger { background: none; border-color: color-mix(in oklab, #c0392b 45%, transparent); color: #c0392b; }
.task-review-btn--danger:hover { background: color-mix(in oklab, #c0392b 10%, transparent); border-color: #c0392b; }
.task-review-btn:disabled { opacity: 0.55; cursor: default; }

/* =============================================================================
   Image attachments (bug #19, part 1) — 5/17/26
   -----------------------------------------------------------------------------
   Three input surfaces (paperclip / drag-drop / paste), one tiny tray above the
   textarea, one image per message. Tray chips are small thumbnails with a
   close affordance. While uploading: gentle shimmer. On error: red tint.

   The composer layout: [mic] [field-with-tray-above-textarea] [paperclip] [send]
   The field column is flex so the tray sits ABOVE the textarea without
   pushing the other buttons around.
   ========================================================================== */

/* Field column wraps textarea + (optional) attachment tray so they stack
   vertically within the flex chatbox row. */
.chatbox__field {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* Tray sits above the textarea. Hidden by default; attachments.js toggles
   the [hidden] attribute when chips come and go. */
.chatbox__attachments {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-top: var(--space-2);
}
.chatbox__attachments[hidden] { display: none; }

/* Doug 5/30/26 PM: paperclip button + .chatbox__attach styles removed.
   Gabriel will instruct users on drag-and-drop when relevant. The drag-drop
   pipeline (attachments.js wireDragDrop) is untouched and still renders chips
   into .chatbox__attachments below when files land on the page. */

/* Reckon — deliberate "go deeper" trigger. Heavier visual weight than the
   transparent mic/attach controls and visually distinct from Send (which is
   filled with --color-text). Reckon uses a slightly darker, slightly bigger
   filled disc with a bronze ring on hover and an amplified bronze halo when
   armed (aria-pressed="true"). Doug 5/17/26: "scales icon, dark bronze /
   charcoal treatment — heavier visual weight than the existing controls." */
.chatbox__reckon {
  width: 40px; height: 40px;
  border-radius: var(--radius-full);
  border: 1.5px solid color-mix(in oklab, var(--color-text) 92%, var(--color-primary) 8%);
  background: color-mix(in oklab, var(--color-text) 88%, var(--color-primary) 12%);
  color: var(--color-text-inverse);
  display: inline-grid; place-items: center;
  flex-shrink: 0;
  margin-bottom: 2px;
  /* Visual breathing room from the attach button on its left so Reckon reads
     as its own thing (a mode toggle), not as a third utility icon glued to
     the attach cluster. Sits ~8px from Send on the right — close enough to
     thumb together, far enough to not look like a Send variant. */
  margin-left: 6px;
  margin-right: 4px;
  cursor: pointer;
  /* Kill iOS Safari's 300ms tap delay so the armed ring snaps on instantly
     when a member taps. Without this, Reckon feels laggy on touch even
     though the underlying state flip is synchronous. */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition:
    background var(--transition-interactive),
    border-color var(--transition-interactive),
    box-shadow var(--transition-interactive),
    transform var(--transition-interactive);
}
.chatbox__reckon:hover {
  background: var(--color-text);
  border-color: color-mix(in oklab, var(--color-primary) 70%, var(--color-text) 30%);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-primary) 20%, transparent);
}
.chatbox__reckon:focus-visible {
  outline: 2px solid color-mix(in oklab, var(--color-primary) 70%, transparent);
  outline-offset: 2px;
}
.chatbox__reckon:active {
  transform: scale(0.96);
}
/* Armed: the user has pressed Reckon and the next send will carry reckon:true.
   Amplify the bronze ring + halo so the affordance is unmistakably "loaded". */
.chatbox__reckon[aria-pressed="true"] {
  background: var(--color-text);
  border-color: var(--color-primary);
  box-shadow:
    0 0 0 2px var(--color-primary),
    0 0 14px color-mix(in oklab, var(--color-primary) 55%, transparent);
  color: color-mix(in oklab, var(--color-text-inverse) 85%, var(--color-primary) 15%);
}
.chatbox__reckon[aria-pressed="true"]:hover {
  box-shadow:
    0 0 0 2px var(--color-primary),
    0 0 18px color-mix(in oklab, var(--color-primary) 70%, transparent);
}

/* Attachment chip — small square thumbnail with an X overlay top-right.
   ~60px keeps it compact so the composer doesn't grow much when the tray
   is open. */
.attachment-chip {
  position: relative;
  width: 60px; height: 60px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--color-surface-offset);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.attachment-chip img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.attachment-chip__remove {
  position: absolute;
  top: 2px; right: 2px;
  width: 18px; height: 18px;
  border-radius: var(--radius-full);
  background: color-mix(in oklab, #000 70%, transparent);
  color: #fff;
  border: 0;
  display: inline-grid; place-items: center;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: background var(--transition-interactive);
}
.attachment-chip__remove:hover {
  background: color-mix(in oklab, #000 88%, transparent);
}

/* Uploading: shimmer overlay + dim + spinner so the user clearly sees
   the chip is in flight. Computer 6/10/26 PM: the old shimmer was a
   white-on-lavender gradient at low opacity and Doug couldn't see it
   — he hit send before the upload landed and the file silently dropped.
   Now we dim the chip body, ring a soft pulse, and pin a spinner in the
   corner so 'not ready yet' is unambiguous. */
.attachment-chip--uploading {
  opacity: 0.75;
  filter: saturate(0.7);
}
.attachment-chip--uploading::before {
  /* Spinner ring in the top-left, layered above the chip background. */
  content: "";
  position: absolute;
  top: 6px;
  left: 6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid color-mix(in oklab, var(--color-primary, #6b5aa8) 35%, transparent);
  border-top-color: var(--color-primary, #6b5aa8);
  animation: attachment-spin 0.7s linear infinite;
  z-index: 2;
  pointer-events: none;
}
.attachment-chip--uploading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    color-mix(in oklab, var(--color-primary, #6b5aa8) 0%, transparent) 0%,
    color-mix(in oklab, var(--color-primary, #6b5aa8) 18%, transparent) 50%,
    color-mix(in oklab, var(--color-primary, #6b5aa8) 0%, transparent) 100%
  );
  background-size: 200% 100%;
  animation: attachment-shimmer 1.2s ease-in-out infinite;
  pointer-events: none;
}
/* Doc chips are wider; nudge the spinner inside the icon column so it
   doesn't sit on top of the file glyph. */
.attachment-chip--doc.attachment-chip--uploading::before {
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
}
.attachment-chip--doc.attachment-chip--uploading .attachment-chip__icon {
  visibility: hidden;
}
@keyframes attachment-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes attachment-spin {
  to { transform: rotate(360deg); }
}
/* Computer 6/10/26 PM round 2: while the composer is awaiting an in-flight
   upload after the user hit send, dim it slightly so it's obvious we're
   holding the message back. NO pointer-events:none — the first round set
   that on the form and a stale chip from a prior failed send kept us in
   the await branch for the full 10s timeout, freezing all composer + page
   interaction (Doug hit a ~10s scroll freeze in the wild). Visual cue
   only now; the JS gate is sufficient to prevent double-submit because
   sendUserMessage only fires inside the resolved .then(). */
.chatbox--sending {
  opacity: 0.85;
}
.chatbox--sending .chatbox__send,
.chatbox--sending textarea {
  /* Just the send button + textarea visually pause; everything else —
     paperclip, voice, scrollbar, X-on-chip — stays live so the user can
     still abort. */
  pointer-events: none;
}

/* Error state: red tint + dashed border to signal something went wrong;
   the X is still tappable so the user can remove the failed chip. */
.attachment-chip--error {
  border-color: color-mix(in oklab, #d9534f 60%, var(--color-border));
  border-style: dashed;
}
.attachment-chip--error img {
  opacity: 0.55;
  filter: saturate(0.6);
}

/* Drag-over state on the composer surface — soft primary glow on the form
   itself so the drop target is unambiguous. The drag-depth counter in
   attachments.js handles flicker from nested children. */
.chatbox--drag-over {
  outline: 2px dashed color-mix(in oklab, var(--color-primary) 55%, transparent);
  outline-offset: 4px;
  border-radius: 14px;
}

/* =============================================================================
   In-message image rendering
   -----------------------------------------------------------------------------
   When a user message carries one or more images, render them above the text
   body, capped at a comfortable height so a tall screenshot doesn't blow out
   the thread. The bubble stays italicized for the text caption beneath.
   ========================================================================== */
.message__attachments {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
/* When the bubble has both image(s) and text body, give breathing room. */
.message--user .message__body:not(:empty) { margin-top: var(--space-2); }

.message__attachment {
  display: block;
  max-width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: var(--color-surface-offset);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  line-height: 0;
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.message__attachment:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md, var(--shadow-sm));
}
.message__attachment img {
  display: block;
  max-width: 320px;
  max-height: 360px;
  width: auto;
  height: auto;
  object-fit: contain;
  background: var(--color-surface);
}
/* Belt-and-suspenders: an image attachment that somehow ends up with no
   <img> child (or an empty gallery slot) gets hidden instead of painting
   a ghost-frame border. Tier 2 docs are explicitly excluded — they're
   filename chips, not images. */
.message__attachment:not(.message__attachment--doc):not(:has(img)) {
  display: none;
}
/* 2026-11-21: a message's photo, full screen, in the app (js/chat.js
   openPhotoView). Safari cannot open it: it has no Gabriel session. */
.photo-view {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) 16px calc(env(safe-area-inset-bottom, 0px) + 16px);
  background: rgba(10, 10, 10, 0.94);
  cursor: zoom-out;
}
.photo-view__img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
}
.photo-view__close {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  right: 12px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  cursor: pointer;
}
/* 2026-11-21: a message's document, in the app (js/chat.js openDocView). */
.photo-view--doc { cursor: default; align-items: stretch; }
.doc-view {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: 12px;
  overflow: hidden;
}
.doc-view__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 16px;
  border-bottom: 1px solid var(--color-divider);
}
.doc-view__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.doc-view__close {
  flex: none;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.doc-view__frame {
  flex: 1;
  width: 100%;
  border: 0;
  background: #fff;
}
.doc-view__text {
  flex: 1;
  margin: 0;
  padding: 16px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  white-space: pre-wrap;
  word-break: break-word;
  font: 14px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.message__attachments:empty {
  display: none;
}
@media (max-width: 640px) {
  .message__attachment img {
    max-width: 80vw;
    max-height: 60vh;
  }
}

/* =============================================================================
   Document attachment chip (tier 2 file reading, Doug 5/17/26)
   -----------------------------------------------------------------------------
   Filename + metadata pill rendered inside a message bubble OR in the
   composer tray. No thumbnail — just an icon, the filename, and a subtext
   line ('N pages' for PDFs, 'EXT · size' otherwise).
   ========================================================================== */

/* Composer tray variant: replaces the 60×60 square with a wider chip. */
.attachment-chip--doc {
  width: auto;
  min-width: 200px;
  max-width: 300px;
  height: 64px;
  padding: 10px 32px 10px 14px;  /* more breathing room; right pad leaves space for X */
  display: flex;
  align-items: center;
  gap: 12px;
  /* Very light lavender — present but not invasive, a soft departure from
     the warm cream surface so files feel like their own object. */
  background:
    linear-gradient(
      135deg,
      #f3effb 0%,
      #ebe6f6 100%
    );
  border-color: color-mix(in oklab, #6b5aa8 18%, var(--color-border));
  box-shadow:
    var(--shadow-sm),
    inset 0 1px 0 color-mix(in oklab, #fff 55%, transparent);
}
.attachment-chip--doc .attachment-chip__icon {
  flex: 0 0 auto;
  color: var(--color-text-muted);
  display: inline-grid;
  place-items: center;
}
.attachment-chip--doc .attachment-chip__meta {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}
.attachment-chip--doc .attachment-chip__filename {
  font-size: 13px;
  line-height: 1.2;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.attachment-chip--doc .attachment-chip__subtext {
  font-size: 11px;
  line-height: 1.2;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* In-bubble variant: the same shape, but sits inside the .message__attachments
   gallery above the prose body. */
.message__attachment--doc {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  max-width: 100%;
  min-width: 240px;
  margin-bottom: 8px;  /* breathing room before the user bubble below */
  line-height: 1.35;
  /* Match the tray chip's lavender so the file reads as the same object
     whether it's pending in the composer or settled in the bubble. */
  background:
    linear-gradient(
      135deg,
      #f3effb 0%,
      #ebe6f6 100%
    );
  border: 1px solid color-mix(in oklab, #6b5aa8 18%, var(--color-border));
  box-shadow: inset 0 1px 0 color-mix(in oklab, #fff 55%, transparent);
}
.message__attachment--doc .message__attachment-icon {
  flex: 0 0 auto;
  color: var(--color-text-muted);
  display: inline-grid;
  place-items: center;
}
.message__attachment--doc .message__attachment-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}
.message__attachment--doc .message__attachment-name {
  font-size: 14px;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 36ch;
}
.message__attachment--doc .message__attachment-sub {
  font-size: 12px;
  color: var(--color-text-muted);
}
@media (max-width: 640px) {
  .message__attachment--doc .message__attachment-name {
    max-width: 60vw;
  }
}

/* ----- Always-light surfaces in dark mode (Doug 5/27/26) ---------------
   Two surfaces are intentionally light in both themes:
     1. The scope-tint backgrounds (sage Journal, sky-blue playground)
        used for the header pill, hamburger drawer rows, and admin cards.
     2. The compose dock at the bottom — the "horizon" — which is locked
        to #ffffff even when the rest of the page goes dark.
   In dark mode, the default text color flips to cream (#ece8d8). That
   cream sits invisibly on the white horizon and washes out on the pale
   sage/sky scope tints. Doug 5/27/26: "the pill at the top and the
   writing in the box... these should be black or something dark that
   is consistent with the vibe."
   Fix: in dark mode, force dark ink on these specific surfaces.
   ----------------------------------------------------------------------- */
[data-theme='dark'] .current-playground.is-journal,
[data-theme='dark'] .current-playground.is-playground,
[data-theme='dark'] .mobile-nav__sub-item.is-journal-row.is-current,
[data-theme='dark'] .mobile-nav__sub-item.is-current:not(.is-journal-row),
[data-theme='dark'] .project-card.is-journal-card.is-active-scope,
[data-theme='dark'] .project-card.is-active-scope:not(.is-journal-card) {
  color: #1f1d18;
}
/* Computer 6/14/26 AM round 1: scope dark-ink override to the post-first-
   message dock state only. In .is-empty-thread state the dock's white
   horizon is disabled (background: transparent, box-shadow: none) and the
   empty-state .chatbox uses var(--color-surface) which is DARK in dark
   mode — forcing #1f1d18 ink there made input text invisible (dark on
   dark). Scoping with :not(.is-empty-thread) lets the empty-state composer
   fall back to the default cream --color-text, which reads correctly on
   the dark surface. The dock-state rule (white horizon, dark ink) is
   unchanged. Doug 6/14/26 AM bug report: "I can read the text in light
   mode but not dark mode" — applied only to the empty-thread moment. */
[data-theme='dark'] .stage:not(.is-empty-thread) .compose-dock,
[data-theme='dark'] .stage:not(.is-empty-thread) .compose-dock .chatbox textarea {
  color: #1f1d18;
}
[data-theme='dark'] .stage:not(.is-empty-thread) .compose-dock .chatbox textarea::placeholder {
  color: #6f6c63;   /* light-mode --color-text-muted; readable on white */
}

/* ---------------------------------------------------------------------
   Shared-playground speaker labels (Doug 6/1/26 PM round N, commit 66,
   re-shipped to root in commit 71).

   When a bubble carries a .message__speaker child (only in shared
   playgrounds -- Journal scope renders without labels), the layout
   switches from a single-row flex to a stacked column so the label
   sits ABOVE the body. We use align-items instead of justify-content
   for left/right alignment in the column direction.

   The label itself reads like metadata: small, muted, slight letter-
   spacing, sans-serif. Not loud -- the human eye should clock "who"
   in a glance and move to the content. Matches the visual register
   of .date-header but smaller and tighter (no flanking dividers).

   Why :has() and not a modifier class: keeps the JS dumb. messageEl
   already conditionally adds the child; we let CSS detect its presence.
   :has() ships in every browser we support per the Phase 2 base set.
   --------------------------------------------------------------------- */
.message:has(.message__speaker) {
  flex-direction: column;
}
.message--ai:has(.message__speaker)   { align-items: flex-start; }
.message--user:has(.message__speaker) { align-items: flex-end; }

.message__speaker {
  font-family: var(--font-app);
  font-size: 0.75rem;          /* 12px -- subordinate to the body */
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);
  padding: 0 var(--space-2);
  /* Inherit the column alignment; don't widen past the body's measure. */
  max-width: 64ch;
}
/* On archive-readonly (time-filter / previous-day mode), the body content
   lifts to readable weight via the existing rule -- match the speaker label
   so the attribution stays in lockstep with the content above it. */
.thread:has(.message[data-archive-readonly]) .message__speaker {
  color: var(--color-text);
}

/* ===========================================================================
   Space rail — sideways-tree directory.
   Computer 6/2/26 PM round 8 (commit 90).

   Doug's locked spec: vertical column on the LEFT, below the sticky
   header (c90: "that's how we read and it seems awkward there"). Siblings
   stack DOWN; children flow RIGHT on the parent's row. [+] glued to the
   right of every space name. Bottom [+] = new top-level. Stage and
   compose dock are untouched (the rail is overlay, not push).

   c84/c90 — collapse/expand:
     - Rail is CLOSED by default (translateX(-100%) tucks it off-screen LEFT).
     - .is-open returns translateX(0) and fades it in.
     - A separate fixed chevron button (.space-rail-toggle) drives the
       state, pinned top-LEFT. The button stays in place; only the rail slides.
     - pointer-events go to 'none' when closed so the off-screen rail
       doesn't intercept clicks at the edge of the stage.

   Position (c90: flipped from right → left):
   - fixed; top: 76px (clears the sticky header per c81)
   - left: 0; right: auto
   - width: auto so it sizes to its grid contents (capped at viewport width)
   - max-height: calc(100dvh - 76px); scrolls if the tree grows large
   - z-index: 25 (above compose-dock z:20)
   =========================================================================== */
.space-rail {
  /* c137 (Computer 6/6/26 AM round 4): make the directory pane read as
     part of the space, not a floating card. Doug: "the upper outline of
     the directory pane is visible against the white header. Compared
     this to detailed where its seamless... we want this to look like
     part of the space."
     The details panel achieved seamlessness via: top:92px (fully under
     the header), no borders, no box-shadow, flat white background that
     the header's eggshell fades into. Mirror that recipe here.
     Top edge: 92px tucks the rail under the site-header so its top
     line lives behind the header chrome -- nothing to outline against.
     Side edge: drop the right border and the 8px right-side shadow so
     the rail's right edge dissolves into the stage instead of stamping
     a card outline. Background stays eggshell (var(--color-bg)) -- it
     already matches the c135 header opaque override so the top hand-off
     is continuous with no seam. */
  position: fixed;
  /* Computer 6/7/26 AM round 7: Doug -- "the directory starts to cover
     up the active space pill as it expands. Suggest dropping the entire
     directory lower (so its below the active space pill)."
     Round 63's top:60 was set when the rail was narrow (Journal + one
     or two columns) -- its content sat far enough left that it never
     reached the horizontally-centered gold pill in the header. Once
     subspaces nest deeper (testing -> test 2 -> ...), the rail extends
     right and its top rows start reaching under the pill that hangs
     ~y=78-92 below the centered brand text.
     Fix: drop rail top 60 -> 100 so it starts at the bottom of the
     header band (.site-header min-height:100px, base.css round 1 from
     r73). The eggshell header now fully contains the brand + pill
     stack and the rail begins on the next visual band. max-height
     adjusted to match. The two chevrons (back nav, resize) are pushed
     down by the same 40px so they keep their previous offsets relative
     to rail-top (chev was 24px below rail-top, resize 64px below). */
  /* Computer 2026-07-23 (Doug): the rail's opaque top edge read as a
     "transition from the header to the directory" once the header's soft
     fade was restored (c135 reversal) -- header fades to transparent at
     its bottom, rail begins hard-opaque at 100px, so a seam appears at the
     hand-off. Raise the top 100 -> 68 so the rail's fade-in zone (see the
     top-fade mask layer below) overlaps the header's lower band. The first
     content row still lands at ~100px because the 32px top padding holds it
     in place -- nothing shifts, the chevrons stay aligned; only the 32px
     above the first row is added as an empty, masked-transparent fade zone
     that dissolves the rail up into the header. Header + directory now read
     as one continuous eggshell surface. */
  /* Mobile wrapper (2026-08-01): on a notched iPhone the .site-header grows
     taller because its padding-top adds env(safe-area-inset-top) (base.css),
     so the first rail rows were clipped under the notch-expanded header.
     FIX v2: keep the rail's eggshell TOP at 68px (do NOT shift the whole box
     down by the inset) so the rail's background still sits under the header's
     fade-to-transparent bottom — the header dissolves onto rail eggshell, not
     the warm wings, exactly as on desktop (a v1 top:+inset shift opened a gap
     there and the wings bled through as a seam). Instead push only the CONTENT
     down: add the inset to padding-top (below) so the first row clears the
     taller header while the eggshell keeps meeting the header. The two floating
     chevrons keep their own +inset (they sit beside the content, not the bg).
     env() is 0 in a normal browser / non-notched device, so desktop is inert. */
  top: 68px;
  left: 0;
  right: auto;
  width: auto;
  max-width: 100vw;
  height: auto;
  max-height: calc(100dvh - 68px);
  z-index: 25;
  background: var(--color-bg);
  border-right: 0;
  border-bottom: 0;
  /* Computer 6/6/26 PM round 61: Doug -- "when we pulled everything up
     for the detailed space, I think we have to do the same with the
     directory." Drop top padding 10 -> 0 so the first row (Journal /
     Doug & Pat) sits at panel-top (92px), level with the floating
     chevron at top:84. Bottom + horizontal padding unchanged. */
  /* Right + bottom padding widened (was 12px / 10px) so the edge-fade mask
     below has empty room to dissolve over without clipping any space name --
     Doug + Claude Code 2026-07-23. This is the "extend the space the directory
     takes up" Doug called for; the extra width/height is the fade zone. */
  /* Doug 2026-07-23 (follow-up): "all white space, they should blend together --
     same color." The earlier top-FADE dissolved the rail into transparency,
     which revealed the warm wings behind it as a faint band -- reading as a
     different colour from the eggshell header. The fix is not a softer fade but
     NO fade at the top: the rail stays solid eggshell (same var(--color-bg) as
     the header), and the header is lifted above the rail while the directory is
     open (see the z-index rule near the header-fade block) so its faded bottom
     reveals the rail's eggshell -- not the wings -- and the two read as one
     continuous surface. Top padding stays 64px purely as breathing room above
     the first heading row. */
  /* Top padding carries the notch inset (see FIX v2 above): the eggshell top
     stays at 68px under the header, but the first content row drops by the
     safe-area amount so it clears the taller notch header without clipping.
     FIX v3: env() inside this 4-value padding SHORTHAND did not take on iOS, so
     padding-top stayed 64px and the first row rode up under the header and
     clipped again. Set the base padding with a plain 64px top, then override
     padding-top as a LONGHAND — the same env-in-a-longhand pattern the header
     uses (base.css .site-header padding-top), which works on device. */
  padding: 64px 44px calc(40px + env(safe-area-inset-bottom, 0px)) 12px;
  padding-top: calc(64px + env(safe-area-inset-top, 0px));
  isolation: isolate;
  overflow: auto;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--color-text) 12%, transparent) transparent;
  /* c90: default closed; slide out from LEFT when .is-open is set. */
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
  transition: transform 200ms ease, opacity 160ms ease;
  /* Soften the rail's RIGHT and BOTTOM edges so the directory bleeds into the
     stage instead of stamping a hard eggshell card (Doug + Claude Code
     2026-07-23). Two mask layers intersected:
       - RIGHT fade: the right ~40px dissolve into the stage.
       - BOTTOM fade: the bottom ~40px dissolves down into the stage.
     The TOP is deliberately NOT faded -- it stays solid eggshell so it blends
     with the same-colour header (which is lifted above the rail while the
     directory is open; see the header z-index rule). Fading the top used to
     reveal the warm wings as a band; keeping it solid is what makes header +
     directory read as one continuous surface. The fade zones land in the
     widened right/bottom padding, so no space name is clipped. The toggle/
     resize chevrons are fixed body-chrome siblings (not rail children), so the
     mask never touches them. */
  -webkit-mask-image:
    linear-gradient(to right,  #000 calc(100% - 40px), transparent),
    linear-gradient(to bottom, #000 0, #000 calc(100% - 40px), transparent 100%);
  mask-image:
    linear-gradient(to right,  #000 calc(100% - 40px), transparent),
    linear-gradient(to bottom, #000 0, #000 calc(100% - 40px), transparent 100%);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
  box-shadow: none;
}
.space-rail.is-open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

/* ---- Chevron toggle button ---- */
/* Fixed top-LEFT (c90: rail moved to left so toggle follows), just under
   the sticky header. Lives outside the rail so it stays put while the rail
   slides. Closed glyph is › ("slide out from left"); open glyph is ‹
   ("tuck back"). Both states share the same hit target. The renderer mounts
   the chevron INSIDE the rail when open, at top-right of the rail —
   immediately to the right of the rail content but still aligned with the
   rail's right edge (the side closest to the stage). */
.space-rail-toggle {
  position: fixed;
  /* Computer 6/7/26 AM round 7: shifted 84 -> 124 to follow rail top
     60 -> 100 (see .space-rail comment above). Maintains the 24px
     offset that puts the chevron level with the rail's second row. */
  /* + env(safe-area-inset-top): follow the rail (and header) down past the
     iPhone notch so the two-button stack keeps its offset below the header. */
  top: calc(124px + env(safe-area-inset-top, 0px));
  left: 12px;
  right: auto;
  z-index: 26;             /* above the rail itself */
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid color-mix(in srgb, var(--color-text) 14%, transparent);
  background: var(--color-bg);
  color: color-mix(in srgb, var(--color-text) 70%, transparent);
  width: 32px;
  height: 32px;
  border-radius: 999px;
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px -2px rgba(0, 0, 0, 0.12);
  transition: top 200ms ease, right 200ms ease, background-color 140ms ease, color 140ms ease, border-color 140ms ease;
  padding: 0 0 2px 0;     /* nudge chevron up to optical centre */
}
/* Doug 11/15/26: rail disconnected -- space-rail.js hides the chevron unless
   a detail panel is open (where it is that panel's Back button). The base
   rule sets display, so [hidden] needs its own override. */
.space-rail-toggle[hidden] { display: none; }
.space-rail-toggle:hover {
  background: color-mix(in srgb, var(--color-text) 6%, var(--color-bg));
  color: var(--color-text);
  border-color: color-mix(in srgb, var(--color-text) 28%, transparent);
}
.space-rail-toggle:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
/* c169 (Computer 6/6/26 PM round 25): unified navigation chevron. Doug:
   "we want them to consistently appear to be the same button (location
   and look)... I like the home page size and location if you want to
   scale everything from there... directory seems a little squished to
   the left." Previously the open-state toggle shrank (32->26), moved
   (top:84 left:12 -> top:8 left:8), and dropped its shadow -- so it
   read as a different control. Keep ALL state changes to the glyph
   only: same size, same position, same chrome whether the rail is
   open, closed, or a detail panel is over it. Bump z-index so the
   button sits above the panel (z:40) and the rail (z:25). */
.space-rail-toggle.is-open {
  /* No position / size / chrome overrides -- inherit the closed-state
     defaults so the button feels stationary. Only the glyph flips. */
}
/* c169: keep the toggle visible above any open detail panel so a single
   chevron in one location drives all back-navigation. */
.space-rail-toggle {
  z-index: 60;
}
/* c90.1 / c169: reserve a left gutter on the open rail so list items
   don't sit under the fixed chevron at left:12px (32px wide). 12 + 32 + 8
   = 52px clear lane before content begins. */
.space-rail.is-open {
  position: fixed;
  padding-left: 52px;
}
/* "You-are-here" dot — shown when a non-Journal space is active and the
   rail is closed, so the chevron still hints there's a current location. */
.space-rail-toggle.has-active::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-bg);
}
.space-rail-toggle.is-open.has-active::after {
  /* When open, the rail itself shows the active pill, so the dot is redundant. */
  display: none;
}

/* c172 (Computer 6/6/26 PM round 26): floating resize chevron, sibling of
   .space-rail-toggle. Doug: "we still need a <. But below that we could
   have a down arrow (so two buttons)." Identical visual shell to the nav
   chevron (32px circle, same border/bg/shadow/hover), just anchored 40px
   lower (top:84 + 32 + 8 = 124) so the two read as a tidy two-button
   stack at the top-left. Only revealed while the detail panel is open;
   JS sets/clears [hidden]. */
.space-rail-resize-toggle {
  position: fixed;
  /* Computer 6/7/26 AM round 7: shifted 124 -> 164 to keep the 40px
     spacing below .space-rail-toggle (now at 124). Two-button stack
     remains visually tidy at the new lower position. */
  /* + env(safe-area-inset-top): follow the nav chevron down past the notch. */
  top: calc(164px + env(safe-area-inset-top, 0px));
  left: 12px;
  right: auto;
  z-index: 60;             /* match .space-rail-toggle so it wins over the panel (40) */
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid color-mix(in srgb, var(--color-text) 14%, transparent);
  background: var(--color-bg);
  color: color-mix(in srgb, var(--color-text) 70%, transparent);
  width: 32px;
  height: 32px;
  border-radius: 999px;
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px -2px rgba(0, 0, 0, 0.12);
  transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
  padding: 0 0 1px 0;     /* nudge glyph up to optical centre */
}
.space-rail-resize-toggle:hover {
  background: color-mix(in srgb, var(--color-text) 4%, var(--color-bg));
  color: var(--color-text);
  border-color: color-mix(in srgb, var(--color-text) 22%, transparent);
}
.space-rail-resize-toggle:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--color-text) 30%, transparent);
  outline-offset: 2px;
}
.space-rail-resize-toggle[hidden] {
  display: none;
}

.space-rail::-webkit-scrollbar { width: 6px; height: 6px; }
.space-rail::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--color-text) 12%, transparent);
  border-radius: 999px;
}

/* The grid: rows = vertical position, columns = depth. grid-template-columns
   is set inline by the renderer based on actual max-depth. */
.space-rail__grid {
  display: grid;
  /* grid-template-columns set inline */
  grid-auto-rows: minmax(28px, auto);
  row-gap: 2px;
  /* c148 (Doug 6/19/26): "the + is pretty tight to the tree... can we
     give it some space... push it out more". Bump column-gap so the
     per-row [+] sits clearly outboard of the name pill column. */
  column-gap: 14px;
  align-items: center;
}

/* c87: a cell wraps a gear + name pill so they sit on the same row in the
   grid. Inline flex so the cell hugs its contents and respects the grid's
   start-alignment.
   c143 (Computer 6/7/26 AM round 9): Doug -- the \u22EF moved with each
   pill's text width, so its x-coordinate shifted row-to-row. Hard to
   mouse-target. Fix: stretch the cell to fill its column and push the
   \u22EF flush-right with space-between. Now \u22EF sits at a fixed x per
   column, directly left of the [+] in the next column (separated only by
   the grid's column-gap). The pill itself stays left-anchored. */
.space-rail__cell {
  display: flex;
  align-items: center;
  gap: 2px;
  justify-self: stretch;
  /* c142 (6/19/26): details (chevron) now sits LEFT of the pill. Pill
     pushes to the right of the chevron with margin-right: auto so the
     trailing whitespace stays in the cell (preserves the [+] alignment
     in the next column). */
  justify-content: flex-start;
}
/* Keep the pill from stretching to fill the cell -- it should hug its
   text. Pill is the second child now; margin-right:auto pushes any
   remaining space to its right. */
.space-rail__cell > .space-rail__row {
  flex: 0 0 auto;
  margin-right: auto;
}

/* ---- Details (\u22EF more) button ----
   c139 (Computer 6/6/26 AM round 6): semantics flipped. Row body
   navigates (universal sidebar convention); this button opens the
   settings/details overlay.
   c141 (Computer 6/6/26 AM round 8): hide at rest, reveal on cell hover
   or :focus-visible. Doug: "can we hide them unless the user highlights
   the space pill (like you had before with the arrows. I think that
   looks visually less cluttered and produces the same affect". Same
   visual relief the killed-gear era was reaching for, minus the gear's
   two real problems (tiny + truly invisible). This button stays 28x28
   and snaps to full opacity on hover so when you ARE reaching for it
   it's a comfortable target -- not the gear's old 22x22 whisper. */
.space-rail__details {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  color: color-mix(in srgb, var(--color-text) 60%, transparent);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  padding: 0;             /* c142: SVG centres on its own */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* c150 (Doug 6/19/26): "down arrows should be permanently visible."
     Chevron now always shown at rest (0.85 opacity). Cell hover boosts to
     full opacity as the actionable-target cue; the c142 always-on-hover
     baseline (0 -> 0.85) is gone. */
  opacity: 0.85;
  pointer-events: auto;
  transition: opacity 140ms ease, background-color 140ms ease, color 140ms ease;
  flex-shrink: 0;
}
.space-rail__details-icon {
  display: block;
}
.space-rail__cell:hover .space-rail__details,
.space-rail__details:focus-visible {
  opacity: 1;
  pointer-events: auto;
}
.space-rail__details:hover {
  opacity: 1;
  color: var(--color-text);
  background: color-mix(in srgb, var(--color-text) 8%, transparent);
}
.space-rail__details:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
/* On the active row the pill is solid primary/white. Tint the details
   button to read against that background once it's revealed on hover.
   c142 (6/19/26): details moved BEFORE the pill in DOM order so we
   target by `:has()` on the parent cell instead of `+` adjacent. */
.space-rail__cell:hover:has(.space-rail__row.is-active) .space-rail__details {
  color: color-mix(in srgb, var(--color-text) 75%, transparent);
}
.space-rail__cell:has(.space-rail__row.is-active) .space-rail__details:hover {
  color: var(--color-text);
}

/* ---- Pill (space name) ---- */
.space-rail__row {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  color: color-mix(in srgb, var(--color-text) 80%, transparent);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  padding: 5px 12px;
  border-radius: 999px;
  min-height: 28px;
  transition: background-color 140ms ease, color 140ms ease;
  text-align: left;
  justify-self: start;          /* left-align inside its grid cell */
}
.space-rail__row:hover {
  background: color-mix(in srgb, var(--color-text) 6%, transparent);
  color: var(--color-text);
}
.space-rail__row:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.space-rail__row.is-active {
  background: var(--color-primary);
  color: #ffffff;
}
.space-rail__row.is-active:hover {
  background: var(--color-primary);
  color: #ffffff;
}
/* c156 (Computer 6/6/26 AM round 14): Journal now matches sibling rows
   exactly -- same font, same weight as Doug & Pat / Money / etc. Doug:
   "Journal font doesn't match space font." The display/serif override
   here made it visually a different typeface from the rest of the rail.
   The .--journal class is kept (still referenced by JS for the data-nav
   target) but carries no visual override now. */
.space-rail__row--journal {
  /* deliberately empty: matches .space-rail__row */
}

.space-rail__row .space-rail__label {
  display: inline-block;
  max-width: 14ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Private spaces (Doug + Claude Code 2026-09-01). The padlock rides INSIDE
   .space-rail__label so it truncates with the name rather than being clipped
   away separately -- on a narrow rail the lock is the part you most need to
   still see, so it leads. Sized down and de-saturated: it is a status mark on
   a pill, not a button. */
.space-rail__lock {
  margin-right: 0.3em;
  font-size: 0.78em;
  opacity: 0.75;
  vertical-align: baseline;
}


/* ---------------------------------------------------------------------------
   .current-space — header chip showing the user's active scope (c90)
   ---------------------------------------------------------------------------
   Rendered next to the Gabriel wordmark/tagline. Visually echoes the
   active rail pill (.space-rail__row.is-active) so the user can read the
   header and immediately know "that's where I am." Hidden via the `hidden`
   attribute when no space is active; current-space.js toggles it.
   =========================================================================== */
.current-space {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  /* c127 (Computer 6/3/26 PM round 33): tighten the pill so the brand-text
     column fits within the 76px panel-top offset. Doug: "close, but it
     gets cut off." Was margin-top 4px + 0.78rem font + 6px vertical
     padding -> brand stack overflowed below the fixed header into the
     panel area. Now: margin-top 2px, tighter padding, slightly smaller
     font. Pill stays legible but lives inside the header band. */
  margin-top: 2px;
  padding: 2px 9px 2px 7px;
  background: var(--color-primary);
  color: #ffffff;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.15;
  max-width: 18ch;
  white-space: nowrap;
}
.current-space[hidden] {
  display: none;
}
/* r81 (Computer 6/7/26 AM round 10): when there's an active space, the
   chip is a click-toggle to/from that space's detail page. JS adds
   .is-clickable + role=button + tabindex=0; CSS provides the affordance
   so it visibly invites the click. Null-scope (Journal active) skips the
   class so the chip stays informational. */
.current-space.is-clickable {
  cursor: pointer;
  transition: filter 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}
.current-space.is-clickable:hover {
  filter: brightness(1.06);
  box-shadow: 0 1px 4px color-mix(in srgb, var(--color-primary) 35%, transparent);
}
.current-space.is-clickable:active {
  transform: translateY(0.5px);
  filter: brightness(0.96);
}
.current-space.is-clickable:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--color-primary) 60%, white);
  outline-offset: 2px;
}
.current-space__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffffff;
  flex: 0 0 auto;
  opacity: 0.85;
}
.current-space__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* ---------------------------------------------------------------------------
   .rail-settings — slide-over settings panel (commit 93, 6/3/26)
   ---------------------------------------------------------------------------
   Border-to-border overlay that opens when the user clicks a rail gear icon.
   Hosts the same per-space settings UI as spaces.html (briefs, time filter,
   reckoning, members, invitations, files), rendered by js/rail-settings.js.
   The chat behind it stays mounted -- this is overlay UX so live activity
   continues underneath while the user edits settings. Slides in from the
   left to mirror the rail's own slide direction (commit 90).
   =========================================================================== */
.rail-settings {
  /* c111 (Computer 6/3/26 PM round 18): half-screen by default per Doug --
     "we should have an option to cut this screen in half (so it only covers
     half the chat), otherwise scroll bar." The panel now occupies the top
     half of the viewport (below the 76px site header). Chat is visible and
     interactive in the bottom half. Internal scroll handles longer content.
     A drag handle at the bottom edge of the panel lets the user minimize
     (↓ -- panel slides down so only the 36px handle peeks above viewport
     bottom) or restore (↑ -- panel slides back up to half-screen). */
  /* c113 (Computer 6/3/26 PM round 20): panel is TOP-anchored under the
     76px site header. Expand/collapse animates height only -- the top edge
     never moves. At half-screen the panel covers the upper half of the
     viewport below the header; at minimized only the 36px handle bar peeks
     out just below the header. Doug feedback: "the top of the page is set
     to go below the chat bar instead of below the header" -- the c112 swap
     between top:76px and bottom:0 was producing the wrong intermediate
     anchor. Single anchor (top) + animated height fixes it. */
  /* c118 (Computer 6/3/26 PM round 25): half-screen state now uses
     height:auto so the panel hugs its content; max-height caps it at
     50vh - 38px so it never exceeds half-screen. Doug feedback: "a lot
     of wastes space below invite." When the content (Fixed/Dynamic/
     Files/Members/Invitations) is short, the panel was still 50vh tall
     with empty bottom space inside. height:auto fixes that -- short
     content = short panel = more chat visible below. */
  position: fixed;
  /* c131 (Computer 6/3/26 PM round 33): back to top:92px under the
     site-header (was top:0 in c129/c130). c129's idea of tucking the
     panel UNDER the header to hide the seam ended up hiding the
     brand chrome too. Doug: "I lost all my headers, buttons, etc."
     Restore the original anchor below the brand stack; the seam is
     now solved by (a) the site-header keeping its own gradient, and
     (b) the panel being solid #ffffff at its top so where the header
     gradient runs out, the panel takes over with a solid wall of
     white -- no gap for wings to leak through. */
  top: 92px;
  left: 0;
  right: 0;
  bottom: auto;
  height: auto;
  /* Doug + Claude Code 2026-08-11: --keyboard-inset is the on-screen
     keyboard's height, published by js/rail-settings.js from the
     visualViewport API (0px when it is closed or unsupported).
     min() rather than a flat subtraction on purpose: at half-screen the
     panel's bottom edge (92px + 50vh - 46px) already clears a typical
     iPhone keyboard, so subtracting the inset unconditionally would shrink
     a panel that was never covered -- Doug would have gone from "can't see
     the caret" to "can only see three lines." The second term is the real
     constraint: never extend past the top of the keyboard. Whichever is
     smaller wins, so the geometry is byte-identical to before whenever the
     keyboard is down. */
  max-height: min(
    calc(50vh - 46px),
    calc(100dvh - 92px - var(--keyboard-inset, 0px))
  );
  z-index: 40;                         /* above rail (25) and chevron (26) */
  /* c133 (Computer 6/3/26 PM round 35): flat opaque white. Doug's
     framing that broke the deadlock: "the wings fade seem to be a
     none issue because you seem to be doing something different for
     the header here versus when we minimize." The site-header looks
     fine in the closed-panel state -- cream gradient fades into chat
     below, no bug. The panel-open state should follow the same rule:
     the header behaves exactly like it does when closed, and the
     panel is just a flat opaque slab where the chat used to be. The
     header's transparent bottom then fades into the panel's solid
     white the same way it fades into chat normally. No wings strip,
     no special header override, no heaven-fade gradient. Just white. */
  /* c172 (Computer 6/6/26 PM round 31): Doug -- "dark mode is inconsistent
     with detailed journal & spaces." Swap hardcoded #ffffff for the
     theme bg token so the panel matches the site-header in BOTH themes.
     Light: #ffffff (unchanged). Dark: #14130f (was a cream slab). */
  background: var(--color-bg);
  /* c109 (Computer 6/3/26 PM round 16): soften the panel edges per Doug --
     "a softer bleed versus a stark line for the directory as well as the
     detailed scope." Hard 1px outer borders dropped; the existing box-shadow
     on line ~2619 gives the panel its float without a crisp edge. */
  border-top: 0;
  border-bottom: 0;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
  /* c113 (Computer 6/3/26 PM round 20): transition the height instead of
     swapping top/bottom anchors. The panel is now ALWAYS anchored to the
     bottom of the viewport; expand/collapse just animates the height. This
     avoids the position-anchor switch that was causing the panel to appear
     to maximize "below the chat bar" -- whatever the intermediate computed
     style was during the top:auto <-> top:76px swap. */
  transition: transform 220ms ease, opacity 180ms ease,
              height 240ms ease, max-height 240ms ease;
  /* c128: drop the box-shadow. With the panel now reading as a
     gradient extension of the header, a drop-shadow would re-introduce
     the boxy stamped feel we just removed. */
  box-shadow: none;
}
.rail-settings.is-open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}
/* c116 (Computer 6/3/26 PM round 23): two-state model -- half-screen or
   full-screen. Doug retired the minimize state ("Two states: half <-> full").
   The arrow on the handle now indicates the direction the panel will GROW:
   chevron-down at half-screen means "expand downward to full", chevron-up
   at full-screen means "contract upward to half". Renamed the toggle class
   from .is-minimized to .is-maximized to match the inverted semantics.
   c118: maximized state forces full available height (overrides the
   c118 auto-fit half-screen). */
.rail-settings.is-open.is-maximized {
  /* c131: back to top:92px (c129 was 100vh). Maximized height fills
     viewport below the header. Doug 2026-07-23: 100vh -> 100dvh so the mobile
     browser chrome doesn't push the panel bottom off-screen (rest of the app
     already uses dvh). */
  /* Doug + Claude Code 2026-08-11: minus --keyboard-inset. This is the state
     Doug was in when he hit it -- a maximized panel is exactly 100dvh tall,
     so ALL of the keyboard's height was overlapping it. dvh does not help
     here: it tracks the browser's collapsing chrome, never the keyboard. */
  height: calc(100dvh - 92px - var(--keyboard-inset, 0px));
  max-height: calc(100dvh - 92px - var(--keyboard-inset, 0px));
}

/* c117 (Computer 6/3/26 PM round 24): bottom resize handle bar deleted.
   Doug feedback: "this bleed at the bottom...wasted valuable chat space.
   No wastes screen space." The 36px handle bar + padding was eating room
   that should belong to the chat below. The toggle moved into the panel
   header top-right (rail-settings__resize-btn--header). The shared button
   styles below still apply -- only the wrapping handle bar went away. */
.rail-settings__resize-btn {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 6px 10px;
  border-radius: var(--radius-full, 999px);
  color: var(--color-text);
  opacity: 0.7;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  line-height: 1;
  transition: opacity 120ms ease, background 120ms ease;
}
.rail-settings__resize-btn:hover,
.rail-settings__resize-btn:focus-visible {
  opacity: 1;
  background: color-mix(in srgb, var(--color-text) 6%, transparent);
  outline: none;
}
.rail-settings__resize-btn svg {
  width: 14px;
  height: 14px;
}
/* c117: header variant -- slightly tighter padding, flex-shrink:0 so the
   button never collapses under tight headers (e.g. long space names).
   c118: bumped baseline opacity from 0.7 -> 0.9 so the toggle reads
   clearly in the header without hover; Doug initially missed it.
   c119: this --header variant is now unused (button moved beside Back)
   but kept in case we ever need a right-aligned header variant again. */
.rail-settings__resize-btn--header {
  flex: 0 0 auto;
  padding: 6px 8px;
  margin-right: 4px;
  opacity: 0.9;
}
/* c119 (Computer 6/3/26 PM round 25): "beside Back" variant. Doug:
   "i see the icon, to the bottom left...its too small and hard to see
   ...but beside back is an obvious place". So we pull the toggle out
   of the right-side header slot and sit it immediately to the right
   of the « Back close button. Bigger SVG (18px vs 14px), full opacity,
   subtle pill background so it reads as a peer action to Back.

   c171 (Computer 6/6/26 PM round 24): Doug: "its overlapping with the
   expand chevron on the detailed space... The down chevron should be
   the same size and structure. Suggest we place it directly below the
   < chevron if possible." The resize button is now a floating sibling
   of the c169 navigation chevron (.space-rail-toggle), stacked directly
   below it at the same column. Same 32px circle, same border, same
   background, same shadow -- so the two buttons read as ONE control
   stack. Only visible while the detail panel is open. The legacy
   --beside-back rule below is retained as the fallback (no panel-open
   state on the body) but the new --floating rule wins when active. */
/* c172 (Computer 6/6/26 PM round 26): c171's --beside-back floating variant
   removed. The in-panel resize button markup is gone from both HTMLs; the
   replacement is .space-rail-resize-toggle, owned by space-rail.js and
   rendered as a body-level sibling of the < navigation chevron (see CSS
   block above near .space-rail-toggle). */
.rail-settings__resize-btn--beside-back {
  display: none !important;
}

/* c172 (Computer 6/6/26 PM round 26): the column-hack approach was wrong.
   Doug's better idea: "we still need a <. But below that we could have a
   down arrow (so two buttons)." Both chevrons live in body chrome as
   siblings (space-rail.js owns both), NOT in the panel content area.
   Panel stays at left:0 with its original padding. The only adjustment
   here: pad the panel TITLE ("Gab Business") right of the < chevron so
   the title text clears the floating button. The body is scrollable
   under the ⌄ -- standard floating-chrome behavior, no special padding
   needed; as soon as the user scrolls the content slides past. */
/* Computer 6/6/26 PM round 38: 44px title-pad removed. The header now has
   60px padding-left (r35) which already clears the floating chevron column,
   so the 44px on the title compounded -> "Stuff" sat at ~108px, way past the
   body left edge. Without this, the title aligns to the same 60px lane as
   the body content below. */
body.rail-settings-open .rail-settings__title {
  padding-left: 0;
}
/* c172 (Computer 6/6/26 PM round 27): Doug -- "everything is indented from
   space heading (journal). Everything should be in line." The title now
   starts at header(16) + title-pad(8) + 44 = 68px. The body had
   padding-left: clamp(16px, 4vw, 36px) which, plus auto-centered max-width,
   sat further right at Doug's viewport. Pin the body's left padding so it
   starts at the same x as the title text. We override the horizontal
   padding only when the panel is open; vertical padding stays. */
body.rail-settings-open .rail-settings__body {
  padding-left: 60px;
  padding-right: clamp(16px, 4vw, 36px);
  margin-left: 0;
  margin-right: auto;
}
/* Computer 6/6/26 PM round 35: header inherits the same 60px left padding
   as the body when the panel is open, so the name input / title chip
   clears the floating chevron column (chevron at left:12, ~28px wide ->
   needs ~50-60px clear). Without this, in create mode the name input
   pill sat under the chevron.

   Computer 6/6/26 PM round 41: in CREATE mode the input pill is
   left-aligned and needs the 60px chevron clearance. In DETAILS mode the
   title-pill is horizontally centered, so we drop the left padding and let
   the pill self-center via margin:0 auto. The chevron at left:12 sits in
   its own floating layer; the centered pill is wider than 60px so even
   when symmetric padding makes the pill overlap the chevron column
   visually, the pill still has comfortable air around it. */
body.rail-settings-open .rail-settings.is-create .rail-settings__header {
  padding-left: 60px;
}
/* Computer 6/6/26 PM round 45: in details mode the panel header is now
   visually empty (title-pill moved into the Scope & Tasks heading row).
   Keep the chevron-clearance padding so the header collapses cleanly
   without forcing horizontal layout shifts. */
body.rail-settings-open .rail-settings:not(.is-create) .rail-settings__header {
  padding-left: 16px;
  padding-right: 16px;
}
/* c116: glyph swap. Default state (half-screen) -- chevron-down means
   "expand downward to full". Maximized state -- chevron-up means
   "contract upward back to half". The button has both SVGs; we toggle
   via attribute selectors so JS just adds/removes .is-maximized. */
.rail-settings__resize-icon--up { display: none; }
.rail-settings__resize-icon--down { display: inline-block; }
.rail-settings.is-maximized .rail-settings__resize-icon--up { display: inline-block; }
.rail-settings.is-maximized .rail-settings__resize-icon--down { display: none; }
.rail-settings[hidden] {
  display: none;
}
.rail-settings__header {
  /* Computer 6/6/26 PM round 54: Doug -- "there is an empty row that
     the top chevron sits on. Can we get rid of that row? Its wasted
     space." Every child is hidden by default in r45+ layout: the close
     button (display:none, c169), the h2 title (paintTitle sets
     hidden=true and moves the pill into the Scope & Tasks heading
     slot), the name input + create button (hidden until create flow),
     and the spacer is empty. The whole row was just 20px of padding
     above the chevron. Collapse it. Create flow re-shows the header
     via the rule below (:has(:not([hidden]))). */
  display: none;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: transparent;
}
/* Re-show the header when the inline create flow needs the name input +
   Create button (both un-hidden together by rail-settings.js). */
.rail-settings__header:has(.rail-settings__title-input:not([hidden])) {
  display: flex;
}
.rail-settings__close {
  /* c169 (Computer 6/6/26 PM round 25): hidden in favor of the unified
     floating chevron (.space-rail-toggle). Doug: "we want them to
     consistently appear to be the same button." The floating chevron at
     top:84/left:12 now handles all back-navigation: closing the detail
     panel and opening the directory in one step. Markup stays so
     keyboard / programmatic close paths still work; display:none just
     removes the visual duplicate from the panel header. */
  display: none;
}
.rail-settings__title {
  margin: 0;
  font-family: var(--font-app);
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  flex: 1 1 auto;
  /* c124 (Computer 6/3/26 PM round 30): left-align the panel title.
     Doug: "i would left align the title of the expanded field so it
     doesn't clash with the pill." Centered text was sitting directly
     under the Gabriel wordmark column, which crowded the brand axis.
     Left-aligned (with a small gap from the resize button) keeps the
     title in the panel-chrome lane and leaves the visual center clean. */
  text-align: left;
  /* Computer 6/6/26 PM round 38: 8px left-pad removed; the header itself
     provides the chevron-clear gap when the panel is open. */
  padding-left: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Computer 6/6/26 PM round 38: when the title represents a navigable space
   (paintTitle adds .is-pill + data-open-project-id) it renders as a pill
   button that matches the Open-space / Create chip language elsewhere in
   the header. Hover/focus lift the surface; cursor is pointer; the click
   handler in rail-settings.js navigates. Drops the separate "Open space
   \u2192" chip. Doug: "make the space name look like the pill (instead of
   a name it looks more like a button)." */
.rail-settings__title.is-pill {
  /* Computer 6/6/26 PM round 46: Doug -- "doesn't match the font, or
     height of active tab. Also not centered on active tab which would
     be ideal." Mirror .current-space font-size/weight/line-height/max-
     width so this pill reads as the same UI primitive as the header
     chip, with the grey background (gold is reserved for the active-
     space chip).
     Computer 6/6/26 PM round 50: Doug -- "can we just put (space)
     (space) before the name? maybe (space) after to even it out?" --
     bumped horizontal padding to 14/14 so longer names like "Gab
     Business" breathe inside the pill. Vertical stays 2px to keep
     height matched to .current-space.
     Computer 6/6/26 PM round 55: Doug -- "add the dot and see if that
     fixes things." Pill now mirrors .current-space exactly: leading
     dot span + label span, asymmetric 2/9/2/7 padding to host the dot,
     5px gap. Matching structure means matching intrinsic width / height
     and clean centering. Grey background stays (gold reserved for the
     active-space chip in the header). */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* Computer 6/6/26 PM round 56: Doug -- "the dot is still on the
     edge versus inside the pill like the active space tab is." The
     gold .current-space chip uses 7px left because its short text
     means the dot reads tucked in proportionally; the grey pill
     with longer text + smaller letter weight makes the same 7px
     read as crowding the rim. Bump padding-left to 10px and bump
     gap to 6px so the dot lives clearly inside the pill, with
     visible air on both sides. Right padding bumped to 12px to keep
     visual balance. */
  gap: 6px;
  flex: 0 0 auto;
  max-width: 18ch;
  margin: 0 auto;
  padding: 2px 12px 2px 10px;
  font-family: var(--font-app);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: normal;
  white-space: nowrap;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-text) 6%, transparent);
  color: var(--color-text);
  cursor: pointer;
  transition: background-color 140ms ease, transform 80ms ease;
}
.rail-settings__title-dot {
  /* Computer 6/6/26 PM round 60: Doug -- "want to keep the dot for the
     active pill, lose it for the inactive pill." Keep the span in the
     flex layout (so the centering / padding we got from mirroring the
     active chip's structure stays put) but paint it transparent. The
     grey title-pill reads as 'not active' without the dot; the gold
     .current-space chip keeps its dot as the active-state signifier. */
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: transparent;
  flex: 0 0 auto;
}
.rail-settings__title-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.rail-settings__title.is-pill:hover {
  background: color-mix(in srgb, var(--color-text) 12%, transparent);
}
.rail-settings__title.is-pill:active {
  transform: translateY(1px);
}
.rail-settings__title.is-pill:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.rail-settings__spacer {
  /* c124: spacer kept for legacy markup. Title no longer centers, so
     this just consumes trailing flex space; reduced from 76px to
     prevent dead-zone on the right edge. */
  flex: 0 0 0;
}
.rail-settings__body {
  /* c95: shrink-to-content so the panel cuts off right at Invitations
     when the form is short. Internal scroll kicks in only when content
     is taller than the viewport-minus-header. */
  flex: 0 1 auto;
  overflow: auto;
  /* Computer 6/6/26 PM round 52: Doug -- "scroll bar is not completely
     against the right of the screen... can we push it against the far
     right?" Previously max-width:980px + margin:0 auto centered the
     body inside the panel, so on wide viewports the scrollbar landed
     at the right edge of the 980px column, well inside from the actual
     viewport edge. Now: body fills the panel full-width and scrollbar
     pins to the viewport right. Content stays centered via horizontal
     padding that auto-expands to consume the extra space (max() picks
     whichever is larger: the original clamp() padding for narrow
     viewports OR the gutter needed to center a 980px column). */
  /* Computer 6/6/26 PM round 57: Doug -- "can we get that tighter to
     the top (have scope & tasks aligned with the back arrow chevron)?"
     Drop top padding 18 -> 0 so the first body row (Scope & Tasks
     heading) sits at panel-top (92px), level with the floating chevron
     at top:84-116. Horizontal + bottom padding unchanged. */
  padding: 0 max(clamp(16px, 4vw, 36px), calc((100% - 980px) / 2)) calc(24px + env(safe-area-inset-bottom, 0px));
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--color-text) 14%, transparent) transparent;
  /* c109 (Computer 6/3/26 PM round 16): soft fade on BOTH ends of the body --
     top fades up into the header, bottom fades down into the wood-texture
     page background.
     Computer 6/6/26 PM round 58: Doug -- "it has become part of the old
     text which gets fading attached to it." Previous %-based stops made
     the top fade band ~8% of body height (60+ px on tall panels), which
     started painting the now-top-aligned Scope & Tasks heading row with
     ghost opacity. Switch to fixed-pixel stops so the fade band is a
     constant ~14px regardless of body height -- short enough that the
     heading row sits in solid black mask (fully opaque). Bottom kept at
     %-based stops since long content scrolls and the bottom fade is
     meant to feather wherever the scroll ends. */
  -webkit-mask-image: linear-gradient(
    to bottom,
    #000 0,
    #000 92%,
    rgba(0,0,0,0.7) 96%,
    rgba(0,0,0,0.25) 98.5%,
    transparent 100%
  );
          mask-image: linear-gradient(
    to bottom,
    #000 0,
    #000 92%,
    rgba(0,0,0,0.7) 96%,
    rgba(0,0,0,0.25) 98.5%,
    transparent 100%
  );
}
.rail-settings__error {
  margin: 0;
  padding: 8px 12px;
  border-radius: 8px;
  background: color-mix(in srgb, #c0392b 12%, transparent);
  color: #c0392b;
  font-size: 0.9rem;
}
.rail-settings__section-heading {
  font-family: var(--font-app);
  font-size: 1rem;
  font-weight: 500;
  margin: 0 0 var(--space-2);
}
/* c122 (reverted in c125): briefly hid the pill while panel was open
   because the centered panel title clashed with it. c124 left-aligned
   the title, so the brand axis is clean and the pill can stay visible
   again. Doug: "pill gets hidden" -- bring it back. */
/* c121 (Computer 6/3/26 PM round 27): scroll lock removed. Doug: "is it
   possible to have the scroll option available on the chat too? That's
   how it was, seems it was disabled to make this work?" Correct -- the
   pre-c120 lock prevented the chat from drifting while the user scrolled
   inside the settings panel, but it also disabled the underlying chat
   scroll entirely. With c120's fixed site-header the brand stays pinned
   regardless of scroll position, so we can safely let the chat scroll
   behind the panel again. The panel itself is position:fixed and won't
   move when the page scrolls. */
/* c120: while the settings panel is open, pin the site header to the
   viewport top so the Gabriel brand + nav controls stay visible no
   matter what scroll position the page was in when the panel opened.
   Sticky positioning depends on a live scroll context; fixed sidesteps
   that. z-index sits above the panel (40) so the header always wins. */
body.rail-settings-open .site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  /* c134 (Computer 6/6/26 AM round 1): the ONLY change vs default is
     the gradient. Doug after sleeping on it: "why can't you just make
     the gabriel header background solid white without covering up the
     buttons. Just extend the white below the active space pill."
     The default site-header gradient (base.css line 397) is opaque
     cream at top, fades to transparent at the bottom. The chrome
     (logo, tagline, pill, hamburger, theme toggle, user pill) lives
     in the top zone where it's opaque. The bottom ~30% is the
     transparent fade zone -- that's where wings leak through when
     the panel is open below it.
     Fix: while the panel is open, push the opaque stop all the way
     to 100% (no transparent zone). The chrome elements are children
     of .site-header and render on top of the background, so they
     remain perfectly visible -- this only changes the painted fill
     behind them. Same backdrop-filter:blur from the base rule
     inherits unchanged. NOT changing position, NOT changing z-index,
     NOT changing backdrop-filter -- only the background gradient. */
  background:
    linear-gradient(to bottom,
      var(--color-bg) 0%,
      var(--color-bg) 100%);
}

/* c135 (Computer 6/6/26 AM round 2): originally solid-filled the header when
   the directory rail opened, to kill the wings-bleed at the header/rail seam.
   REVERSED (Doug + Claude Code 2026-07-23): that solid fill hard-edged the
   whole header the moment the directory opened -- the exact soft "slip into the
   spiritual world" fade was lost. Restore the base soft fade (same stops as
   base.css .site-header) so the header keeps dissolving into the stage with the
   directory open, and soften the rail's own trailing edges (see the .space-rail
   mask below) so header + directory read as one continuous frosted region, not
   two solid panels with a seam. The wings-bleed this once prevented is now the
   intended soft bleed. Blur inherits from the base rule, unchanged. */
body:has(.space-rail.is-open) .site-header {
  background:
    linear-gradient(to bottom,
      var(--color-bg) 0%,
      color-mix(in oklab, var(--color-bg) 88%, transparent) 70%,
      transparent 100%);
}
/* Doug 2026-07-23 (follow-up): header + directory are the same eggshell and
   should read as ONE surface, and the active-space pill must always stay on
   top. The rail is a sibling of the header inside .app-shell (shared z:1
   stacking context) and its z:25 otherwise paints over the header. While the
   directory is open, lift the header above the rail (z:30 > 25) so:
     - its faded bottom reveals the rail's SOLID eggshell (not the warm wings),
       so the two blend as one continuous colour -- the .space-rail top fade was
       removed to make this work; and
     - the .current-space pill (a header child) always paints over the
       directory, even when a deeply-nested rail grows wide enough to reach the
       header centre. Doug: "ideally it's always on the top layer."
   Scoped :not(.rail-settings-open) so the detail-panel state keeps its own z:50
   header (which must stay above the panel at z:40). */
body:has(.space-rail.is-open):not(.rail-settings-open) .site-header {
  z-index: 30;
}
/* c167 (Computer 6/6/26 PM round 23): kill the "eyebrow" line above Back.
   Doug 6/6/26: "sometimes I get this bug... an almost eyebrow looking
   line above back... comes if I click anywhere in chat." Root cause:
   the site-header ends at its own content height (~76-80px) but the
   rail-settings panel starts at top:92px. That ~12-16px gap has no
   solid background -- chat content + wings paint through it. When the
   user clicks chat, the thread auto-scrolls or shifts focus, and the
   top of a message bubble or divider lines up with this strip, reading
   as a hairline "eyebrow" right above the panel's Back button.
   Fix: paint solid white in the gap by extending the panel's visual
   surface 20px upward via a 0-blur box-shadow. The panel still starts
   at top:92px (layout unchanged), but the shadow fills the gap zone
   with the same #ffffff the panel itself uses -- no chat or wings can
   show through. Same recipe covers maximized + half states.

   c172 (Computer 6/6/26 PM round 25): box-shadow now scoped so it never
   paints over the .current-space gold pill that hangs below the brand
   text. Doug: "Pill is getting covered." The 20px upward extension was
   reaching from y=72 up into the bottom of the pill (~y=70-76). Tighter
   12px reaches only y=80, just enough to seal the visible eyebrow zone
   without eating into the pill. The header itself gets a min-height of
   92px while the panel is open -- this paints the eggshell bg all the
   way down to where the panel starts so the box-shadow truly only fills
   the residual sub-pixel rounding gap. */
body.rail-settings-open .rail-settings.is-open {
  /* c172 (Computer 6/6/26 PM round 29): shadow shrunk from -12px to -4px.
     Doug: "Active pill is getting cut off just a smidge." The 12px upward
     extension was reaching into the bottom curve of the .current-space
     pill (which hangs ~y=82-95 below the brand stack). 4px is enough to
     seal the residual sub-pixel rounding gap between header bottom
     (now 100px) and panel top (92px) without touching the pill.
     c172 round 31: token-ize the shadow color the same way as the panel
     background so dark mode no longer paints a cream stripe above the
     dark panel. */
  box-shadow: 0 -4px 0 0 var(--color-bg);
}
body.rail-settings-open .site-header {
  /* c172 round 29: bumped 92px -> 100px so the eggshell header bg paints
     fully under the .current-space pill, which extends a few px past the
     prior 92px boundary at default zoom. Panel still starts at top:92px;
     the 8px overlap sits behind the header (z:50 > panel z:40) so layout
     is unchanged but the pill gets a clean opaque backdrop. */
  min-height: 100px;
}
/* Brief/detail view ONLY — the header is border-box with a safe-area
   padding-top, so on a notched iPhone that padding eats the 100px min-height
   and the header row (moon / avatar) is shoved up into the notch and clipped
   ("cutting off the header"). Grow min-height by the inset so the row clears.
   SCOPED :not(:has(.space-rail.is-open)) so it does NOT apply when the directory
   rail is open OVER the brief — there a taller header would paint over and clip
   the space-button grid (the #706 regression). Verified in a headless render of
   both states: brief grows and clears the notch; directory-open stays short. */
body.rail-settings-open:not(:has(.space-rail.is-open)) .site-header {
  min-height: calc(100px + env(safe-area-inset-top, 0px));
}
/* Same inset fix the space-rail got on its own `top`, now for the detail PANEL:
   .rail-settings is fixed at a hardcoded top:92px (8px under the 100px header).
   On a notched iPhone the header grows by the inset (above) and its whole row
   shifts down, but the panel stayed at 92px — so its opaque top rode UP over the
   notch-shifted header row (moon / avatar / pill) and clipped it. Drop the panel
   by the same inset so it keeps tucking under the grown header instead of over
   the header chrome. Same scope as the header grow. */
body.rail-settings-open:not(:has(.space-rail.is-open)) .rail-settings {
  top: calc(92px + env(safe-area-inset-top, 0px));
}
/* The maximized detail panel is `height: calc(100dvh - 92px)` (c131, line ~3427),
   sized for a top:92px anchor. But the rule above pushes the panel's top DOWN by
   the safe-area-inset-top on a notched iPhone, and the bottom home-indicator inset
   was never subtracted either — so the panel bottom overflowed the viewport by
   (inset-top + inset-bottom) (~93px on a Dynamic Island phone), pushing the last
   lines of the brief off-screen / crammed against the home indicator ("compressed
   at the bottom"). Subtract both insets from the maximized height so the panel
   bottom clears the home indicator instead of running under it. Scoped to the
   detail-only view (same guard as the top fix) so the directory grid is untouched. */
/* Doug + Claude Code 2026-08-11: --keyboard-inset lands HERE too, and this is
   the copy that actually governs a real brief edit. This rule outranks the
   .rail-settings.is-open.is-maximized one above whenever body.rail-settings-open
   is set, which is every time the panel is open in the app -- so subtracting the
   keyboard only up there fixed nothing on the surface Doug was using. Caught by
   the geometry test: with the body class applied, the maximized panel still ran
   the keyboard's full 336px under it.

   max() rather than another subtraction: the home indicator and the keyboard
   occupy the SAME strip at the bottom of the screen, so subtracting both
   double-counts ~34px and leaves a dead band above the keyboard. The bottom
   obstruction is whichever of the two is taller -- when the keyboard is up it
   covers the home indicator entirely; when it is down the inset is 0px and
   safe-area wins, which is the pre-existing behavior unchanged. */
body.rail-settings-open:not(:has(.space-rail.is-open)) .rail-settings.is-maximized {
  height: calc(100dvh - 92px - env(safe-area-inset-top, 0px)
               - max(env(safe-area-inset-bottom, 0px), var(--keyboard-inset, 0px)));
  max-height: calc(100dvh - 92px - env(safe-area-inset-top, 0px)
               - max(env(safe-area-inset-bottom, 0px), var(--keyboard-inset, 0px)));
}
/* Compensate for the now-fixed header: the panel starts at top:92px
   (c127), so reserve 92px at the top of the stage to prevent a layout
   jump under the panel. */
body.rail-settings-open .stage {
  padding-top: calc(92px + clamp(var(--space-6), 4vw, var(--space-10)));
}
/* c115 (Computer 6/3/26 PM round 22): when the half-screen rail-settings
   panel is open, force the underlying empty-thread composer to pin at the
   bottom of the stage instead of floating mid-page. Without this, the
   empty-state centered composer (Doug's 5/30/26 design choice) collided
   with the half-screen panel overlay -- the composer landed near viewport
   center with empty wings background bleeding through above and below.
   Doug: "the bottom of the screen extends far below the down arrow at
   mid size." The override is scoped to .rail-settings-open so the empty
   state still centers when no panel is up. */
body.rail-settings-open .stage.is-empty-thread,
body.practice-open .stage.is-empty-thread,
body.dream-open .stage.is-empty-thread {
  justify-content: flex-end;
}
body.rail-settings-open .stage.is-empty-thread > .compose-dock,
body.practice-open .stage.is-empty-thread > .compose-dock,
body.dream-open .stage.is-empty-thread > .compose-dock {
  margin-top: auto;
  margin-bottom: 0;
}
/* Doug + Claude Code 2026-10-30 ("keep the textarea locked to the bottom of
   the screen"): the same pin while the Practice panel (practice-open) or the
   dream (dream-open) is up. Both panels fit themselves between the header and
   the dock's top edge (fitToPage in js/practice.js and js/dream.js), so a
   centered composer dragged the panel's bottom up with it and left empty
   background below (any time no member message is on screen).
   Flush to the floor like the normal dock (the negative margin through the
   stage's bottom padding), not 32px above it as the settings-panel pin is.
   10-30 round 2 (Doug: "still not all the way down"): the dock is sticky at
   the viewport's bottom, so its 36px bottom padding showed as a band under
   the floating card (the normal dock paints that band white, so it reads as
   the floor there). Here the card sits just above the home indicator. */
body.practice-open .stage.is-empty-thread > .compose-dock,
body.dream-open .stage.is-empty-thread > .compose-dock {
  margin-bottom: calc(var(--space-8) * -1);
  padding-bottom: calc(var(--space-1) + env(safe-area-inset-bottom, 0px));
}
/* ---- Create mode (c94, 6/3/26 AM) ----
   When the user opens the panel via [+], the static title is hidden and
   an editable name input takes its place, along with a top-bar Create
   button. Same visual proportions as the existing header. */
/* Computer 6/6/26 PM round 34: shrink the create-mode name input so it
   reads as a small chip in the header (not a banner). Width is bounded to
   ~260px so it could later "layer on the directory" -- i.e. fit inside a
   rail pill slot when we move the create flow inline. No flex-grow. */
.rail-settings__title-input {
  flex: 0 1 260px;
  width: 260px;
  max-width: 100%;
  font-family: var(--font-app);
  font-size: 0.95rem;
  font-weight: 500;
  margin: 0;
  padding: 5px 12px;
  min-height: 28px;
  border: 1px solid color-mix(in srgb, var(--color-text) 18%, transparent);
  border-radius: 999px;
  background: var(--color-bg);
  color: var(--color-text);
  min-width: 0;
  text-align: left;
}
.rail-settings__title-input::placeholder {
  color: color-mix(in srgb, var(--color-text) 45%, transparent);
  font-style: italic;
  font-weight: 400;
}
.rail-settings__title-input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--color-accent) 60%, transparent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-accent) 28%, transparent);
}
/* Computer 6/6/26 PM round 33: demote from giant green pill to a small
   ghost chip matching the Edit/Actions buttons in the details panel. Doug:
   create flow should land on the same surface as opening an existing
   space, not show a banner-sized CTA at the top. Enter in the name input
   also submits (handler in rail-settings.js). */
.rail-settings__create-btn {
  flex: 0 0 auto;
  margin-left: 8px;
  padding: 5px 12px;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1;
  min-height: 28px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--color-text) 22%, transparent);
  background: transparent;
  color: color-mix(in srgb, var(--color-text) 78%, transparent);
  cursor: pointer;
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}
.rail-settings__create-btn:hover {
  background: color-mix(in srgb, var(--color-text) 8%, transparent);
  color: var(--color-text);
  border-color: color-mix(in srgb, var(--color-text) 35%, transparent);
}
.rail-settings__create-btn:disabled {
  opacity: 0.55;
  cursor: default;
}
@media (max-width: 720px) {
  .rail-settings__header { padding: 8px 12px; }
  /* Mobile: drop the 60px chevron gutter (line ~3525) so the detail space
     CENTERS like the chat page instead of sitting in a reserved left column.
     The chevrons are fixed-position; with the gutter gone they float OVER the
     brief's left edge (hiding a sliver of text) — the desired trade on the
     wrapper where horizontal space is scarce. Match padding-left to the
     existing padding-right (clamp) so the two margins are symmetric. Needs the
     same (0,2,1) specificity as 3525 and comes later, so it wins. */
  body.rail-settings-open .rail-settings__body {
    padding-left: clamp(16px, 4vw, 36px);
  }
  .rail-settings__body {
    padding: 14px 14px calc(18px + env(safe-area-inset-bottom, 0px));
    /* Lock the brief/detail panel to vertical scrolling on phones. The base
       rule is overflow:auto (both axes); on touch any child a hair wider than
       the panel let the WHOLE column pan side-to-side ("the brief moves like a
       chunk"). It should only go up/down — clip the horizontal axis and stop
       horizontal scroll-chaining so a diagonal swipe reads as a vertical scroll.
       Scoped to the phone breakpoint so a wide admin table on desktop can still
       scroll horizontally under the base overflow:auto. */
    overflow-x: hidden;
    overscroll-behavior-x: none;
  }
  .rail-settings__title { font-size: 1.05rem; }
  .rail-settings__spacer { flex: 0 0 56px; }
  .rail-settings__title-input { font-size: 1rem; padding: 5px 8px; }
  .rail-settings__create-btn { padding: 4px 10px; font-size: 0.78rem; min-height: 26px; }
}

/* ---- [+] buttons ---- */
/* Per-row subspace [+] sits in the next depth column; bottom-row new-space [+]
   sits in column 2 (under Journal). Same visual treatment; hover-revealed
   neighbors of pills, always-visible for the bottom flat-add. */
.space-rail__add {
  appearance: none;
  -webkit-appearance: none;
  border: 1px dashed color-mix(in srgb, var(--color-text) 22%, transparent);
  background: transparent;
  color: color-mix(in srgb, var(--color-text) 60%, transparent);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* c148 (Doug 6/19/26): "maybe make it represent more space visually".
     Bumped 26 -> 32px so the [+] reads as a real target, not a whisper. */
  width: 32px;
  height: 32px;
  border-radius: 999px;
  padding: 0;
  transition: opacity 140ms ease, background-color 140ms ease, color 140ms ease, border-color 140ms ease;
  opacity: 0.5;
  /* c147 (Computer 6/7/26 AM round 18): left-justify for uniformity.
     Doug walked through center-attempts (r86 = center in column, r87 =
     under-parent-on-new-row, r89 = min-content columns), all had
     tradeoffs because the rail is a single shared grid -- column N's
     width is dominated by whichever row has the longest content there
     (e.g. "new space" pushing col 2 wider for everyone). Left-justify
     pins every [+] to a predictable x-offset per column. Doug:
     "left justified is maybe the best? We could do that to journal
     too for consistency." Flat-add below now centers in its column
     (under Journal) per c148. */
  justify-self: start;
}
.space-rail__add:hover {
  background: color-mix(in srgb, var(--color-text) 8%, transparent);
  color: var(--color-text);
  border-color: color-mix(in srgb, var(--color-text) 35%, transparent);
  opacity: 1;
}
/* c163 (Doug 6/19/26): the hover-reveal contextual [+] is retired. On
   mobile there's no hover, which left iPhone Firefox with no way to
   create a space at all (and Doug's read: a tap on a pill was probably
   landing on the surrounding [+] geometry, opening the add-sub modal
   instead of navigating). Replaced by a single permanent .space-rail__forge
   button below the rail -- drag it onto a pill (or drag a pill onto it)
   to declare parentage; tap alone = top-level. The old .space-rail__add
   visuals are kept in markup tolerance only (legacy plus-sub/plus-flat
   cells are no-ops in space-rail.js's render fn) and force-hidden so
   they can never light up again. */
.space-rail__add {
  display: none !important;
}
.space-rail__add--flat {
  /* c148 -> c152 (Doug 6/19/26): plus-flat was centered under Journal at
     rows[1][0]; c152 moves it to a new bottom row at col 1 (under the
     last top-level space, where the new space would actually land).
     Left-justify so it aligns with the space pills above it -- that is
     where the new pill will appear on click. */
  justify-self: start;
}

/* ---- Toast ---- */
.space-rail__toast {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--color-text);
  color: var(--color-bg);
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 1;
}
.space-rail__toast.is-visible {
  opacity: 0.95;
  transform: translateX(-50%) translateY(0);
}

/* ---- c163: Forge (permanent drag-me button) ---- */
/* The forge sits at the bottom of the rail aside, BELOW the list. It is
   the only path to creating a new space on mobile (and replaces the
   hover-revealed [+] on desktop too -- unify everywhere per Doug). The
   pill body says "drag me" so the gesture is discoverable; tap alone
   creates a top-level space (no parent). Visual language: dashed border
   like the old [+] so the muscle memory carries over, but wide enough to
   read the label without truncation. */
.space-rail__forge {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 10px 6px 4px;
  padding: 6px 12px;
  border: 1px dashed color-mix(in srgb, var(--color-text) 30%, transparent);
  background: transparent;
  color: color-mix(in srgb, var(--color-text) 70%, transparent);
  border-radius: 999px;
  font: 500 0.78rem/1 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0.02em;
  cursor: grab;
  /* touch-action: none keeps iOS Firefox from scrolling the page while
     a drag candidate is in flight -- without this the gesture often
     became a vertical scroll mid-drag. */
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  transition:
    background-color 160ms ease,
    color 160ms ease,
    border-color 160ms ease,
    transform 160ms ease,
    opacity 160ms ease;
}
.space-rail__forge:hover {
  background: color-mix(in srgb, var(--color-text) 7%, transparent);
  color: var(--color-text);
  border-color: color-mix(in srgb, var(--color-text) 45%, transparent);
}
.space-rail__forge:focus-visible {
  outline: 2px solid color-mix(in oklab, var(--color-primary) 70%, transparent);
  outline-offset: 2px;
}
.space-rail__forge:active { cursor: grabbing; transform: scale(0.97); }
.space-rail__forge-plus {
  font-size: 1rem;
  line-height: 1;
  font-weight: 600;
  opacity: 0.85;
}
.space-rail__forge-label {
  font-size: 0.78rem;
}

/* Pills participate in drag, so they need the same touch-action gate.
   Without it iOS Firefox happily scrolls the rail vertically when the
   user starts a pill-drag. */
.space-rail__row {
  touch-action: none;
}

/* While a drag is in flight: source element fades, valid drop targets
   glow, the active drop target glows brighter. */
.space-rail__forge.is-drag-source,
.space-rail__row.is-drag-source {
  opacity: 0.45;
}
.space-rail__forge.is-drop-target,
.space-rail__row.is-drop-target {
  outline: 1px dashed color-mix(in srgb, var(--color-primary) 60%, transparent);
  outline-offset: 2px;
  background: color-mix(in srgb, var(--color-primary) 8%, transparent);
}
.space-rail__forge.is-drop-target-hot,
.space-rail__row.is-drop-target-hot {
  outline-color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 18%, transparent);
  color: var(--color-text);
}

/* The drag ghost follows the pointer. It's appended to <body> at
   drag-start and removed at drag-end. Positioned via translate so we
   don't fight layout. */
.space-rail__drag-ghost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10000;
  pointer-events: none;
  padding: 4px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-text) 92%, transparent);
  color: var(--color-bg);
  font: 500 0.78rem/1 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  white-space: nowrap;
  max-width: 60vw;
  overflow: hidden;
  text-overflow: ellipsis;
  /* Slight offset so the ghost doesn't sit directly under the finger. */
  will-change: transform;
}

/* Draggable spaces (reorder): while dragging a space pill over a sibling,
   a primary-coloured insertion line shows whether the drop will land ABOVE
   (is-reorder-before) or BELOW (is-reorder-after) that sibling. Drawn on a
   pseudo-element so it never disturbs the pill's own box. */
.space-rail__row.is-reorder-before,
.space-rail__row.is-reorder-after {
  position: relative;
}
.space-rail__row.is-reorder-before::before,
.space-rail__row.is-reorder-after::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  height: 2px;
  border-radius: 2px;
  background: var(--color-primary);
  pointer-events: none;
}
.space-rail__row.is-reorder-before::before { top: -3px; }
.space-rail__row.is-reorder-after::after { bottom: -3px; }

/* Draggable spaces (nest): dropping a space on the MIDDLE of another pill (or
   on Journal) re-parents it so it becomes a child to the right. The target
   glows solid to read as "this becomes the parent" -- deliberately distinct
   from the thin insertion line used for up/down reordering. */
.space-rail__row.is-nest-target {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  background: color-mix(in srgb, var(--color-primary) 20%, transparent);
  color: var(--color-text);
}

/* Mobile sizing: the forge is comfortable on narrow rails too. */
@media (max-width: 720px) {
  .space-rail__forge {
    margin: 8px 4px 4px;
    padding: 5px 10px;
    font-size: 0.74rem;
  }
  .space-rail__forge-label { font-size: 0.74rem; }
}

/* c168 (Doug 6/19/26): "something funny still going on... when I create a
   sub space of investing... it should go to the right.. (a column over)...
   it is going below". c167 spanned Journal across grid-row 1 / -1 but the
   space column still saw row-track inflation from col 1. Refactor: Journal
   + forge are now rendered OUTSIDE the grid as a sibling flex-column. The
   list element becomes flex-row, holding [journal-stack][spaces-grid].
   This structurally decouples col 1 from any grid row track. */
.space-rail__list {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 14px;
}
.space-rail__journal-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 auto;
}
.space-rail__journal-stack .space-rail__cell--journal {
  /* Journal pill still uses the standard cell layout (gear + pill row). */
  align-self: stretch;
}
.space-rail__forge--in-grid {
  /* Sits below Journal in the stack with vertical breathing room. */
  margin: 1.25em 0 0;
  align-self: center;
}
@media (max-width: 720px) {
  .space-rail__list {
    gap: 10px;
  }
  .space-rail__forge--in-grid {
    margin: 0.9em 0 0;
  }
}


/* ---- Mobile ---- */
/* On mobile the rail stays vertical (Doug's call: "we want the nesting
   inside the vertical"), but we tighten label max-width and font so a
   2-3 deep chain still fits in narrow widths. The rail is right-anchored
   and sizes to content; the stage and compose dock keep their full width
   underneath -- the rail overlays the right edge of the thread. */
@media (max-width: 720px) {
  .space-rail {
    padding: 8px 10px calc(10px + env(safe-area-inset-bottom, 0px));
    /* This 3-value shorthand set padding-top to a flat 8px, overriding the base
       rule's notch-aware top padding — so the OPEN rail's first row rode up
       under the taller iPhone header and clipped ("space header still getting
       cut"). When the eggshell top moved from `top:68+inset` to a plain `top:68`
       (the seam fix), the notch inset that used to drop the content was lost
       here, riding the first row up exactly one line. Restore it: 8px + inset
       reproduces the known-good drop, keeping the eggshell at 68px (no seam).
       env-in-a-longhand applies reliably on iOS (unlike the shorthand). */
    padding-top: calc(8px + env(safe-area-inset-top, 0px));
  }
  .space-rail__row {
    font-size: 0.76rem;
    padding: 4px 10px;
    min-height: 26px;
  }
  .space-rail__row .space-rail__label {
    max-width: 10ch;
  }
  .space-rail__add {
    /* c148: keep mobile a touch smaller than desktop's bumped 32px,
       but bigger than the old 24 so the touch target is honest. */
    width: 28px;
    height: 28px;
  }
  .space-rail__grid {
    /* c148: tighter than desktop's 14px but still loose enough to breathe. */
    column-gap: 8px;
    row-gap: 1px;
  }
  /* c90: bring the chevron a hair tighter so it doesn't crowd the header on
     mobile. + env(safe-area-inset-top): on a notched iPhone the header grows by
     the inset, but these flat 80/118px tops did not — so the chevron stack rode
     up into the header and cut off the date. Add the inset so the stack drops
     below the header row (date / moon / avatar), matching the header's shift. */
  .space-rail-toggle {
    top: calc(80px + env(safe-area-inset-top, 0px));
    left: 8px;
    width: 30px;
    height: 30px;
  }
  /* Maximize (resize) chevron: stack it directly under the back chevron on
     mobile. The desktop base puts it at 164px, but the back chevron is pulled
     up to 80px above and the resize toggle had NO mobile override — so it was
     stranded ~140px lower, floating down by the brief. Mirror the back
     chevron's mobile top (+ inset) + one button height + an 8px gap so the two
     read as one tight two-button stack that clears the notch header. */
  .space-rail-resize-toggle {
    top: calc(118px + env(safe-area-inset-top, 0px));   /* 80 + inset + 30 (button) + 8 (gap) */
    left: 8px;
    width: 30px;
    height: 30px;
  }
}

/* ---- Dark mode ---- */
/* c172 (Computer 6/6/26 PM round 31): Doug -- "Directory tab probably should
   blend with the header... like we have on light mode." The previous
   tinted overlay (bg 92% + text 8%) intentionally made the rail slightly
   LIGHTER than the header so it would read as a card. In light mode the
   rail uses var(--color-bg) flat and seamlessly blends into the header --
   we want the same in dark mode. Drop the tint and let the rail inherit
   var(--color-bg) from the base rule so it matches the dark site-header
   exactly, and drop the explicit borders that were stamping a card edge. */
[data-theme='dark'] .space-rail {
  background: var(--color-bg);
  border-right-color: transparent;
  border-bottom-color: transparent;
}
[data-theme='dark'] .space-rail-toggle {
  background: color-mix(in srgb, var(--color-bg) 92%, var(--color-text) 8%);
  border-color: color-mix(in srgb, var(--color-text) 20%, transparent);
  color: color-mix(in srgb, var(--color-text) 78%, transparent);
}
[data-theme='dark'] .space-rail-toggle:hover {
  background: color-mix(in srgb, var(--color-bg) 84%, var(--color-text) 16%);
  color: var(--color-text);
}
/* ============================================================================
   .rail-settings inherited styles (Computer 6/3/26 AM round 5, c96)
   ---------------------------------------------------------------------------
   Extracted from spaces.html's inline <style> block (lines 267-815) and
   scoped under .rail-settings so the slide-over overlay on index.html
   and space.html renders identically to the original admin page.
   Doug 6/3/26 AM: "This page was actually pretty clean... we want it as
   close to that as possible, design wise."
   ========================================================================== */

.rail-settings .chip {
  display: inline-block;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--color-text-faint);
  color: var(--color-text-muted);
}

.rail-settings .chip.role-admin {
  border-color: var(--color-primary); color: var(--color-primary);
}

.rail-settings .chip.role-collaborator {
  border-color: var(--color-text-muted); color: var(--color-text);
}

.rail-settings .chip.role-viewer {
  border-color: var(--color-text-faint);
}

.rail-settings .mini-btn {
  background: none;
  border: 1px solid var(--color-text-faint);
  border-radius: 8px;
  padding: 4px 10px;
  font: inherit;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  cursor: pointer;
}

.rail-settings .mini-btn:hover {
  color: var(--color-text); border-color: var(--color-text-muted);
}

.rail-settings .mini-btn.is-primary {
  color: var(--color-primary); border-color: var(--color-primary);
}

.rail-settings .mini-btn.is-danger:hover {
  color: crimson; border-color: crimson;
}

.rail-settings .btn--danger {
  background: transparent;
  color: crimson;
  border: 1px solid crimson;
}

.rail-settings .btn--danger:hover {
  background: crimson; color: #fff;
}

.rail-settings .detail-danger {
  margin: var(--space-3) 0 var(--space-4);
  padding: var(--space-3);
  border: 1px dashed var(--color-text-faint);
  border-radius: 8px;
}

.rail-settings .detail-danger .sub {
  color: var(--color-text-muted);
}

.rail-settings .empty {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  padding: var(--space-3) 0;
}

.rail-settings .detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

@media (min-width: 760px) {
  .rail-settings .detail-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.rail-settings .member-row,
.rail-settings .invite-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-text-faint);
  align-items: center;
}

.rail-settings .member-row:last-child,
.rail-settings .invite-row:last-child {
  border-bottom: none;
}

.rail-settings .member-row__name,
.rail-settings .invite-row__email {
  font-size: var(--text-sm);
  color: var(--color-text);
}

.rail-settings .member-row__email,
.rail-settings .invite-row__meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.rail-settings .row-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.rail-settings .role-select {
  background: transparent;
  border: 1px solid var(--color-text-faint);
  border-radius: 8px;
  padding: 4px 8px;
  font: inherit;
  font-size: var(--text-xs);
  color: var(--color-text);
}

.rail-settings .invite-form {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: var(--space-2);
  margin-top: var(--space-3);
  align-items: stretch;
}

.rail-settings .invite-form select.input {
  width: auto;
}

/* Doug 10/4/26: invite-to-Gabriel form has no role select. */
.rail-settings .invite-form--gabriel {
  grid-template-columns: 1fr auto;
}

.rail-settings .invite-form .btn {
  white-space: nowrap; padding-left: var(--space-4); padding-right: var(--space-4);
}

.rail-settings .invite-link-result {
  margin-top: var(--space-2);
}

.rail-settings .invite-link-result__row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-2);
  align-items: stretch;
}

.rail-settings .invite-link-result__row .input {
  font-family: var(--font-mono, monospace); font-size: var(--text-sm);
}

.rail-settings .invite-link-result__hint {
  margin: var(--space-2) 0 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.rail-settings .status-line {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-3);
}

.rail-settings .status-line.is-error {
  color: crimson;
}

.rail-settings .status-line.is-ok {
  color: var(--color-primary);
}

/* Members + invite controls stack on phones. Both rows pack their action
   controls into a right-hand `auto` grid column (member row: role <select> +
   Remove; invite form: role <select> + Invite button) that overflowed the right
   edge on a narrow screen — Remove and Invite were sliced to "Rem" / "In". Drop
   the controls onto their own line, using the white space under the name/email
   (members) or under the email field (invite) instead of running off-screen.
   Placed AFTER the base .member-row / .invite-form definitions above so these
   equal-specificity overrides win by source order (media queries add none). */
@media (max-width: 720px) {
  .rail-settings .member-row {
    grid-template-columns: 1fr;
  }
  .rail-settings .member-row .row-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  /* .btn is `width: 100%` globally (line ~822); left as-is it stretches the
     Remove/Invite buttons to fill the flex line and overflow. Pin them to
     natural width so role-select + button sit side-by-side on their own line. */
  .rail-settings .member-row .row-actions .btn {
    width: auto;
  }
  .rail-settings .invite-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
  }
  /* Email takes its own full-width row; role <select> + Invite share the line
     below. min-width:0 defeats the flex default (min-width:auto), which would
     otherwise let each control's intrinsic width push past the panel and clip. */
  .rail-settings .invite-form input[type="email"] {
    flex: 1 1 100%;
    min-width: 0;
  }
  .rail-settings .invite-form select.input {
    flex: 0 1 auto;
    width: auto;
    min-width: 0;
  }
  .rail-settings .invite-form .btn {
    flex: 0 0 auto;
    width: auto;
  }
}

.rail-settings .inbox-list {
  list-style: none; padding: 0; margin: 0;
}

.rail-settings .inbox-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-text-faint);
  align-items: center;
}

.rail-settings .inbox-row:last-child {
  border-bottom: none;
}

.rail-settings .inbox-row__body {
  font-size: var(--text-sm);
}

.rail-settings .inbox-row__meta {
  font-size: var(--text-xs); color: var(--color-text-muted); margin-top: var(--space-1);
}

.rail-settings .gate {
  text-align: center; padding: var(--space-6); color: var(--color-text-muted);
}

.rail-settings .gate a {
  color: var(--color-text); text-decoration: underline; text-underline-offset: 3px;
}

.rail-settings .brief-block {
  margin: 0 0 var(--space-5);
  padding-bottom: var(--space-4);
  /* c109 (Computer 6/3/26 PM round 16): soft gradient divider between
     brief-blocks (Fixed Scope / Dynamic Scope / Files / Members) instead
     of the previous hard 1px line. The gradient fades to transparent at
     both ends so each section reads as its own breathing zone rather than
     being boxed in. Per Doug: "softer bleed versus a stark line for the
     directory as well as the detailed scope." */
  border-bottom: 1px solid transparent;
  border-image: linear-gradient(
    to right,
    transparent 0%,
    color-mix(in srgb, var(--color-text) 10%, transparent) 18%,
    color-mix(in srgb, var(--color-text) 10%, transparent) 82%,
    transparent 100%
  ) 1;
}
/* c166 (Computer 6/6/26 PM round 22): in journal mode the Files block is the
   last visible .brief-block (Members + Invitations are hidden -- c162). Its
   bottom divider read as an arbitrary line under "No files yet." with empty
   space below. Doug 6/6/26: "What if you just cut off the white screen below
   no files yet?" Strip the gradient divider AND the padding-bottom when the
   files-block is in journal scope so the panel ends cleanly at the empty
   state. Project mode (data-files-scope="project") keeps the divider because
   Members + Invitations follow it. */
.rail-settings .brief-block[data-files-scope="journal"] {
  border-bottom: none;
  border-image: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.rail-settings .brief-block__heading {
  font-family: var(--font-app);
  font-size: 1rem;
  font-weight: 500;
  margin: 0 0 var(--space-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  /* Computer 6/6/26 PM round 45: anchor for the absolutely-positioned
     title-pill slot so it centers in the row regardless of the flanking
     label and actions widths. */
  position: relative;
}
/* Computer 6/6/26 PM round 45: title-pill lives in the middle of the
   heading row. Absolute centering keeps it visually fixed even as the
   right-side actions cluster expands (Edit vs Save, Actions menu open). */
/* Computer 6/6/26 PM round 49: revert the r47 position:fixed approach.
   Now that r48 fixed the header (sides flow at content width, brand
   position:absolute at viewport 50%), the panel body container --
   which is centered on viewport via max-width 980px + margin auto --
   also sits at viewport 50%. So absolute-in-row positioning at left:50%
   correctly aligns the pill with the brand chip above. Plus the pill
   stays in the heading row visually (it was rendering disconnected
   when pulled out via position:fixed). */
.rail-settings .brief-block__heading-pill-slot {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  pointer-events: none;
}
.rail-settings .brief-block__heading-pill-slot > * {
  pointer-events: auto;
}

.rail-settings .brief-block__edit-toggle {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--color-text) 18%, transparent);
  border-radius: var(--radius-full, 999px);
  padding: 2px 10px;
  font-family: var(--font-app);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  line-height: 1.4;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.rail-settings .brief-block__edit-toggle:hover {
  color: var(--color-text);
  border-color: color-mix(in srgb, var(--color-text) 36%, transparent);
  background: color-mix(in srgb, var(--color-text) 4%, transparent);
}

.rail-settings .brief-block__edit-toggle[aria-expanded="true"] {
  background: var(--color-text);
  color: var(--color-text-inverse, #fff);
  border-color: var(--color-text);
}

.rail-settings .brief-block__edit-toggle.is-danger {
  color: crimson;
  border-color: color-mix(in srgb, crimson 50%, transparent);
}

.rail-settings .brief-block__edit-toggle.is-danger:hover {
  color: crimson;
  border-color: crimson;
  background: color-mix(in srgb, crimson 6%, transparent);
}

.rail-settings .brief-block__edit-toggle[disabled],
.rail-settings .brief-block__edit-toggle.is-locked {
  opacity: 0.55;
  cursor: not-allowed;
}

.rail-settings .brief-block__edit-toggle[disabled]:hover,
.rail-settings .brief-block__edit-toggle.is-locked:hover {
  color: var(--color-text-muted);
  border-color: color-mix(in srgb, var(--color-text) 18%, transparent);
  background: transparent;
}

.rail-settings .brief-block__lock-note {
  flex: 1 1 auto;
  text-align: right;
  font-family: var(--font-app);
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-style: italic;
}

.rail-settings .brief-block__lock-note .force-release {
  margin-left: var(--space-2, 6px);
  font-style: normal;
  text-decoration: underline;
  cursor: pointer;
  color: var(--color-text-muted);
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  font-family: inherit;
}

.rail-settings .brief-block__lock-note .force-release:hover {
  color: var(--color-text);
}

.rail-settings .brief-block__current {
  margin: 0 0 var(--space-3);
}

.rail-settings .brief-context {
  white-space: normal;
  color: var(--color-text);
  margin: 0 0 var(--space-2);
}

.rail-settings .brief-context--empty {
  color: var(--color-text-muted); font-style: italic;
}

/* Voice panel save status ("Saved."). */
.rail-settings .voice-status { color: var(--color-text-muted); font-size: 0.85rem; min-height: 1em; }

/* 2026-10-11: Voice panel dream words (read-only; Gabriel's latest <dream> set). */
.rail-settings .dream-words__meta { color: var(--color-text-muted); font-size: 0.85rem; }
.rail-settings .dream-words--empty { color: var(--color-text-muted); font-style: italic; }

/* Doug 10/4/26: JOURNAL_BRIEF_DEFAULT welcome text, shown only while the
   Journal brief is empty. Muted so it reads as a default, not saved content. */
.rail-settings .brief-context--default {
  color: var(--color-text-muted);
}

.rail-settings .brief-subhead {
  font-family: var(--font-app);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: var(--space-3) 0 var(--space-1);
}

.rail-settings .brief-task-list {
  margin: 0 0 var(--space-2);
  padding-left: 1.25rem;
}

.rail-settings .brief-task-list li {
  margin: 0 0 2px;
}

.rail-settings .brief-empty {
  color: var(--color-text-muted);
  font-style: italic;
  margin: 0 0 var(--space-2);
}

.rail-settings .brief-meta {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  margin: var(--space-2) 0 0;
}

.rail-settings .brief-block__editor,
.rail-settings .brief-block__history {
  margin-top: var(--space-3);
}

.rail-settings .brief-block__editor > summary,
.rail-settings .brief-block__history > summary {
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  padding: 4px 0;
}

.rail-settings .brief-block__editor[open] > summary,
.rail-settings .brief-block__history[open] > summary {
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.rail-settings .brief-block__editor.brief-block__editor--headless > summary,
.rail-settings .brief-block__history.brief-block__history--headless > summary {
  display: none;
}

.rail-settings .profile-form {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.rail-settings .profile-form .field {
  display: block; min-width: 0;
}

.rail-settings .profile-form .field__label {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 0 0 4px;
}

.rail-settings .profile-form .field__static {
  padding: 10px 12px;
  border: 1px solid var(--color-text-faint);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
}

.rail-settings .profile-form .field__hint {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 4px 0 0;
}

.rail-settings .profile-form .input,
.rail-settings .profile-form input.input,
.rail-settings .profile-form textarea.input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--color-text-faint);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
}

.rail-settings .profile-form textarea.input {
  resize: vertical;
}

.rail-settings .profile-form .profile-status {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.rail-settings .files-block__sub {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  margin: 0 0 var(--space-3);
}

.rail-settings .files-meter {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.rail-settings .files-meter__bar {
  flex: 1;
  height: 6px;
  background: var(--color-text-faint);
  border-radius: 3px;
  overflow: hidden;
  min-width: 80px;
}

.rail-settings .files-meter__fill {
  display: block;
  height: 100%;
  background: var(--color-text);
  transition: width 160ms ease;
}

.rail-settings .files-meter.is-full .files-meter__fill {
  background: #c0392b;
}

.rail-settings .files-list {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-3);
  display: grid;
  gap: var(--space-2);
}

.rail-settings .files-list__empty {
  color: var(--color-text-muted);
  font-style: italic;
  margin: 0 0 var(--space-3);
}

.rail-settings .file-card {
  border: 1px solid var(--color-text-faint);
  border-radius: 8px;
  background: var(--color-surface);
  padding: var(--space-2) var(--space-3);
}

.rail-settings .file-card__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.rail-settings .file-card__name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  text-align: left;
  color: var(--color-text);
  font: inherit;
  cursor: pointer;
  padding: 0;
}

.rail-settings .file-card__name:hover {
  text-decoration: underline; text-underline-offset: 3px;
}

.rail-settings .file-card__meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-left: var(--space-2);
  white-space: nowrap;
}

/* Image files in Files (Doug + CC 2026-08-14). Small square thumbnail on the
   left of the row; the name stays an <a> to the /raw bytes rather than the
   text-editor button, so clicking an image opens the picture. */
.rail-settings .file-card__thumb {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm, 6px);
  overflow: hidden;
  display: block;
  background: var(--color-surface-2, rgba(0,0,0,.05));
}
.rail-settings .file-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.rail-settings .file-card--image .file-card__name {
  text-decoration: none;
}
.rail-settings .file-form--image {
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border, rgba(0,0,0,.08));
}
.rail-settings .file-image__label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.rail-settings .file-card__actions {
  display: flex; gap: 4px;
}

/* "Attach" -- hands the file to the composer's attachment tray (Doug + CC
   2026-08-18). Sits left of the delete ×; deliberately quiet until hover so
   the row still reads as a list of files rather than a row of buttons. */
.rail-settings .file-card__attach {
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: var(--text-xs);
  line-height: 1;
  padding: 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
  transition: color .12s ease, border-color .12s ease;
}

.rail-settings .file-card__attach:hover:not(:disabled) {
  color: var(--color-text);
  border-color: var(--color-text-muted);
}

.rail-settings .file-card__attach:disabled {
  opacity: .6;
  cursor: default;
}

.rail-settings .file-card__remove {
  border: 0;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 6px;
}

.rail-settings .file-card__remove:hover {
  color: #c0392b;
}

.rail-settings .file-card__editor {
  margin-top: var(--space-2);
  display: grid;
  gap: var(--space-2);
}

.rail-settings .file-card__editor[hidden] {
  display: none;
}

.rail-settings .file-form {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px dashed var(--color-text-faint);
  border-radius: 8px;
  background: var(--color-surface);
  margin: 0 0 var(--space-3);
}

.rail-settings .file-form input.input,
.rail-settings .file-form textarea.input {
  width: 100%;
  box-sizing: border-box;
}

.rail-settings .file-form textarea.input {
  min-height: 140px; resize: vertical;
}

.rail-settings .file-form__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.rail-settings .files-status {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  min-height: 1.2em;
  margin: 0;
}

.rail-settings .files-status.is-error {
  color: #c0392b;
}

.rail-settings .files-status.is-ok {
  color: #2a7d4f;
}

.rail-settings .brief-form {
  display: grid; gap: var(--space-3); margin-top: var(--space-2);
}

.rail-settings .brief-field {
  display: block;
}

.rail-settings .brief-field__label {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 0 0 4px;
}

.rail-settings .brief-field__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin: 0 0 4px;
}

.rail-settings .brief-field__header .brief-field__label {
  margin: 0;
}

/* Doug 2026-07-23: Save + Add grouped at the right of the Tasks header so task
   edits/reorders can be saved without scrolling to the top Save button. */
.rail-settings .brief-field__header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rail-settings .brief-form textarea:not(.brief-task__input) {
  /* c153 (Computer 6/6/26 AM round 11): scope textarea (the only thing
     this selector matches) starts at a single line and grows as the user
     types -- same model as task bubbles. Computer 6/6/26 PM round 34:
     Doug wants a single-row scope that auto-grows ("Tasks already works
     on this basis. Should be the same."). Removed the 17rem floor and
     resize handle; JS autoGrowField sizes it from scrollHeight. */
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--color-text-faint);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  resize: none;
  overflow: hidden;
  min-height: 36px;
  line-height: 1.5;
  box-sizing: border-box;
}

.rail-settings .brief-tasks {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-2);
  display: grid;
  gap: 6px;
}

.rail-settings .brief-task {
  /* Doug 2026-07-23: a drag handle leads each task so the list can be reordered
     by priority. Columns: grip (auto) · input (1fr) · remove (auto). */
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
}

/* Drag handle — grip dots, quiet until the row is hovered, grab cursor. */
.rail-settings .brief-task__drag {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  color: color-mix(in srgb, var(--color-text) 35%, transparent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 2px;
  cursor: grab;
  border-radius: 6px;
  flex-shrink: 0;
  /* touch-action: none so a drag on the grip doesn't scroll the panel on
     touch (matters for the mobile wrapper). */
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  transition: color 140ms ease, background-color 140ms ease;
}
.rail-settings .brief-task:hover .brief-task__drag,
.rail-settings .brief-task__drag:focus-visible {
  color: color-mix(in srgb, var(--color-text) 60%, transparent);
}
.rail-settings .brief-task__drag:hover {
  color: var(--color-text);
  background: color-mix(in srgb, var(--color-text) 8%, transparent);
}
.rail-settings .brief-task__drag:active { cursor: grabbing; }
.rail-settings .brief-task__drag:focus-visible {
  outline: 2px solid color-mix(in oklab, var(--color-primary) 70%, transparent);
  outline-offset: 2px;
}

/* The row being dragged: lift it with a subtle shadow + primary tint so it
   reads as picked-up while it moves through the list. */
.rail-settings .brief-task.is-dragging {
  background: color-mix(in srgb, var(--color-primary) 8%, var(--color-surface));
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  border-radius: 8px;
  position: relative;
  z-index: 2;
}

.rail-settings .brief-task__bullet {
  color: var(--color-text-muted);
}

.rail-settings .brief-task__input {
  /* c151 (Computer 6/6/26 AM round 9): task textareas. line-height + display
     block keep the one-line bubble compact; box-sizing so padding doesn't
     pile onto the JS-set height; min-height set to one line at this font/lh
     so initial render (before autoGrowTask has measured) doesn't show the
     UA-default ~150-200px textarea height. */
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--color-text-faint);
  border-radius: 6px;
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  line-height: 1.35;
  display: block;
  box-sizing: border-box;
  min-height: 32px;
}

.rail-settings .brief-task__remove {
  border: 0;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0 6px;
}

/* c172 (Computer 6/6/26 PM round 30): Doug -- "that saved section with two
   lines around it... seems like valuable real estate being used for no
   reason. It only exists on edit." The Save button was hidden in c148
   (the heading-row Save is the only entry now), leaving this sticky bar
   as a dead container holding only the transient status text. Strip the
   sticky pin, the border-top, the surface background, and the margins so
   it occupies zero vertical space when the status is empty. Status text
   still renders inline when present (and auto-clears -- see rail-settings
   .status-line:empty rule below + JS auto-clear in rail-settings.js). */
.rail-settings .brief-form__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: 0;
  margin: 0;
}
/* Empty status line takes no layout space; the .brief-form__actions row
   collapses to zero height when both children (status + hidden Save) are
   empty. */
.rail-settings .status-line:empty {
  display: none;
}

/* The old .brief-history / __entry / __meta rules that lived here were dead:
   nothing in js/ or any HTML referenced them (they styled the multi-row brief
   list from before Doug's 5/26/26 "one row per project" change). Removed with
   c178, which reuses the .brief-history name for the real history pane -- the
   stale `display: grid` here was being applied to c178's <details> element and
   breaking its disclosure layout. New rules live further down this file. */

/* ---------------------------------------------------------------------------
   .reckoning-trigger — header pill that triggers reckoning on the active chat
   (Computer 6/3/26 AM round 8, c99 -- moved right; crimson+gold restored).
   ---------------------------------------------------------------------------
   Doug 6/3/26 AM round 1 (c97): "bring it out of the admin space and onto
   active chat... put it beside the moon in the top left."
   Doug 6/3/26 AM round 2 (c99): "actually lets move reckoning to the right,
   it competes with the date..... right beside user name. Also same coulours
   as before."

   The button now lives in .site-header__side--right immediately before the
   auth-slot, so it sits flush against the user pill. It inherits the full
   crimson+gold palette via the .mobile-nav__row--reckon class on the same
   element (palette tokens defined at :root / [data-theme='dark']). The only
   thing this rule does is override the drawer-row width:100% / horizontal
   padding so the row becomes a compact header pill that hugs its content.

   The label still uses the display-font small-caps spec from
   .mobile-nav__row--toggle .mobile-nav__row-label so RECKONING reads as a
   sibling of PLAYGROUNDS ADMIN / TIME FILTER in the drawer.

   data-members-only -> auth.js auto-unhides on signed-in confirmation.
   data-reckon-btn  -> chat.js's delegated click handler fires reckoning.
   =========================================================================== */
.reckoning-trigger {
  /* Override .mobile-nav__row--toggle's width:100% so the row stops trying
     to span the drawer width. Compact pill geometry, fixed height to match
     the moon and auth-pill on the right side. */
  width: auto;
  height: 32px;
  padding: 0 12px;
  gap: 6px;
  /* Inherit border-radius from a pill, not the rounded square the drawer
     row uses. */
  border-radius: var(--radius-full, 999px);
  /* Allow flex parent (site-header__side--right) to size us naturally. */
  flex: 0 0 auto;
  /* Don't push the crimson background to the rest of the header. */
  align-self: center;
}
.reckoning-trigger[hidden] { display: none !important; }
/* Mobile: drop the label, icon-only chip so the header doesn't crowd the
   user pill on narrow viewports. The crimson backdrop still reads as
   "this is the reckoning affordance". */
@media (max-width: 720px) {
  .reckoning-trigger { padding: 0 10px; gap: 0; }
  .reckoning-trigger .mobile-nav__row-label { display: none; }
}

/* ---------------------------------------------------------------------------
   Time-filter pill (Computer 6/3/26 AM round 8, c99)
   ---------------------------------------------------------------------------
   Doug 6/3/26 AM: "then collapse time filter." The previous Time filter
   block burned half the panel width: a heading row above a full-width
   .mobile-nav__row that just showed CURRENT / Today / chevron. We collapse
   that into a single header row -- label on the left, pill+dropdown on the
   right -- using the same pattern as .brief-field__header (the Tasks "Add"
   pill row).

   The pill reuses .mini-btn (inherited via the class on the button) so it
   matches Edit / New / Add geometry across the panel. The dropdown menu
   anchors below it via the existing .mobile-nav__sub container; we just
   tighten its position so it floats under the pill rather than spanning
   the row width.
   =========================================================================== */
.rail-settings .brief-block--inline {
  /* The default .brief-block has margin-bottom: var(--space-5). When the
     block is a single inline row instead of a heading+body stack, the big
     gap below reads as too much air. Tighten by one notch. */
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
}
/* c103 (Computer 6/3/26 AM round 10): two-pill row. Time pill sits left,
   Actions pill sits right. Each is its own brief-block--inline; the row
   gives them a horizontal layout instead of stacking. Each block keeps its
   own bottom border so they read as siblings, not a single merged unit. */
.rail-settings .rail-actions-row {
  display: flex;
  gap: var(--space-3);
  align-items: stretch;
  margin-bottom: var(--space-4);
}
.rail-settings .rail-actions-row .brief-block--inline {
  /* Inside the flex row, each block should fill its share but not balloon. */
  flex: 1 1 50%;
  min-width: 0;
  margin-bottom: 0;
  padding-bottom: var(--space-3);
}
.rail-settings .rail-actions-row .brief-block__heading {
  /* Heading row's children stay aligned even when the block is narrow. */
  gap: var(--space-2);
}
.rail-settings .rail-actions-row .time-filter-menu {
  /* Each block is half-width; let the menu match that width instead of
     capping at 280px (which would overflow on the narrower column). */
  max-width: none;
}
@media (max-width: 480px) {
  /* On very narrow rails, stack the two pills so neither gets squeezed. */
  .rail-settings .rail-actions-row { flex-direction: column; }
  .rail-settings .rail-actions-row .brief-block--inline { flex: 1 1 auto; }
}
.rail-settings .time-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  /* mini-btn already provides padding/border/radius; just sit alongside. */
}
.rail-settings .time-filter-pill__value {
  /* The current selection ("Today", "Yesterday", "Jun 2 -- Jun 2"). Same
     muted small-caps spec as .mobile-nav__row-value so it matches the
     drawer aesthetic. */
  font-family: var(--font-app);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text);
}
.rail-settings .time-filter-pill__chev {
  flex: 0 0 10px;
  color: var(--color-text-muted);
}
.rail-settings .time-filter-pill[aria-expanded="true"] .time-filter-pill__chev {
  transform: rotate(180deg);
}
.rail-settings .time-filter-menu {
  /* When the menu opens, position it relative to the heading row's right
     edge so it doesn't stretch across the whole panel. */
  margin-top: var(--space-2);
  max-width: 280px;
  margin-left: auto;
  border: 1px solid var(--color-text-faint);
  border-radius: 10px;
  background: var(--color-surface);
  padding: 6px;
  box-shadow: 0 8px 24px -16px rgba(0,0,0,0.18);
}
/* c100 (Computer 6/3/26 AM round 8): unified Actions menu styling.
   The same menu container now holds time picks at top + admin actions
   below a divider. Admin items follow the same .mobile-nav__sub-item
   geometry; the divider is a hairline rule between the two groups. */
.rail-settings .rail-actions__divider {
  height: 1px;
  background: var(--color-text-faint);
  margin: 6px 4px;
  border: 0;
  opacity: 0.6;
}
.rail-settings .rail-actions__menu .mobile-nav__sub-item.is-danger {
  color: var(--color-danger, #b3261e);
}
.rail-settings .rail-actions__menu .mobile-nav__sub-item.is-danger:hover {
  background: rgba(179, 38, 30, 0.08);
}
[data-theme='dark'] .rail-settings .rail-actions__menu .mobile-nav__sub-item.is-danger {
  color: #ff8a80;
}
[data-theme='dark'] .rail-settings .rail-actions__menu .mobile-nav__sub-item.is-danger:hover {
  background: rgba(255, 138, 128, 0.10);
}

/* c104/c105 (Computer 6/3/26 AM round 11/12): inline Fixed Scope heading
   buttons. c105 folds the Time pill into this same heading row, to the left
   of the Edit dropdown, so both wraps share the right-side cluster. Doug:
   "the time has to go down into the fixed context field. To the left of
   that edit button. saves screen space." */
.rail-settings .brief-block__actions-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
/* c105 fix (Computer 6/3/26 AM round 12 retry): push the actions cluster to
   the right edge. The earlier :first-of-type selector matched the wrong
   <span> (Fixed Scope title) because :first-of-type matches by tag name,
   not class. Use class selectors instead.

   Fixed Scope heading order: [title] [lock-note] [Time wrap] [Edit wrap]
   - .brief-block__actions-wrap--time gets margin-left:auto -> pushes Time
     and everything after it to the right edge.
   - The adjacent-sibling rule adds a small gap between Time and Edit.
   Dynamic Scope heading has a bare <button> (not a wrap) so the parent's
   justify-content:space-between handles it already. */
.rail-settings .brief-block__heading .brief-block__actions-wrap--time {
  margin-left: auto;
}
.rail-settings .brief-block__heading .brief-block__actions-wrap--time + .brief-block__actions-wrap {
  margin-left: var(--space-2);
}
.rail-settings .brief-block__heading .brief-block__actions-wrap .time-filter-pill {
  /* Sit at heading-button scale so it matches the old "Edit" pill geometry. */
  font-size: 0.7rem;
  padding: 4px 8px;
}
.rail-settings .rail-actions__menu--inline {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 20;
  min-width: 160px;
  margin-top: 0;
  margin-left: 0;
}

/* ---------------------------------------------------------------------------
   c110 (Computer 6/3/26 PM round 17): Reckoning shrunk to icon-only AND
   Time filter relocated to the chat header.
   ---------------------------------------------------------------------------
   Doug: "sign in to the far right, time filter to the left of it, scales
   symbol to the left of that. Should all fit on mobile. Also make reckoning
   smaller too. Just the scales."

   - .reckoning-trigger--compact: icon-only at ALL viewports (the existing
     @media (max-width: 720px) rule above only hid the label on mobile; this
     modifier makes it permanent so the desktop header matches mobile).
   - .header-time-block: relative position so the menu drops below the pill;
     thin vertical separators between it and its neighbors via the parent
     .site-header__side--right's existing gap.
   - .header-time-menu: absolute drop-down positioned RIGHT-aligned to the
     pill (the menu can be wider than the pill itself when Custom range is
     expanded, so right-alignment keeps it from spilling off-screen).
   --------------------------------------------------------------------------- */
.reckoning-trigger--compact {
  padding: 0 10px;
  gap: 0;
}
.reckoning-trigger--compact .mobile-nav__row-label {
  display: none;
}

.header-time-block {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.header-time-block[hidden] {
  display: none !important;
}
.header-time-block .time-filter-pill {
  /* Match the .reckoning-trigger's 32px geometry so the three header chips
     (scales / time / sign-in) all sit on the same baseline. */
  height: 32px;
  border-radius: var(--radius-full, 999px);
  white-space: nowrap;
}
.header-time-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: auto;
  z-index: 50;            /* above wings/halo but below modal overlays */
  min-width: 180px;
  max-width: 280px;
  margin: 0;
  border: 1px solid var(--color-text-faint);
  border-radius: 10px;
  background: var(--color-surface);
  padding: 6px;
  box-shadow: 0 8px 24px -8px rgba(0,0,0,0.22);
}

/* Mobile: keep the Time pill compact so all three header chips fit. The
   pill's label ("Today" / "Jun 3" / "Jun 3 — Jun 5") can grow long, so we
   clamp the value width and let it truncate with an ellipsis. */
@media (max-width: 720px) {
  .header-time-block .time-filter-pill {
    padding: 0 10px;
  }
  .header-time-block .time-filter-pill__value {
    max-width: 9ch;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .header-time-menu {
    min-width: 200px;
  }
}



/* ---------------------------------------------------------------------------
   c171 (Computer 6/19/26 PM round 1) — heading-row button consistency
   ---------------------------------------------------------------------------
   Doug: "remove (scope & tasks) and replace it with the detailed space
   heading... make it a button like actions (make it clear to the user he
   can click it... and also make it consistent with what we have. Also edit,
   actions, and project name should all have consistency in size, shape,
   and font."

   Three changes:
   1) The space-name pill (rendered by paintTitle into [data-brief-heading-pill])
      moves from the CENTERED slot to the LEFT slot where "Scope & Tasks" used
      to live. The --left modifier on the slot drops the absolute centering
      so the button sits in normal flow on the left edge of the row.
   2) When the pill (.rail-settings__title.is-pill) renders inside that left
      slot, it adopts .brief-block__edit-toggle geometry/font so all three
      heading buttons read as the same primitive.
   3) The Actions pill (.time-filter-pill inside .brief-block__heading) is
      pulled off its small-caps/uppercase styling and pulled onto the same
      Inter 0.75rem mixed-case spec as Edit. Border-radius is set to the pill
      999px to match Edit's shape. -------------------------------------------- */

/* 1) Left-slot variant: static flow, no absolute centering. */
.rail-settings .brief-block__heading-pill-slot--left {
  position: static;
  left: auto;
  top: auto;
  transform: none;
  display: inline-flex;
  align-items: center;
  pointer-events: auto;
  /* Take the same flex role as the old "Scope & Tasks" span. */
  flex: 0 0 auto;
}

/* 2) When the title-pill renders inside the heading's left slot, override
      its centered-pill geometry to match .brief-block__edit-toggle exactly. */
.rail-settings .brief-block__heading-pill-slot--left .rail-settings__title.is-pill {
  margin: 0;
  max-width: none;
  padding: 2px 10px;
  gap: 5px;
  font-family: var(--font-app);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: normal;
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid color-mix(in srgb, var(--color-text) 18%, transparent);
  border-radius: var(--radius-full, 999px);
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.rail-settings .brief-block__heading-pill-slot--left .rail-settings__title.is-pill:hover {
  color: var(--color-text);
  border-color: color-mix(in srgb, var(--color-text) 36%, transparent);
  background: color-mix(in srgb, var(--color-text) 4%, transparent);
}
.rail-settings .brief-block__heading-pill-slot--left .rail-settings__title.is-pill:active {
  transform: translateY(1px);
}
/* Hide the inert dot inside the left-slot pill — it was an active-state
   carry-over from the centered pill and reads as noise next to Edit/Actions. */
.rail-settings .brief-block__heading-pill-slot--left .rail-settings__title-dot {
  display: none;
}

/* 3) Bring the Actions pill onto Edit's geometry/font. The existing rule at
      line 4978 set font-size 0.7rem and padding 4px 8px to "match the old
      Edit pill geometry" — but the actual Edit pill is 0.75rem / 2px 10px /
      Inter mixed-case. This block aligns Actions to that real spec. */
.rail-settings .brief-block__heading .brief-block__actions-wrap .time-filter-pill {
  padding: 2px 10px;
  border-radius: var(--radius-full, 999px);
  border: 1px solid color-mix(in srgb, var(--color-text) 18%, transparent);
  background: transparent;
  color: var(--color-text-muted);
  font-family: var(--font-app);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.rail-settings .brief-block__heading .brief-block__actions-wrap .time-filter-pill:hover {
  color: var(--color-text);
  border-color: color-mix(in srgb, var(--color-text) 36%, transparent);
  background: color-mix(in srgb, var(--color-text) 4%, transparent);
}
.rail-settings .brief-block__heading .brief-block__actions-wrap .time-filter-pill .time-filter-pill__value {
  font-family: var(--font-app);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
  color: inherit;
}


/* ---------------------------------------------------------------------------
   c173 (Computer 6/19/26 PM round 2) — detailed-space typography + chip
   ---------------------------------------------------------------------------
   Doug: "if we're on that space it should also be the same color as the pill.
   Also, all the pills and font should be the same throughout the detailed
   space. should match the text size of the textarea too. Heading can be
   maybe 1-2 points bigger. Should all be the same font."

   1) Left-slot space-name pill goes GOLD when it represents the currently-
      open space. Mirrors .current-space chip in the header so the user gets
      "you are here" signal at two anchor points.
   2) One font (Inter) everywhere inside the detailed space. Section headings
      (Files, Members, Invitations) bump from 1rem display-serif to 1.0625rem
      Inter. Body text size stays at 1rem (matches textarea content).
   3) One pill primitive for every clickable control. Inter 0.75rem 500,
      2px 10px padding, 999px radius, muted-border at rest, same hover lift.
      Targets: .mini-btn, .role-select, .invite-form .input, .btn--primary
      inside invite-form. The c172 spec for .brief-block__edit-toggle and
      .time-filter-pill stands; this block aligns the rest. ----------------- */

/* 1) ACTIVE-SPACE gold pill in the heading left slot. paintTitle() adds
      .is-current when selectedProject.id matches Active.getProjectId(). */
.rail-settings .brief-block__heading-pill-slot--left .rail-settings__title.is-pill.is-current {
  background: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary);
}
.rail-settings .brief-block__heading-pill-slot--left .rail-settings__title.is-pill.is-current:hover {
  background: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary);
  filter: brightness(1.06);
}
.rail-settings .brief-block__heading-pill-slot--left .rail-settings__title.is-pill.is-current:active {
  filter: brightness(0.96);
}

/* 2) SECTION HEADINGS (Files, Members, Invitations) and the brief-block
      heading row text: one font (Inter), heading slightly larger than body. */
.rail-settings__section-heading,
.rail-settings .brief-block__heading {
  font-family: var(--font-app);
  font-size: 1.0625rem;        /* ~+1pt over 1rem body */
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
}
/* Body context paragraph -- pin to Inter explicitly so it can't drift to
   the display serif via inheritance. */
.rail-settings .brief-context,
.rail-settings .brief-context--empty {
  font-family: var(--font-app);
  font-size: 1rem;
  line-height: 1.5;
}
/* Subhead labels (e.g. inside Scope detail) — same font, drop the uppercase
   small-caps to align with the rest of the panel. */
.rail-settings .brief-subhead {
  font-family: var(--font-app);
  text-transform: none;
  letter-spacing: normal;
}
/* Field labels inside the editor (Scope/Tasks "Scope" / "Tasks" small label) —
   same family so the editor reads consistent with the rest. */
.rail-settings .brief-field__label {
  font-family: var(--font-app);
}
/* files-block__sub ("Text Gabriel should keep handy in this space.") — same
   family, slightly muted, matches body. */
.rail-settings .files-block__sub {
  font-family: var(--font-app);
  font-size: 1rem;
}

/* 3) PILL PRIMITIVE applied to every clickable control inside the detailed
      space. Same spec as .brief-block__edit-toggle so the whole panel reads
      as one button family. */

/* 3a) .mini-btn — used by "Remove" rows in members list, etc. */
.rail-settings .mini-btn {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--color-text) 18%, transparent);
  border-radius: var(--radius-full, 999px);
  padding: 2px 10px;
  font-family: var(--font-app);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--color-text-muted);
  cursor: pointer;
  /* Pills are short labels — never let one wrap to two lines. On a narrow
     phone the "Suggestion pending:" pill was wrapping, making it taller than
     its neighbors and pinching the toolbar row. Keep every pill single-line. */
  white-space: nowrap;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.rail-settings .mini-btn:hover {
  color: var(--color-text);
  border-color: color-mix(in srgb, var(--color-text) 36%, transparent);
  background: color-mix(in srgb, var(--color-text) 4%, transparent);
}
.rail-settings .mini-btn.is-danger {
  color: crimson;
  border-color: color-mix(in srgb, crimson 50%, transparent);
}
.rail-settings .mini-btn.is-danger:hover {
  color: crimson;
  border-color: crimson;
  background: color-mix(in srgb, crimson 6%, transparent);
}
/* Private spaces (Doug + Claude Code 2026-09-01). The Private toggle rides
   .mini-btn for its shape and only overrides the ON state, so an open space's
   button reads as a peer of Edit / Nightly beside it and a private one reads as
   engaged. Scoped under .rail-settings and placed here with its siblings
   deliberately: `.rail-settings .mini-btn` above sets background:transparent at
   the same specificity, so an unscoped `.brief-block__privacy.is-on` earlier in
   the file loses the cascade and paints nothing. */
.rail-settings .mini-btn.brief-block__privacy.is-on {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-text-inverse);
}
.rail-settings .mini-btn.brief-block__privacy.is-on:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  color: var(--color-text-inverse);
}

/* The scope-detail toolbar (.brief-block__heading) packs the scope pill,
   Nightly select, Edit and Actions into one non-wrapping flex row. When a
   brief suggestion is pending it also injects "Suggestion pending: Approve
   Disregard Edit" — four more pills — which on a phone overflowed off the
   right edge (Approve clipped, Disregard/Edit off-screen entirely), so the
   pending action wasn't even discoverable. Let the toolbar wrap onto extra
   lines on phones so every pill stays visible. Placed after the base
   .brief-block__heading definitions so these equal-specificity overrides win
   by source order. */
@media (max-width: 720px) {
  /* Right-align every wrapped row (Doug 2026-08-02). The floating back/resize
     chevrons overlay the TOP-LEFT of the panel, so left-aligned pills sat right
     under them ("Doug & Pat" / "Nightly" clipped by the chevrons). Pushing the
     pills to the right edge keeps them clear of the chevron column. */
  .rail-settings .brief-block__heading {
    flex-wrap: wrap;
    justify-content: flex-end;
    row-gap: var(--space-2);
  }
  /* The actions cluster carries an inline `margin-left:auto`; once the row
     wraps that would shove the wrapped cluster back off the right edge, so
     override it (inline needs !important) and let the cluster (and the nested
     suggestion pills) flow/wrap right-aligned, clear of the chevrons. */
  .rail-settings .brief-block__heading-actions {
    margin-left: 0 !important;
    flex: 1 1 100%;            /* full-width line under the scope pill, so its
                                  pills have the whole width to lay out in */
    flex-wrap: wrap;
    justify-content: flex-end;
    row-gap: var(--space-2);
  }
  /* Group the pending-suggestion pills onto their own full-width line so the
     scope-Edit toggle and Actions wrap cleanly below them rather than getting
     sliced at the right edge. */
  .rail-settings .brief-block__suggestion-actions {
    flex: 1 1 100%;
    flex-wrap: wrap;
    justify-content: flex-end;
    row-gap: var(--space-2);
  }
}

/* 3b) .role-select — Admin / Collaborator / Viewer dropdown. */
.rail-settings .role-select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--color-text) 18%, transparent);
  border-radius: var(--radius-full, 999px);
  padding: 2px 22px 2px 10px;   /* extra right pad for native dropdown arrow */
  font-family: var(--font-app);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--color-text-muted);
  cursor: pointer;
  /* Native chevron via inline SVG so the control reads as a select even
     after we remove the UA appearance. */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 10px 10px;
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}
.rail-settings .role-select:hover {
  color: var(--color-text);
  border-color: color-mix(in srgb, var(--color-text) 36%, transparent);
  background-color: color-mix(in srgb, var(--color-text) 4%, transparent);
}

/* 3c) Email input inside the invite form — match pill geometry but keep
       the input affordance (slight bg tint, slightly larger pad for typing). */
.rail-settings .invite-form input.input[type="email"],
.rail-settings .invite-form input.input {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--color-text) 18%, transparent);
  border-radius: var(--radius-full, 999px);
  padding: 4px 12px;
  font-family: var(--font-app);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--color-text);
  transition: border-color 120ms ease, background-color 120ms ease;
}
.rail-settings .invite-form input.input::placeholder {
  color: var(--color-text-muted);
}
.rail-settings .invite-form input.input:hover,
.rail-settings .invite-form input.input:focus {
  border-color: color-mix(in srgb, var(--color-text) 36%, transparent);
  background: color-mix(in srgb, var(--color-text) 4%, transparent);
  outline: none;
}
/* The select inside invite-form already inherits .role-select above; force
   the input.role-select duo to the same height/baseline. */
.rail-settings .invite-form select.role-select {
  padding: 4px 22px 4px 12px;
}

/* 3d) Invite green button — keep primary signal color, adopt pill geometry
       and Inter font. */
.rail-settings .invite-form .btn,
.rail-settings .invite-form .btn--primary {
  appearance: none;
  -webkit-appearance: none;
  border-radius: var(--radius-full, 999px);
  padding: 4px 14px;
  font-family: var(--font-app);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
  /* keep brand green for primary action; matches signin etc. */
  background: #7aa86a;
  border: 1px solid #7aa86a;
  color: var(--color-text-inverse, #ffffff);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 120ms ease, border-color 120ms ease;
}
.rail-settings .invite-form .btn:hover,
.rail-settings .invite-form .btn--primary:hover {
  background: #5e8e52;
  border-color: #5e8e52;
}


/* ---------------------------------------------------------------------------
   c174 (Computer 6/19/26 PM round 3) — proportion pass on tasks + files
   ---------------------------------------------------------------------------
   Doug: "files txt looks bigger... tasks too" -- after c173 unified the font
   family, the size hierarchy collapsed because everything was inheriting 1rem
   from body. Tasks read at the same weight as Scope prose, the Files helper
   text matched body, and the file-form inputs / file-card content all sat at
   body size too. Establish hierarchy:

     Section heading (Files, Members, Invitations) ............ 1.0625rem  (c173)
     Body (.brief-context)  ..................................... 1rem      (c173)
     Tasks textarea + file-form input/textarea  ................. 0.9rem
     File card name (filename header in saved file)  ............ 0.9375rem
     Helper / sub text (files-block__sub)  ...................... 0.875rem
     Empty-state italic (No files yet.)  ........................ 0.875rem
     Meter readout (already var(--text-sm))  .................... unchanged

   Same font family throughout (Inter). Only the scale changes here. -------- */

/* Tasks textarea — match the brief body (.brief-context, 1rem/1.5) and the
   read-only task list (.brief-tasks--readonly li, which inherits 1rem). Doug
   2026-07-23: "editing they are normal size... after editing they are a larger
   size -- make them consistent with the brief." c174 had demoted this to 0.9rem
   for a size hierarchy, but that left the edit state smaller than both the saved
   display AND the brief, so the text jumped size on save. Same size in both
   states now. */
.rail-settings .brief-task__input {
  font-family: var(--font-app);
  font-size: 1rem;
  line-height: 1.5;
}
/* Read-only (saved) task list — pin to the same 1rem/1.5 as the edit textarea
   and the brief body. It was inheriting the panel's slightly-larger base
   (~16.9px), so a saved task rendered a touch bigger than both the brief and
   its own edit field. Now edit + display + brief all match exactly. */
.rail-settings .brief-tasks--readonly li {
  font-family: var(--font-app);
  font-size: 1rem;
  line-height: 1.5;
  /* Doug 2026-07-23: now that tasks match the brief's size, they read as more
     prose. Give each saved task a bullet so it's clearly a list item, distinct
     from the scope paragraphs above. list-style is none on .brief-tasks (it's a
     CSS grid), so draw the marker with ::before. */
  position: relative;
  padding-left: 1.15em;
}
.rail-settings .brief-tasks--readonly li::before {
  content: "•";
  position: absolute;
  left: 0.1em;
  top: 0;
  line-height: 1.5;          /* align the dot with the first text line */
  color: var(--color-primary);
}

/* File-form fields (name + body) — same scale as tasks. */
.rail-settings .file-form input.input,
.rail-settings .file-form textarea.input {
  font-family: var(--font-app);
  font-size: 0.9rem;
  line-height: 1.4;
}

/* File card name (filename header inside a saved file row) — slightly
   bigger than the body field so the card has its own internal heading. */
.rail-settings .file-card__name {
  font-family: var(--font-app);
  font-size: 0.9375rem;
}

/* Files helper text "Text Gabriel should keep handy in this space." Pull
   it back to muted helper size (c173 had pinned it to 1rem which made it
   compete with the body paragraph). */
.rail-settings .files-block__sub {
  font-size: 0.875rem;
}

/* Empty state ("No files yet.") — same muted helper size. */
.rail-settings .files-list__empty {
  font-family: var(--font-app);
  font-size: 0.875rem;
}

/* =============================================================================
   Mobile-wrapper readiness (Doug 2026-07-23)
   -----------------------------------------------------------------------------
   Audit ahead of wrapping the app in a mobile WebView/PWA. Horizontal overflow
   is already clean and every drag is Pointer-Events based; these close the
   remaining gaps: iOS focus-zoom, comfortable tap targets, and the drawer's
   status-bar clearance. Safe-area rules resolve to 0 in a normal browser and on
   non-notched devices (they engage once viewport-fit=cover is set, which it now
   is on every consumer page).
   ========================================================================== */

/* Mobile drawer clears the status bar / notch in a standalone wrapper. */
.mobile-nav__panel {
  padding-top: calc(var(--space-12) + env(safe-area-inset-top, 0px));
}

/* Touch-only refinements — scoped to coarse pointers so the desktop (fine
   pointer) layout and density are untouched. */
@media (pointer: coarse) {
  /* iOS zooms the whole page when a sub-16px field takes focus. Lift the real
     form inputs to 16px so focusing them doesn't yank the viewport. */
  .np-field input[type="text"],
  .np-field input[type="email"],
  .np-field textarea,
  .np-collab input,
  .np-collab select,
  .rail-settings .invite-form input.input,
  .rail-settings .role-select,
  .rail-settings .file-form input.input,
  .rail-settings .file-form textarea.input,
  .mobile-nav__date-input,
  .admin-overlay__search {
    font-size: 16px;
  }

  /* Comfortable thumb targets (~44px, Apple/Google guidance) on the smallest,
     most-tapped standalone controls. min-* only sets a floor. */
  .icon-btn,
  .chatbox__attach,
  .chatbox__send {
    min-width: 44px;
    min-height: 44px;
  }
  .signin-btn,
  .link-button,
  .site-header__brand {
    min-height: 44px;
  }

  /* Tight in-row controls: expand the hit area with a transparent overlay so
     the touch target grows without changing the visual size or reflowing the
     row (the narrow voice caret and the rail row chevron are the worst). */
  .space-rail__details,
  .chatbox__voice-caret {
    position: relative;
  }
  .space-rail__details::before,
  .chatbox__voice-caret::before {
    content: "";
    position: absolute;
    inset: -12px;
  }
}

/* ---------------------------------------------------------------------------
   Brief version history (c178, Claude Code 2026-09-14)

   Collapsible pane under the brief body listing the states the brief has held,
   newest first, each restorable. Deliberately quiet: muted, smaller than the
   brief itself, and visually subordinate to it. History is something you go
   looking for after something went wrong, not a second thing competing with
   the brief for attention every time the panel opens.
   --------------------------------------------------------------------------- */
.rail-settings .brief-history {
  margin: 0 0 var(--space-4, 16px);
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-2, 6px);
}

.rail-settings .brief-history__summary {
  display: flex;
  align-items: center;
  gap: var(--space-2, 6px);
  cursor: pointer;
  list-style: none;
  font-family: var(--font-app);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 0;
}
.rail-settings .brief-history__summary::-webkit-details-marker { display: none; }
.rail-settings .brief-history__summary:hover { color: var(--color-text); }

/* Disclosure triangle, drawn rather than relying on the native marker so it
   matches the rest of the rail's chrome and can rotate on open. */
.rail-settings .brief-history__summary::before {
  content: '';
  width: 0; height: 0;
  border-left: 4px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 120ms ease;
}
.rail-settings .brief-history[open] > .brief-history__summary::before {
  transform: rotate(90deg);
}

.rail-settings .brief-history__summary-hint {
  text-transform: none;
  letter-spacing: 0;
  opacity: 0.75;
}

.rail-settings .brief-history__body { padding: var(--space-2, 6px) 0 0; }

.rail-settings .brief-history__status {
  margin: 0 0 var(--space-2, 6px);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.rail-settings .brief-history__status.is-error { color: crimson; }
.rail-settings .brief-history__status.is-ok    { color: var(--color-primary); }

.rail-settings .brief-history__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.rail-settings .brief-history__item {
  padding: var(--space-2, 6px) 0;
  border-bottom: 1px solid var(--color-border);
}
.rail-settings .brief-history__item:last-child { border-bottom: none; }

.rail-settings .brief-history__head {
  display: flex;
  align-items: center;
  gap: var(--space-2, 6px);
}

/* The whole when/who line is the preview toggle, so the hit target is the
   row rather than a separate chevron. */
.rail-settings .brief-history__toggle {
  flex: 1 1 auto;
  display: flex;
  align-items: baseline;
  gap: var(--space-2, 6px);
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: var(--color-text);
  min-width: 0;
}
.rail-settings .brief-history__toggle:hover .brief-history__when { text-decoration: underline; }

.rail-settings .brief-history__when {
  font-size: var(--text-xs);
  color: var(--color-text);
  white-space: nowrap;
}

.rail-settings .brief-history__who {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-settings .brief-history__current-tag {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-style: italic;
  white-space: nowrap;
}

.rail-settings .brief-history__why {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* Word-level diff, straight from brief_edit_log's stored additions/removals.
   Colour is a secondary cue only -- the − and + signs carry the meaning, so
   this still reads correctly without colour vision. */
.rail-settings .brief-history__diff {
  margin-top: 4px;
  font-size: var(--text-xs);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 2px;
  word-break: break-word;
}
.rail-settings .brief-history__diff-run.is-removed { color: #b3261e; }
.rail-settings .brief-history__diff-run.is-added   { color: #1b6b3a; }
/* Dark mode: the light-theme red/green are too dark to read on #14130f.
   Lightened to sit at a similar contrast against the dark ground. */
[data-theme='dark'] .rail-settings .brief-history__diff-run.is-removed { color: #f2857c; }
[data-theme='dark'] .rail-settings .brief-history__diff-run.is-added   { color: #7fd6a0; }

.rail-settings .brief-history__preview {
  margin-top: var(--space-2, 6px);
  padding: var(--space-2, 6px);
  border-left: 2px solid var(--color-border);
  background: var(--color-surface-offset);
  border-radius: 0 6px 6px 0;
}

.rail-settings .brief-history__preview-scope {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--color-text);
  white-space: normal;
}
.rail-settings .brief-history__preview-scope.is-empty {
  color: var(--color-text-muted);
  font-style: italic;
}

.rail-settings .brief-history__preview-tasks {
  margin: var(--space-2, 6px) 0 0;
  padding-left: 1.1rem;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.rail-settings .brief-history__confirm {
  margin-top: var(--space-2, 6px);
  display: flex;
  align-items: center;
  gap: var(--space-2, 6px);
  flex-wrap: wrap;
  font-size: var(--text-xs);
  color: var(--color-text);
}
.rail-settings .brief-history__confirm-actions {
  display: inline-flex;
  gap: var(--space-2, 6px);
  margin-left: auto;
}

@media (max-width: 480px) {
  .rail-settings .brief-history__head { flex-wrap: wrap; }
  .rail-settings .brief-history__confirm-actions { margin-left: 0; }
}

/* Field label on a tasks diff row, so a task change reads distinctly from a
   scope rewrite when both land in the same version (c178). */
.rail-settings .brief-history__diff-field {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 2px;
}

/* ---------------------------------------------------------------------------
   Dream Space panel (2026-10-11; js/dream.js). A full-bleed image layer over
   the conversation, fitted between the header and the compose dock's top edge
   (js/dream.js), so the mic and send are never covered and voice keeps
   running. The button only appears for accounts in
   DREAM_LIVE_USERS. Motion is CSS only: dissolve with a blur through the
   middle, slow drift, a breathing haze.
   --------------------------------------------------------------------------- */
/* 2026-10-11 (Doug: "dream is hidden... it should draw the eye so people
   know it's there"): the one gold button in the header, like the Meditation
   badge, with a small star and a slow breathing glow. Reduce Motion keeps
   the gold and drops the glow. */
.dream-btn {
  font: inherit; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.05em;
  padding: 5px 14px 5px 12px; border-radius: var(--radius-full);
  border: 1px solid color-mix(in oklab, var(--color-primary, #b08a3e) 70%, #fff);
  background: linear-gradient(135deg, color-mix(in oklab, var(--color-primary, #b08a3e) 85%, #fff), var(--color-primary, #b08a3e));
  color: #fff; cursor: pointer;
  text-shadow: 0 1px 2px rgba(0,0,0,0.18);
  animation: dreamBtnBreathe 4.5s ease-in-out infinite;
}
.dream-btn::before { content: '\2726'; margin-right: 6px; font-size: 0.75em; opacity: 0.9; }
.dream-btn:hover { background: var(--color-primary-hover, #8c6c2c); }
.dream-btn[aria-pressed="true"] { animation: none; background: var(--color-primary-hover, #8c6c2c); }
@keyframes dreamBtnBreathe {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--color-primary, #b08a3e) 0%, transparent); }
  50%      { box-shadow: 0 0 14px 2px color-mix(in oklab, var(--color-primary, #b08a3e) 55%, transparent); }
}
@media (prefers-reduced-motion: reduce) { .dream-btn { animation: none; } }

.dream-space {
  position: fixed; left: 0; right: 0; bottom: 0; top: 0;
  z-index: 15; overflow: hidden;
  background: #0d0b0a;
}
.dream-space[hidden] { display: none; }
.dream-space__layer {
  position: absolute; inset: 0;
  opacity: 0; will-change: opacity, transform, filter;
}
/* The frame itself: an SVG <image> filling the layer (js/dream.js). */
.dream-space__svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; }
/* Durations, glow and mist come from the admin "Dream" settings via CSS
   variables set by js/dream.js; the values here are the defaults. */
.dream-space__layer.is-in  { animation: dreamSpaceIn var(--dream-fade, 6s) ease-in-out forwards; }
.dream-space__layer.is-out { animation: dreamSpaceOut var(--dream-fade, 6s) ease-in-out forwards; }
/* The melt's blur is the admin's Fade setting (--dream-fade-blur, js/dream.js). */
@keyframes dreamSpaceIn  { 0% { opacity: 0; filter: blur(var(--dream-fade-blur, 18px)) saturate(0.8) brightness(1.08); } 55% { filter: blur(calc(var(--dream-fade-blur, 18px) / 3)) brightness(1.04); } 100% { opacity: 1; filter: blur(0) saturate(1) brightness(1); } }
@keyframes dreamSpaceOut { 0% { opacity: 1; filter: blur(0); } 45% { filter: blur(calc(var(--dream-fade-blur, 18px) * 0.4)); } 100% { opacity: 0; filter: blur(var(--dream-fade-blur, 18px)) saturate(0.8); } }
/* Dream glow: a blurred, brightened copy of the same frame screened over it
   (the "half-remembered" bloom), breathing slowly. Blur is static; only
   opacity animates, which the phone composites cheaply. */
/* Haze (2026-10-11): a pre-blurred copy of the frame over the sharp one.
   Its opacity is the haze lane (--dream-haze-now, moved at random by
   js/dream.js), so the dream drifts in and out of focus. The blur radius
   is fixed per setting, which keeps it cheap on a phone. Above the frame,
   below the glow. */
.dream-space__layer::before {
  content: ''; position: absolute; inset: -3%; z-index: 1;
  background-image: var(--dream-img, none); background-size: cover; background-position: center;
  filter: blur(var(--dream-haze-blur, 10px)) brightness(1.04) saturate(0.92);
  opacity: var(--dream-haze-now, 0.4);
}
.dream-space__layer::after {
  content: ''; position: absolute; inset: 0; z-index: 2;
  background-image: var(--dream-img, none); background-size: cover; background-position: center;
  filter: blur(22px) brightness(1.18) saturate(1.15);
  mix-blend-mode: screen; opacity: var(--dream-glow-lo, 0.12);
  animation: dreamSpaceGlow var(--dream-glow-speed, 11s) ease-in-out infinite alternate;
}
@keyframes dreamSpaceGlow { from { opacity: var(--dream-glow-lo, 0.12); } to { opacity: var(--dream-glow-hi, 0.36); } }
/* Drifting mist: soft banks crossing slowly, transform-only. 2026-10-11:
   denser and larger -- at the old strength it vanished on pale frames. */
.dream-space__mist {
  position: absolute; inset: -25%; pointer-events: none; z-index: 1;
  background:
    radial-gradient(ellipse 55% 26% at 28% 62%, rgba(245,242,236,0.72), rgba(245,242,236,0) 72%),
    radial-gradient(ellipse 48% 22% at 72% 38%, rgba(245,242,236,0.62), rgba(245,242,236,0) 72%),
    radial-gradient(ellipse 60% 18% at 50% 85%, rgba(235,232,226,0.55), rgba(235,232,226,0) 70%);
  animation: dreamSpaceMist 70s ease-in-out infinite alternate;
  opacity: var(--dream-mist-now, 0.6);
}
@keyframes dreamSpaceMist {
  from { transform: translate(-8%, 2%); }
  to   { transform: translate(8%, -3%); }
}
.dream-space::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 50%, rgba(255,240,220,0.10), rgba(0,0,0,0) 45%, rgba(0,0,0,0.42) 100%);
  animation: dreamSpaceBreathe 9s ease-in-out infinite alternate;
}
@keyframes dreamSpaceBreathe { from { opacity: 0.55; } to { opacity: 1; } }
.dream-space__empty {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: rgba(243,239,230,0.55); font-family: Georgia, "Times New Roman", serif; font-style: italic;
}
.dream-space__empty[hidden] { display: none; }
.dream-space__cap {
  position: absolute; z-index: 2; pointer-events: none;
  color: #f3efe6; font: 15px/1.5 Georgia, "Times New Roman", serif;
  text-shadow: 0 1px 12px rgba(0,0,0,0.85);
  transition: opacity 1.2s ease;
}
.dream-space__cap[data-off] { opacity: 0; }
.dream-space__cap--words {
  right: 20px; bottom: 14px;
  max-width: min(46ch, 80vw); text-align: right; font-style: italic; opacity: 0.85;
}
.dream-space__cap--said {
  left: 50%; transform: translateX(-50%); bottom: 14px;
  width: min(720px, 92vw);
  /* 2026-10-11: the whole last turn, laid out like the chat (Doug: "my
     response right, gabriel left, bubble around mine but make them both
     translucent... maybe my bubble slightly less so"). Long replies scroll
     inside a band no taller than ~45% of the dream. */
  display: flex; flex-direction: column; gap: 10px;
  max-height: 45%; overflow-y: auto; overscroll-behavior: contain;
  pointer-events: auto; padding: 4px 2px;
  text-shadow: none; text-align: left;
  font-family: var(--font-app); font-size: 0.95rem; line-height: 1.6; font-style: normal;
  scrollbar-width: thin; scrollbar-color: rgba(243,239,230,0.35) transparent;
}
.dream-space__cap--said[data-off] { pointer-events: none; }
.dream-space__said-m, .dream-space__said-g {
  /* 2026-10-11 (Doug: "increase the transparency substantially, I want it
     available if they miss something, but if they want words they will
     switch to the other view"): faint dark glass and light type with a soft
     shadow, so the dream shows through and the words still read on bright
     or dark frames. Was cream at 80% / 62% with dark type. */
  color: #f6f1e7;
  text-shadow: 0 1px 3px rgba(0,0,0,0.75), 0 0 12px rgba(0,0,0,0.35);
  -webkit-backdrop-filter: blur(1.5px); backdrop-filter: blur(1.5px);
  padding: var(--space-3) var(--space-4);
}
/* The member: right, italic, the chat's bubble shape -- a little more solid. */
.dream-space__said-m {
  align-self: flex-end; max-width: 85%;
  font-style: italic;
  background: rgba(22, 18, 12, 0.30);
  border: 1px solid rgba(232, 195, 122, 0.45);
  border-radius: 20px 20px 6px 20px;
}
/* Gabriel: left, plain type, more see-through. */
.dream-space__said-g {
  align-self: flex-start; max-width: 92%;
  background: rgba(22, 18, 12, 0.16);
  border: 1px solid rgba(246, 241, 231, 0.18);
  border-radius: 20px 20px 20px 6px;
}
.dream-space__said-g p { margin: 0 0 0.6em; }
.dream-space__said-g p:last-child { margin-bottom: 0; }
.dream-space__bar {
  position: absolute; top: 10px; right: 12px; z-index: 3;
  display: flex; gap: 8px; align-items: center;
  /* Never wider than the dream (clear of the space rail's chevron at the
     left): on a phone the word selector gives way, not the arrows. */
  left: 52px; justify-content: flex-end; min-width: 0;
}
.dream-space__bar > * { flex: 0 0 auto; }
.dream-space__bar .dream-space__words { flex: 0 1 auto; min-width: 0; width: auto; max-width: 100%; text-overflow: ellipsis; }
@media (max-width: 420px) {
  .dream-space__bar { gap: 4px; right: 8px; left: 46px; }
  .dream-space__bar select { padding: 3px 4px; }
  .dream-space__nav { gap: 2px; }
  .dream-space__bar .dream-space__pos { min-width: 0; }
  .dream-space__bar .dream-space__words { min-width: 4.8em; }
  .dream-space__prev, .dream-space__next, .dream-space__save, .dream-space__show, .dream-space__pause, .dream-space__close { width: 28px; height: 28px; }
  /* 2026-10-18: with save, pause and show the bar outgrew a phone. Two rows:
     the buttons (and close) on top, the two pickers under them. */
  .dream-space__bar { flex-wrap: wrap; row-gap: 6px; }
  .dream-space__nav { order: 1; } .dream-space__save { order: 2; } .dream-space__pause { order: 3; }
  .dream-space__show { order: 4; } .dream-space__close { order: 5; }
  .dream-space__bar .dream-space__words { order: 6; } .dream-space__bar .dream-space__motion { order: 7; }
  .dream-space__bar .dream-space__words { min-width: 7em; }
  .dream-space .dream-space__when { top: 86px; }
}
.dream-space__bar select, .dream-space__bar button {
  font: inherit; font-size: 0.8rem; color: #f3efe6;
  background: rgba(10,10,12,0.45); border: 1px solid rgba(243,239,230,0.25);
  border-radius: var(--radius-full); padding: 3px 10px;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.dream-space__close { width: 30px; height: 30px; padding: 0 !important; line-height: 1; font-size: 1.1rem !important; cursor: pointer; }
/* 2026-10-11 (Doug): step through recent images; js/dream.js browse(). */
.dream-space__nav { display: inline-flex; align-items: center; gap: 4px; }
.dream-space__nav[hidden] { display: none; }
.dream-space__prev, .dream-space__next { width: 30px; height: 30px; padding: 0 !important; line-height: 1; font-size: 1.15rem !important; cursor: pointer; }
.dream-space__prev:disabled, .dream-space__next:disabled { opacity: 0.35; cursor: default; }
/* While stepping: when the picture was painted ("Sat 3:14 pm"). */
.dream-space__when { position: absolute; top: 48px; right: 14px; z-index: 3; pointer-events: none;
  font-size: 0.78rem; color: #f3efe6; text-shadow: 0 1px 6px rgba(0,0,0,0.8); letter-spacing: 0.02em; }
.dream-space__when[hidden] { display: none; }
/* The readout is also the saved-only switch ("♥ 2 / 5"); a plain label look. */
.dream-space__bar .dream-space__pos { background: none; border: none; padding: 0 2px; -webkit-backdrop-filter: none; backdrop-filter: none; cursor: pointer; }
.dream-space__nav.is-saved-only .dream-space__pos, .dream-space__nav.is-unsaved-only .dream-space__pos { color: #e8c37a; }
/* ♡ / ♥ save (2026-10-11): kept past Keep, in this space. */
.dream-space__save { width: 30px; height: 30px; padding: 0 !important; line-height: 1; font-size: 1.05rem !important; cursor: pointer; }
.dream-space__save[hidden] { display: none; }
/* Show Gabriel (2026-10-18): the eye; gold while a picture is waiting to go. */
.dream-space__show { width: 30px; height: 30px; padding: 0 !important; line-height: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.dream-space__show[hidden] { display: none; }
/* Pause (2026-10-18): two bars; a play triangle, gold, while paused. */
.dream-space__pause { width: 30px; height: 30px; padding: 0 !important; line-height: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.dream-space__pause .dream-space__play { display: none; }
.dream-space__pause.is-paused .dream-space__play { display: inline; }
.dream-space__pause.is-paused .dream-space__pause-a, .dream-space__pause.is-paused .dream-space__pause-b { display: none; }
.dream-space__pause.is-paused { color: #e8c37a !important; border-color: rgba(232,195,122,0.7) !important; }
.dream-space__show.is-shown { color: #e8c37a !important; border-color: rgba(232,195,122,0.7) !important; }
.dream-space__save.is-saved { color: #e8c37a !important; border-color: rgba(232,195,122,0.7) !important; }
.dream-space__pos { min-width: 4.6em; text-align: center; font-size: 0.8rem; color: #f3efe6; text-shadow: 0 1px 6px rgba(0,0,0,0.7); font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) {
  .dream-space__layer.is-in, .dream-space__layer.is-out { animation-duration: 1.2s; }
  .dream-space::after, .dream-space__layer::after, .dream-space__mist { animation: none; }
}
/* The thread's jump-to-latest arrow lives in the dock and would sit on the
   dream; it has nothing to jump to while the dream is open. */
body.dream-open .jump-to-latest { display: none !important; }
/* Phone: the header's right cluster overlaps the centred wordmark, so the
   Dream button floats just under the header at the right edge instead
   (top set by js/dream.js from the header's height). While the dream is
   open it steps aside; the panel's own x closes it. */
@media (max-width: 540px) {
  .dream-btn {
    position: fixed; right: 12px; top: var(--dream-btn-top, 84px); z-index: 16;
  }
  body.dream-open .dream-btn { display: none; }
}
/* 2026-10-11 (Doug: "weirder" -- Waking Life): the layers sit in a stage.
   The boiling-line filter (#dreamBoil) goes on each frame's SVG <image> in
   "weird" motion -- not on HTML, which iPhone WebKit would not filter, and
   not on the layers, whose fade animations own their own `filter`. */
.dream-space__defs { position: absolute; width: 0; height: 0; overflow: hidden; }
/* Zoom (2026-10-11, Doug: "zoom in and out", no pan): the zoom lane
   (--dream-zoom, moved at random by js/dream.js) scales the whole stage. */
/* The zoom aims at each frame's bright spot (js/dream.js aimZoom); the
   origin glides there over the fade. */
.dream-space__stage { position: absolute; inset: -2%; transform: scale(var(--dream-zoom, 1.14)); will-change: transform;
  transition: transform-origin var(--dream-fade, 6s) ease-in-out; }
/* The boil filter is set on each frame's SVG <image> (js/dream.js), not on
   this stage: iPhone WebKit ignored it here. */

/* 2026-10-12 listen mode (docs/brief-listen-mode.md L1). The ear sits beside
   the mic. Pressed: Gabriel listens and does not reply; the room's words
   collect in the panel above the composer, greyed, newest at the bottom. */
.chatbox__listen {
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  display: inline-grid; place-items: center;
  flex-shrink: 0;
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: color var(--transition-interactive), background var(--transition-interactive);
}
@media (hover: hover) {
  .chatbox__listen:hover {
    color: var(--color-text);
    background: color-mix(in oklab, var(--color-surface-offset) 70%, transparent);
  }
}
/* 2026-10-13 (Doug: "a bit close together... space them out more,
   equidistant"): ear, mic and send 60px apart, centre to centre (the caret
   rides between mic and send). */
.chatbox__listen { margin-right: 28px; }
.chatbox__voice { margin-right: 6px; }
.chatbox__listen[aria-pressed="true"],
/* 10-17 (Doug): one of eye / ear / mic is always lit, the eye too. */
.chatbox__listen[data-ear] {
  color: var(--color-primary);
  background: color-mix(in oklab, var(--color-primary) 14%, transparent);
}
/* 2026-10-16 (Doug): the ear's options caret, like the mic's. It takes 12px
   of the ear's 28px gap, so ear, mic and send stay 60px apart. */
.chatbox__listen:has(+ .chatbox__listen-caret:not([hidden])) { margin-right: 0; }
.chatbox__listen-caret { margin-right: 16px; }
.chatbox__listen-caret[hidden] { display: none; }
.chatbox__voice:has(.chatbox__mic[aria-pressed="true"]) .chatbox__listen-caret { color: var(--color-text-faint); }
.chatbox__voice:has(.chatbox__listen[aria-pressed="true"]) .chatbox__listen-caret,
.chatbox__listen-caret[aria-expanded="true"] { color: var(--color-primary); }
/* 2026-10-16 (Doug: "it just isn't clear what is doing what"): a plain line
   under each of the ear menu's rows saying what the current state does. */
.voice-menu__note--row { margin: -0.15rem 0 0.45rem; padding: 0 0.7rem; }
.listen-log {
  max-height: 9.5rem;
  overflow-y: auto;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.25rem;
  border-radius: 10px;
  background: color-mix(in oklab, var(--color-surface-offset) 55%, transparent);
  color: var(--color-text-muted);
  font-size: 0.85rem;
  line-height: 1.4;
}
.listen-log__head {
  font-size: 0.75rem;
  color: var(--color-text-faint);
  margin-bottom: 0.25rem;
}
.listen-log__line { margin: 0.1rem 0; }
.listen-log__line time { color: var(--color-text-faint); margin-right: 0.4rem; font-variant-numeric: tabular-nums; }
form.is-ear-listening textarea { color: var(--color-text-muted); }
form.is-ear-listening.is-ear-speak textarea { color: inherit; }   /* 10-17: Speak reads as talk */
/* Ear on: the mic is drawn off (it is capturing underneath, for the ear) and
   the ear carries the "heard" pulse instead. Ear off: the mic comes back. */
form.is-ear-listening .chatbox__mic,
form.is-ear-listening .chatbox__mic[aria-pressed="true"] {
  color: var(--color-text-faint);
  background: transparent;
  animation: none;
  box-shadow: none;
}
form.is-ear-listening .chatbox__mic .mic-icon { display: inline-block; }
form.is-ear-listening .chatbox__mic .mic-icon-stop,
form.is-ear-listening .chatbox__mic .mic-icon-horn { display: none; }
form.is-ear-listening .chatbox__voice-caret { color: var(--color-text-faint); }
/* Doug + CC 2026-11-21: Listen and Talk are two buttons (chat.js paint).
   The active one is lit (data-ear, the rule above); the other is drawn with
   a slash, quiet; both slashed = silence. */
.chatbox__listen:not([data-ear]) {
  color: var(--color-text-faint);
  background: transparent;
}
.chatbox__listen:not([data-ear]):hover { color: var(--color-text-muted); }
/* Listen off asks first: Respond / Archive / Forget (shared room: Respond /
   Done). A short row above the composer; unanswered, it holds after 20 s. */
.listen-offask {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.5rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.35rem;
  border-radius: 10px;
  background: color-mix(in oklab, var(--color-surface-offset) 70%, transparent);
  color: var(--color-text-muted);
  font-size: 0.85rem;
}
.listen-offask__q { flex: 1 1 100%; }
.listen-offask__btn {
  appearance: none;
  border: 1px solid var(--color-text-faint);
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}
.listen-offask__btn:hover { border-color: var(--color-text-muted); }
.listen-offask__btn.is-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-text-inverse);
}
.listen-offask--note .listen-offask__q { flex: none; }
/* 2026-11-21: the room's user chat -- another member here, Listen and Talk
   off: messages go to the thread with no reply (chat.js paintRoomChat). */
.room-chat-note {
  padding: 0.4rem 0.75rem;
  margin-bottom: 0.35rem;
  border-radius: 10px;
  background: color-mix(in oklab, var(--color-primary) 10%, transparent);
  color: var(--color-text-muted);
  font-size: 0.82rem;
}
.room-chat-note[hidden] { display: none; }

/* 10-17 (Doug): the voice cue on the ear (chat.js paint sets data-ear-cue).
   Tan pulse while the member is heard, blue while Gabriel speaks; the glyph
   (horn, mic, ear) is chat.js's. */
.chatbox__listen[data-ear-cue="heard"] {
  animation: mic-pulse 1.6s ease-in-out infinite;
}
.chatbox__listen[data-ear-cue="speaking"] {
  animation: gabriel-speaking-pulse 1.8s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .chatbox__listen[data-ear-cue="heard"] {
    animation: none;
    box-shadow: 0 0 0 4px color-mix(in oklab, var(--color-primary) 30%, transparent);
  }
  .chatbox__listen[data-ear-cue="speaking"] {
    animation: none;
    box-shadow: 0 0 0 4px color-mix(in oklab, var(--voice-speaking, #6f9eff) 30%, transparent);
  }
}

/* 2026-10-13 (Doug: "switch something when Gabriel talks ... the whole aura
   and trumpet turn into a pulsing Gabriel logo"). The cue's third state:
   from his first audible sound to the end of his audio, the button shows his
   mark in a blue pulse, so "heard you" (gold trumpet) and "he is talking"
   can no longer be confused. */
.chatbox__mic .mic-icon-gabriel { display: none; }
.chatbox__mic[data-voice-cue="speaking"] {
  color: var(--voice-speaking, #6f9eff);
  background: color-mix(in oklab, var(--voice-speaking, #6f9eff) 14%, transparent);
  animation: gabriel-speaking-pulse 1.8s ease-in-out infinite;
}
.chatbox__mic[data-voice-cue="speaking"] .mic-icon,
.chatbox__mic[data-voice-cue="speaking"] .mic-icon-stop,
.chatbox__mic[data-voice-cue="speaking"] .mic-icon-horn { display: none; }
.chatbox__mic[data-voice-cue="speaking"] .mic-icon-gabriel { display: inline-block; }
.chatbox__voice:has(.chatbox__mic[data-voice-cue="speaking"]) .chatbox__voice-caret { color: var(--voice-speaking, #6f9eff); }
@keyframes gabriel-speaking-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--voice-speaking, #6f9eff) 30%, transparent); }
  50%      { box-shadow: 0 0 0 10px color-mix(in oklab, var(--voice-speaking, #6f9eff) 0%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .chatbox__mic[data-voice-cue="speaking"] {
    animation: none;
    box-shadow: 0 0 0 4px color-mix(in oklab, var(--voice-speaking, #6f9eff) 30%, transparent);
  }
}
/* Listen mode draws the mic off whatever the cue says. */
form.is-ear-listening .chatbox__mic .mic-icon-gabriel { display: none; }
form.is-ear-listening .chatbox__mic[data-voice-cue="speaking"] { animation: none; color: var(--color-text-faint); background: transparent; box-shadow: none; }
