/* Companion (web/agent) — CLUBS identity: grayscale neo-brutalist, mirroring
   web/index.html + clubs-mobile/src/styles/colors.ts. NO greens, reds,
   blues, gold — state is contrast, weight, uppercase, borders, rotation;
   never hue. Every color lives in :root; no hex outside the token block.
   Fonts: Solway (everything structural, 300 body / 700-800 display),
   Caveat (handwritten annotations only) — Google Fonts <link> per page. */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* Surfaces (back to front) — gray200 is THE brand background (colors.ts);
     white cards pop against it */
  --bg:        #E8E8E8;  /* page canvas — the brand surface */
  --surface:   #FFFFFF;  /* cards, composer, user bubbles */
  --surface-2: #F0F0F0;  /* nested cards, hover states, chips (gray100) */
  --surface-3: #D0D0D0;  /* pressed states, active pills (gray300) */

  /* Inverted band — the mobile tab bar / landing black-section device.
     Scoped onto bars via var reassignment, never raw hex in components. */
  --inv-bg:      #1A1A1A;
  --inv-surface: #333333;
  --inv-text:    #FFFFFF;
  --inv-text-2:  #D0D0D0;
  --inv-border:  #333333;

  /* Lines — the brand's borders are real, not hairlines */
  --border:        #D0D0D0;  /* default (gray300) */
  --border-strong: #000000;  /* focused/hover/structural — 2px black */

  /* Text */
  --text:        #000000;  /* primary */
  --text-2:      #666666;  /* secondary (gray500) */
  --text-3:      #999999;  /* muted — placeholder/decorative only (gray400) */
  --text-on-accent: #FFFFFF; /* ink on black fills */

  /* "Accent" = black. Emphasis comes from inversion (black fill / white
     text), weight, uppercase tracking, and the gray200 highlight — never a
     hue. The gradient token stays for compatibility but resolves flat black. */
  --accent:          #000000;
  --accent-deep:     #333333;
  --accent-gradient: linear-gradient(180deg, #000000 0%, #000000 100%);
  --accent-glow:     4px 4px 0 #000000;          /* focus = hard offset, not glow */
  --accent-track:    #E8E8E8;                    /* unfilled meter / highlight band (gray200) */

  /* Status — grayscale like the app: badges are gray100 + gray500 caps;
     danger is bold black (semantic.destructive), never red */
  --live:    #000000;
  --staged:  #000000;
  --danger:  #000000;
  --live-bg:   #F0F0F0;
  --staged-bg: #F0F0F0;

  /* Dataviz de-emphasis (sparkline history, non-current bars) */
  --viz-dim: #D0D0D0;

  /* Mural card suits — quiet grayscale linework */
  --suit-red: #999999;

  /* Solid fills (glass is not a Clubs device — bars are solid + bordered) */
  --bg-glass:       #FAFAFA;
  --bg-glass-heavy: #FFFFFF;
  --muted-bg:       #F0F0F0;

  /* Type families — Solway asserts, Caveat whispers */
  --font-serif: 'Solway', Georgia, serif;
  --font-sans:  'Solway', Georgia, serif;
  --font-mono:  'Solway', Georgia, serif;
  --font-hand:  'Caveat', 'Solway', cursive;

  /* Radii */
  --r-sm: 8px;    /* chips; status pills use --r-pill */
  --r-md: 14px;   /* cards, rows, tool chips */
  --r-lg: 20px;   /* user bubbles, stat tiles, panel cards */
  --r-xl: 24px;   /* composer card, greeting input */
  --r-pill: 999px;

  /* Neo-brutalist shadows — hard offsets, zero blur, black */
  --shadow-card:  3px 3px 0 #000000;
  --shadow-float: 4px 4px 0 #000000;
  --shadow-panel: 8px 8px 0 #000000;

  /* Spacing scale — use exclusively */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px; --s-5: 20px;
  --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px; --s-16: 64px;

  /* Motion */
  --dur-1: 120ms;  /* hovers, focus, chip presses */
  --dur-2: 220ms;  /* message reveal, fades, sheet content */
  --dur-3: 360ms;  /* panel open/close, greeting → conversation */
  --ease-out:    cubic-bezier(0.22, 1, 0.36, 1);   /* decelerate — entrances */
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);   /* moves/resizes */

  --topbar-h: 56px;
}

html { height: 100%; }

body {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 300; /* Solway Light body — 700/800 assert, like the app */
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--accent-deep); }

button { font-family: inherit; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Mouse focus keeps each input's quiet glow; keyboard focus restores the
   ring (these inputs no longer carry a blanket outline: none). */
.composer textarea:focus:not(:focus-visible),
.sibling-title:focus:not(:focus-visible),
.brief-title:focus:not(:focus-visible),
.brief-input:focus:not(:focus-visible),
.field input:focus:not(:focus-visible) { outline: none; }

.hidden { display: none !important; }

/* Visually hidden but readable by screen readers (live-region announcer). */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Micro-label recipe (--type-micro) — one source of truth. Apply .u-micro
   to new elements; the existing kickers/labels compose via this group. */
.u-micro,
.panel-kicker,
.stat-label,
.funnel-label,
.sibling-section,
.rail-header,
.rail-subheader {
  font-size: 11px;
  line-height: 1.3;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
}

/* ---------------------------------------------------------------------
   Ember orb (topbar mark, greeting, login hero)
   --------------------------------------------------------------------- */
/* The mark: the drawn club character — sunglasses, grin, bowtie — on a white
   chip, tilted like a stamp.

   This is Dylan's artwork (web/img/companion-mark.png), cropped to the
   character and re-mounted on a white square. It is NOT a trace: an earlier
   pass shipped a hand-redrawn SVG approximation and was reverted, because a
   near-miss of someone's character reads as the brand being wrong rather than
   absent.

   WHITE chip, not var(--accent). The chip used to be a BLACK circle with a
   white ♣ glyph; this mark is black ink, which on a black circle is nothing at
   all. Same 2px ring it always had.

   Sized at 88%, not 78%: the PNG carries ~12% of its own padding so the club's
   lobes never touch the crop edge, so the old figure would have shrunk the
   character inside the circle.

   The alpha channel is deliberately untouched — the artwork's white background
   is left opaque and simply matches the chip. Thresholding white to
   transparent is the documented way to punch holes in exactly this character:
   the sunglass lenses, the grin, the sparkle and the middle of the bowtie are
   all white and all part of the drawing. */
.orb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #FFFFFF url('/img/companion-mark.png') center/88% no-repeat;
  border: 2px solid var(--border-strong);
  flex: none;
  transform: rotate(-4deg);
}
.orb-lg { width: 44px; height: 44px; }
.orb-md { width: 34px; height: 34px; }
.orb-breathe { animation: orb-breathe 4s ease-in-out infinite; }
@keyframes orb-breathe {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(3deg); }
}

/* ---------------------------------------------------------------------
   Topbar — 56px, translucent, content scrolls under it
   --------------------------------------------------------------------- */
/* The topbar is an INVERTED band (mobile tab-bar #1A1A1A) — children keep
   using the standard tokens, which are reassigned to the inverse set here. */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--s-4);
  background: var(--inv-bg);
  border-bottom: 2px solid var(--inv-border);
  --text: var(--inv-text);
  --text-2: var(--inv-text-2);
  --text-3: var(--inv-text-2);
  --surface: var(--inv-surface);
  --surface-2: var(--inv-surface);
  --surface-3: var(--inv-border);
  --border: var(--inv-border);
  --border-strong: var(--inv-text);
  --accent: var(--inv-text);
  --accent-deep: var(--inv-text-2);
  --accent-gradient: linear-gradient(180deg, var(--inv-text), var(--inv-text));
  --text-on-accent: var(--inv-bg);
  --live: var(--inv-text);
  --staged: var(--inv-text-2);
  --danger: var(--inv-text);
  --muted-bg: var(--inv-surface);
}
.topbar .brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  text-decoration: none;
  color: var(--text);
}
.topbar .brand:hover { color: var(--text); }
.topbar .wordmark { font-weight: 600; font-size: 15px; color: var(--text); }
.topbar .byline { font-weight: 400; font-size: 12px; color: var(--text-2); }
.topbar-right { display: flex; align-items: center; gap: var(--s-2); }
.topbar-link {
  font-size: 13px;
  color: var(--text-2);
  text-decoration: none;
}
.topbar-link:hover { color: var(--text); text-decoration: underline; }

/* Ambitions pill (§5.1) + Chats pill (multi-chat history) — same treatment */
.ambitions-pill,
.chats-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out);
}
.ambitions-pill:hover,
.chats-pill:hover { background: var(--surface-3); border-color: var(--border-strong); }
a.ambitions-pill { text-decoration: none; }
.ambitions-pill .pill-icon,
.chats-pill .pill-icon { display: none; color: var(--text-2); }
.pill-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--text-on-accent);
  font-size: 11px;
  font-weight: 600;
}
.pill-badge[hidden] { display: none; }

/* Overflow "···" menu */
.overflow-wrap { position: relative; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-2);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn svg { display: block; }
.overflow-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 140px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-float);
  padding: var(--s-1);
  z-index: 60;
}
.overflow-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--s-2) var(--s-3);
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.overflow-menu button:hover { background: var(--surface-3); }

/* Chats history dropdown — overflow-menu treatment, wider; scrolls past
   ~8 items. Rows: sans 13px truncated title + mono relative time. */
.chats-wrap { position: relative; }
.chats-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: min(280px, calc(100vw - 24px));
  max-height: 312px;
  overflow-y: auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-float);
  padding: var(--s-1);
  z-index: 60;
}
.chat-item {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
  width: 100%;
  text-align: left;
  padding: var(--s-2) var(--s-3);
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  cursor: pointer;
  transition: background var(--dur-1) var(--ease-out);
}
.chat-item:hover { background: var(--surface-3); }
.chat-item[aria-current="true"] { background: var(--surface-3); }
.chat-item-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-item-time {
  flex: none;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-2);
}
/* Channel badge on non-web conversations: a phone call or the SMS thread
   reads at a glance in the chats dropdown and the left rail. */
.chat-item-tag {
  flex: none;
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 6px;
}
.chats-empty {
  padding: var(--s-3);
  text-align: center;
  font-size: 13px;
  color: var(--text-2);
}

/* ---------------------------------------------------------------------
   App shell — main grid animates for the artifact-style split (§5.2)
   --------------------------------------------------------------------- */
.main {
  display: grid;
  grid-template-columns: 1fr 0fr;
  transition: grid-template-columns var(--dur-3) var(--ease-in-out);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
.main.panel-open { grid-template-columns: 2fr 3fr; }  /* ~40 / 60 */

/* ---------------------------------------------------------------------
   Flag gate ("Coming soon") — reuses the login card styling (§7)
   --------------------------------------------------------------------- */
.gate {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-4);
  padding: calc(var(--topbar-h) + var(--s-6)) var(--s-6) var(--s-16);
}
.gate-card, .login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-float);
  padding: var(--s-8) var(--s-6);
}
.gate-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 24px;
  line-height: 1.25;
}
.gate-sub { font-size: 14px; color: var(--text-2); margin-top: var(--s-2); }
.gate-note { font-size: 13px; color: var(--text-2); margin-top: var(--s-4); }

/* ---------------------------------------------------------------------
   Chat pane — greeting (Screen 1) and conversation (Screen 2)
   --------------------------------------------------------------------- */
.chat-pane {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 380px;
  min-height: 0;
  overflow: hidden;
}

/* Greeting state (§3): vertically centered stack, gap --s-8 */
.chat-pane.mode-greeting {
  align-items: center;
  justify-content: center;
  gap: var(--s-8);
  padding: calc(var(--topbar-h) + var(--s-6)) var(--s-6) var(--s-6);
}
.chat-pane.mode-greeting .chat-scroll { display: none; }
.chat-pane.mode-greeting .disclaimer { display: none; }
.chat-pane.mode-greeting .composer-dock {
  width: 100%;
  max-width: 640px;
  margin: 0;
  padding: 0;
}
.chat-pane.mode-greeting .composer {
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-float);
}
.chat-pane:not(.mode-greeting) .greeting-top,
.chat-pane:not(.mode-greeting) .greeting-chips { display: none; }

.greeting-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-3);
  text-align: center;
}
.greeting-top .orb-lg { margin-bottom: var(--s-5); }
.salutation {
  font-family: var(--font-serif);
  font-weight: 800;
  font-size: clamp(34px, 5vw, 46px);
  line-height: 1.1;
  letter-spacing: -1px;
  color: var(--text);
}
/* The annotation voice — handwritten, tilted, lowercase. */
.subline {
  font-family: var(--font-hand);
  font-size: 22px;
  font-weight: 400;
  color: var(--text-2);
  transform: rotate(-2deg);
}

/* Fade-out for orb/salutation/subline/chips on first send (§3.2) */
.greeting-leave {
  opacity: 0 !important;
  transform: translateY(-12px);
  transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out);
}

/* Suggestion chips (§3.1.5) — also reused under replies for zero-ambition
   users. One chip recipe: .brief-chip composes from the same base and only
   overrides its chip-sm padding where it's defined. */
.chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s-2);
}
.chip,
.brief-chip {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 8px 14px;
  cursor: pointer;
  transition: background var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.chip:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.thread .chips { justify-content: flex-start; margin-top: var(--s-2); }

/* Conversation column (§4.1) */
.chat-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.thread {
  width: 100%;
  max-width: 720px;
  margin-inline: auto;
  /* Generous bottom room so the last reply never ends pressed against
     the composer dissolve. */
  padding: calc(var(--topbar-h) + var(--s-6)) var(--s-6) var(--s-16);
}
.thread-note {
  color: var(--text-2);
  font-size: 13px;
  text-align: center;
  padding: var(--s-6) 0;
}

/* Turns: --s-5 between turns; --s-2 between an assistant message and its
   attached tool chips / draft chip (§4.1) */
.msg { display: flex; }
.msg + .msg { margin-top: var(--s-5); }
/* A new user turn opens a wider beat than the intra-turn (assistant→its own
   tool chips) spacing — conversations need breathing between exchanges. */
.msg-assistant + .msg-user,
.msg-tool + .msg-user,
.msg-brief-card + .msg-user { margin-top: var(--s-8); }
.msg-tool + .msg-tool,
.msg-assistant + .msg-tool,
.msg-tool + .msg-assistant { margin-top: var(--s-2); }

/* Assistant: no bubble — flat serif prose (§4.2), markdown-lite rendered
   (bold/italic/code/links/lists/headers/tables — no raw HTML passthrough).
   No pre-wrap: the renderer owns line breaks (<p> + <br>). */
.msg-assistant { flex-direction: column; align-items: flex-start; }
.msg-assistant .msg-block {
  font-family: var(--font-serif);
  /* Solway Light prose, like landing body copy; <strong> asserts at 700. */
  font-weight: 300;
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  word-wrap: break-word;
  /* Serif prose caps at a comfortable reading measure; the thread stays 720px
     so tool chips, tables, and the inline brief card keep the wider grid. */
  max-width: 65ch;
  min-width: 0;
}
.msg-assistant .msg-block + .msg-block { margin-top: 1.65em; }
.msg-assistant .msg-block > * + * { margin-top: 0.7em; }
/* Links ride in body-text color with an accent underline — gold is never
   body ink (the token's own rule); the hover reveals it. */
.msg-assistant a { color: var(--text); text-decoration: underline; text-decoration-color: var(--accent-track); text-underline-offset: 2px; }
.msg-assistant a:hover { color: var(--accent); text-decoration-color: var(--accent); }
.msg-assistant strong { font-weight: 700; }
.msg-assistant code {
  font-family: var(--font-mono);
  font-size: 0.78em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 6px;
  white-space: nowrap;
}
/* ### headers render as quiet bold lines, not giant h3s */
.msg-assistant .md-h {
  font-weight: 600;
  font-size: 17px;
  line-height: 1.5;
}
.msg-assistant .md-list {
  margin-left: 0;
  padding-left: 1.35em;
}
.msg-assistant .md-list li + li { margin-top: 0.3em; }
/* GitHub-style pipe tables → minimal hairline tables; wide ones scroll
   inside their own container, never the page */
.msg-assistant .md-table-wrap {
  width: 100%;
  max-width: none;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.msg-assistant .md-table {
  border-collapse: collapse;
  width: 100%;
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
}
.msg-assistant .md-table th,
.msg-assistant .md-table td {
  text-align: left;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.msg-assistant .md-table thead th {
  font-size: 11px;
  line-height: 1.3;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
.msg-assistant .md-table tbody tr:last-child td { border-bottom: none; }
.msg-assistant .md-table td { color: var(--text); }
.msg-assistant .md-table td:not(:first-child) { color: var(--text-2); }

/* Typed-reveal caret — a hairline at the type point (the gold reads because
   it moves; a block dominates every frame). */
.type-caret {
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: text-bottom;
  border-radius: 1px;
  background: var(--accent);
  opacity: 0.7;
}

/* User: quiet bubble, right-aligned (§4.2) */
.msg-user { justify-content: flex-end; }
.msg-user .msg-bubble {
  max-width: 75%;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-lg);
  border-bottom-right-radius: var(--r-sm);
  box-shadow: 2px 2px 0 var(--border-strong);
  padding: 10px 16px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Message entrance (standard) */
.msg-enter { opacity: 0; transform: translateY(6px); }
.msg-enter.msg-in {
  opacity: 1;
  transform: none;
  transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out);
}

/* Tool chips (§4.3) */
/* Passive tool chips are bare mono whispers — no fill, no border. Clickable
   chips (.tool-chip-btn) earn their chrome on hover. Consecutive chips wrap
   inline within one .msg-tool row. */
.tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  padding: 2px 0;
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text-2);
}
.msg-tool { flex-wrap: wrap; gap: var(--s-2) var(--s-3); }
/* Neutral by default — a green LED on every success reads as debug output;
   status color is reserved for failure. */
.tool-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--text-3);
  flex: none;
}
.tool-dot.failed { background: var(--danger); }

/* Draft chip in-thread (§4.6) */
.draft-chip {
  display: inline-flex;
  align-items: center;
  margin-top: var(--s-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 4px 12px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.draft-chip:hover { border-color: var(--border-strong); color: var(--text); }

/* Thinking state (§4.4.1): mono "thinking…" chip + 2-line shimmer skeleton */
.thinking {
  max-width: 720px;
  width: 100%;
  margin-inline: auto;
  padding: var(--s-5) var(--s-6) 0;
}
.thinking-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 4px 12px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-2);
  margin-bottom: var(--s-3);
}
.thinking-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: orb-breathe 1.4s ease-in-out infinite;
}
.skeleton-line {
  position: relative;
  height: 12px;
  border-radius: 6px;
  background: var(--surface-2);
  overflow: hidden;
  margin-bottom: var(--s-2);
}
.skeleton-line.w-85 { width: 85%; }
.skeleton-line.w-55 { width: 55%; }
.skeleton-line::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(0,0,0,0.05), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer {
  to { transform: translateX(100%); }
}
.thinking-leave { opacity: 0; transition: opacity var(--dur-1) var(--ease-out); }

/* "↓ New reply" pill (§4.4.3) — sticky at the bottom of the scroll area */
.new-reply-pill {
  position: sticky;
  bottom: var(--s-3);
  align-self: center;
  margin-top: var(--s-3);
  background: var(--surface-3);
  border: none;
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-float);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  z-index: 5;
}

/* Composer (§4.5) */
.composer-dock {
  position: relative;
  flex: none;
  width: 100%;
  max-width: 720px;
  margin-inline: auto;
  padding: 0 var(--s-6);
  padding-bottom: max(var(--s-4), env(safe-area-inset-bottom));
}
.composer-dock::before {
  /* messages dissolve behind the composer */
  content: '';
  position: absolute;
  top: -24px; left: 0; right: 0;
  height: 24px;
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none;
}
/* The capture-form idiom from the landing page: white card, 2px black
   border, hard shadow — focus lifts the whole form off its shadow. */
.composer {
  display: flex;
  align-items: flex-end;
  gap: var(--s-2);
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: var(--r-xl);
  padding: var(--s-2) var(--s-2) var(--s-2) var(--s-4);
  box-shadow: var(--shadow-card);
  transition: transform var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out);
}
.composer:focus-within {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--border-strong);
}
.composer textarea {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  min-height: 24px;
  max-height: 168px;  /* auto-grow 1→6 rows */
  padding: 6px 0;
}
.composer textarea::placeholder { color: var(--text-3); font-size: 15px; }
.send-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  background: var(--accent);
  color: var(--text-on-accent);
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--border-strong);
  transition: transform var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out);
}
.send-btn:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--border-strong); }
.send-btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--border-strong); }
.send-btn:disabled {
  background: var(--surface-3);
  color: var(--text-3);
  cursor: not-allowed;
  filter: none;
}
.send-btn .icon-stop { display: none; }
.send-btn.in-flight .icon-send { display: none; }
.send-btn.in-flight .icon-stop { display: block; }
/* In-flight is a working state, not a blocked one — keep it lit, not the
   greyed "not-allowed" disabled treatment (the button is disabled during
   the request only to prevent a double-send). */
.send-btn.in-flight:disabled {
  background: var(--surface-3);
  color: var(--text);
  cursor: default;
  filter: none;
}
/* A legal line, not an eyebrow — tracked caps make the quietest text the
   loudest style. Sentence case, like Claude's own disclaimer. */
.disclaimer {
  margin-top: var(--s-2);
  text-align: center;
  font-size: 12px;
  line-height: 1.3;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-3);
}

/* ---------------------------------------------------------------------
   Ambitions panel (Screen 3, §5)
   --------------------------------------------------------------------- */
.panel {
  position: relative;
  z-index: 45; /* above the border mural (40), below the topbar (50) */
  overflow: hidden;
  min-width: 0;
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-panel);
  visibility: hidden;
  transition: visibility 0s linear var(--dur-3);
}
.main.panel-open .panel { visibility: visible; transition: visibility 0s; }
.panel-inner {
  width: clamp(480px, 60vw, 860px);
  height: 100%;
  display: flex;
  flex-direction: column;
  padding-top: var(--topbar-h);
  background: var(--bg);
  /* contents fade + rise, 80ms after the tracks start moving (§5.2) */
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out);
}
.main.panel-open .panel-inner {
  opacity: 1;
  transform: none;
  transition-delay: 80ms;
}

/* A. Panel header — sticky, 56px */
.panel-header {
  flex: none;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--s-6);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.panel-kicker {
  font-size: 11px;
  line-height: 1.3;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
}
.panel-close { color: var(--text-2); }

.panel-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: var(--s-6);
}

/* B. Ambition switcher — masked horizontal scroll of pills */
.switcher {
  display: flex;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-6);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, rgba(0,0,0,1) 24px, rgba(0,0,0,1) calc(100% - 24px), transparent);
  mask-image: linear-gradient(90deg, transparent, rgba(0,0,0,1) 24px, rgba(0,0,0,1) calc(100% - 24px), transparent);
}
.switcher::-webkit-scrollbar { display: none; }
.switcher-pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 8px 14px;
  cursor: pointer;
  transition: background var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.switcher-pill:hover { background: var(--surface-2); color: var(--text); }
.switcher-pill[aria-pressed="true"] {
  background: var(--surface-3);
  border-color: var(--border-strong);
  color: var(--text);
}
.switcher-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--live);
  flex: none;
}
.switcher-dot.staged { background: var(--staged); }

/* C. Ambition header block */
.ambition-header { padding: var(--s-6) var(--s-6) var(--s-4); }
.ambition-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 24px;
  line-height: 1.25;
  color: var(--text);
}
.ambition-meta { font-size: 13px; color: var(--text-2); margin-top: var(--s-1); }

/* D. Headline stats row — 3 stat tiles */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-3);
  padding: 0 var(--s-6);
}
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-4);
}
.stat-label {
  font-size: 11px;
  line-height: 1.3;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
}
.stat-value {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 32px;
  line-height: 1.1;
  color: var(--text);
  margin-top: var(--s-1);
  /* proportional figures — tabular digits look loose at display sizes */
}
.stat-value.empty { color: var(--text-3); }
.stats-caption {
  font-size: 13px;
  color: var(--text-2);
  padding: var(--s-3) var(--s-6) 0;
}

/* Zero-state — shown when no companion drafts exist yet */
.panel-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--s-2);
  padding: var(--s-16) var(--s-6);
}
.panel-empty-mark {
  font-size: 28px;
  line-height: 1;
  color: var(--text-3);
  margin-bottom: var(--s-2);
}
.panel-empty-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 19px;
  line-height: 1.3;
  color: var(--text);
}
.panel-empty-sub {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-2);
  max-width: 320px;
}

/* E. Sibling project rows */
/* Hairline rows, not stacked cards — rhythm from the rules, matching the
   public site renderer's editorial index language. */
.sibling-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: var(--s-4) var(--s-6) 0;
  border-bottom: 1px solid var(--border);
}
/* Section label inside the Drafts pseudo-ambition ("Posted") */
.sibling-section {
  font-size: 11px;
  line-height: 1.3;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
  padding-top: var(--s-3);
}
.sibling-row {
  background: transparent;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
  padding: var(--s-4) 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s-2) var(--s-4);
  align-items: start;
}
.sibling-main { min-width: 0; }
.status-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  line-height: 1.3;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.status-chip.live { color: var(--live); background: var(--live-bg); }
.status-chip.staged { color: var(--staged); background: var(--staged-bg); }
/* Posted-but-not-active projects (paused/closed/…) — deliberately quiet */
.status-chip.muted { color: var(--text-2); background: var(--muted-bg); }
.sibling-title-link {
  display: block;
  margin-top: var(--s-2);
  font-size: 15px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}
.sibling-title-link:hover { color: var(--accent); text-decoration: underline; }
.sibling-title-wrap { position: relative; margin-top: var(--s-2); }
.sibling-title {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 2px 24px 2px 4px;
  margin-left: -4px;
  outline: none;
  transition: background var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out);
}
.sibling-title:hover, .sibling-title:focus {
  background: var(--surface-2);
  border-color: var(--border-strong);
}
.sibling-title:disabled { opacity: 0.5; }
.sibling-title-wrap .pencil {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  color: var(--text-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-1) var(--ease-out);
}
.sibling-title-wrap:hover .pencil,
.sibling-title-wrap:focus-within .pencil { opacity: 1; }
.sibling-desc {
  margin-top: var(--s-1);
  font-size: 13px;
  color: var(--text-2);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}
.sibling-location { margin-top: var(--s-1); font-size: 12px; color: var(--text-2); }

/* Funnel numbers — right column, live rows only */
.sibling-funnel { display: flex; gap: var(--s-3); }
.funnel-pair { min-width: 56px; text-align: right; }
.funnel-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.funnel-label {
  font-size: 11px;
  line-height: 1.3;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
}

/* Mini bar (meter) — applied, shared scale across siblings */
.sibling-meter {
  grid-column: 1 / -1;
  height: 4px;
  border-radius: 2px;
  background: var(--accent-track);
  overflow: hidden;
}
.sibling-meter .fill {
  display: block;
  height: 100%;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
}

/* Staged-row actions */
.sibling-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: var(--s-2);
}
.btn-secondary {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background var(--dur-1) var(--ease-out);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-secondary:hover { background: var(--surface-3); color: var(--text); }
.btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost {
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: color var(--dur-1) var(--ease-out), background var(--dur-1) var(--ease-out);
}
.btn-ghost:hover { color: var(--danger); background: var(--surface-2); }
.btn-ghost:disabled { opacity: 0.5; cursor: not-allowed; }

/* F. Approve-all CTA — sticky bar at the panel bottom; the app's only
   gradient-filled button */
.approve-all-bar {
  flex: none;
  padding: var(--s-4) var(--s-6);
  background: var(--bg-glass-heavy);
  border-top: 2px solid var(--border-strong);
}
/* Primary CTA = the landing .cta: black fill, hard shadow, lift/sink physics. */
.btn-primary {
  display: block;
  width: 100%;
  height: 48px;
  border: 2px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--accent);
  color: var(--text-on-accent);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-float);
  transition: transform var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out);
  text-decoration: none;
  text-align: center;
  line-height: 44px;
}
a.btn-primary { display: block; color: var(--text-on-accent); }
.btn-primary:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--border-strong); color: var(--text-on-accent); }
.btn-primary:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--border-strong); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; filter: none; }

/* G. Manual ambition creation — the "+ New ambition" pill + kind/title modal.
   Ambitions used to be chat-only; this is the by-hand door (companion-ambitions
   create). Neo-brutalist: dashed→solid black rule, hard offset shadow. */
.switcher-pill.new-pill {
  color: var(--text);
  background: transparent;
  border: 2px dashed var(--border-strong);
  font-weight: 600;
}
.switcher-pill.new-pill:hover { background: var(--surface-2); border-style: solid; }
.switcher-pill.new-pill .np-plus { font-weight: 800; margin-right: 2px; }
.panel-empty .btn-primary { width: auto; padding: 0 22px; margin-top: var(--s-5); }

.am-modal-backdrop {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: var(--s-4);
  background: rgba(0, 0, 0, 0.42);
  animation: am-fade 160ms var(--ease-out);
}
.am-modal-backdrop.hidden { display: none; }
@keyframes am-fade { from { opacity: 0; } to { opacity: 1; } }
.am-modal {
  width: 100%; max-width: 460px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: var(--r-lg);
  box-shadow: 8px 8px 0 var(--border-strong);
  padding: var(--s-6);
  animation: am-rise 200ms var(--ease-out);
}
@keyframes am-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.am-modal-head { display: flex; align-items: baseline; justify-content: space-between; }
.am-modal-title { font-family: var(--font-serif); font-weight: 800; font-size: 21px; letter-spacing: -0.01em; color: var(--text); }
.am-modal-x { background: none; border: none; font-size: 24px; line-height: 1; color: var(--text-2); cursor: pointer; padding: 2px 6px; }
.am-modal-x:hover { color: var(--text); }
.am-label { display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); margin: var(--s-5) 0 var(--s-2); }
.am-kind-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); }
.am-kind-tile {
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color var(--dur-1) var(--ease-out), background var(--dur-1) var(--ease-out);
}
.am-kind-tile:hover { background: var(--surface-2); border-color: var(--border-strong); }
.am-kind-tile[aria-pressed="true"] { border: 2px solid var(--border-strong); background: var(--surface-3); padding: 9px 11px; }
.am-kind-label { display: block; font-size: 14px; font-weight: 600; color: var(--text); }
.am-kind-hint { display: block; font-size: 11px; color: var(--text-2); margin-top: 2px; line-height: 1.3; }
.am-title-input {
  width: 100%; height: 46px;
  border: 2px solid var(--border-strong); border-radius: var(--r-md);
  padding: 0 14px; font-family: var(--font-sans); font-size: 15px; color: var(--text);
  background: var(--surface); box-sizing: border-box;
}
.am-title-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.am-modal-foot { display: flex; gap: var(--s-2); justify-content: flex-end; align-items: center; margin-top: var(--s-6); }
.am-modal-foot .btn-primary { width: auto; padding: 0 22px; }
.am-modal-foot .btn-ghost:hover { color: var(--text); }

/* H. Workspace views — Progress + Schedule panel takeovers. Same ← back
   chrome as the project view; content is a rollup / timeline over the data
   the panel already holds. Neo-brutalist: 2px rules, hard shadows, no hue. */
.ws-pill .ws-pill-ico { font-size: 12px; opacity: 0.8; }
.ws-head { padding: var(--s-4) 0 var(--s-3); }
.ws-title { font-family: var(--font-serif); font-weight: 800; font-size: 24px; letter-spacing: -0.02em; color: var(--text); }
.ws-sub { font-size: 13px; color: var(--text-2); margin-top: var(--s-1); line-height: 1.45; max-width: 42ch; }
.ws-summary { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); margin-bottom: var(--s-4); }
.ws-avg {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-4); margin-bottom: var(--s-5);
  border: 2px solid var(--border-strong); border-radius: var(--r-md); background: var(--surface);
}
.ws-avg-label { font-size: 12px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.ws-avg-pct { font-family: var(--font-serif); font-weight: 800; font-size: 16px; color: var(--text); }

/* Progress bar — black fill on a gray track, no hue. */
.prog-bar { height: 8px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.prog-bar-fill { display: block; height: 100%; background: var(--accent); border-radius: var(--r-pill); transition: width var(--dur-2, 240ms) var(--ease-out); }

.prog-card {
  display: block; width: 100%; text-align: left;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); padding: var(--s-4); margin-bottom: var(--s-2); cursor: pointer;
  transition: border-color var(--dur-1) var(--ease-out), transform var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out);
}
.prog-card:hover { border: 2px solid var(--border-strong); padding: calc(var(--s-4) - 1px); transform: translate(-2px, -2px); box-shadow: var(--shadow-float); }
.prog-card-top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-2); }
.prog-card-title { font-weight: 700; font-size: 15px; color: var(--text); }
.prog-card-kind { font-size: 12px; color: var(--text-2); margin: 2px 0 var(--s-3); }
.prog-phase { flex: none; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 7px; border-radius: var(--r-pill); border: 1px solid var(--border-strong); color: var(--text-2); }
.prog-phase.phase-promote { background: var(--accent); color: var(--text-on-accent); border-color: var(--accent); }
.prog-bar-label { font-size: 11px; color: var(--text-2); margin-top: 6px; }
.prog-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--s-3); }
.prog-chip { font-size: 11px; font-weight: 600; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 3px 8px; }
.prog-chip.is-live { color: var(--text-on-accent); background: var(--accent); border-color: var(--accent); }
.prog-chip.is-empty { font-weight: 500; font-style: italic; background: transparent; border-style: dashed; }
.prog-next { font-size: 12px; color: var(--text-2); margin-top: var(--s-3); padding-top: var(--s-2); border-top: 1px dashed var(--border); }

/* Schedule timeline */
.sched-list { display: flex; flex-direction: column; }
.sched-month {
  font-family: var(--font-serif); font-weight: 800; font-size: 13px; letter-spacing: 0.02em;
  color: var(--text); text-transform: uppercase;
  margin: var(--s-4) 0 var(--s-2); padding-bottom: 4px; border-bottom: 2px solid var(--border-strong);
}
.sched-item {
  display: flex; align-items: center; gap: var(--s-3); width: 100%; text-align: left;
  padding: var(--s-3) var(--s-2); background: none; border: none; border-bottom: 1px solid var(--border); cursor: pointer;
  transition: background var(--dur-1) var(--ease-out);
}
.sched-item:hover { background: var(--surface-2); }
.sched-date {
  flex: none; width: 46px; height: 46px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 2px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface);
}
.sched-dow { font-size: 9px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-2); }
.sched-day { font-family: var(--font-serif); font-weight: 800; font-size: 18px; line-height: 1; color: var(--text); }
.sched-body { display: flex; flex-direction: column; min-width: 0; }
.sched-label { font-weight: 600; font-size: 14px; color: var(--text); }
.sched-amb { font-size: 12px; color: var(--text-2); margin-top: 1px; }
.sched-item.is-today .sched-date { background: var(--accent); border-color: var(--accent); }
.sched-item.is-today .sched-dow, .sched-item.is-today .sched-day { color: var(--text-on-accent); }
.sched-item.is-overdue .sched-date { opacity: 0.5; border-style: dashed; }
.sched-item.is-overdue .sched-label { color: var(--text-2); }

/* Schedule v2 — add button + editable milestone rows */
.sched-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3); }
.sched-head-text { flex: 1; min-width: 0; }
.sched-add { flex: none; margin-top: var(--s-2); white-space: nowrap; }
.sched-milestone { align-items: center; }
.sched-check {
  flex: none; width: 22px; height: 22px; margin-right: 2px;
  border: 2px solid var(--border-strong); border-radius: 6px; background: var(--surface);
  font-size: 13px; font-weight: 800; line-height: 1; color: var(--text-on-accent); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.sched-check:hover { background: var(--surface-2); }
.sched-item.is-done .sched-check { background: var(--accent); border-color: var(--accent); }
.sched-body-btn { background: none; border: none; text-align: left; cursor: pointer; padding: 0; min-width: 0; flex: 1; display: flex; flex-direction: column; }
.sched-item.is-done .sched-label { text-decoration: line-through; color: var(--text-2); }
.sched-item.is-done .sched-date { opacity: 0.55; }
.sched-del {
  flex: none; width: 26px; height: 26px; border: none; background: none; color: var(--text-2);
  font-size: 14px; cursor: pointer; border-radius: 6px; opacity: 0; transition: opacity var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.sched-milestone:hover .sched-del, .sched-del:focus-visible { opacity: 1; }
.sched-del:hover { color: var(--danger); background: var(--surface-2); }

/* Shared empty state for workspace views */
.ws-empty { text-align: center; padding: var(--s-12) var(--s-4); }
.ws-empty-title { font-family: var(--font-serif); font-weight: 800; font-size: 17px; color: var(--text); }
.ws-empty-sub { font-size: 13px; color: var(--text-2); margin-top: var(--s-2); line-height: 1.5; max-width: 34ch; margin-left: auto; margin-right: auto; }
.ws-empty .btn-primary { width: auto; padding: 0 22px; margin-top: var(--s-5); display: inline-block; }

/* I. Project/role edit surface — shape how a role reads as a project. */
.proj-edit-row { display: flex; gap: var(--s-2); margin: var(--s-3) 0 var(--s-4); }
.proj-edit-row .btn-primary.proj-post { width: auto; height: auto; padding: 9px 18px; line-height: 1.2; }
.proj-edit-form { display: flex; flex-direction: column; gap: var(--s-4); margin-top: var(--s-2); }
.pe-field { display: flex; flex-direction: column; }
.pe-label { font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-2); margin-bottom: 6px; }
.pe-input {
  width: 100%; box-sizing: border-box;
  border: 2px solid var(--border-strong); border-radius: var(--r-md);
  padding: 10px 12px; font-family: var(--font-sans); font-size: 14px; color: var(--text); background: var(--surface);
}
.pe-input:disabled { color: var(--text-2); background: var(--surface-2); border-color: var(--border); }
.pe-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pe-textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
.pe-hint { font-size: 11px; color: var(--text-2); margin-top: 5px; }
.pe-actions { display: flex; gap: var(--s-2); justify-content: flex-end; align-items: center; margin-top: var(--s-2); }
.pe-actions .btn-primary { width: auto; padding: 0 22px; }

/* Manual project/role builder inside a brief */
.brief-projects-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); margin-top: var(--s-6); margin-bottom: var(--s-1); }
.brief-projects-head .sibling-section { margin: 0; }
.staged-actions { display: flex; justify-content: flex-end; margin: -6px 0 var(--s-3); }
.staged-edit-btn { background: none; border: none; font-size: 12px; font-weight: 600; color: var(--text-2); cursor: pointer; padding: 2px 4px; text-decoration: underline; text-underline-offset: 2px; }
.staged-edit-btn:hover { color: var(--text); }
/* project-draft modal reuses am-modal + pe-input; give its select/textarea room */
#project-draft-modal .pe-input { margin-bottom: 2px; }

/* G. Share-link block */
.share-block {
  margin: var(--s-4) var(--s-6) 0;
  background: var(--surface-2);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
}
.share-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.share-row .link-icon { flex: none; color: var(--text-2); }
.share-link {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text);
  word-break: break-all;
  text-decoration: none;
}
.share-link:hover { color: var(--accent); text-decoration: underline; }
.share-caption { margin-top: var(--s-2); font-size: 12px; color: var(--text-2); }

/* Flash ring when a draft chip jumps to a row (§4.6) */
.draft-flash { animation: flash-ring 1.2s var(--ease-out) forwards; }
@keyframes flash-ring {
  0%   { box-shadow: 0 0 0 2px var(--border-strong); }
  100% { box-shadow: 0 0 0 2px rgba(0,0,0,0); }
}

/* H. Per-project screen — replaces the dashboard inside the panel region.
   Reuses ambition-header / stats-row / share-block / sibling-section. */
.sibling-row[data-project-id] { cursor: pointer; transition: background var(--dur-1) var(--ease-out); }
.sibling-row[data-project-id]:hover { background: var(--surface); }
.project-back {
  display: inline-flex;
  margin: var(--s-4) var(--s-6) 0;
  padding: 0;
  background: transparent;
  border: none;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text-2);
  cursor: pointer;
  transition: color var(--dur-1) var(--ease-out);
}
.project-back:hover { color: var(--accent); }
.project-head { padding-top: var(--s-4); }
.project-chip-row { margin-bottom: var(--s-2); }
.project-skel { padding: var(--s-6); }
.project-skel .skeleton-line { margin-bottom: var(--s-3); }
.project-desc-wrap { padding: 0 var(--s-6) var(--s-4); }
.project-desc {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-2);
  white-space: pre-wrap;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
}
.project-desc.expanded {
  display: block;
  -webkit-line-clamp: none;
}
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  padding: 0 var(--s-6) var(--s-4);
}
.project-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 10px;
}
.applicant-empty { font-size: 13px; color: var(--text-2); }
.applicant-row {
  background: transparent;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
  padding: var(--s-4) 0;
}
.applicant-head {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
}
.applicant-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.applicant-time {
  flex: none;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-2);
}
.applicant-preview {
  margin-top: var(--s-2);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-2);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.applicant-preview.expanded {
  display: block;
  -webkit-line-clamp: none;
}
.applicant-preview.expanded .app-answer + .app-answer { margin-top: var(--s-2); }
.app-q { color: var(--text-2); font-style: italic; }
.applicant-expand {
  margin-top: var(--s-1);
  padding: 0;
  background: transparent;
  border: none;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--text-2);
  cursor: pointer;
  transition: color var(--dur-1) var(--ease-out);
}
.applicant-expand:hover { color: var(--text); }
.applicant-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-3);
}
/* Accept — the row-level solid accent action (Decline stays btn-ghost) */
.btn-accent {
  background: var(--accent);
  border: none;
  border-radius: var(--r-sm);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-on-accent);
  cursor: pointer;
  transition: filter var(--dur-1) var(--ease-out);
}
.btn-accent:hover { filter: brightness(1.06); }
.btn-accent:active { filter: brightness(0.95); }
.btn-accent:disabled { opacity: 0.5; cursor: not-allowed; filter: none; }
.team-row {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-1);
  border-bottom: 1px solid var(--border);
}
.team-row:last-child { border-bottom: none; }
.team-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* I. Brief pages (companion-ambitions) — serif inline-editable title,
   phase toggle, template-field form with debounced auto-save, linked
   drafts/projects/share-links, quiet archive footer. */
.brief-head { padding-bottom: var(--s-2); }
.brief-title-wrap { position: relative; }
.brief-title {
  width: 100%;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 24px;
  line-height: 1.25;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 2px 30px 2px 6px;
  margin-left: -6px;
  outline: none;
  transition: background var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out);
}
.brief-title:hover, .brief-title:focus {
  background: var(--surface-2);
  border-color: var(--border-strong);
}
.brief-title-wrap .pencil {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  color: var(--text-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-1) var(--ease-out);
}
.brief-title-wrap:hover .pencil,
.brief-title-wrap:focus-within .pencil { opacity: 1; }
.brief-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-3);
  margin-top: var(--s-2);
}
.brief-kind {
  font-size: 11px;
  line-height: 1.3;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
}
.phase-toggle {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 2px;
}
.phase-toggle button {
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: background var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.phase-toggle button:hover { color: var(--text); }
.phase-toggle button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }
.brief-progress {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
/* Auto-save whisper — fades in beside the progress, then away. */
.brief-saved {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.4;
  color: var(--live);
  opacity: 0;
  transition: opacity var(--dur-2) var(--ease-out);
}
.brief-saved.show { opacity: 1; }

.brief-form {
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
  padding: var(--s-2) var(--s-6) 0;
}
.brief-label {
  display: block;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--text);
}
.brief-hint {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-2);
  margin-top: 2px;
}
.brief-label + .brief-input,
.brief-label + .brief-chiprow,
.brief-hint + .brief-input,
.brief-hint + .brief-chiprow { margin-top: var(--s-2); }
.brief-input {
  display: block;
  width: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 12px;
  outline: none;
  transition: border-color var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out);
}
.brief-input:focus { border-color: var(--border-strong); box-shadow: var(--accent-glow); }
.brief-input::placeholder { color: var(--text-3); }
textarea.brief-input {
  resize: vertical;
  min-height: 72px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
}
/* Chevron color = --text-2 (#666666) — data URIs can't reference vars. */
select.brief-input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23666666' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}
input.brief-input[type="date"] { color-scheme: dark; cursor: pointer; }
.brief-field { display: block; min-width: 0; }
.brief-chiprow { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.brief-chip {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 6px 12px;
  cursor: pointer;
  transition: background var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.brief-chip:hover { border-color: var(--border-strong); color: var(--text); }
.brief-chip.on {
  background: var(--accent-track);
  border-color: var(--accent-deep);
  color: var(--text);
}

/* The other phase's fields collapse under a subtle divider. */
.brief-divider {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  padding: var(--s-2) 0;
  background: transparent;
  border: none;
  font-size: 11px;
  line-height: 1.3;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
  cursor: pointer;
  transition: color var(--dur-1) var(--ease-out);
}
.brief-divider:hover { color: var(--text); }
.brief-divider-label { flex: none; white-space: nowrap; }
.brief-divider-line { flex: 1 1 auto; height: 1px; background: var(--border); }

/* Pipeline staging card — master badged gold, roles badged as hidden
   intake posts. */
.pipeline-note {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-2);
}
.pipe-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
  padding: 2px 8px;
  margin-left: var(--s-2);
  font-size: 11px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.pipe-badge.master { color: var(--text-on-accent); background: var(--accent); }
/* Role rows drop the pill — bare mono note beside the status chip, not a
   second stacked-caps badge. */
.pipe-badge.role {
  background: transparent;
  border: 0;
  padding: 0;
  font-family: var(--font-mono);
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
}

/* Post-approval intake links (a pipeline's hidden role posts) */
.intake-list { padding: var(--s-4) var(--s-6) 0; }
.intake-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) 0;
  border-bottom: 1px solid var(--border);
}
.intake-row:last-child { border-bottom: none; }
.intake-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.intake-link {
  flex: none;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-2);
  text-decoration: none;
}
.intake-link:hover { color: var(--accent); text-decoration: underline; }

/* Quiet archive footer */
.brief-footer { padding: var(--s-6); }
.brief-archive {
  padding: 0;
  background: transparent;
  border: none;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-2);
  cursor: pointer;
  transition: color var(--dur-1) var(--ease-out);
}
.brief-archive:hover { color: var(--danger); }

/* Project-screen share row: url text + "public page ↗" + Copy — the one
   surface (plus post-approval blocks) where /p is linked. */
.share-link-text {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text);
  word-break: break-all;
}
.share-open {
  flex: none;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-2);
  text-decoration: none;
  white-space: nowrap;
}
.share-open:hover { color: var(--accent); text-decoration: underline; }

/* Toast action (Undo) */
.toast-action {
  margin-left: var(--s-3);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  transition: background var(--dur-1) var(--ease-out);
}
.toast-action:hover { background: var(--surface-2); }

/* Switcher: brief-pill dot + archived group */
/* Filled gold = action waiting; a hollow ring = a brief (a document). */
.switcher-dot.brief { background: transparent; border: 1.5px solid var(--accent); opacity: 1; }
.switcher-pill.archived-toggle { color: var(--text-2); border-style: dashed; }
.switcher-pill.archived-toggle:hover { color: var(--text-2); }
.switcher-pill.is-archived { opacity: 0.65; }

/* Ambition tool chips are clickable */
.tool-chip-btn {
  cursor: pointer;
  transition: border-color var(--dur-1) var(--ease-out), background var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out), padding var(--dur-1) var(--ease-out);
}
.tool-chip-btn:hover { border-color: var(--border); background: var(--surface-2); color: var(--text); padding: 2px 10px; }

/* Inline brief card — the LATEST upsert_ambition tool row renders as a
   live, editable brief card in the thread (earlier rows keep the chip).
   Compact panel-card treatment (--surface, --r-lg, hairline) sized for
   the 720px chat column; field rows reuse the brief-field renderers. */
.msg-brief-card { flex-direction: column; align-items: stretch; }
/* Sits close to its turn, like tool chips */
.msg-assistant + .msg-brief-card,
.msg-tool + .msg-brief-card,
.msg-brief-card + .msg-tool,
.msg-brief-card + .msg-assistant { margin-top: var(--s-2); }
.brief-card {
  width: 100%;
  max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-card);
  padding: var(--s-4) var(--s-5);
}
/* Inputs inside the in-thread card sit on --surface too — lift them a step
   so fields don't vanish into the card. */
.brief-card .brief-input { background: var(--surface-2); }
.brief-card .brief-chip { background: var(--surface-2); }
.brief-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
}
.brief-card-heading { min-width: 0; }
.brief-card-title {
  display: block;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 19px;
  line-height: 1.3;
  color: var(--text);
}
.brief-card-kind {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.3;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
}
/* Thin accent progress bar — same fill treatment as sibling-meter */
.brief-card-progress {
  height: 3px;
  border-radius: 2px;
  background: var(--accent-track);
  overflow: hidden;
  margin-top: var(--s-3);
}
.brief-card-progress .fill {
  display: block;
  height: 100%;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
  transition: width var(--dur-2) var(--ease-out);
}
.brief-card-fields {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  margin-top: var(--s-4);
}
.brief-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-top: var(--s-4);
}
.brief-card-answered,
.brief-card-open {
  padding: 0;
  background: transparent;
  border: none;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-2);
  cursor: pointer;
  transition: color var(--dur-1) var(--ease-out);
}
.brief-card-answered:hover { color: var(--text); }
.brief-card-open { margin-left: auto; }
.brief-card-open:hover { color: var(--accent); }

/* Agent-authored (custom: true) brief fields — tiny gold dot after the
   label, on the panel form and inline cards alike. */
.custom-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-left: 6px;
  vertical-align: 2px;
  border-radius: 50%;
  background: var(--accent);
  cursor: help;
}

/* Sheet grabber (mobile only) */
.sheet-grabber {
  display: none;
  flex: none;
  width: 100%;
  padding: var(--s-3) 0 var(--s-1);
  background: transparent;
  border: none;
  cursor: pointer;
}
.sheet-grabber span {
  display: block;
  width: 36px; height: 4px;
  margin: 0 auto;
  border-radius: var(--r-pill);
  background: var(--border-strong);
}

/* ---------------------------------------------------------------------
   Border mural — decorative Clubs layer (suits ♣♠♥♦, poker chips,
   playing cards) hugging the viewport edges. Transform-only ambient
   float; JS adds cursor magnetism on the .mural-el wrappers. Layering:
   content (auto) < mural (40) < panel (45) < topbar (50) < toast (100).
   --------------------------------------------------------------------- */
.mural {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  overflow: hidden;
  transition: opacity 360ms var(--ease-in-out);
}
/* The open Ambitions panel compresses the chat into the mural's edge lanes —
   fade the mural out so it never sits over readable text. */
body.panel-open .mural { opacity: 0; }
body.panel-open .mural .m-chip { pointer-events: none; }
.mural-el { position: absolute; will-change: transform; }
.mural-anim {
  animation: mural-float 14s var(--ease-in-out) infinite alternate;
}
@keyframes mural-float {
  from { transform: translateY(-7px) rotate(-2.5deg); }
  to   { transform: translateY(7px) rotate(2.5deg); }
}

/* Suit glyphs — warm gray, with one ember club and two muted-red pips */
.m-suit {
  line-height: 1;
  color: var(--viz-dim);
  opacity: 0.55;
  user-select: none;
}
.m-suit.m-red { color: var(--danger); opacity: 0.38; }
.m-suit.m-ember { color: var(--accent); opacity: 0.4; }

/* Playing cards — rounded rects with tiny corner pips */
.m-card {
  position: relative;
  width: 44px;
  height: 62px;
  border-radius: 7px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-card);
  opacity: 0.75;
}
.m-card.m-sm { width: 36px; height: 50px; }
.m-card .pip {
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 11px;
  line-height: 1;
  color: var(--viz-dim);
}
.m-card .pip-b {
  top: auto;
  left: auto;
  bottom: 4px;
  right: 6px;
  transform: rotate(180deg);
}
.m-card.m-red-pips .pip { color: var(--danger); opacity: 0.6; }

/* Poker chips — layered circles with a dashed edge ring; the one
   interactive mural element (click = springy spin + ember glow) */
.m-chip {
  position: relative;
  pointer-events: auto;
  cursor: pointer;
  border-radius: 50%;
  background: var(--surface-3);
  border: 2px solid var(--border-strong);
  opacity: 0.85;
}
.m-chip::before {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  border: 2px dashed var(--viz-dim);
}
.m-chip::after {
  content: '♣';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  color: var(--viz-dim);
}
.m-chip.m-ember-ring::before { border-color: var(--accent); opacity: 0.6; }
.m-chip.m-ember-ring::after { color: var(--accent); opacity: 0.75; }
.m-chip.spin {
  animation:
    chip-spin 900ms cubic-bezier(0.34, 1.56, 0.64, 1),
    chip-glow 900ms var(--ease-out);
}
@keyframes chip-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(720deg); }
}
@keyframes chip-glow {
  0%   { box-shadow: none; }
  30%  { box-shadow: var(--accent-glow), 0 0 0 3px var(--accent-track); }
  100% { box-shadow: none; }
}

/* Reduced-motion fallback: static faint corner suits */
.mural-static {
  display: none;
  position: absolute;
  font-size: 26px;
  line-height: 1;
  color: var(--viz-dim);
  opacity: 0.35;
  user-select: none;
}

@media (max-width: 900px) {
  .mural { display: none; }
}

/* ---------------------------------------------------------------------
   Edge hover rails (desktop >900px) — Chats (left) + Ambitions (right).
   14px invisible hover zones on the viewport's vertical middle with a
   3px×48px hint strip each; the rail is a floating --surface card that
   springs in from its edge (translateX ±24px → 0, 380ms overshoot) with
   staggered items, and reverses fast (200ms, no spring). Zones/rails sit
   at z-70: above the panel (45) and topbar (50), under the toast (100).
   On ≤900px they are display:none and the topbar Chats pill takes over.
   --------------------------------------------------------------------- */
/* Edge affordances + drawers, v2 — the Claude-sidebar pattern: an
   always-visible slim hint at each edge; hovering it slides a FULL-HEIGHT
   solid drawer over the content. Navigation surfaces don't bounce: fast
   easeOut-expo open, faster linear-ish close, transform-only. */
.edge-zone {
  position: fixed;
  top: var(--topbar-h);
  bottom: 0;
  width: 18px;
  z-index: 70;
}
.edge-zone.edge-left { left: 0; }
.edge-zone.edge-right { right: 0; }
/* Disclosure chevron — rotates open instead of glyph-swapping. */
.disc-arrow {
  display: inline-block;
  vertical-align: -1px;
  transition: transform var(--dur-1) var(--ease-out);
}
.disc-arrow.open { transform: rotate(90deg); }

/* A real (focusable) button — visually still the thin strip. */
.edge-hint {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: var(--r-pill);
  background: var(--border-strong);
  cursor: pointer;
  transition: background var(--dur-1) var(--ease-out),
              box-shadow var(--dur-1) var(--ease-out),
              height var(--dur-1) var(--ease-out);
}
.edge-left .edge-hint { left: 6px; }
.edge-right .edge-hint { right: 6px; }
.edge-zone:hover .edge-hint,
.edge-zone:focus-within .edge-hint,
.edge-zone.zone-hot .edge-hint {
  background: var(--accent);
  box-shadow: var(--accent-glow);
  height: 64px;
}

.rail {
  position: fixed;
  top: var(--topbar-h);
  bottom: 0;
  z-index: 75;                       /* over the panel (45); under toast (100) */
  display: flex;
  flex-direction: column;
  background: var(--surface);        /* fully opaque — drawers never muddle */
  box-shadow: var(--shadow-panel);
  visibility: hidden;
  pointer-events: none;
  transition: transform 200ms var(--ease-in-out), visibility 0s linear 200ms;
}
.rail-left {
  left: 0;
  width: 300px;
  border-right: 1px solid var(--border-strong);
  transform: translateX(-100%);
}
.rail-right {
  right: 0;
  width: 320px;
  border-left: 1px solid var(--border-strong);
  transform: translateX(100%);
}
.rail.rail-open {
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0);
  transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1), visibility 0s;
}
/* Items fade up softly behind the slide; --stagger set inline per item.
   Base state carries no delay so closing reverses everything at once. */
.rail-item {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out);
}
.rail.rail-open .rail-item {
  opacity: 1;
  transform: none;
  transition-delay: var(--stagger, 0ms);
}
/* An open drawer owns the edge — dim the mural underneath it */
body.drawer-open .mural { opacity: 0; }

.rail-header {
  flex: none;
  padding: var(--s-4) var(--s-4) var(--s-2);
  font-size: 11px;
  line-height: 1.3;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
}
.rail-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 var(--s-2) var(--s-2);
}
.rail-empty {
  padding: var(--s-4) var(--s-3);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-2);
  text-align: center;
}

/* RIGHT rail — condensed ambition mini-cards + per-project rows */
.rail-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: var(--r-md);
  padding: var(--s-3);
  cursor: pointer;
  transition: background var(--dur-1) var(--ease-out);
}
.rail-card:hover { background: var(--surface-2); }
.rail-card-title {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-width: 0;
}
.rail-card-title-text {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 16px;
  line-height: 1.3;
  color: var(--text);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rail-dot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--staged); /* gold — matches the switcher's staged dot */
}
.rail-card-meta { font-size: 12px; line-height: 1.4; color: var(--text-2); }
.rail-card-funnel {
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.rail-footer {
  flex: none;
  width: 100%;
  text-align: left;
  padding: var(--s-3) var(--s-4);
  background: transparent;
  border: none;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text-2);
  cursor: pointer;
  transition: color var(--dur-1) var(--ease-out), background var(--dur-1) var(--ease-out);
}
.rail-footer:hover { color: var(--accent); background: var(--surface-2); }

/* Individual project rows under the group cards — "PROJECTS" subheader,
   then title + status dot + compact applied count per row. */
.rail-subheader {
  flex: none;
  padding: var(--s-4) var(--s-3) var(--s-1);
  font-size: 11px;
  line-height: 1.3;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
}
.rail-proj {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  width: 100%;
  text-align: left;
  padding: var(--s-2) var(--s-3);
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--dur-1) var(--ease-out);
}
.rail-proj:hover { background: var(--surface-2); }
.rail-proj-dot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--live);
}
.rail-proj-dot.muted { background: var(--text-3); }
.rail-proj-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rail-proj-count {
  flex: none;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

/* LEFT rail — New chat row + recent chats */
.rail-new-chat {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin: var(--s-2) var(--s-2) 0;
  padding: var(--s-3);
  background: transparent;
  border: none;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: color var(--dur-1) var(--ease-out), background var(--dur-1) var(--ease-out);
}
.rail-new-chat svg { flex: none; color: var(--text-2); transition: color var(--dur-1) var(--ease-out); }
.rail-new-chat:hover { color: var(--accent); background: var(--surface-2); }
.rail-new-chat:hover svg { color: var(--accent); }
.rail-left .rail-body {
  margin-top: var(--s-2);
  padding-top: var(--s-2);
  border-top: 1px solid var(--border);
}
.rail-chat {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
  width: 100%;
  text-align: left;
  padding: var(--s-2) var(--s-3);
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--dur-1) var(--ease-out);
}
.rail-chat:hover { background: var(--surface-2); }
.rail-chat[aria-current="true"] { background: var(--surface-3); }
.rail-chat-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rail-chat-time {
  flex: none;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-2);
}

/* Desktop gets the rails; the topbar Chats pill + dropdown retire >900px
   (they stay as the touch affordance — hover doesn't exist there). */
@media (min-width: 901px) {
  .chats-wrap { display: none !important; }
}

/* ---------------------------------------------------------------------
   Toast
   --------------------------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: var(--s-6);
  transform: translateX(-50%);
  max-width: min(480px, calc(100vw - 32px));
  background: var(--surface-3);
  color: var(--text);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-float);
  padding: var(--s-3) var(--s-4);
  font-size: 14px;
  z-index: 100;
}

/* ---------------------------------------------------------------------
   Login page (§7)
   --------------------------------------------------------------------- */
.login-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-6);
  padding: calc(var(--topbar-h) + var(--s-6)) var(--s-6) var(--s-16);
}
.login-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-3);
  text-align: center;
}
.login-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 24px;
  line-height: 1.25;
  color: var(--text);
}
.login-sub { font-size: 14px; color: var(--text-2); }

.field { margin-bottom: var(--s-4); }
.field label {
  display: block;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: var(--s-2);
}
.field input {
  width: 100%;
  height: 48px;
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding-inline: var(--s-4);
  outline: none;
  transition: border-color var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out);
}
.field input::placeholder { color: var(--text-3); }
.field input:focus { border-color: var(--border-strong); box-shadow: var(--accent-glow); }
.field .hint { font-size: 12px; color: var(--text-2); margin-top: var(--s-2); }

.otp-input {
  font-size: 24px !important;
  font-weight: 600;
  letter-spacing: 0.35em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.alert {
  background: var(--surface-2);
  border-radius: var(--r-md);
  border-left: 3px solid var(--border-strong);
  padding: var(--s-3) var(--s-4);
  font-size: 14px;
  color: var(--text);
  margin-bottom: var(--s-4);
}
.alert-success { border-left-color: var(--live); }
.alert-error { border-left-color: var(--danger); }
.alert-info { border-left-color: var(--border-strong); }

.login-note { font-size: 13px; color: var(--text-2); max-width: 400px; text-align: center; }
.login-body-note { font-size: 13px; color: var(--text-2); margin-bottom: var(--s-4); }

/* Turnstile slot: third-party widget — when enabling __REQUIRE_CAPTCHA, set
   the widget's theme to 'dark' in the turnstile.render() options so it
   matches this surface. */
#captcha-slot { margin: var(--s-4) 0; }

.row { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.mt-4 { margin-top: var(--s-4); }
.mb-4 { margin-bottom: var(--s-4); }

/* ---------------------------------------------------------------------
   Mobile (≤ 900px, §6) — panel becomes a full-screen sheet
   --------------------------------------------------------------------- */
@media (max-width: 900px) {
  .main { grid-template-columns: 1fr !important; }
  /* No hover on touch — edge zones/hints/rails retire; the topbar Chats
     pill + dropdown stay as the ≤900px affordance. */
  .edge-zone, .rail { display: none !important; }
  .chat-pane { min-width: 0; }
  .thread { padding-inline: var(--s-4); }
  .composer-dock { padding-inline: var(--s-4); }
  .msg-user .msg-bubble { max-width: 85%; }
  .greeting-top .orb-lg { width: 32px; height: 32px; }
  .chat-pane.mode-greeting { padding-inline: var(--s-4); }

  .panel {
    position: fixed;
    inset: 0;
    top: max(12px, env(safe-area-inset-top));
    z-index: 70;
    border-left: none;
    border-radius: 20px 20px 0 0;
    background: var(--bg);
    box-shadow: var(--shadow-panel);
    overflow: hidden;
    transform: translateY(100%);
    visibility: hidden;
    transition: transform var(--dur-2) var(--ease-in-out), visibility 0s linear var(--dur-2);
  }
  .main.panel-open .panel {
    transform: translateY(0);
    visibility: visible;
    transition: transform 320ms var(--ease-out), visibility 0s;
  }
  .panel-inner {
    width: 100%;
    padding-top: 0;
    opacity: 1;
    transform: none;
    transition: none;
  }
  .sheet-grabber { display: block; }

  .stats-row .stat-value { font-size: 28px; }
}

@media (max-width: 480px) {
  /* Topbar pills collapse to icon (+ badge) */
  .ambitions-pill .pill-label,
  .chats-pill .pill-label { display: none; }
  .ambitions-pill .pill-icon,
  .chats-pill .pill-icon { display: inline-flex; }
}

@media (max-width: 360px) {
  .stats-row { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------------
   Reduced motion (§8)
   --------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .orb-breathe, .thinking-dot { animation: none; }
  .skeleton-line::after { animation: none; content: none; }
  .main { transition: none; }
  .panel { transition: opacity var(--dur-1) linear, visibility 0s linear var(--dur-1); opacity: 0; }
  .main.panel-open .panel { transition: opacity var(--dur-1) linear, visibility 0s; opacity: 1; }
  .panel-inner { transition: opacity var(--dur-1) linear; transform: none; }
  .main.panel-open .panel-inner { transition-delay: 0s; }
  @media (max-width: 900px) {
    .panel { transform: none; }
    .main.panel-open .panel { transform: none; }
  }
  .msg-enter { opacity: 0; transform: none; }
  .msg-enter.msg-in {
    transition: opacity var(--dur-1) linear;
    opacity: 1;
  }
  .greeting-leave { transition: opacity var(--dur-1) linear; transform: none; }
  /* Edge rails: instant show/hide, no slide, no stagger */
  .rail { transition: none; }
  .rail.rail-open { transition: none; transform: translateX(0); }
  .rail-item, .rail.rail-open .rail-item { transition: none; transform: none; transition-delay: 0ms; }
  .edge-hint { transition: none; }
  html { scroll-behavior: auto; }
  /* Mural: no float/magnetism/spin — static faint corners instead */
  .mural-el { display: none; }
  .mural-anim, .m-chip.spin { animation: none; }
  .mural-static { display: block; }
}

/* Assistant message hover actions (copy) */
.msg-assistant { position: relative; }
.msg-actions {
  display: flex;
  gap: var(--s-2);
  margin-top: var(--s-1);
  opacity: 0;
  transition: opacity var(--dur-1) var(--ease-out);
}
.msg-assistant:hover .msg-actions,
.msg-actions:focus-within { opacity: 1; }
.msg-copy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: none;
  background: transparent;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 6px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: color var(--dur-1) var(--ease-out), background var(--dur-1) var(--ease-out);
}
.msg-copy:hover { color: var(--text); background: var(--surface-2); }
.msg-copy.copied { color: var(--accent); }
@media (prefers-reduced-motion: no-preference) {
  .typing .msg-actions { opacity: 0 !important; } /* hidden while typing out */
}

/* ---- Live page preview (panel 'site:' view) --------------------------------
   The draft rendered through the shared SiteRender inside a framed viewport.
   site.css owns everything inside .site-root; these rules only frame it. */

.site-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  flex-wrap: wrap;
  margin: var(--s-4) 0 var(--s-3);
}

.site-preview-meta {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-width: 0;
}

.site-preview-slug {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
  overflow-wrap: anywhere;
}

.site-preview-actions {
  display: flex;
  gap: 8px;
}

/* Quiet one-tap revert of the Companion's latest edit — reads like the
   brief-archive footer link, not a CTA. Only rendered when the newest
   revision is the Companion's and a pre-Companion revision exists. */
.site-undo-btn {
  padding: 0;
  background: transparent;
  border: none;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-2);
  cursor: pointer;
  transition: color var(--dur-1) var(--ease-out);
}
.site-undo-btn:hover { color: var(--text); text-decoration: underline; }
.site-undo-btn:disabled { opacity: 0.5; cursor: not-allowed; text-decoration: none; }

.site-preview-frame {
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  overflow: hidden;
}

/* The public page fills the viewport; inside the panel it sizes to content —
   the svh-based hero heights would otherwise tower against the real screen. */
.site-preview-frame .site-root { min-height: 0; }
.site-preview-frame .site-section-hero { min-height: 320px; }
.site-preview-frame .site-hero-cover { min-height: 400px; }

.site-preview-note {
  color: var(--text-2);
  font-size: 12px;
  margin: var(--s-3) 2px 0;
}

/* ---- Switcher shelf split: ambitions above, projects/pages below ---------- */

.switcher-divider {
  align-self: stretch;
  width: 2px;
  margin: 2px var(--s-1);
  background: var(--border);
  border-radius: 1px;
}

a.switcher-pill.switcher-link { text-decoration: none; color: var(--text-2); }
a.switcher-pill.switcher-link:hover { color: var(--text); border-color: var(--border-strong); }

/* ---------------------------------------------------------------------
   Login — the other doors (email / Google / Apple). One quiet row under
   the phone form; every one of them creates the account on the spot.
   --------------------------------------------------------------------- */
.login-methods {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.login-methods-label {
  font-size: 12px;
  color: var(--text-secondary, #6b6b6b);
  margin-right: 2px;
}
.login-methods .btn-ghost {
  border: 1px solid var(--border-strong);
  border-radius: var(--r-pill, 999px);
  padding: 6px 14px;
}

/* ---------------------------------------------------------------------
   Module views (web/agent/_lib/panel*.js) — clubs, chat, inbox, approvals.
   Clubs grayscale neo-brutalism: hairline rows, 2px black where it matters,
   no new colors. Prefix: cv-.
   --------------------------------------------------------------------- */
.cv-head {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}
.cv-back {
  background: transparent;
  border: 0;
  color: var(--text-2);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 8px;
  flex: none;
}
.cv-back:hover { color: var(--text); }
.cv-title {
  font-family: var(--font-serif);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.3px;
  color: var(--text);
  margin: 0;
}
.cv-sub { font-size: 13px; color: var(--text-2); margin: 2px 0 0; }
.cv-mono { font-size: 12px; overflow-wrap: anywhere; }
.cv-note { font-size: 13px; color: var(--text-2); padding: var(--s-3) 0; }
.cv-link {
  background: transparent;
  border: 0;
  color: var(--text);
  text-decoration: underline;
  cursor: pointer;
  font-size: inherit;
  padding: 0;
}
.cv-skel {
  height: 54px;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  margin-bottom: var(--s-2);
  animation: cvPulse 1.2s ease-in-out infinite;
}
@keyframes cvPulse { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .cv-skel { animation: none; } }
.cv-empty { padding: var(--s-6) 0; }
.cv-empty-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  margin: 0 0 var(--s-1);
}

/* Hairline rows (thread list, club list, channel list) */
.cv-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  padding: 10px 4px;
  cursor: pointer;
  min-width: 0;
}
.cv-row:hover { background: var(--surface-2); }
.cv-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  border: 1px solid var(--text-2);
  flex: none;
}
.cv-dot.on { background: var(--text); border-color: var(--text); }
.cv-row-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1 1 auto; }
.cv-row-title {
  font-size: 14px;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cv-row-title.unread { font-weight: 700; }
.cv-row-sub {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cv-row-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.cv-time { font-size: 11px; color: var(--text-3); }
.cv-tag {
  font-size: 10px;
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
}
.cv-tag-block { display: inline-block; margin: var(--s-1) 0; }

/* Cards (approvals tray, staged replies) */
.cv-card {
  border: 2px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  padding: var(--s-4);
  margin-bottom: var(--s-3);
  box-shadow: 4px 4px 0 var(--border-strong);
}
.cv-card-done { box-shadow: none; border-color: var(--border); }
.cv-card-kind {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-2);
  margin-bottom: var(--s-2);
}
.cv-card-line { font-size: 14px; color: var(--text); margin: 0 0 var(--s-2); }
.cv-card-note { font-size: 13px; color: var(--text-2); margin: 0 0 var(--s-2); }
.cv-quote {
  border-left: 2px solid var(--border-strong);
  margin: 0 0 var(--s-3);
  padding: var(--s-1) 0 var(--s-1) var(--s-3);
  font-size: 14px;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.cv-diff-row { display: flex; gap: var(--s-3); font-size: 13px; padding: 2px 0; }
.cv-diff-key { color: var(--text-2); flex: none; min-width: 96px; }
.cv-diff-val { color: var(--text); overflow-wrap: anywhere; }
.cv-fail { font-size: 12px; color: var(--text); font-weight: 700; margin: 0 0 var(--s-2); }
.cv-card-actions { display: flex; gap: var(--s-2); margin-top: var(--s-2); }
.cv-commit {
  background: var(--accent);
  color: var(--text-on-accent);
  border: 2px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  padding: 8px 16px;
  cursor: pointer;
  transition: transform var(--dur-1), box-shadow var(--dur-1);
}
.cv-commit:hover:not(:disabled) { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--border-strong); }
.cv-commit:active:not(:disabled) { transform: translate(1px, 1px); box-shadow: none; }
.cv-commit:disabled { opacity: 0.5; cursor: default; }
.cv-discard {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 13px;
  padding: 8px 14px;
  cursor: pointer;
}
.cv-discard:hover:not(:disabled) { color: var(--text); border-color: var(--border-strong); }
.cv-discard:disabled { opacity: 0.5; cursor: default; }

/* Messages (inbox thread, channel chat) */
.cv-msg {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  padding: var(--s-3);
  margin-bottom: var(--s-2);
  max-width: 46em;
}
.cv-msg.out { background: var(--surface-2); margin-left: var(--s-8); }
.cv-msg-meta {
  display: flex;
  gap: var(--s-3);
  align-items: baseline;
  font-size: 12px;
  color: var(--text);
  margin-bottom: 2px;
}
.cv-msg-subject { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.cv-msg-body { font-size: 14px; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.cv-composer {
  display: flex;
  gap: var(--s-2);
  align-items: flex-end;
  margin-top: var(--s-3);
  padding-top: var(--s-3);
  border-top: 1px solid var(--border);
}
.cv-textarea {
  flex: 1 1 auto;
  min-width: 0;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 8px 10px;
}
.cv-textarea:focus-visible { outline: none; border-color: var(--border-strong); box-shadow: var(--accent-glow); }
.cv-staged { border-style: dashed; box-shadow: none; }

/* Phone view (panelPhone.js) */
.cv-inline-form {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
  align-items: center;
  margin-top: var(--s-2);
}
.cv-input {
  flex: 0 1 auto;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 8px 10px;
}
.cv-input:focus-visible { outline: none; border-color: var(--border-strong); box-shadow: var(--accent-glow); }
.cv-toggle-row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: 14px;
  color: var(--text);
  margin: var(--s-2) 0 0;
  cursor: pointer;
}
.cv-toggle-row input { accent-color: var(--text); }
.cv-row-static {
  display: flex;
  justify-content: space-between;
  gap: var(--s-2);
  font-size: 13px;
  color: var(--text);
  padding: 6px 0;
  border-top: 1px solid var(--border);
}
.cv-row-static:first-of-type { border-top: 0; }

/* Dossier facts (panelDossier.js) */
.cv-fact {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  padding: 6px 0;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
}
.cv-fact:first-of-type { border-top: 0; }
.cv-fact-text { flex: 1 1 auto; min-width: 0; }
.cv-fact-actions { flex: none; display: inline-flex; gap: 4px; }
.cv-fact-btn {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-2);
  font-size: 11px;
  line-height: 1;
  padding: 3px 6px;
  cursor: pointer;
}
.cv-fact-btn:hover { color: var(--text); border-color: var(--border-strong); }
