/* ============================================================
   HumanDeploy Design System — Components
   The single source of truth for every visual primitive used
   across HumanDeploy: marketing site, app surfaces, brand pages,
   email, blog, legal. Every component has documented states.
   The showcase page (index.html) renders all of them in light + dark.

   Domains:
     1–5   Foundations + chat primitives
     6–10  Long-running, artifact, confidence, memory, inline
     11–20 Forms, toggles, tooltip, pill, menu, tabs, modal,
           toast, file, reactions
     21–27 System patterns: topbar, sidebar, cmdk, find,
           presence, banners, conv-card
     28    Responsive
     29    Marketing primitives (nav, hero, section, prose, cta, footer)
   ============================================================ */

/* ============================================================
   1. PRIMITIVES
   ============================================================ */

/* --- 1.1 Button -------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--sans);
  font-size: var(--fs-base);
  font-weight: 500;
  letter-spacing: -0.005em;
  line-height: 1;
  padding: 10px 16px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--dur-base) var(--ease-standard),
              border-color var(--dur-base) var(--ease-standard),
              color var(--dur-base) var(--ease-standard),
              box-shadow var(--dur-base) var(--ease-standard),
              transform var(--dur-base) var(--ease-standard);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--coral-wash);
  border-color: var(--coral);
}
.btn[disabled], .btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.5;
}

.btn--primary {
  background: var(--ink);
  color: var(--paper);
}
.btn--primary:hover:not([disabled]) {
  background: var(--coral);
  transform: translateY(-1px);
  box-shadow: var(--shadow-coral);
}

.btn--coral {
  background: var(--coral);
  color: #fff;
  box-shadow: var(--shadow-coral);
}
.btn--coral:hover:not([disabled]) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-coral-lift);
}

/* ── Slack CTA variant ─────────────────────────────────────
   Coral button with white Slack icon. The primary conversion
   action across the site. Use with .btn--coral:
     <a class="btn btn--coral btn--slack" href="...">
       <img src="/logos/slack-white.svg" alt="" class="btn-icon"/>
       Add to Slack
     </a>
   Sizes inherit from .btn (sm/md/lg via padding).
   ──────────────────────────────────────────────────────── */
.btn-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.btn--sm .btn-icon { width: 14px; height: 14px; }
.btn--lg .btn-icon { width: 20px; height: 20px; }

.btn--secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--hairline);
}
.btn--secondary:hover:not([disabled]) {
  border-color: var(--hairline-strong);
  background: var(--surface-soft);
}

.btn--ghost {
  background: transparent;
  color: var(--ink-soft);
}
.btn--ghost:hover:not([disabled]) {
  background: var(--surface-soft);
  color: var(--ink);
}

.btn--destructive {
  background: var(--surface);
  color: var(--error-text);
  border-color: var(--hairline);
}
.btn--destructive:hover:not([disabled]) {
  background: var(--error);
  color: #fff;
  border-color: var(--error-text);
}

.btn--sm { padding: 6px 10px; font-size: var(--fs-sm); }
.btn--lg { padding: 14px 22px; font-size: var(--fs-md); }

.btn--loading { position: relative; color: transparent !important; }
.btn--loading::after {
  content: '';
  position: absolute; inset: 0; margin: auto;
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
  color: var(--paper);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- 1.2 Icon button --------------------------------------- */
.icon-btn {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-md);
  background: transparent;
  border: 1px solid var(--hairline);
  color: var(--ink-quiet);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 14px; line-height: 1;
  transition: all var(--dur-fast) var(--ease-standard);
}
.icon-btn:hover {
  color: var(--ink);
  border-color: var(--hairline-strong);
  background: var(--surface-soft);
}
.icon-btn--bare { border-color: transparent; }
.icon-btn--sm { width: 24px; height: 24px; font-size: 11px; border-radius: var(--r-sm); }

/* --- 1.3 Input --------------------------------------------- */
.input {
  width: 100%;
  font-family: var(--sans);
  font-size: var(--fs-base);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 10px 12px;
  line-height: 1.4;
  outline: none;
  transition: border-color var(--dur-base), box-shadow var(--dur-base);
}
.input::placeholder { color: var(--ink-faint); font-style: italic; }
.input:hover { border-color: var(--hairline-strong); }
.input:focus { border-color: var(--coral); box-shadow: 0 0 0 3px var(--coral-wash); }
.input[disabled] { opacity: 0.5; cursor: not-allowed; }
.input--error { border-color: var(--error-text); }
.input--error:focus { box-shadow: 0 0 0 3px rgba(183, 80, 61, 0.15); }

/* --- 1.4 Pill / Tag ---------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono);
  font-size: var(--fs-mono-sm);
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  padding: 4px 10px;
  white-space: nowrap;
  line-height: 1;
}
.pill--solid    { background: var(--surface-soft); border-color: transparent; }
.pill--coral    { color: var(--coral); border-color: var(--coral-wash); background: var(--coral-wash); }
.pill--ok       { color: var(--ok-text);    border-color: rgba(79, 138, 110, 0.20); background: rgba(79, 138, 110, 0.08); }
.pill--warn     { color: var(--warn-text);  border-color: rgba(194, 139, 62, 0.20); background: rgba(194, 139, 62, 0.08); }
.pill--error    { color: var(--error-text); border-color: rgba(183, 80, 61, 0.20); background: rgba(183, 80, 61, 0.08); }
.pill--info     { color: var(--info-text);  border-color: rgba(92, 122, 168, 0.20); background: rgba(92, 122, 168, 0.08); }
.pill .pill-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
.pill--breathing .pill-dot {
  background: var(--coral);
  animation: breathe var(--dur-breathe) ease-in-out infinite;
  box-shadow: 0 0 0 3px var(--coral-wash);
}

/* --- 1.5 Avatar -------------------------------------------- */
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  position: relative;
  background: var(--surface-soft);
  color: var(--ink-soft);
  border: 1px solid var(--hairline);
}
.avatar--xs { width: 18px; height: 18px; font-size: 8px; }
.avatar--sm { width: 24px; height: 24px; font-size: 9.5px; }
.avatar--lg { width: 44px; height: 44px; font-size: 14px; }

/* User: solid ink fill */
.avatar--user {
  background: var(--ink);
  color: var(--paper);
  border-color: transparent;
}

/* AI: hairline ring with breathing coral dot */
.avatar--ai {
  background: var(--paper);
  color: var(--ink-soft);
  border: 1px solid var(--hairline-strong);
  font-style: italic;
  font-family: var(--serif);
  font-variation-settings: "opsz" 24;
  font-size: 14px;
  font-weight: 400;
}
.avatar--ai::after {
  content: '';
  position: absolute;
  bottom: -1px; right: -1px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--coral);
  border: 2px solid var(--paper);
  animation: breathe var(--dur-breathe) ease-in-out infinite;
}

/* Specialist: coral-tinted ring */
.avatar--specialist {
  background: var(--coral-wash);
  color: var(--coral);
  border-color: var(--coral-soft);
}

/* Org: paper with coral arrow */
.avatar--org {
  background: var(--surface);
  color: var(--coral);
  border-color: var(--hairline-strong);
}

/* System: dashed border */
.avatar--system {
  background: var(--paper);
  color: var(--ink-quiet);
  border-style: dashed;
}

/* Agent: pixel-art operating team member
   Usage: <span class="avatar avatar--agent"><svg viewBox="0 0 14 14">…</svg></span>
   Each agent face is a 14×14 SVG with crispEdges rendering, eyes centered
   at y=7 (circle midpoint). The bone background + coral accent carry through. */
.avatar--agent {
  background: var(--bone);
  border: 1px solid var(--hairline);
  overflow: hidden;
  padding: 0;
}
.avatar--agent svg {
  width: 100%;
  height: 100%;
  display: block;
  shape-rendering: crispEdges;
  image-rendering: pixelated;
}
/* Breathing blink on agent eyes (opt-in via .blink class on pupil rects) */
@keyframes agent-blink { 0%,88%,92%,100%{opacity:1} 90%{opacity:0} }
.avatar--agent .blink  { animation: agent-blink 4s ease-in-out infinite; }
.avatar--agent .blink2 { animation: agent-blink 3.5s ease-in-out infinite; }
.avatar--agent .blink3 { animation: agent-blink 4.5s ease-in-out infinite; }
/* Coral accent breathing */
.avatar--agent .cb { animation: breathe var(--dur-breathe, 3.2s) ease-in-out infinite; }

/* --- 1.6 Identity (avatar + name + role + meta) ------------ */
.identity {
  display: inline-flex; align-items: center; gap: var(--space-3);
  min-width: 0;
}
.identity-body { min-width: 0; line-height: 1.25; }
.identity-name {
  font-family: var(--serif);
  font-variation-settings: "opsz" 18;
  font-size: var(--fs-md);
  color: var(--ink);
  font-weight: 500;
  letter-spacing: -0.005em;
}
.identity-name em { font-style: italic; }
.identity-role {
  font-family: var(--mono);
  font-size: var(--fs-mono-sm);
  letter-spacing: 0.04em;
  color: var(--ink-quiet);
}
.identity-meta {
  font-family: var(--sans);
  font-size: var(--fs-sm);
  color: var(--ink-quiet);
}

/* --- 1.7 Kbd ------------------------------------------------ */
.kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; padding: 1px 5px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-soft);
  background: var(--hairline);
  border-radius: 3px;
}

/* --- 1.8 Hairline divider ---------------------------------- */
.hairline { height: 1px; background: var(--hairline); border: 0; margin: 0; }
.hairline--strong { background: var(--hairline-strong); }
.hairline--short { width: 60px; margin-left: auto; margin-right: auto; }

/* --- 1.9 Pixel mark (breathing) ----------------------------- */
.dot-breathe {
  width: 8px; height: 8px;
  background: var(--coral);
  animation: breathe var(--dur-breathe) ease-in-out infinite;
  box-shadow: 0 0 0 3px var(--coral-wash);
  display: inline-block;
  shape-rendering: crispEdges;
}
.dot-breathe--lg {
  width: 44px; height: 44px;
  box-shadow: 0 0 0 8px var(--coral-wash), 0 0 0 18px rgba(232, 106, 78, 0.04);
}
.dot-breathe--xs { width: 5px; height: 5px; box-shadow: 0 0 0 2px var(--coral-wash); }

/* --- 1.10 Eyebrow / Label ---------------------------------- */
.eyebrow {
  font-family: var(--mono);
  font-size: var(--fs-label);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-quiet);
}

/* --- 1.11 Skeleton ----------------------------------------- */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-soft) 0%,
    var(--hairline) 50%,
    var(--surface-soft) 100%
  );
  background-size: 800px 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: var(--r-sm);
  height: 12px;
}

/* ============================================================
   2. COMPOSITES
   ============================================================ */

/* --- 2.1 Card ---------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: var(--space-5);
}
.card--soft   { background: var(--surface-soft); }
.card--lift   { box-shadow: var(--shadow-soft); }
.card--strong { box-shadow: var(--shadow-lift); }

/* --- 2.2 Action card --------------------------------------- */
.action-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  display: flex; align-items: flex-start; gap: 14px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: all var(--dur-base) var(--ease-standard);
  font-family: inherit;
  color: inherit;
}
.action-card:hover {
  border-color: var(--hairline-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}
.action-card .ac-num {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--coral);
  letter-spacing: 0.08em;
  margin-top: 3px;
}
.action-card .ac-title {
  font-family: var(--serif);
  font-variation-settings: "opsz" 18;
  font-size: var(--fs-lg);
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.005em;
  line-height: 1.3;
  margin-bottom: 3px;
}
.action-card .ac-desc {
  font-family: var(--sans);
  font-size: var(--fs-sm);
  color: var(--ink-quiet);
  line-height: 1.45;
}

/* --- 2.3 Day divider --------------------------------------- */
.day-divider {
  display: flex; align-items: center; gap: 1rem;
  margin: 24px 0 28px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-quiet);
}
.day-divider::before, .day-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--hairline);
}

/* --- 2.4 Message bubble ------------------------------------ */
.msg {
  display: flex; gap: 14px;
  padding: 18px 0;
  animation: fade-in var(--dur-base) var(--ease-standard);
}
.msg-body { flex: 1; min-width: 0; }
.msg-meta {
  display: flex; align-items: baseline; gap: 10px;
  margin-bottom: 6px;
}
.msg-author {
  font-family: var(--serif);
  font-variation-settings: "opsz" 18;
  font-size: var(--fs-md);
  color: var(--ink);
  font-weight: 500;
  letter-spacing: -0.005em;
}
.msg-author em { font-style: italic; }
.msg-role {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--ink-quiet);
  text-transform: uppercase;
}
.msg-time {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-faint);
  margin-left: auto;
}
.msg-content {
  font-family: var(--serif);
  font-variation-settings: "opsz" 18;
  font-size: 16.5px;
  color: var(--ink-soft);
  line-height: 1.55;
}
.msg-content p { margin: 0 0 10px; }
.msg-content p:last-child { margin-bottom: 0; }
.msg-content em { font-style: italic; color: var(--ink); }

.msg--ai .msg-content { color: var(--ink); }
.msg--user .msg-content { color: var(--ink); }
.msg--system {
  font-family: var(--mono);
  font-size: var(--fs-mono-sm);
  color: var(--ink-quiet);
  letter-spacing: 0.04em;
  text-align: center;
  padding: 10px 0;
  font-style: italic;
}

/* --- 2.5 Plan block ---------------------------------------- */
.plan {
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  background: var(--surface);
  margin: 14px 0 6px;
}
.plan-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px;
}
.plan-title {
  font-family: var(--serif);
  font-variation-settings: "opsz" 18;
  font-size: var(--fs-md);
  color: var(--ink);
  font-weight: 500;
}
.plan-step {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 8px 0;
  border-top: 1px solid var(--hairline);
}
.plan-step:first-of-type { border-top: 0; padding-top: 0; }
.plan-step-num {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--coral);
  letter-spacing: 0.08em;
  margin-top: 5px;
  min-width: 18px;
}
.plan-step-body {
  font-family: var(--serif);
  font-size: var(--fs-md);
  color: var(--ink);
  line-height: 1.5;
}
.plan-step--done .plan-step-body { color: var(--ink-quiet); text-decoration: line-through; text-decoration-color: var(--hairline-strong); }

/* --- 2.6 Artifact card ------------------------------------- */
.artifact {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  margin: 10px 0;
  transition: all var(--dur-base) var(--ease-standard);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.artifact:hover {
  border-color: var(--hairline-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}
.artifact-icon {
  width: 38px; height: 48px;
  border-radius: 4px;
  background: var(--paper-soft);
  border: 1px solid var(--hairline);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ink-quiet);
  letter-spacing: 0.08em;
  flex-shrink: 0;
}
.artifact-body { flex: 1; min-width: 0; }
.artifact-title {
  font-family: var(--serif);
  font-variation-settings: "opsz" 18;
  font-size: var(--fs-md);
  color: var(--ink);
  font-weight: 500;
  margin-bottom: 2px;
}
.artifact-meta {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-quiet);
  letter-spacing: 0.04em;
}
.artifact-action {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--coral);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* --- 2.7 Proactive insight --------------------------------- */
.insight {
  position: relative;
  border-radius: var(--r-lg);
  padding: 18px 20px 18px 22px;
  background:
    linear-gradient(135deg, var(--coral-wash) 0%, transparent 60%),
    var(--surface);
  border: 1px solid var(--coral-soft);
  margin: 14px 0;
  overflow: hidden;
}
.insight::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--coral);
}
.insight-eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--coral);
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.insight-title {
  font-family: var(--serif);
  font-variation-settings: "opsz" 24;
  font-size: 18px;
  color: var(--ink);
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.insight-body {
  font-family: var(--serif);
  font-size: var(--fs-md);
  color: var(--ink-soft);
  line-height: 1.55;
}

/* --- 2.8 Composer ------------------------------------------ */
.composer-wrap {
  display: flex; flex-direction: column;
  gap: 12px;
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}
.composer-context {
  display: flex; align-items: center; justify-content: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-quiet);
}
.composer-context .ctx-sep { color: var(--hairline-strong); }
.composer {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  padding: 14px 14px 14px 18px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow-soft), 0 12px 32px -16px rgba(20, 17, 15, 0.12);
  transition: border-color var(--dur-base), box-shadow var(--dur-base);
}
.composer:focus-within {
  border-color: rgba(232, 106, 78, 0.5);
  box-shadow: var(--shadow-soft), 0 12px 32px -12px var(--coral-glow), 0 0 0 4px var(--coral-wash);
}
.composer-attach {
  width: 32px; height: 32px;
  border-radius: var(--r-md);
  background: transparent;
  border: 1px solid var(--hairline);
  color: var(--ink-quiet);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  font-family: var(--mono); font-size: 16px; line-height: 1;
  transition: all var(--dur-fast) var(--ease-standard);
}
.composer-attach:hover {
  color: var(--ink);
  border-color: var(--hairline-strong);
  background: var(--surface-soft);
}
.composer-input {
  flex: 1;
  border: none; background: transparent;
  font-family: var(--serif);
  font-variation-settings: "opsz" 18;
  font-size: 17.5px;
  color: var(--ink);
  outline: none;
  line-height: 1.4;
  padding: 4px 0;
}
.composer-input::placeholder { color: var(--ink-quiet); font-style: italic; }
.composer-send {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--coral);
  border: none; color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  font-family: var(--mono); font-size: 15px;
  transition: transform var(--dur-base), box-shadow var(--dur-base);
  box-shadow: var(--shadow-coral);
}
.composer-send:hover { transform: translateY(-1px); box-shadow: var(--shadow-coral-lift); }
.composer-meta {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 0 4px;
}
.composer-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.composer-chip {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  padding: 4px 10px;
  cursor: pointer;
  transition: all var(--dur-fast);
  letter-spacing: 0.02em;
}
.composer-chip:hover {
  color: var(--ink);
  border-color: var(--hairline-strong);
  background: var(--surface);
}
.composer-chip .chip-slash { color: var(--coral); margin-right: 1px; }
.composer-hint {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-quiet);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

/* --- 2.9 Status pill --------------------------------------- */
.status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--hairline);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.status-pill .sp-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ok);
}
.status-pill--live .sp-dot {
  background: var(--coral);
  animation: breathe 1.4s ease-in-out infinite;
}
.status-pill--idle .sp-dot { background: var(--ink-faint); }
.status-pill--blocked .sp-dot { background: var(--error); }

/* --- 2.10 Panel section (accordion) ------------------------ */
.panel-section {
  border-bottom: 1px solid var(--hairline);
}
.panel-section:last-child { border-bottom: 0; }
.panel-section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  user-select: none;
}
.panel-section-header .chev {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink-quiet);
  transition: transform var(--dur-base);
}
.panel-section.open .panel-section-header .chev { transform: rotate(90deg); }
.panel-section-body {
  padding: 0 20px 18px;
  display: none;
}
.panel-section.open .panel-section-body { display: block; }
.panel-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color var(--dur-base);
}
.panel-card:hover { border-color: var(--hairline-strong); }
.pc-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--coral);
  margin-bottom: 4px;
}
.pc-title {
  font-family: var(--serif);
  font-size: 13.5px;
  color: var(--ink);
  font-weight: 500;
  line-height: 1.35;
  margin-bottom: 6px;
}
.pc-meta {
  display: flex; justify-content: space-between;
  font-family: var(--sans);
  font-size: 11px;
  color: var(--ink-quiet);
}

/* --- 2.11 Empty state -------------------------------------- */
.empty {
  text-align: center;
  padding: 48px 24px;
  border: 1px dashed var(--hairline-strong);
  border-radius: var(--r-lg);
  background: var(--paper-soft);
}
.empty-mark { display: inline-block; margin-bottom: 16px; }
.empty-title {
  font-family: var(--serif);
  font-variation-settings: "opsz" 24;
  font-size: 20px;
  color: var(--ink);
  font-weight: 500;
  margin-bottom: 6px;
}
.empty-title em { font-style: italic; }
.empty-body {
  font-family: var(--serif);
  font-size: var(--fs-md);
  color: var(--ink-soft);
  max-width: 380px;
  margin: 0 auto 16px;
  line-height: 1.5;
}

/* --- 2.12 Toast -------------------------------------------- */
.toast {
  display: inline-flex; align-items: center; gap: 12px;
  background: var(--ink);
  color: var(--paper);
  padding: 12px 16px;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lift);
  font-family: var(--sans);
  font-size: var(--fs-base);
  max-width: 420px;
}
.toast .dot-breathe { background: var(--coral); }
.toast--ok    { background: var(--ok); color: #fff; }
.toast--warn  { background: var(--warn); color: #fff; }
.toast--error { background: var(--error); color: #fff; }

/* ============================================================
   3. AI CONVERSATION PRIMITIVES (added v0.2)
   ============================================================ */

/* --- 3.1 Streaming cursor ---------------------------------- */
.cursor-stream {
  display: inline-block;
  width: 8px; height: 1em;
  background: var(--coral);
  margin-left: 2px;
  vertical-align: text-bottom;
  border-radius: 1px;
  animation: cursor-blink var(--dur-cursor) steps(1) infinite;
}

/* --- 3.2 Thinking indicator (3 dots) ------------------------ */
.thinking-dots {
  display: inline-flex; gap: 4px;
  padding: 2px 0;
}
.thinking-dots span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ink-quiet);
  animation: thinking-pulse 1.2s ease-in-out infinite;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.15s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.30s; }

/* --- 3.3 Inline code ---------------------------------------- */
.code-inline,
code:not(pre code) {
  font-family: var(--mono);
  font-size: 0.88em;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--paper-soft);
  border: 1px solid var(--hairline);
  color: var(--ink);
  letter-spacing: 0;
}

/* --- 3.4 Code block ----------------------------------------- */
.code-block {
  position: relative;
  background: var(--paper-soft);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  overflow: hidden;
  margin: 12px 0;
}
.code-block-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid var(--hairline);
  font-family: var(--mono);
  font-size: var(--fs-mono-sm);
  color: var(--ink-quiet);
  letter-spacing: var(--tracking-wide);
}
.code-block-lang { text-transform: uppercase; letter-spacing: var(--tracking-wider); font-size: 10px; }
.code-block-copy {
  background: transparent; border: 0;
  font-family: var(--mono); font-size: 10.5px;
  color: var(--ink-quiet);
  cursor: pointer;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  transition: color var(--dur-fast);
}
.code-block-copy:hover { color: var(--coral); }
.code-block pre {
  margin: 0;
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink);
  overflow-x: auto;
}

/* --- 3.5 Markdown content wrapper --------------------------- */
.md-content {
  font-family: var(--serif);
  font-variation-settings: "opsz" 18;
  font-size: 16.5px;
  line-height: var(--leading-normal);
  color: var(--ink);
}
.md-content > * + * { margin-top: 10px; }
.md-content p { margin: 0; }
.md-content em { font-style: italic; }
.md-content strong { font-weight: 600; }
.md-content a {
  color: var(--coral);
  text-decoration: underline;
  text-decoration-color: var(--coral-soft);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: text-decoration-color var(--dur-fast);
}
.md-content a:hover { text-decoration-color: var(--coral); }
.md-content ul, .md-content ol {
  margin: 0; padding-left: 22px;
}
.md-content li { margin: 4px 0; }
.md-content blockquote {
  margin: 12px 0;
  padding: 4px 0 4px 16px;
  border-left: 2px solid var(--coral);
  color: var(--ink-soft);
  font-style: italic;
}
.md-content h1, .md-content h2, .md-content h3 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: var(--tracking-snug);
  margin: 18px 0 8px;
  line-height: var(--leading-snug);
}
.md-content h1 { font-size: 24px; font-variation-settings: "opsz" 32; }
.md-content h2 { font-size: 19px; font-variation-settings: "opsz" 24; }
.md-content h3 { font-size: 16px; font-variation-settings: "opsz" 18; }
.md-content hr {
  border: 0; height: 1px; background: var(--hairline);
  margin: 18px 0;
}

/* --- 3.6 Avatar image + group ------------------------------- */
.avatar img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.avatar--image { background: transparent; }
.avatar--image::after { content: none; }

.avatar-group {
  display: inline-flex;
  align-items: center;
}
.avatar-group .avatar {
  margin-left: -8px;
  border: 2px solid var(--paper);
  box-shadow: none;
}
.avatar-group .avatar:first-child { margin-left: 0; }
.avatar-group .avatar-more {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-quiet);
  margin-left: 6px;
  letter-spacing: var(--tracking-wide);
}

/* ============================================================
   4. AI CONVERSATION COMPOSITES (added v0.2)
   ============================================================ */

/* --- 4.1 Citation chip -------------------------------------- */
.cite {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px 2px 4px;
  border-radius: var(--r-pill);
  background: var(--paper-soft);
  border: 1px solid var(--hairline);
  font-family: var(--sans);
  font-size: 11px;
  color: var(--ink-soft);
  text-decoration: none;
  vertical-align: middle;
  margin: 0 2px;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.cite:hover {
  border-color: var(--coral-soft);
  background: var(--coral-wash);
  color: var(--ink);
}
.cite-num {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
}
.cite-source {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: var(--tracking-wide);
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- 4.2 Suggestion chips (AI offers user) ------------------ */
.suggest-row {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--hairline);
}
.suggest-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--ink-quiet);
  width: 100%;
  margin-bottom: -4px;
}
.suggest {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--hairline);
  font-family: var(--serif);
  font-variation-settings: "opsz" 18;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  font-style: italic;
  transition: all var(--dur-fast);
}
.suggest:hover {
  border-color: var(--coral-soft);
  background: var(--coral-wash);
  transform: translateY(-1px);
}
.suggest::before {
  content: '→';
  color: var(--coral);
  font-family: var(--mono);
  font-style: normal;
  font-size: 12px;
}

/* --- 4.3 Message hover actions ------------------------------ */
.msg { position: relative; }
.msg-actions {
  position: absolute;
  top: 14px; right: 0;
  display: flex; gap: 2px;
  opacity: 0;
  transition: opacity var(--dur-fast);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 2px;
  box-shadow: var(--shadow-soft);
}
.msg:hover .msg-actions,
.msg:focus-within .msg-actions { opacity: 1; }
.msg-action {
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: 0; border-radius: var(--r-sm);
  color: var(--ink-quiet);
  cursor: pointer;
  font-family: var(--mono); font-size: 12px;
  transition: all var(--dur-fast);
}
.msg-action:hover { color: var(--ink); background: var(--surface-soft); }
.msg-action--coral:hover { color: var(--coral); }

/* --- 4.4 Message error state -------------------------------- */
.msg--error .msg-content { color: var(--ink-soft); }
.msg-error-bar {
  display: flex; align-items: center; gap: 10px;
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(183, 80, 61, 0.06);
  border: 1px solid rgba(183, 80, 61, 0.20);
  border-radius: var(--r-md);
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--error-text);
}
.msg-error-bar .retry {
  margin-left: auto;
  background: transparent; border: 0;
  font-family: var(--mono); font-size: 10.5px;
  letter-spacing: var(--tracking-wider); text-transform: uppercase;
  color: var(--error-text); cursor: pointer;
}

/* --- 4.5 Thinking reveal (collapsible CoT) ------------------ */
.thinking {
  margin: 8px 0 12px;
  border: 1px dashed var(--hairline-strong);
  border-radius: var(--r-md);
  background: var(--paper-soft);
  overflow: hidden;
}
.thinking-toggle {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: transparent; border: 0;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--ink-quiet);
  cursor: pointer;
}
.thinking-toggle .chev { margin-left: auto; transition: transform var(--dur-base); }
.thinking.open .thinking-toggle .chev { transform: rotate(90deg); }
.thinking-body {
  display: none;
  padding: 4px 16px 14px;
  font-family: var(--serif);
  font-size: 14px;
  color: var(--ink-soft);
  font-style: italic;
  line-height: var(--leading-normal);
  border-top: 1px dashed var(--hairline);
}
.thinking.open .thinking-body { display: block; }

/* --- 4.6 Multiline composer (textarea) ---------------------- */
.composer--multi {
  align-items: flex-start;
  padding: 12px 12px 10px 18px;
}
.composer--multi .composer-attach { margin-top: 4px; }
.composer--multi .composer-send   { margin-top: 0; align-self: flex-end; }
.composer-textarea {
  flex: 1;
  border: none; background: transparent;
  font-family: var(--serif);
  font-variation-settings: "opsz" 18;
  font-size: 17.5px;
  color: var(--ink);
  outline: none;
  line-height: var(--leading-normal);
  padding: 6px 0;
  resize: none;
  min-height: 28px;
  max-height: 240px;
  width: 100%;
  font-family: var(--serif);
}
.composer-textarea::placeholder { color: var(--ink-quiet); font-style: italic; }
.composer-send[disabled],
.composer-send[aria-disabled="true"] {
  background: var(--ink-faint);
  cursor: not-allowed;
  box-shadow: none;
  opacity: 0.6;
}
.composer-send[disabled]:hover { transform: none; box-shadow: none; }

/* --- 4.7 Inline reference (@mention / #tag) ----------------- */
.ref-mention {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px;
  border-radius: var(--r-pill);
  background: var(--coral-wash);
  color: var(--coral);
  font-family: var(--mono);
  font-size: 0.86em;
  font-style: normal;
  letter-spacing: var(--tracking-wide);
  text-decoration: none;
}
.ref-tag {
  font-family: var(--mono);
  font-size: 0.86em;
  color: var(--info-text);
  text-decoration: none;
  letter-spacing: var(--tracking-wide);
}

/* ============================================================
   5. BRAND MOMENTS (added v0.3)
   The components that make HumanDeploy feel like HumanDeploy —
   not generic chat. Tool use, handoff, approval, variants,
   memory, atmosphere.
   ============================================================ */

/* --- 5.0 Brand atmosphere ----------------------------------- */
/* Apply to a surface to add the signature grain + warm radial wash.
   Must wrap content; uses ::before/::after layers behind position: relative children. */
.atmosphere {
  position: relative;
  background: var(--paper);
  isolation: isolate;
}
.atmosphere::before {
  content: '';
  position: absolute; inset: 0;
  background-image: var(--grain-url);
  background-size: 200px 200px;
  opacity: 0.05;
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 0;
}
[data-theme="dark"] .atmosphere::before {
  opacity: 0.08;
  mix-blend-mode: screen;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .atmosphere::before {
    opacity: 0.08;
    mix-blend-mode: screen;
  }
}
.atmosphere--warm::after {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(60% 80% at 15% 0%,  var(--coral-wash) 0%, transparent 60%),
    radial-gradient(50% 70% at 95% 100%, var(--coral-wash) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
  opacity: 0.7;
}
.atmosphere > * { position: relative; z-index: 1; }

/* --- 5.1 Brand mark ----------------------------------------- */
/* The HumanDeploy mark = the Pixel H — a 4×3 CSS grid with 5 pixel cells
   forming an "H". The coral pixel (p2) is the ONE human pixel that survives
   every deployment. Optionally paired with the wordmark. */
.brand-mark {
  display: inline-flex; align-items: center; gap: 10px;
}
.brand-mark-dot {
  width: 24px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 1fr);
  aspect-ratio: 4 / 3;
  gap: 1px;
  flex-shrink: 0;
}
.brand-mark-dot i {
  display: block;
  border-radius: 0.5px;
}
.brand-mark-dot .p1 { grid-column: 2; grid-row: 1; background: var(--ink); }
.brand-mark-dot .p2 { grid-column: 1; grid-row: 2; background: var(--coral); animation: breathe var(--dur-breathe) ease-in-out infinite; }
.brand-mark-dot .p3 { grid-column: 3; grid-row: 2; background: var(--ink); }
.brand-mark-dot .p4 { grid-column: 2; grid-row: 3; background: var(--ink); }
.brand-mark-dot .p5 { grid-column: 4; grid-row: 1 / 4; background: var(--ink); }
.brand-mark-word {
  font-family: var(--serif);
  font-variation-settings: "opsz" 24;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: var(--tracking-normal);
}
.brand-mark-word em { font-style: italic; }
.brand-mark--lg .brand-mark-dot { width: 36px; }
.brand-mark--lg .brand-mark-word { font-size: 22px; font-variation-settings: "opsz" 32; }
.brand-mark--sm .brand-mark-dot { width: 14px; }
.brand-mark--sm .brand-mark-word { font-size: 13px; }

/* --- 5.2 Tool use card -------------------------------------- */
/* "AI is using a tool" — appears inline in AI message body.
   States: --running, --done, --error. Optional collapsible result. */
.tool-card {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: var(--paper-soft);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  margin: 6px 0;
  font-family: var(--sans);
}
.tool-card-icon {
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--hairline);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: var(--tracking-wide);
  flex-shrink: 0;
}
.tool-card-body { flex: 1; min-width: 0; line-height: 1.3; }
.tool-card-name {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--ink-quiet);
  margin-bottom: 2px;
}
.tool-card-action {
  font-family: var(--serif);
  font-variation-settings: "opsz" 18;
  font-size: 14.5px;
  color: var(--ink);
  font-style: italic;
}
.tool-card-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 10px;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--ink-quiet);
  flex-shrink: 0;
}
.tool-card--running .tool-card-status { color: var(--coral); }
.tool-card--running .tool-card-status::before {
  content: '';
  width: 6px; height: 6px;
  background: var(--coral);
  animation: breathe 1.4s ease-in-out infinite;
}
.tool-card--done .tool-card-status { color: var(--ok-text); }
.tool-card--done .tool-card-status::before { content: '✓'; font-size: 11px; }
.tool-card--error .tool-card-status { color: var(--error-text); }
.tool-card--error .tool-card-status::before { content: '✗'; font-size: 11px; }

.tool-result {
  border-top: 1px dashed var(--hairline);
  padding: 10px 14px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-soft);
  background: var(--surface);
}
.tool-result-list { display: flex; flex-direction: column; gap: 4px; }

/* --- 5.3 Handoff moment ------------------------------------- */
/* The brand-defining moment: AI hands work to a human specialist.
   Two avatars bridged by an arrow. Coral wash + soft border. */
.handoff {
  display: flex; align-items: center; gap: 18px;
  padding: 18px 20px;
  background:
    linear-gradient(135deg, var(--coral-wash) 0%, transparent 60%),
    var(--surface);
  border: 1px solid var(--coral-soft);
  border-radius: var(--r-lg);
  margin: 14px 0;
  position: relative;
  overflow: hidden;
}
.handoff::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--coral);
}
.handoff-bridge {
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.handoff-arrow {
  font-family: var(--mono);
  font-size: 16px;
  color: var(--coral);
  animation: handoff-pulse 2.4s ease-in-out infinite;
}
@keyframes handoff-pulse {
  0%, 100% { opacity: 0.5; transform: translateX(0); }
  50%      { opacity: 1;   transform: translateX(2px); }
}
.handoff-body { flex: 1; min-width: 0; }
.handoff-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--coral);
  margin-bottom: 6px;
  display: flex; align-items: center; gap: 6px;
}
.handoff-reason {
  font-family: var(--serif);
  font-variation-settings: "opsz" 18;
  font-size: 16px;
  font-style: italic;
  color: var(--ink);
  line-height: var(--leading-snug);
  margin-bottom: 8px;
  letter-spacing: var(--tracking-normal);
}
.handoff-meta {
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--ink-quiet);
  display: flex; align-items: center; gap: 12px;
}
.handoff-meta strong { color: var(--ink); font-weight: 500; }
.handoff-meta .sep { color: var(--hairline-strong); }

.handoff--reviewing { border-style: dashed; }
.handoff--complete {
  background: var(--surface);
  border-color: rgba(79, 138, 110, 0.30);
}
.handoff--complete::before { background: var(--ok); }
.handoff--complete .handoff-arrow { color: var(--ok-text); animation: none; }
.handoff--complete .handoff-eyebrow { color: var(--ok-text); }

/* --- 5.4 Approval block ------------------------------------- */
/* When the AI surfaces something for user decision: ship/revise/reject.
   States: pending (default), --approved, --revised, --rejected. */
.approval {
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  background: var(--surface);
  margin: 14px 0;
}
.approval-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--ink-quiet);
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.approval-eyebrow .dot-breathe { width: 5px; height: 5px; box-shadow: 0 0 0 2px var(--coral-wash); }
.approval-title {
  font-family: var(--serif);
  font-variation-settings: "opsz" 24;
  font-size: 19px;
  color: var(--ink);
  font-weight: 500;
  letter-spacing: var(--tracking-snug);
  margin-bottom: 6px;
  line-height: var(--leading-snug);
}
.approval-title em { font-style: italic; }
.approval-body {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink-soft);
  line-height: var(--leading-normal);
  margin-bottom: 16px;
}
.approval-actions {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.approval-resolved {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-radius: var(--r-md);
  background: var(--paper-soft);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--ink-soft);
}
.approval-resolved-icon { font-family: var(--mono); }
.approval--approved .approval-resolved { color: var(--ok-text); }
.approval--revised  .approval-resolved { color: var(--warn-text); }
.approval--rejected .approval-resolved { color: var(--error-text); }
.approval--approved .approval-resolved-icon::before { content: '✓ '; }
.approval--revised  .approval-resolved-icon::before { content: '↻ '; }
.approval--rejected .approval-resolved-icon::before { content: '✗ '; }

/* --- 5.5 Multi-variant picker ------------------------------- */
/* "Here are three takes — pick one." Selection bumps others to faded. */
.variants {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin: 14px 0;
}
.variant {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 16px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: inherit;
  transition: all var(--dur-base) var(--ease-standard);
  position: relative;
  display: flex; flex-direction: column; gap: 8px;
}
.variant:hover {
  border-color: var(--hairline-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}
.variant-num {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--coral);
}
.variant-body {
  font-family: var(--serif);
  font-variation-settings: "opsz" 18;
  font-size: 15px;
  color: var(--ink);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-normal);
}
.variant-meta {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: var(--tracking-wide);
  color: var(--ink-quiet);
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px dashed var(--hairline);
}
.variant--selected {
  border-color: var(--coral);
  background: linear-gradient(135deg, var(--coral-wash) 0%, transparent 80%), var(--surface);
  box-shadow: var(--shadow-coral);
  transform: translateY(-2px);
}
.variant--selected .variant-num::after { content: ' · selected'; }
.variants--has-selection .variant:not(.variant--selected) {
  opacity: 0.5;
}
.variants--has-selection .variant:not(.variant--selected):hover {
  opacity: 0.9;
}

/* --- 5.6 Memory update strip -------------------------------- */
/* Quiet but visible: "I added this to your brand memory" */
.memory-update {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px 10px 12px;
  background: var(--paper-soft);
  border-left: 2px solid var(--coral);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  margin: 10px 0;
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.4;
}
.memory-update-icon {
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--coral-wash);
  color: var(--coral);
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}
.memory-update strong { color: var(--ink); font-weight: 500; font-style: italic; font-family: var(--serif); }
.memory-update-time {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-quiet);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

/* --- 5.7 Specialist intro card ------------------------------ */
/* Used when a specialist enters. Bigger than .identity, less than a profile.
   Includes name, role, response time, and an action. */
.specialist-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  margin: 10px 0;
}
.specialist-card .avatar { width: 44px; height: 44px; }
.specialist-card-body { flex: 1; min-width: 0; }
.specialist-card-name {
  font-family: var(--serif);
  font-variation-settings: "opsz" 18;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: var(--tracking-normal);
  margin-bottom: 2px;
}
.specialist-card-role {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--ink-quiet);
}
.specialist-card-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--sans);
  font-size: 11.5px;
  color: var(--ok-text);
  margin-top: 4px;
}
.specialist-card-status::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ok);
}


/* ============================================================
   6 · LONG-RUNNING + STREAMING EDGES (v0.4)
   The AI working in real time. Cancellable, observable,
   shows partial output as it forms.
   ============================================================ */

/* --- 6.1 Long-run banner ------------------------------------- */
/* Sits at the top of a streaming AI message during deep work.
   Shows live elapsed time, what it's doing, and a stop affordance. */
.longrun {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px 10px 14px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-left: 2px solid var(--coral);
  border-radius: var(--r-md);
  margin: 0 0 12px 0;
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--ink-soft);
  position: relative;
  overflow: hidden;
}
.longrun::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  height: 1px; width: 33%;
  background: linear-gradient(90deg, transparent, var(--coral), transparent);
  animation: progress-indeterminate 1.6s var(--ease-standard) infinite;
}
.longrun-pulse {
  width: 8px; height: 8px;
  background: var(--coral);
  flex-shrink: 0;
  animation: breathe var(--dur-breathe) var(--ease-standard) infinite;
}
.longrun-body {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.longrun-action {
  color: var(--ink);
  font-weight: 500;
}
.longrun-detail {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-quiet);
  letter-spacing: var(--tracking-wide);
}
.longrun-time {
  /* borderless tabular mono — counts up without competing for attention */
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-quiet);
  letter-spacing: var(--tracking-wide);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  padding-right: 4px;
}
.longrun-stop {
  display: inline-flex; align-items: center; gap: 8px;
  height: 28px;
  padding: 0 12px 0 10px;
  background: transparent;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-sm);
  font-family: var(--sans);
  font-size: 11.5px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-standard);
  flex-shrink: 0;
}
.longrun-stop:hover {
  background: var(--coral-wash);
  border-color: var(--coral);
  color: var(--coral);
}
.longrun-stop::before {
  /* proper stop square: outlined ring with filled center, scales clean */
  content: '';
  width: 9px; height: 9px;
  background: currentColor;
  border-radius: 1.5px;
  box-shadow: 0 0 0 2px transparent;
  transition: box-shadow var(--dur-fast);
}
.longrun-stop:hover::before {
  box-shadow: 0 0 0 2px var(--coral-wash);
}

/* --- 6.2 Partial result (still streaming under banner) ------- */
.partial {
  position: relative;
  font-family: var(--serif);
  font-variation-settings: "opsz" 18;
  font-size: 16px;
  line-height: var(--leading-relaxed);
  color: var(--ink);
  letter-spacing: var(--tracking-normal);
  --partial-bg: var(--surface);
  padding-bottom: 12px;
}
.partial::after {
  /* fades the bottom of the partial output to suggest more coming.
     Override --partial-bg per surface (paper, paper-soft, etc.) */
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 36px;
  background: linear-gradient(180deg, transparent, var(--partial-bg) 92%);
  pointer-events: none;
}

/* --- 6.3 Streaming markdown edges --------------------------- */

/* Table forming mid-stream — rows pop in as completed */
.stream-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 13px;
  margin: 8px 0;
}
.stream-table thead th {
  text-align: left;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--ink-quiet);
  padding: 6px 10px;
  border-bottom: 1px solid var(--hairline-strong);
  font-weight: 500;
}
.stream-table tbody td {
  padding: 8px 10px;
  border-bottom: 1px dashed var(--hairline);
  color: var(--ink);
  vertical-align: top;
}
.stream-table tr.row--building {
  animation: row-build var(--dur-base) var(--ease-standard);
}
.stream-table tr.row--pending {
  /* one continuous shimmer across the whole row, not per-cell */
  background: linear-gradient(90deg,
    var(--paper-soft) 0%,
    var(--hairline) 50%,
    var(--paper-soft) 100%);
  background-size: 800px 100%;
  animation: shimmer 1.8s linear infinite;
}
.stream-table tr.row--pending td {
  color: transparent;
  border-bottom-color: transparent;
  background: transparent;
  height: 28px;
  padding: 0 10px;
}

/* Code block forming line-by-line */
.stream-code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--paper-soft);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 12px 14px;
  margin: 8px 0;
  overflow-x: auto;
  line-height: 1.55;
  color: var(--ink);
}
.stream-code .line {
  display: block;
  white-space: pre;
}
.stream-code .line--building {
  animation: line-build var(--dur-base) var(--ease-standard);
}
.stream-code .line--pending {
  display: block;
  height: 1em;
  margin: 2px 0;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--hairline) 30%,
    transparent 70%);
  background-size: 200px 100%;
  animation: shimmer 1.4s linear infinite;
  width: 60%;
  border-radius: 2px;
}
.stream-code .line--cursor::after {
  content: '▍';
  color: var(--coral);
  margin-left: 2px;
  animation: cursor-blink var(--dur-cursor) steps(2) infinite;
}

/* List forming — items appearing as completed */
.stream-list {
  list-style: none;
  padding: 0; margin: 8px 0;
}
.stream-list li {
  position: relative;
  padding: 4px 0 4px 22px;
  font-family: var(--serif);
  font-variation-settings: "opsz" 16;
  font-size: 15px;
  line-height: var(--leading-snug);
  color: var(--ink);
}
.stream-list li::before {
  content: '';
  position: absolute;
  left: 6px; top: 12px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--coral);
}
.stream-list li.item--building {
  animation: row-build var(--dur-base) var(--ease-standard);
}
.stream-list li.item--pending {
  /* keep the bullet, shimmer the text track only */
  color: transparent;
  position: relative;
  padding: 8px 0 8px 22px;
}
.stream-list li.item--pending::before {
  /* dim the bullet so the row reads as not-yet-here */
  background: var(--ink-faint);
}
.stream-list li.item--pending::after {
  content: '';
  position: absolute;
  left: 22px; top: 50%;
  transform: translateY(-50%);
  height: 10px;
  width: 60%;
  background: linear-gradient(90deg,
    var(--paper-soft) 0%,
    var(--hairline) 50%,
    var(--paper-soft) 100%);
  background-size: 600px 100%;
  animation: shimmer 1.8s linear infinite;
  border-radius: var(--r-xs);
}
.stream-list li.item--pending:nth-child(odd)::after { width: 75%; }

/* ============================================================
   7 · ARTIFACT LIFECYCLE (v0.4)
   Versions, diffs, latest-pinned, suggested edits accept/reject
   ============================================================ */

.artifact {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin: 12px 0;
  box-shadow: var(--shadow-soft);
}
.artifact-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--hairline);
  background: var(--paper-soft);
}
.artifact-icon {
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--hairline);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
  flex-shrink: 0;
}
.artifact-title {
  flex: 1; min-width: 0;
  font-family: var(--serif);
  font-variation-settings: "opsz" 16;
  font-size: 14.5px;
  color: var(--ink);
  font-weight: 500;
}
.artifact-meta {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--ink-quiet);
}
.artifact-body {
  padding: 14px 16px;
  font-family: var(--serif);
  font-variation-settings: "opsz" 18;
  font-size: 15px;
  line-height: var(--leading-relaxed);
  color: var(--ink);
}

/* Version timeline */
.artifact-versions {
  display: flex; align-items: center; gap: 0;
  padding: 8px 12px;
  border-top: 1px solid var(--hairline);
  background: var(--surface-soft);
  overflow-x: auto;
}
.version {
  flex-shrink: 0;
  display: inline-flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--dur-fast);
  position: relative;
  min-width: 56px;
}
.version:hover { background: var(--paper-soft); }
.version-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: var(--tracking-wider);
  color: var(--ink-quiet);
  font-weight: 500;
}
.version-time {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--ink-faint);
  letter-spacing: var(--tracking-wide);
}
.version--active {
  background: var(--coral-wash);
}
.version--active .version-label { color: var(--coral); }
.version--latest {
  /* a quiet coral pin dot at top-right, contained inside the version block */
  padding-top: 12px;
}
.version--latest::after {
  content: '';
  position: absolute;
  top: 6px; right: 6px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 0 2px var(--coral-wash);
}
/* Caption strip below the timeline, anchored to the active version */
.artifact-versions-meta {
  padding: 0 12px 8px 12px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--coral);
  background: var(--surface-soft);
  border-top: none;
}
.version-link {
  width: 24px;
  height: 1px;
  background: var(--hairline-strong);
  flex-shrink: 0;
}

/* Diff view inside artifact body */
.diff {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  background: var(--paper-soft);
  border-radius: var(--r-md);
  padding: 10px 0;
  border: 1px solid var(--hairline);
  overflow: hidden;
}
.diff-line {
  display: flex; gap: 8px;
  padding: 0 12px;
  white-space: pre;
}
.diff-line--add {
  background: rgba(79, 138, 110, 0.10);
  color: var(--ok-text);
}
.diff-line--del {
  background: rgba(183, 80, 61, 0.10);
  color: var(--error-text);
  text-decoration: line-through;
  text-decoration-color: rgba(183, 80, 61, 0.4);
}
.diff-line--ctx { color: var(--ink-soft); }
.diff-marker {
  display: inline-block;
  width: 12px;
  color: var(--ink-quiet);
  user-select: none;
  flex-shrink: 0;
}

/* Inline suggested edit (within prose).
   Inline span renders old → new; actions appear in a small popover
   on hover/focus so they don't break line-wrapping or fail touch targets. */
.suggest-edit {
  display: inline;
  padding: 1px 4px;
  background: var(--coral-wash);
  border-bottom: 1px dashed var(--coral);
  border-radius: var(--r-xs);
  font-family: inherit;
  cursor: pointer;
  position: relative;
}
.suggest-edit-old {
  text-decoration: line-through;
  text-decoration-color: var(--coral);
  color: var(--ink-quiet);
  margin-right: 4px;
}
.suggest-edit-new { color: var(--ink); font-weight: 500; }
.suggest-edit-actions {
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  display: inline-flex; gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-soft);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-fast), transform var(--dur-fast) var(--ease-standard);
  white-space: nowrap;
  z-index: var(--z-overlay);
}
.suggest-edit:hover .suggest-edit-actions,
.suggest-edit:focus-within .suggest-edit-actions {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.suggest-edit-btn {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  font-family: var(--mono);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--dur-fast);
}
.suggest-edit-btn--accept { color: var(--ok-text); }
.suggest-edit-btn--accept:hover { background: var(--ok); color: var(--surface); }
.suggest-edit-btn--reject { color: var(--error-text); }
.suggest-edit-btn--reject:hover { background: var(--error); color: var(--surface); }

/* ============================================================
   8 · CONFIDENCE & UNCERTAINTY (v0.4)
   The AI signaling its own epistemic state.
   ============================================================ */

/* Inline low-confidence chip — wraps a phrase the AI isn't sure about */
.confidence {
  display: inline-flex; align-items: baseline; gap: 4px;
  padding: 0 4px;
  border-radius: var(--r-xs);
  border-bottom: 1px dotted var(--ink-quiet);
  cursor: help;
  position: relative;
}
.confidence::after {
  content: attr(data-source);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: var(--tracking-wide);
  padding: 4px 8px;
  border-radius: var(--r-sm);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-fast);
}
.confidence:hover::after { opacity: 1; }
.confidence--low {
  /* quietly readable: warm wash + dotted warn underline. No animation —
     uncertainty should be honest, not visually loud. */
  background: rgba(194, 139, 62, 0.07);
  border-bottom: 1px dotted var(--warn);
}
.confidence--high {
  /* high confidence is the ambient case — barely a treatment.
     Solid hairline underline in ok-green, no fill. */
  border-bottom: 1px solid var(--ok);
}

/* "I'm guessing here" inline marker — softer, italic, set off */
.guess {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px 2px 6px;
  background: var(--paper-soft);
  border: 1px dashed var(--hairline-strong);
  border-radius: var(--r-pill);
  font-family: var(--sans);
  font-size: 11px;
  color: var(--ink-soft);
  letter-spacing: var(--tracking-normal);
  font-style: italic;
  vertical-align: 1px;
}
.guess::before {
  content: '~';
  font-family: var(--mono);
  font-style: normal;
  color: var(--warn-text);
  font-weight: 700;
}

/* Source-strength signal on a citation */
.cite-strength {
  display: inline-flex; gap: 1px;
  margin-left: 4px;
  vertical-align: 1px;
}
.cite-strength i {
  width: 3px; height: 8px;
  background: var(--hairline-strong);
  border-radius: 1px;
}
.cite-strength--3 i { background: var(--ok); }
.cite-strength--2 i:nth-child(-n+2) { background: var(--warn); }
.cite-strength--1 i:nth-child(1) { background: var(--error); }

/* ============================================================
   9 · MEMORY PANEL (v0.4)
   The full "what does the AI know about us" surface.
   ============================================================ */

.memory-panel {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.memory-panel-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--hairline);
}
.memory-panel-title {
  font-family: var(--serif);
  font-variation-settings: "opsz" 24;
  font-size: 18px;
  color: var(--ink);
  font-weight: 500;
  letter-spacing: var(--tracking-snug);
}
.memory-panel-count {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--ink-quiet);
  margin-left: auto;
}
/* Search bar under the head */
.memory-panel-search {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface-soft);
}
.memory-panel-search input {
  flex: 1; min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink);
}
.memory-panel-search input::placeholder { color: var(--ink-quiet); }
.memory-panel-search-icon {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-quiet);
  flex-shrink: 0;
  width: 14px;
  text-align: center;
}
/* Add-fact row at the bottom of a section */
.memory-add {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 0 4px 0;
  margin-top: 4px;
  border-top: 1px dashed var(--hairline);
  font-family: var(--sans);
  font-size: 12px;
  color: var(--coral);
  cursor: pointer;
  background: transparent;
  border-left: none; border-right: none; border-bottom: none;
  width: 100%;
  text-align: left;
}
.memory-add::before {
  content: '+';
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--coral-wash);
  color: var(--coral);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1;
}
.memory-add:hover { color: var(--ink); }
.memory-add:hover::before { background: var(--coral); color: var(--surface); }
.memory-section {
  padding: 12px 16px;
  border-bottom: 1px solid var(--hairline);
}
.memory-section:last-child { border-bottom: none; }
.memory-section-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--ink-quiet);
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.memory-fact {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 0;
  border-top: 1px dashed var(--hairline);
}
.memory-fact:first-of-type { border-top: none; }
.memory-fact-body {
  flex: 1; min-width: 0;
  font-family: var(--serif);
  font-variation-settings: "opsz" 16;
  font-size: 14px;
  color: var(--ink);
  line-height: var(--leading-snug);
}
.memory-fact-source {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: var(--tracking-wide);
  color: var(--ink-quiet);
  margin-top: 2px;
  text-transform: uppercase;
}
.memory-fact-actions {
  display: flex; gap: 4px;
  opacity: 0;
  transition: opacity var(--dur-fast);
  flex-shrink: 0;
}
.memory-fact:hover .memory-fact-actions { opacity: 1; }
.memory-fact-btn {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-xs);
  background: transparent;
  border: 1px solid var(--hairline);
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-quiet);
  cursor: pointer;
}
.memory-fact-btn:hover { color: var(--coral); border-color: var(--coral); }

/* ============================================================
   10 · INLINE INTERACTIVITY (v0.4)
   Date, multi-select, mini-poll: AI asking back in structure.
   ============================================================ */

.inline-form {
  background: var(--paper-soft);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 12px 14px;
  margin: 10px 0;
  display: flex; flex-direction: column; gap: 10px;
}
.inline-form-q {
  font-family: var(--serif);
  font-variation-settings: "opsz" 18;
  font-size: 14.5px;
  color: var(--ink);
  line-height: var(--leading-snug);
}

/* Date picker (inline, minimal) */
.inline-date {
  display: flex; gap: 6px;
  flex-wrap: wrap;
}
.inline-date-opt {
  display: inline-flex; flex-direction: column; align-items: center;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  cursor: pointer;
  min-width: 52px;
  transition: all var(--dur-fast) var(--ease-standard);
}
.inline-date-opt:hover {
  border-color: var(--hairline-strong);
  transform: translateY(-1px);
}
.inline-date-day {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--ink-quiet);
}
.inline-date-num {
  font-family: var(--serif);
  font-variation-settings: "opsz" 24;
  font-size: 18px;
  color: var(--ink);
  font-weight: 500;
  line-height: 1;
  margin-top: 2px;
}
.inline-date-opt--selected {
  background: var(--coral);
  border-color: var(--coral);
  box-shadow: var(--shadow-coral);
}
.inline-date-opt--selected .inline-date-day,
.inline-date-opt--selected .inline-date-num { color: var(--paper); }

/* Multi-select chips */
.inline-multi {
  display: flex; gap: 6px;
  flex-wrap: wrap;
}
.inline-multi-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-standard);
  user-select: none;
}
.inline-multi-chip:hover { border-color: var(--hairline-strong); color: var(--ink); }
.inline-multi-chip::before {
  content: '';
  width: 12px; height: 12px;
  border-radius: 3px;
  border: 1.5px solid var(--ink-faint);
  background: var(--surface);
  flex-shrink: 0;
  transition: all var(--dur-fast);
}
.inline-multi-chip--checked {
  background: var(--coral-wash);
  border-color: var(--coral);
  color: var(--ink);
}
.inline-multi-chip--checked::before {
  background: var(--coral);
  border-color: var(--coral);
  box-shadow: inset 0 0 0 2px var(--surface);
}

/* Mini-poll — quick distribution */
.inline-poll {
  display: flex; flex-direction: column; gap: 6px;
}
.inline-poll-row {
  display: grid;
  grid-template-columns: 100px 1fr 36px;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  transition: background var(--dur-fast);
}
.inline-poll-row:hover { background: var(--surface); }
.inline-poll-label {
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inline-poll-bar {
  position: relative;
  height: 6px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.inline-poll-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--coral-soft), var(--coral));
  border-radius: var(--r-pill);
  transition: width var(--dur-slow) var(--ease-standard);
}
.inline-poll-pct {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-quiet);
  letter-spacing: var(--tracking-wide);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.inline-poll-row--mine .inline-poll-label { color: var(--coral); font-weight: 500; }
.inline-poll-row--mine .inline-poll-pct { color: var(--coral); }

/* Submit row for inline forms */
.inline-form-submit {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding-top: 6px;
  border-top: 1px dashed var(--hairline);
}
.inline-form-skip {
  background: transparent;
  border: none;
  font-family: var(--sans);
  font-size: 11.5px;
  color: var(--ink-quiet);
  cursor: pointer;
  padding: 6px 8px;
}
.inline-form-skip:hover { color: var(--ink); }


/* ============================================================
   11 · FORMS (v0.5)
   The wrapper that turns label + input + helper + error
   into a single composable unit.
   ============================================================ */
.field {
  display: flex; flex-direction: column; gap: 6px;
}
.field-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--ink-quiet);
  display: flex; align-items: center; gap: 6px;
}
.field-label .field-required {
  /* a single coral asterisk — quieter than a tag, universally read as required */
  color: var(--coral);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 0;
  letter-spacing: 0;
  text-transform: none;
  vertical-align: -3px;
}
.field-label .field-optional {
  color: var(--ink-faint);
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: var(--tracking-normal);
  font-style: italic;
}
.field-helper {
  font-family: var(--sans);
  font-size: 11.5px;
  color: var(--ink-quiet);
  line-height: var(--leading-snug);
}
.field-error {
  font-family: var(--sans);
  font-size: 11.5px;
  color: var(--error-text);
  line-height: var(--leading-snug);
  display: flex; align-items: flex-start; gap: 6px;
}
.field-error::before {
  content: '!';
  display: inline-flex; align-items: center; justify-content: center;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--error);
  color: var(--surface);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}
.field--invalid .input,
.field--invalid .textarea,
.field--invalid .select {
  border-color: var(--error-text);
  box-shadow: 0 0 0 3px rgba(183, 80, 61, 0.10);
}
.field--invalid .field-label { color: var(--error-text); }

/* Textarea + Select (siblings to .input) */
.textarea {
  width: 100%;
  min-height: 80px;
  padding: 10px 12px;
  font-family: var(--sans);
  font-size: var(--fs-base);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-md);
  outline: none;
  resize: vertical;
  line-height: var(--leading-snug);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.textarea:focus {
  border-color: var(--coral);
  box-shadow: var(--focus-ring);
}
.textarea::placeholder { color: var(--ink-faint); }

.select {
  appearance: none;
  width: 100%;
  height: 36px;
  padding: 0 32px 0 12px;
  font-family: var(--sans);
  font-size: var(--fs-base);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-md);
  outline: none;
  cursor: pointer;
  /* chevron */
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%),
                    linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 12px) 50%;
  background-size: 4px 4px;
  background-repeat: no-repeat;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.select:focus {
  border-color: var(--coral);
  box-shadow: var(--focus-ring);
}

/* ============================================================
   12 · TOGGLES — switch / checkbox / radio (v0.5)
   Native input visually hidden, real focus ring on the proxy.
   ============================================================ */

.switch {
  display: inline-flex; align-items: center; gap: 10px;
  cursor: pointer;
  user-select: none;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink);
}
.switch input {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}
.switch-track {
  position: relative;
  width: 32px; height: 18px;
  background: var(--ink-faint);
  border-radius: var(--r-pill);
  flex-shrink: 0;
  transition: background var(--dur-base) var(--ease-standard);
}
.switch-track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: var(--surface);
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(20,17,15,0.25);
  /* binary toggle — no overshoot, no flippancy */
  transition: transform var(--dur-base) var(--ease-standard);
}
.switch input:checked ~ .switch-track {
  background: var(--coral);
}
.switch input:checked ~ .switch-track::after {
  transform: translateX(14px);
}
.switch input:focus-visible ~ .switch-track {
  box-shadow: var(--focus-ring);
}
.switch input:disabled ~ .switch-track {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Checkbox */
.check {
  display: inline-flex; align-items: flex-start; gap: 10px;
  cursor: pointer;
  user-select: none;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink);
  line-height: 1.5;
}
.check input {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}
.check-box {
  width: 16px; height: 16px;
  background: var(--surface);
  border: 1.5px solid var(--ink-faint);
  border-radius: var(--r-xs);
  flex-shrink: 0;
  position: relative;
  transition: all var(--dur-fast) var(--ease-standard);
  margin-top: 2px;
}
.check input:checked ~ .check-box {
  background: var(--coral);
  border-color: var(--coral);
}
.check input:checked ~ .check-box::after {
  content: '';
  position: absolute;
  top: 1px; left: 4px;
  width: 4px; height: 8px;
  border: solid var(--surface);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.check input:indeterminate ~ .check-box {
  background: var(--coral);
  border-color: var(--coral);
}
.check input:indeterminate ~ .check-box::after {
  content: '';
  position: absolute;
  top: 6px; left: 3px;
  width: 8px; height: 2px;
  background: var(--surface);
  border-radius: 1px;
}
.check input:focus-visible ~ .check-box {
  box-shadow: var(--focus-ring);
}
.check input:disabled ~ .check-box { opacity: 0.5; }
.check input:disabled ~ * { color: var(--ink-faint); }

/* Radio */
.radio {
  display: inline-flex; align-items: flex-start; gap: 10px;
  cursor: pointer;
  user-select: none;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink);
  line-height: 1.5;
}
.radio input {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}
.radio-dot {
  width: 16px; height: 16px;
  background: var(--surface);
  border: 1.5px solid var(--ink-faint);
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  transition: border-color var(--dur-fast) var(--ease-standard);
  margin-top: 2px;
}
.radio-dot::after {
  /* the inner filled dot — scales from 0 on toggle for crisp animation */
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 8px; height: 8px;
  background: var(--coral);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  transition: transform var(--dur-fast) var(--ease-emphasized);
}
.radio input:checked ~ .radio-dot {
  border-color: var(--coral);
}
.radio input:checked ~ .radio-dot::after {
  transform: translate(-50%, -50%) scale(1);
}
.radio input:focus-visible ~ .radio-dot {
  box-shadow: var(--focus-ring);
}

/* Radio group helper */
.radio-group, .check-group {
  display: flex; flex-direction: column; gap: 8px;
}
.radio-group--horizontal, .check-group--horizontal {
  flex-direction: row; gap: 16px;
  flex-wrap: wrap;
}

/* ============================================================
   13 · TOOLTIP (v0.5)
   Utility wrapper. data-tooltip on parent, position via modifier.
   ============================================================ */

[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(2px);
  white-space: nowrap;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: var(--tracking-wide);
  padding: 5px 8px;
  border-radius: var(--r-sm);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-fast), transform var(--dur-fast);
  z-index: var(--z-overlay);
  box-shadow: var(--shadow-popover);
}
[data-tooltip]::before {
  /* arrow */
  content: '';
  position: absolute;
  bottom: calc(100% + 1px);
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border: 4px solid transparent;
  border-top-color: var(--ink);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-fast);
  z-index: var(--z-overlay);
}
[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
[data-tooltip]:hover::before,
[data-tooltip]:focus-visible::before {
  opacity: 1;
}
[data-tooltip-pos="bottom"]::after {
  bottom: auto;
  top: calc(100% + 6px);
}
[data-tooltip-pos="bottom"]::before {
  bottom: auto;
  top: calc(100% + 1px);
  border-top-color: transparent;
  border-bottom-color: var(--ink);
}

/* ============================================================
   14 · REMOVABLE PILL (v0.5)
   Pill primitive + dismissable variant
   ============================================================ */

.pill--removable {
  padding-right: 4px;
  display: inline-flex; align-items: center; gap: 4px;
}
.pill-remove {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  margin-right: -2px;
  border-radius: 50%;
  background: transparent;
  border: none;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1;
  color: currentColor;
  opacity: 0.55;
  cursor: pointer;
  transition: all var(--dur-fast);
  padding: 0;
}
.pill-remove:hover {
  opacity: 1;
  background: rgba(20,17,15,0.10);
}
[data-theme="dark"] .pill-remove:hover {
  background: rgba(242,237,229,0.12);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pill-remove:hover {
    background: rgba(242,237,229,0.12);
  }
}

/* ============================================================
   15 · MENU / DROPDOWN (v0.5)
   Floating panel of items. Anchor it yourself — this is the panel.
   ============================================================ */

.menu {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-popover);
  padding: 4px;
  min-width: 200px;
  z-index: var(--z-overlay);
  animation: popover-pop var(--dur-fast) var(--ease-standard);
}
.menu-section-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--ink-quiet);
  padding: 8px 10px 4px 10px;
}
.menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  transition: background var(--dur-fast);
}
.menu-item:hover, .menu-item:focus-visible {
  background: var(--paper-soft);
  outline: none;
}
.menu-item-icon {
  width: 16px; height: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-quiet);
  font-family: var(--mono);
  font-size: 13px;
  flex-shrink: 0;
}
.menu-item-label { flex: 1; min-width: 0; }
.menu-item-kbd {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-quiet);
  letter-spacing: var(--tracking-wide);
  flex-shrink: 0;
}
.menu-item--check::before {
  content: '';
  width: 4px; height: 8px;
  border: solid var(--coral);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg) translate(-2px, -1px);
  margin-right: 6px;
  flex-shrink: 0;
}
.menu-item--danger { color: var(--error-text); }
.menu-item--danger:hover { background: rgba(183, 80, 61, 0.08); }
.menu-item--danger .menu-item-icon { color: var(--error-text); }
.menu-item:disabled, .menu-item--disabled {
  color: var(--ink-faint);
  cursor: not-allowed;
}
.menu-item:disabled:hover, .menu-item--disabled:hover { background: transparent; }
.menu-divider {
  height: 1px;
  background: var(--hairline);
  margin: 4px 0;
}

/* ============================================================
   16 · TABS — underline + segmented (v0.5)
   ============================================================ */

/* Underline tabs (default — for navigation between content panes) */
.tabs {
  display: flex; align-items: center;
  gap: 0;
  border-bottom: 1px solid var(--hairline);
  position: relative;
}
.tab {
  position: relative;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: transparent;
  border: none;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-quiet);
  cursor: pointer;
  letter-spacing: var(--tracking-normal);
  transition: color var(--dur-fast);
}
.tab:hover { color: var(--ink-soft); }
.tab--active {
  color: var(--ink);
  font-weight: 500;
}
.tab--active::after {
  content: '';
  position: absolute;
  left: 10px; right: 10px;
  bottom: -1px;
  height: 2px;
  background: var(--coral);
  border-radius: 1px 1px 0 0;
  animation: fade-in var(--dur-base) var(--ease-standard);
}
.tab-count {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-quiet);
  letter-spacing: var(--tracking-wide);
  background: var(--paper-soft);
  padding: 1px 6px;
  border-radius: var(--r-pill);
}
.tab--active .tab-count {
  background: var(--coral-wash);
  color: var(--coral);
}

/* Segmented control (for switching modes/views inline) */
.segmented {
  display: inline-flex;
  padding: 3px;
  background: var(--paper-soft);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  gap: 2px;
}
.segmented button {
  padding: 5px 12px;
  background: transparent;
  border: none;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: var(--r-sm);
  transition: all var(--dur-fast) var(--ease-standard);
  letter-spacing: var(--tracking-normal);
}
.segmented button:hover { color: var(--ink); }
.segmented button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
  font-weight: 500;
}

/* ============================================================
   17 · MODAL / DIALOG (v0.5)
   Scrim + raised panel. Three sizes. Composable head/body/foot.
   ============================================================ */

.scrim {
  position: fixed; inset: 0;
  background: var(--scrim);
  z-index: var(--z-modal);
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-6);
  animation: scrim-in var(--dur-base) var(--ease-standard);
  backdrop-filter: blur(2px);
}
.modal {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lift);
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: modal-rise var(--dur-slow) var(--ease-emphasized);
}
.modal--sm { max-width: 380px; }
.modal--md { max-width: 480px; }
.modal--lg { max-width: 640px; }
.modal--xl { max-width: 840px; }

.modal-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 18px 20px 12px 20px;
}
.modal-head-body {
  flex: 1; min-width: 0;
}
.modal-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--ink-quiet);
  margin-bottom: 4px;
}
.modal-title {
  font-family: var(--serif);
  font-variation-settings: "opsz" 28;
  font-size: 21px;
  color: var(--ink);
  font-weight: 500;
  letter-spacing: var(--tracking-snug);
  line-height: var(--leading-tight);
}
.modal-title em {
  font-style: italic;
  color: var(--ink);
}
.modal-close {
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  background: transparent;
  border: none;
  font-family: var(--mono);
  font-size: 18px;
  line-height: 1;
  color: var(--ink-quiet);
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all var(--dur-fast);
}
.modal-close:hover { background: var(--paper-soft); color: var(--ink); }

.modal-body {
  padding: 0 20px 18px 20px;
  overflow-y: auto;
  font-family: var(--serif);
  font-variation-settings: "opsz" 18;
  font-size: 14.5px;
  line-height: var(--leading-relaxed);
  color: var(--ink-soft);
  letter-spacing: var(--tracking-normal);
}
.modal-foot {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--hairline);
  background: var(--surface-soft);
}
.modal-foot--split { justify-content: space-between; }

/* ============================================================
   18 · TOAST (v0.5)
   Slides up from bottom-right. Icon + body + optional action + dismiss.
   ============================================================ */

.toast-region {
  position: fixed;
  bottom: var(--space-6); right: var(--space-6);
  display: flex; flex-direction: column; gap: 8px;
  z-index: var(--z-toast);
  pointer-events: none;
}
.toast-region > .toast { pointer-events: auto; }

.toast {
  /* grid keeps icon top-left, body in the middle, action+close on the right
     all aligned to the title baseline rather than visual center */
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--ink-soft);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lift);
  min-width: 280px;
  max-width: 380px;
  animation: toast-in var(--dur-slow) var(--ease-emphasized);
}
.toast > .toast-action,
.toast > .toast-close {
  /* nudge to align with the title's cap-height */
  margin-top: 1px;
}
.toast-icon {
  width: 18px; height: 18px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--surface);
  flex-shrink: 0;
  margin-top: 1px;
}
.toast-body {
  flex: 1; min-width: 0;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink);
  line-height: var(--leading-snug);
}
.toast-title {
  font-weight: 500;
  margin-bottom: 2px;
}
.toast-detail {
  color: var(--ink-soft);
  font-size: 12px;
}
.toast-action {
  background: transparent;
  border: none;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--coral);
  cursor: pointer;
  padding: 4px 6px;
  margin: -2px;
  border-radius: var(--r-xs);
  flex-shrink: 0;
}
.toast-action:hover { background: var(--coral-wash); }
.toast-close {
  width: 22px; height: 22px;
  border-radius: var(--r-xs);
  background: transparent;
  border: none;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink-quiet);
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.toast-close:hover { color: var(--ink); background: var(--paper-soft); }

.toast--ok      { border-left-color: var(--ok-text);    }
.toast--ok    .toast-icon { background: var(--ok); }
.toast--warn    { border-left-color: var(--warn-text);  }
.toast--warn  .toast-icon { background: var(--warn); }
.toast--error   { border-left-color: var(--error-text); }
.toast--error .toast-icon { background: var(--error); }
.toast--info    { border-left-color: var(--info-text);  }
.toast--info  .toast-icon { background: var(--info); }
.toast--brand   { border-left-color: var(--coral); }
.toast--brand .toast-icon { background: var(--coral); }

/* ============================================================
   19 · FILE ATTACHMENT (v0.5)
   Chip in composer + dropzone overlay state.
   ============================================================ */

.file-chip {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 10px 6px 6px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink);
  max-width: 280px;
}
.file-chip-type {
  width: 28px; height: 32px;
  background: var(--paper-soft);
  border-radius: var(--r-xs);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: var(--tracking-wider);
  color: var(--ink-soft);
  flex-shrink: 0;
  position: relative;
}
.file-chip-type::after {
  /* dog-ear corner — uses the hairline tone so it reads as a fold
     against any backing color in either theme */
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 0; height: 0;
  border-style: solid;
  border-width: 0 7px 7px 0;
  border-color: transparent var(--hairline-strong) transparent transparent;
  filter: drop-shadow(-0.5px 0.5px 0 rgba(0,0,0,0.06));
}
.file-chip--pdf .file-chip-type { background: rgba(183, 80, 61, 0.10); color: var(--error-text); }
.file-chip--img .file-chip-type { background: rgba(79, 138, 110, 0.10); color: var(--ok-text); }
.file-chip--xls .file-chip-type { background: rgba(79, 138, 110, 0.10); color: var(--ok-text); }
.file-chip--doc .file-chip-type { background: rgba(92, 122, 168, 0.10); color: var(--info-text); }
.file-chip-body {
  display: flex; flex-direction: column; min-width: 0;
}
.file-chip-name {
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-chip-meta {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-quiet);
  letter-spacing: var(--tracking-wide);
}
.file-chip-remove {
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: transparent;
  border: none;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink-quiet);
  cursor: pointer;
  flex-shrink: 0;
  margin-left: 4px;
}
.file-chip-remove:hover { background: var(--paper-soft); color: var(--ink); }

/* Upload progress on a chip */
.file-chip--uploading {
  position: relative;
  overflow: hidden;
}
.file-chip--uploading::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  height: 2px;
  background: var(--coral);
  width: var(--progress, 50%);
  transition: width var(--dur-base) var(--ease-standard);
}

/* Composer dropzone state — apply .composer--dropping to .composer */
.composer-dropzone {
  position: absolute;
  inset: 0;
  border: 2px dashed var(--coral);
  border-radius: inherit;
  background: var(--coral-wash);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif);
  font-variation-settings: "opsz" 24;
  font-size: 16px;
  color: var(--coral);
  font-style: italic;
  pointer-events: none;
  z-index: var(--z-raised);
  animation: fade-in var(--dur-fast) var(--ease-standard);
}

/* ============================================================
   20 · REACTIONS (v0.5)
   Compact pills with count, plus an "add" trigger.
   ============================================================ */

.reactions {
  display: inline-flex; align-items: center; gap: 4px;
  flex-wrap: wrap;
}
.reaction {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px 3px 6px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  font-family: var(--sans);
  font-size: 11.5px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-standard);
  user-select: none;
}
.reaction:hover { border-color: var(--hairline-strong); transform: translateY(-1px); }
.reaction-emoji { font-size: 13px; line-height: 1; }
.reaction-count {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-quiet);
  letter-spacing: var(--tracking-wide);
  font-variant-numeric: tabular-nums;
}
.reaction--mine {
  background: var(--coral-wash);
  border-color: var(--coral);
  color: var(--coral);
}
.reaction--mine .reaction-count { color: var(--coral); }
.reaction-add {
  width: 24px; height: 22px;
  padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px dashed var(--hairline-strong);
  border-radius: var(--r-pill);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-quiet);
  cursor: pointer;
  transition: all var(--dur-fast);
}
.reaction-add:hover { color: var(--coral); border-color: var(--coral); border-style: solid; }

/* Reaction picker (small popover with grid of emoji) */
.reaction-picker {
  display: inline-grid;
  grid-template-columns: repeat(6, 26px);
  gap: 2px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-popover);
  animation: popover-pop var(--dur-fast) var(--ease-standard);
}
.reaction-picker button {
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  font-size: 16px;
  cursor: pointer;
  transition: background var(--dur-fast), transform var(--dur-fast);
}
.reaction-picker button:hover {
  background: var(--paper-soft);
  transform: scale(1.15);
}


/* ============================================================
   21 · TOP BAR (v0.6)
   The conversation context bar. Editable title, model, cost, actions.
   Sits at the top of every conversation surface.
   ============================================================ */
.topbar {
  display: flex; align-items: center;
  height: var(--topbar-h);
  padding: 0 var(--space-4) 0 var(--space-5);
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
  gap: var(--space-3);
  position: relative;
}
.topbar-left {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 10px;
  overflow: hidden;
}
.topbar-right {
  display: flex; align-items: center; gap: 4px;
  flex-shrink: 0;
}

/* Editable title — serif italic that becomes an input on click */
.topbar-title {
  font-family: var(--serif);
  font-variation-settings: "opsz" 20;
  font-size: 15.5px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: var(--tracking-snug);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 4px 8px;
  margin: 0 -2px;
  outline: none;
  max-width: 480px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  cursor: text;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.topbar-title:hover {
  background: var(--paper-soft);
}
.topbar-title:focus {
  background: var(--surface);
  border-color: var(--hairline-strong);
  box-shadow: var(--focus-ring);
}
.topbar-title--untitled {
  color: var(--ink-quiet);
  font-style: italic;
}

/* Title-generation moment — appears next to topbar-title while AI auto-titles */
.title-generating {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px;
  background: var(--coral-wash);
  border-radius: var(--r-pill);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--coral);
  flex-shrink: 0;
  animation: fade-in var(--dur-base) var(--ease-standard);
}
.title-generating::before {
  content: '';
  width: 5px; height: 5px;
  background: var(--coral);
  animation: breathe var(--dur-breathe) var(--ease-standard) infinite;
}

/* Model picker — pill that opens a menu */
.model-picker {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px;
  padding: 0 8px 0 10px;
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all var(--dur-fast);
}
.model-picker:hover {
  background: var(--paper-soft);
  color: var(--ink);
  border-color: var(--hairline-strong);
}
.model-picker-name {
  font-weight: 500;
  color: var(--ink);
}
.model-picker::after {
  content: '';
  width: 5px; height: 5px;
  border-right: 1.25px solid currentColor;
  border-bottom: 1.25px solid currentColor;
  transform: rotate(45deg) translate(-1px, -1px);
  opacity: 0.7;
  margin-left: 2px;
}

/* Cost meter — tiny, mono, tabular */
.cost-meter {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-quiet);
  letter-spacing: var(--tracking-wide);
  font-variant-numeric: tabular-nums;
  padding: 0 8px;
  border-left: 1px solid var(--hairline);
  height: 20px;
}
.cost-meter-value { color: var(--ink-soft); font-weight: 500; }
.cost-meter--warn .cost-meter-value { color: var(--warn-text); }
.cost-meter--high .cost-meter-value { color: var(--error-text); }

/* ============================================================
   22 · SIDEBAR (v0.6)
   Brand → search → sections → user menu.
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--surface-soft);
  border-right: 1px solid var(--hairline);
  display: flex; flex-direction: column;
  flex-shrink: 0;
}
.sidebar-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 14px 12px 16px;
}
.sidebar-head .brand-mark { flex: 1; }
.sidebar-new {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  background: var(--coral);
  border: none;
  color: var(--paper);
  cursor: pointer;
  transition: all var(--dur-fast);
  box-shadow: var(--shadow-coral);
}
.sidebar-new:hover {
  box-shadow: var(--shadow-coral-lift);
  transform: translateY(-1px);
}
.sidebar-new::before {
  content: '+';
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
}

.sidebar-search {
  display: flex; align-items: center; gap: 8px;
  margin: 0 12px 12px 12px;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  transition: border-color var(--dur-fast);
}
.sidebar-search:focus-within {
  border-color: var(--coral);
  box-shadow: var(--focus-ring);
}
.sidebar-search-icon {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-quiet);
  flex-shrink: 0;
  width: 14px;
  text-align: center;
}
.sidebar-search input {
  flex: 1; min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--ink);
}
.sidebar-search input::placeholder { color: var(--ink-quiet); }
.sidebar-search-kbd {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--ink-quiet);
  letter-spacing: var(--tracking-wide);
  padding: 1px 5px;
  background: var(--paper-soft);
  border: 1px solid var(--hairline);
  border-radius: var(--r-xs);
  flex-shrink: 0;
}

.sidebar-body {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 4px 8px 12px 8px;
}
.sidebar-section {
  margin-bottom: 16px;
}
.sidebar-section-label {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px 4px 10px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--ink-quiet);
  cursor: pointer;
  user-select: none;
}
.sidebar-section-label::after {
  content: '';
  width: 5px; height: 5px;
  border-right: 1.25px solid currentColor;
  border-bottom: 1.25px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.5;
  margin-left: auto;
  transition: transform var(--dur-fast);
}
.sidebar-section--collapsed .sidebar-section-label::after {
  transform: rotate(-45deg);
}
.sidebar-section--collapsed .sidebar-section-body {
  display: none;
}

.sidebar-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--ink-soft);
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  transition: background var(--dur-fast), color var(--dur-fast);
  position: relative;
}
.sidebar-item:hover { background: var(--paper-soft); color: var(--ink); }
.sidebar-item-icon {
  width: 14px; height: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-quiet);
  flex-shrink: 0;
}
.sidebar-item-label {
  flex: 1; min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-item-meta {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--ink-faint);
  letter-spacing: var(--tracking-wide);
  flex-shrink: 0;
}
.sidebar-item--active {
  background: var(--coral-wash);
  color: var(--coral);
}
.sidebar-item--active .sidebar-item-icon,
.sidebar-item--active .sidebar-item-meta {
  color: var(--coral);
}
.sidebar-item--active::before {
  /* coral indicator stripe on the left */
  content: '';
  position: absolute;
  left: -2px; top: 4px; bottom: 4px;
  width: 2px;
  background: var(--coral);
  border-radius: 0 2px 2px 0;
}

/* Specialist online — small breathing dot on avatar */
.sidebar-item-avatar {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--paper-soft);
  flex-shrink: 0;
  position: relative;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  color: var(--ink-soft);
  display: inline-flex; align-items: center; justify-content: center;
  text-transform: uppercase;
  letter-spacing: 0;
}
.sidebar-item-avatar--online::after {
  content: '';
  position: absolute;
  bottom: -1px; right: -1px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ok);
  border: 1.5px solid var(--surface-soft);
}

.sidebar-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--hairline);
  background: var(--surface);
}
.sidebar-foot-name {
  flex: 1; min-width: 0;
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-foot-org {
  display: block;
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--ink-quiet);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  font-weight: 400;
}

/* Notification dot on any sidebar item or icon */
.notif-dot {
  position: relative;
}
.notif-dot::after {
  content: '';
  position: absolute;
  top: 2px; right: 2px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--coral);
  border: 1.5px solid var(--surface-soft);
}
.notif-dot--count::after {
  content: attr(data-count);
  width: auto; height: auto;
  min-width: 14px;
  padding: 0 4px;
  background: var(--coral);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 700;
  line-height: 12px;
  border-radius: var(--r-pill);
  text-align: center;
  border: 1.5px solid var(--surface-soft);
}

/* ============================================================
   23 · COMMAND PALETTE — ⌘K (v0.6)
   Defining moment for keyboard-first users.
   ============================================================ */
.cmdk {
  width: 100%;
  max-width: 580px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lift);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: modal-rise var(--dur-slow) var(--ease-emphasized);
}
.cmdk-input-wrap {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--hairline);
}
.cmdk-input-icon {
  font-family: var(--mono);
  font-size: 16px;
  color: var(--ink-quiet);
  flex-shrink: 0;
}
.cmdk-input {
  flex: 1; min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--serif);
  font-variation-settings: "opsz" 24;
  font-size: 18px;
  color: var(--ink);
  letter-spacing: var(--tracking-snug);
}
.cmdk-input::placeholder {
  color: var(--ink-quiet);
  font-style: italic;
}
.cmdk-results {
  max-height: 380px;
  overflow-y: auto;
  padding: 4px;
}
.cmdk-section-label {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--ink-quiet);
  padding: 8px 10px 4px 10px;
}
.cmdk-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  transition: background var(--dur-fast);
}
.cmdk-item:hover, .cmdk-item--selected {
  background: var(--coral-wash);
}
.cmdk-item--selected { box-shadow: inset 2px 0 0 var(--coral); }
.cmdk-item-icon {
  width: 22px; height: 22px;
  border-radius: var(--r-xs);
  background: var(--paper-soft);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
  flex-shrink: 0;
}
.cmdk-item--selected .cmdk-item-icon {
  background: var(--surface);
  color: var(--coral);
}
.cmdk-item-body {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
}
.cmdk-item-title {
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cmdk-item-detail {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-quiet);
  letter-spacing: var(--tracking-wide);
}
.cmdk-item-kbd {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-quiet);
  letter-spacing: var(--tracking-wide);
  padding: 2px 6px;
  background: var(--paper-soft);
  border: 1px solid var(--hairline);
  border-radius: var(--r-xs);
  flex-shrink: 0;
}
.cmdk-item--selected .cmdk-item-kbd {
  background: var(--surface);
  color: var(--ink-soft);
}
.cmdk-empty {
  padding: 40px 20px;
  text-align: center;
  font-family: var(--serif);
  font-variation-settings: "opsz" 20;
  font-style: italic;
  color: var(--ink-quiet);
  font-size: 14px;
}
.cmdk-foot {
  display: flex; align-items: center; gap: 16px;
  padding: 8px 12px;
  border-top: 1px solid var(--hairline);
  background: var(--surface-soft);
}
.cmdk-foot-hint {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--sans);
  font-size: 10.5px;
  color: var(--ink-quiet);
}
.cmdk-foot-hint kbd {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--ink-soft);
  padding: 1px 5px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-xs);
  letter-spacing: var(--tracking-wide);
}

/* ============================================================
   24 · FIND-IN-CONVERSATION (v0.6)
   Slides in from top of conversation surface.
   ============================================================ */
.find-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
  box-shadow: var(--shadow-soft);
  animation: fade-in var(--dur-base) var(--ease-standard);
}
.find-bar-icon {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-quiet);
  width: 16px; text-align: center;
  flex-shrink: 0;
}
.find-bar input {
  flex: 1; min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink);
  height: 24px;
  padding: 0;
}
.find-bar input::placeholder { color: var(--ink-quiet); font-style: italic; }
.find-bar-count {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-quiet);
  letter-spacing: var(--tracking-wide);
  font-variant-numeric: tabular-nums;
  padding: 0 8px;
  border-left: 1px solid var(--hairline);
  flex-shrink: 0;
}
.find-bar-nav {
  display: inline-flex; gap: 2px;
  flex-shrink: 0;
}
.find-bar-nav button {
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--r-xs);
  color: var(--ink-quiet);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
  transition: all var(--dur-fast);
}
.find-bar-nav button:hover { background: var(--paper-soft); color: var(--ink); }
.find-bar-close {
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--r-xs);
  color: var(--ink-quiet);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 14px;
  flex-shrink: 0;
  transition: all var(--dur-fast);
}
.find-bar-close:hover { background: var(--paper-soft); color: var(--ink); }

/* Match highlight in conversation prose */
.find-match {
  background: rgba(194, 139, 62, 0.22);
  border-radius: 2px;
  padding: 1px 1px;
  margin: -1px -1px;
}
.find-match--active {
  background: var(--coral);
  color: var(--paper);
}

/* ============================================================
   25 · PRESENCE (v0.6)
   Typing, unread divider, mention dot.
   ============================================================ */

/* Typing indicator — sits in the thread between messages */
.typing {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 6px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  font-family: var(--sans);
  font-size: 11.5px;
  color: var(--ink-soft);
  margin: 8px 0;
  width: fit-content;
  animation: fade-in var(--dur-base) var(--ease-standard);
}
.typing .avatar { width: 20px; height: 20px; }
.typing-name {
  font-family: var(--serif);
  font-style: italic;
  font-variation-settings: "opsz" 14;
  color: var(--ink);
}
.typing-dots {
  display: inline-flex; gap: 3px;
  margin-left: 2px;
}
.typing-dots i {
  width: 4px; height: 4px;
  background: var(--ink-quiet);
  border-radius: 50%;
  animation: thinking-pulse 1.2s var(--ease-standard) infinite;
}
.typing-dots i:nth-child(2) { animation-delay: 0.15s; }
.typing-dots i:nth-child(3) { animation-delay: 0.3s; }

/* Unread divider — runs across the thread with a label in the middle */
.unread-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 16px 0;
  color: var(--coral);
}
.unread-divider::before, .unread-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--coral-glow);
}
.unread-divider-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--coral);
  padding: 2px 10px;
  background: var(--coral-wash);
  border: 1px solid var(--coral-glow);
  border-radius: var(--r-pill);
  flex-shrink: 0;
}

/* Mention dot — modifier for any item that has an unread @mention */
.has-mention {
  position: relative;
}
.has-mention::after {
  content: '@';
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--coral);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  display: inline-flex;
  align-items: center; justify-content: center;
  line-height: 1;
}
/* When a sidebar-item carries a mention, the @ dot replaces the meta count
   so the row stays single-line and the right-edge slot has one occupant. */
.sidebar-item.has-mention .sidebar-item-meta { display: none; }

/* ============================================================
   26 · BANNERS — offline / rate-limit / maintenance / info (v0.6)
   Full-width strips that sit at the very top of the viewport.
   ============================================================ */
.banner {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px;
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--ink);
  background: var(--paper-soft);
  border-bottom: 1px solid var(--hairline);
  width: 100%;
}
.banner-icon {
  width: 18px; height: 18px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--paper);
  flex-shrink: 0;
}
.banner-body { flex: 1; min-width: 0; }
.banner-title { font-weight: 500; }
.banner-detail { color: var(--ink-soft); font-size: 11.5px; }
.banner-action {
  background: transparent;
  border: 1px solid currentColor;
  border-radius: var(--r-sm);
  font-family: var(--sans);
  font-size: 11.5px;
  color: inherit;
  padding: 4px 10px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--dur-fast);
}
.banner-action:hover { background: var(--hairline); }
.banner-close {
  width: 22px; height: 22px;
  border-radius: var(--r-xs);
  border: none;
  background: transparent;
  color: inherit;
  font-family: var(--mono);
  font-size: 14px;
  cursor: pointer;
  opacity: 0.6;
  flex-shrink: 0;
}
.banner-close:hover { opacity: 1; }

.banner--offline {
  background: rgba(183, 80, 61, 0.10);
  border-bottom-color: rgba(183, 80, 61, 0.20);
  color: var(--error-text);
}
.banner--offline .banner-icon { background: var(--error); }

.banner--ratelimit {
  background: rgba(194, 139, 62, 0.10);
  border-bottom-color: rgba(194, 139, 62, 0.20);
  color: var(--warn-text);
}
.banner--ratelimit .banner-icon { background: var(--warn); }

.banner--maintenance {
  background: rgba(92, 122, 168, 0.10);
  border-bottom-color: rgba(92, 122, 168, 0.20);
  color: var(--info-text);
}
.banner--maintenance .banner-icon { background: var(--info); }

.banner--info {
  background: var(--paper-soft);
  color: var(--ink-soft);
}
.banner--info .banner-icon { background: var(--ink-soft); }

/* Full empty / 404 / no-results / you-finished — for empty surfaces */
.full-empty {
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  padding: 80px 32px;
  max-width: 480px;
  margin: 0 auto;
  gap: 12px;
}
.full-empty-mark {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--coral-wash);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono);
  font-size: 20px;
  color: var(--coral);
  margin-bottom: 4px;
}
.full-empty-title {
  font-family: var(--serif);
  font-variation-settings: "opsz" 32;
  font-size: 26px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: var(--tracking-snug);
  line-height: var(--leading-tight);
}
.full-empty-title em { font-style: italic; }
.full-empty-body {
  font-family: var(--serif);
  font-variation-settings: "opsz" 18;
  font-size: 15px;
  line-height: var(--leading-relaxed);
  color: var(--ink-soft);
  letter-spacing: var(--tracking-normal);
}
.full-empty-actions {
  display: flex; gap: 8px;
  margin-top: 8px;
}

/* ============================================================
   27 · CONVERSATION CARD (v0.6)
   For browsing past conversations. Title + preview + meta + actions.
   ============================================================ */
.conv-card {
  display: flex; flex-direction: column; gap: 6px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-standard);
  position: relative;
}
.conv-card:hover {
  border-color: var(--hairline-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}
.conv-card-head {
  display: flex; align-items: baseline; gap: 8px;
}
.conv-card-title {
  flex: 1; min-width: 0;
  font-family: var(--serif);
  font-variation-settings: "opsz" 18;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: var(--tracking-snug);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-card-time {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-quiet);
  letter-spacing: var(--tracking-wide);
  flex-shrink: 0;
  text-transform: uppercase;
}
.conv-card-preview {
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: var(--leading-snug);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.conv-card-meta {
  display: flex; align-items: center; gap: 10px;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--ink-quiet);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}
.conv-card-meta-item {
  display: inline-flex; align-items: center; gap: 4px;
}
.conv-card-meta-item + .conv-card-meta-item::before {
  content: '·';
  margin-right: 6px;
  color: var(--ink-faint);
}
.conv-card-actions {
  position: absolute;
  top: 8px; right: 8px;
  display: flex; gap: 2px;
  opacity: 0;
  transition: opacity var(--dur-fast);
}
.conv-card:hover .conv-card-actions { opacity: 1; }
.conv-card--pinned {
  border-left: 2px solid var(--coral);
}
.conv-card--pinned .conv-card-title::before {
  content: '◆';
  color: var(--coral);
  font-size: 9px;
  margin-right: 6px;
  vertical-align: 1px;
}

/* ============================================================
   28 · RESPONSIVE — mobile + tablet adaptations (v0.7)
   Breakpoints:
     md  ≤ 900px  — tablet portrait, condensed sidebar
     sm  ≤ 640px  — phone, sidebar becomes drawer, modals fullscreen
   The library is desktop-first; these queries are progressive overrides.
   ============================================================ */

/* ---- Tablet (≤ 900px): condense the chrome ---- */
@media (max-width: 900px) {
  :root {
    --sidebar-w: 64px;       /* icon-only rail */
    --topbar-h: 48px;
    --read-width: 100%;
  }
  .sidebar-search,
  .sidebar-section-label,
  .sidebar-item-label,
  .sidebar-item-meta { display: none; }
  .sidebar-item { justify-content: center; padding: 8px; }
  .sidebar-item--active::before { left: 0; }
  .topbar-title { font-size: 14px; max-width: 240px; }
  .cost-meter,
  .model-picker-meta { display: none; }
  .conv-card { padding: 12px; }
  .conv-card-actions { opacity: 1; }   /* no hover on touch — always show */
}

/* ---- Phone (≤ 640px): drawer + sheet patterns ---- */
@media (max-width: 640px) {
  :root {
    --space-6: 16px;
    --space-8: 20px;
  }

  /* Sidebar becomes off-canvas drawer; toggle by adding .sidebar--open */
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform var(--dur-base) var(--ease-standard);
    z-index: var(--z-modal);
    box-shadow: var(--shadow-lift);
  }
  .sidebar--open { transform: translateX(0); }
  .sidebar .sidebar-search,
  .sidebar .sidebar-section-label,
  .sidebar .sidebar-item-label,
  .sidebar .sidebar-item-meta { display: revert; }
  .sidebar .sidebar-item { justify-content: flex-start; padding: 6px 12px; }

  /* Topbar density */
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar-title { max-width: 160px; font-size: 13.5px; }

  /* Modal becomes a bottom sheet on phones */
  .modal {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    top: auto;
    transform: translateY(0);
    border-radius: var(--r-2xl) var(--r-2xl) 0 0;
    max-width: 100%;
    max-height: 92vh;
    animation: sheet-rise var(--dur-slow) var(--ease-emphasized);
  }

  /* Toasts dock to the bottom edge instead of a corner stack */
  .toast-region {
    inset: auto 12px 12px 12px;
    width: auto;
  }
  .toast { width: 100%; }

  /* Command palette uses near-full viewport */
  .cmdk { width: calc(100vw - 24px); max-width: 100%; }

  /* Find bar full width */
  .find-bar { left: 12px; right: 12px; width: auto; }

  /* Composer + message rows use less side padding */
  .msg-row { padding-left: 12px; padding-right: 12px; }
  .composer { padding: 10px; }

  /* Conv-card stacks meta below preview */
  .conv-card-meta { flex-wrap: wrap; gap: 6px; }
  .conv-card-meta-item + .conv-card-meta-item::before { display: none; }

  /* Banners take less vertical space */
  .banner { padding: 6px 12px; font-size: 12px; }
}

/* Sheet rise animation — phones only */
@keyframes sheet-rise {
  from { transform: translateY(100%); opacity: 0.6; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* Pointer-coarse tweaks (touch, regardless of width) — bigger hit targets */
@media (pointer: coarse) {
  .icon-btn { width: 36px; height: 36px; }
  .icon-btn--sm { width: 28px; height: 28px; }
  .sidebar-item { min-height: 40px; }
  .conv-card-actions { opacity: 1; }
  .menu-item { padding-top: 10px; padding-bottom: 10px; }
}

/* ============================================================
   29 · MARKETING PRIMITIVES (v0.9)
   Building blocks for marketing, blog, legal, brand, and
   email pages. All compose from foundations 1–5; nothing
   redefines tokens or core primitives.

   Naming: every marketing class is prefixed `.m-` so it's
   visibly distinct from app/chat surface classes and never
   collides with the rest of the library.

   Surfaces compose these primitives. Surfaces NEVER redefine
   tokens or override these classes — extend with descendants
   (`.m-hero .m-hero-figure`) or add page-local modifiers.
   ============================================================ */

/* ── 29.1 Container ──────────────────────────────────── */
.m-container {
  width: 100%;
  max-width: var(--container, 1200px);
  margin: 0 auto;
  padding: 0 var(--gutter, 48px);
}
@media(max-width:720px){
  .m-container{padding:0 var(--gutter-mobile, 24px);}
}
.m-container--narrow { max-width: 760px; }
.m-container--wide   { max-width: 1280px; }

/* ── 29.2 Top nav ────────────────────────────────────── */
.m-nav {
  position: sticky;
  top: 0;
  z-index: var(--z-overlay);
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 1px solid transparent;
  transition: background 0.3s var(--ease-standard),
              backdrop-filter 0.3s var(--ease-standard),
              border-color 0.2s ease;
}
.m-nav.scrolled {
  background: rgba(245, 239, 228, 0.88);   /* --paper at 88% */
  backdrop-filter: var(--blur-bg);
  -webkit-backdrop-filter: var(--blur-bg);
  border-color: var(--hairline);
}
[data-theme="dark"] .m-nav.scrolled { background: rgba(20, 17, 15, 0.88); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .m-nav.scrolled { background: rgba(20, 17, 15, 0.88); }
}
.m-nav-inner {
  max-width: var(--container, 1200px);
  margin: 0 auto;
  padding: 0 var(--gutter, 48px);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
}
.m-nav-brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}
.m-nav-wordmark {
  display: block;
  height: 28px;
  width: auto;
}
/* Light mode: show dark wordmark, hide light */
.m-nav-wordmark--dark  { display: none; }
.m-nav-wordmark--light { display: block; }
[data-theme="dark"] .m-nav-wordmark--dark  { display: block; }
[data-theme="dark"] .m-nav-wordmark--light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .m-nav-wordmark--dark  { display: block; }
  :root:not([data-theme="light"]) .m-nav-wordmark--light { display: none; }
}
.m-nav-brand-dot {
  width: 10px; height: 10px;
  background: var(--coral);
  box-shadow: 0 0 0 4px var(--coral-wash);
  animation: breathe var(--dur-breathe) ease-in-out infinite;
  flex-shrink: 0;
}
.m-nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}
.m-nav-link {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-standard);
}
.m-nav-link:hover,
.m-nav-link--active { color: var(--ink); }
.m-nav-link--active {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
}
.m-nav-cta {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--r-md);
  background: var(--ink);
  color: var(--paper);
  border: none;
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-standard);
}
.m-nav-cta:hover { transform: translateY(-1px); }
[data-theme="dark"] .m-nav-cta { background: #F5EFE4; color: #14110F; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .m-nav-cta { background: #F5EFE4; color: #14110F; }
}

.m-nav-signin {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-quiet);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-standard);
}
.m-nav-signin:hover { color: var(--ink); }
@media (max-width: 720px) {
  .m-nav-link { display: none; }
  .m-nav-signin { display: none; }
}

/* ── 29.3 Section + eyebrow ──────────────────────────── */
.m-section {
  padding: 96px 0;
  position: relative;
}
.m-section--soft   { background: var(--paper-soft); }
.m-section--ink    { background: var(--ink); color: var(--paper); }
[data-theme="dark"] .m-section--ink { background: var(--surface); color: #F5EFE4; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .m-section--ink { background: var(--surface); color: #F5EFE4; }
}
.m-section--narrow { padding: 64px 0; }

.m-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--coral);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.m-eyebrow::before {
  content: '';
  width: 24px; height: 1px;
  background: var(--coral);
}

.m-section-head {
  margin-bottom: 48px;
  max-width: 720px;
}
.m-section-head--centered {
  margin-left: auto; margin-right: auto;
  text-align: center;
}
.m-section-head--centered .m-eyebrow { justify-content: center; }
.m-section-head--centered .m-eyebrow::after {
  content: '';
  width: 24px; height: 1px;
  background: var(--coral);
}

/* ── 29.4 Display type ───────────────────────────────── */

/* Widow guard: every heading and display surface gets balance.
   Prevents single-word last lines (e.g. lone "agents." under a
   three-line hero). text-wrap is inherited, so class-level rules
   that don't set text-wrap will pick this up automatically. */
h1, h2, h3, h4, h5, h6,
.m-display, .m-h1, .m-h2, .m-h3,
.m-hero-headline, .m-cta-headline,
[class*="-headline"] {
  text-wrap: balance;
}

.m-display {
  font-family: var(--serif);
  font-variation-settings: "opsz" 60;
  font-size: clamp(40px, 6vw, 64px);
  font-weight: 400;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--ink);
}
.m-display em { font-style: italic; font-weight: 500; }
.m-display--coral em { color: var(--coral); font-style: italic; }

.m-h1 {
  font-family: var(--serif);
  font-variation-settings: "opsz" 44;
  font-size: clamp(32px, 4.5vw, 48px);
  font-weight: 400;
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-snug);
  color: var(--ink);
}
.m-h1 em { font-style: italic; font-weight: 500; }

.m-h2 {
  font-family: var(--serif);
  font-variation-settings: "opsz" 32;
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 400;
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-snug);
  color: var(--ink);
}
.m-h2 em { font-style: italic; font-weight: 500; }

.m-h3 {
  font-family: var(--serif);
  font-variation-settings: "opsz" 24;
  font-size: 22px;
  font-weight: 500;
  line-height: var(--leading-snug);
  color: var(--ink);
}

.m-lede {
  font-family: var(--serif);
  font-variation-settings: "opsz" 24;
  font-size: clamp(18px, 2vw, 21px);
  font-weight: 400;
  line-height: var(--leading-relaxed);
  color: var(--ink-soft);
  max-width: 60ch;
}

.m-subhead {
  font-family: var(--sans);
  font-size: 17px;
  color: var(--ink-soft);
  line-height: 1.55;
  max-width: 58ch;
  margin-top: 14px;
}

.m-body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: var(--leading-normal);
  color: var(--ink-soft);
}

.m-meta {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--ink-quiet);
}

/* ── 29.5 Hero ───────────────────────────────────────── */
.m-hero {
  padding: 120px 0 96px;
  position: relative;
  overflow: hidden;
}
.m-hero-eyebrow { /* alias of .m-eyebrow for hero scope */ }
.m-hero-headline {
  font-family: var(--serif);
  font-variation-settings: "opsz" 60;
  font-size: clamp(44px, 7vw, 72px);
  font-weight: 400;
  line-height: 1.04;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin-bottom: 24px;
  max-width: 18ch;
}
.m-hero-headline em { font-style: italic; font-weight: 500; }
.m-hero-headline em.coral { color: var(--coral); }
.m-hero-sub {
  font-family: var(--serif);
  font-variation-settings: "opsz" 24;
  font-size: clamp(18px, 2.2vw, 22px);
  font-weight: 400;
  line-height: var(--leading-relaxed);
  color: var(--ink-soft);
  max-width: 52ch;
  margin-bottom: 40px;
}
.m-hero-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* ── 29.6 Buttons (marketing variants) ───────────────── */
.m-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  padding: 12px 22px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur-fast) var(--ease-standard),
              background var(--dur-fast) var(--ease-standard);
  white-space: nowrap;
}
.m-btn:hover { transform: translateY(-1px); }
.m-btn--primary {
  background: var(--coral);
  color: #fff;
  box-shadow: var(--shadow-coral);
}
.m-btn--primary:hover { box-shadow: var(--shadow-coral-lift); }
.m-btn--ink {
  background: var(--ink);
  color: var(--paper);
}
[data-theme="dark"] .m-btn--ink { background: #F5EFE4; color: #14110F; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .m-btn--ink { background: #F5EFE4; color: #14110F; }
}
.m-btn--ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--hairline-strong);
}
.m-btn--ghost:hover { border-color: var(--ink); }
.m-btn--outline {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--hairline);
}
.m-btn--outline:hover {
  background: var(--paper-soft);
  border-color: var(--hairline-strong);
  transform: translateY(-1px);
}
.m-btn--accent {
  background: var(--coral);
  color: #fff;
  border-color: var(--coral);
  box-shadow: var(--shadow-coral);
}
.m-btn--accent:hover {
  background: var(--ember);
  border-color: var(--ember);
  transform: translateY(-1px);
  box-shadow: var(--shadow-coral-lift);
}
.m-btn--lg { font-size: 16px; padding: 14px 26px; }
.m-btn--sm { font-size: 13px; padding: 8px 14px; }

/* ── 29.7 Grids ──────────────────────────────────────── */
.m-grid {
  display: grid;
  gap: var(--space-6);
}
.m-grid--2 { grid-template-columns: repeat(2, 1fr); }
.m-grid--3 { grid-template-columns: repeat(3, 1fr); }
.m-grid--4 { grid-template-columns: repeat(4, 1fr); }
.m-grid--asym { grid-template-columns: 1.4fr 1fr; }
@media (max-width: 880px) {
  .m-grid--2, .m-grid--3, .m-grid--4, .m-grid--asym {
    grid-template-columns: 1fr;
  }
}

/* ── 29.8 Card ───────────────────────────────────────── */
.m-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 28px;
  transition: transform var(--dur-base) var(--ease-standard),
              border-color var(--dur-base) var(--ease-standard),
              box-shadow var(--dur-base) var(--ease-standard);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.m-card:hover {
  transform: translateY(-2px);
  border-color: var(--hairline-strong);
  box-shadow: var(--shadow-soft);
}
.m-card-eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--coral);
}
.m-card-title {
  font-family: var(--serif);
  font-variation-settings: "opsz" 24;
  font-size: 22px;
  font-weight: 500;
  line-height: var(--leading-snug);
  color: var(--ink);
}
.m-card-body {
  font-family: var(--sans);
  font-size: 15px;
  line-height: var(--leading-normal);
  color: var(--ink-soft);
}
.m-card-meta {
  margin-top: auto;
  padding-top: 16px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-quiet);
  border-top: 1px solid var(--hairline);
}

/* ── 29.9 Quote pullout ──────────────────────────────── */
.m-quote {
  position: relative;
  padding: 32px 0 32px 32px;
  border-left: 2px solid var(--coral);
  max-width: 720px;
}
.m-quote-text {
  font-family: var(--serif);
  font-variation-settings: "opsz" 32;
  font-size: clamp(22px, 2.6vw, 28px);
  font-style: italic;
  font-weight: 400;
  line-height: var(--leading-snug);
  color: var(--ink);
  letter-spacing: var(--tracking-snug);
}
.m-quote-attr {
  margin-top: 20px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--ink-quiet);
}

/* ── 29.10 Stat ──────────────────────────────────────── */
.m-stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.m-stat-value {
  font-family: var(--serif);
  font-variation-settings: "opsz" 60;
  font-size: clamp(40px, 5vw, 56px);
  font-weight: 400;
  line-height: 1;
  color: var(--ink);
  letter-spacing: var(--tracking-tight);
}
.m-stat-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--ink-quiet);
}

/* ── 29.11 CTA block ─────────────────────────────────── */
.m-cta {
  background: var(--ink);
  color: var(--paper);
  padding: 80px var(--space-6);
  border-radius: var(--r-2xl);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.m-cta-headline {
  font-family: var(--serif);
  font-variation-settings: "opsz" 48;
  font-size: clamp(32px, 4vw, 44px);
  font-weight: 400;
  line-height: var(--leading-snug);
  color: var(--paper);
  margin-bottom: 16px;
  letter-spacing: var(--tracking-snug);
}
.m-cta-headline em { font-style: italic; color: var(--coral); }
.m-cta-sub {
  font-family: var(--serif);
  font-variation-settings: "opsz" 20;
  font-size: 18px;
  font-weight: 400;
  line-height: var(--leading-relaxed);
  color: rgba(251, 248, 243, 0.7);
  max-width: 50ch;
  margin: 0 auto 32px;
}
.m-cta-actions {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}
.m-cta .m-btn--ghost {
  color: var(--paper);
  border-color: rgba(251, 248, 243, 0.24);
}
.m-cta .m-btn--ghost:hover { border-color: var(--paper); }

/* Dark mode: CTA is an "always dark" component — keep dark bg + light text.
   Use --surface for a subtle lift above the dark page background. */
[data-theme="dark"] .m-cta {
  background: var(--surface);
  color: #F5EFE4;
}
[data-theme="dark"] .m-cta-headline { color: #F5EFE4; }
[data-theme="dark"] .m-cta-sub { color: rgba(245, 239, 228, 0.7); }
[data-theme="dark"] .m-cta .m-btn--ghost {
  color: #F5EFE4;
  border-color: rgba(245, 239, 228, 0.24);
}
[data-theme="dark"] .m-cta .m-btn--ghost:hover { border-color: #F5EFE4; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .m-cta {
    background: var(--surface);
    color: #F5EFE4;
  }
  :root:not([data-theme="light"]) .m-cta-headline { color: #F5EFE4; }
  :root:not([data-theme="light"]) .m-cta-sub { color: rgba(245, 239, 228, 0.7); }
  :root:not([data-theme="light"]) .m-cta .m-btn--ghost {
    color: #F5EFE4;
    border-color: rgba(245, 239, 228, 0.24);
  }
  :root:not([data-theme="light"]) .m-cta .m-btn--ghost:hover { border-color: #F5EFE4; }
}

/* ── 29.12 Footer ────────────────────────────────────── */
.m-footer {
  /* No background, no top border — inherits body --paper for
     a seamless page. Separation comes from whitespace (margin-top)
     and content change (link grid + mono labels). */
  padding: 64px 0 40px;
  margin-top: 96px;
}
.m-footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: var(--space-6);
  margin-bottom: 48px;
}
@media (max-width: 720px) {
  .m-footer-grid { grid-template-columns: 1fr 1fr; }
}
.m-footer-col-title {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--ink-quiet);
  margin-bottom: 16px;
}
.m-footer-link {
  display: block;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 4px 0;
  transition: color var(--dur-fast) var(--ease-standard);
}
.m-footer-link:hover { color: var(--ink); }
.m-footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 24px;
  border-top: 1px solid var(--hairline);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-quiet);
  letter-spacing: var(--tracking-wide);
}
@media (max-width: 720px) {
  .m-footer-bottom { flex-direction: column; gap: 12px; align-items: flex-start; }
}
.m-footer-brand { margin-bottom: 0; }
.m-footer-brand .m-nav-brand { margin-bottom: 12px; display: inline-block; }
.m-footer-brand .m-nav-wordmark { height: 36px; }
.m-footer-brand p {
  margin: 0;
  max-width: 36ch;
  line-height: 1.55;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink-soft);
}
.m-footer-status {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--ink-quiet);
  font-family: var(--sans);
  font-size: 14px;
  transition: color var(--dur-fast);
}
.m-footer-status:hover { color: var(--ink-soft); }
.m-footer-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(63, 163, 106, 0.15);
}
.m-footer-meta {
  display: flex;
  gap: 16px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink-quiet);
}
.m-footer-meta .sep { color: var(--hairline-strong); }
@media (max-width: 720px) {
  .m-footer-meta { flex-wrap: wrap; }
}

/* ── 29.12b Theme toggle ─────────────────────────────── */
.m-theme-toggle {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 16px;
}
.m-theme-toggle button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: var(--ink-quiet);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color var(--dur-fast), background var(--dur-fast);
}
.m-theme-toggle button:hover { color: var(--ink-soft); }
.m-theme-toggle button.is-active {
  color: var(--ink);
  background: var(--paper-soft);
}
.m-theme-toggle svg { width: 16px; height: 16px; }

/* ── 29.13 Prose (long-form: blog, legal, docs) ─────── */
.m-prose {
  font-family: var(--serif);
  font-variation-settings: "opsz" 12;
  font-size: 19px;
  line-height: var(--leading-relaxed);
  color: var(--ink-soft);
  max-width: 68ch;
  margin: 0 auto;
}
.m-prose > * + * { margin-top: 24px; }
.m-prose h2 {
  font-family: var(--serif);
  font-variation-settings: "opsz" 32;
  font-size: 28px;
  font-weight: 500;
  line-height: var(--leading-snug);
  color: var(--ink);
  margin-top: 56px;
  letter-spacing: var(--tracking-snug);
}
.m-prose h3 {
  font-family: var(--serif);
  font-variation-settings: "opsz" 24;
  font-size: 22px;
  font-weight: 500;
  line-height: var(--leading-snug);
  color: var(--ink);
  margin-top: 40px;
}
.m-prose h2 em, .m-prose h3 em { font-style: italic; }
.m-prose p { color: var(--ink-soft); }
.m-prose strong { color: var(--ink); font-weight: 500; }
.m-prose a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--coral-glow);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  transition: text-decoration-color var(--dur-fast);
}
.m-prose a:hover { text-decoration-color: var(--coral); }
.m-prose blockquote {
  margin: 32px 0;
  padding: 16px 0 16px 28px;
  border-left: 2px solid var(--coral);
  font-style: italic;
  color: var(--ink);
  font-size: 22px;
}
.m-prose blockquote cite {
  display: block;
  margin-top: 12px;
  font-family: var(--mono);
  font-style: normal;
  font-size: 11px;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--ink-quiet);
}
.m-prose ul, .m-prose ol {
  padding-left: 28px;
  color: var(--ink-soft);
}
.m-prose ul li, .m-prose ol li {
  margin-bottom: 8px;
  padding-left: 6px;
}
.m-prose ul li::marker { color: var(--coral); }
.m-prose ol li::marker { color: var(--ink-quiet); font-family: var(--mono); }
.m-prose code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--paper-soft);
  padding: 2px 6px;
  border-radius: var(--r-xs);
  color: var(--ink);
}
.m-prose hr {
  border: none;
  border-top: 1px solid var(--hairline);
  margin: 56px auto;
  max-width: 80px;
}

/* ── 29.14 Article header (blog post) ────────────────── */
.m-article-head {
  text-align: center;
  padding: 80px 0 48px;
  max-width: 760px;
  margin: 0 auto;
}
.m-article-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--coral);
  margin-bottom: 24px;
}
.m-article-title {
  font-family: var(--serif);
  font-variation-settings: "opsz" 48;
  font-size: clamp(36px, 5vw, 52px);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: var(--tracking-snug);
  color: var(--ink);
  margin-bottom: 24px;
}
.m-article-title em { font-style: italic; font-weight: 500; }
.m-article-meta {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--ink-quiet);
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.m-article-meta .sep { color: var(--hairline-strong); }

/* ── 29.15 Marquee ───────────────────────────────────── */
.m-marquee {
  overflow: hidden;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  padding: 18px 0;
  background: var(--paper-soft);
}
.m-marquee-track {
  display: inline-flex;
  align-items: center;
  gap: 56px;
  white-space: nowrap;
  animation: m-marquee-slide 40s linear infinite;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--ink-quiet);
}
.m-marquee-track > * { display: inline-flex; align-items: center; gap: 12px; }
.m-marquee-track .dot { width: 4px; height: 4px; background: var(--coral); }
@keyframes m-marquee-slide {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ── 29.16 Page hero (interior pages, smaller than home hero) ── */
.m-page-hero {
  padding: 96px 0 48px;
  border-bottom: 1px solid var(--hairline);
}
.m-page-hero-title {
  font-family: var(--serif);
  font-variation-settings: "opsz" 48;
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: var(--tracking-tight);
  color: var(--ink);
  margin-bottom: 16px;
  max-width: 22ch;
}
.m-page-hero-title em { font-style: italic; font-weight: 500; }
.m-page-hero-sub {
  font-family: var(--serif);
  font-variation-settings: "opsz" 20;
  font-size: 19px;
  line-height: var(--leading-relaxed);
  color: var(--ink-soft);
  max-width: 55ch;
}

/* ──────────────────────────────────────────────────────────────
   §29.17  PRODUCT FRAMES  (Claude/Lindy/Linear style)
   The floating device frames that house real product shots.
   Three archetypes + optional chrome bar.
   ────────────────────────────────────────────────────────────── */

.m-frame {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow:
    0 1px 2px rgba(20,17,15,0.04),
    0 8px 24px rgba(20,17,15,0.06),
    0 32px 64px rgba(20,17,15,0.08);
  transition: transform var(--dur-med) var(--ease-standard),
              box-shadow var(--dur-med) var(--ease-standard);
}
[data-theme="dark"] .m-frame {
  box-shadow:
    0 1px 2px rgba(0,0,0,0.2),
    0 8px 24px rgba(0,0,0,0.3),
    0 32px 64px rgba(0,0,0,0.4);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .m-frame {
    box-shadow:
      0 1px 2px rgba(0,0,0,0.2),
      0 8px 24px rgba(0,0,0,0.3),
      0 32px 64px rgba(0,0,0,0.4);
  }
}

/* Big frame — hero + "watch it ship" sections */
.m-frame--big {
  aspect-ratio: 16 / 10;
  max-width: 1080px;
  margin-inline: auto;
  transform: perspective(2400px) rotateX(2deg);
}
.m-frame--big:hover { transform: perspective(2400px) rotateX(0deg); }

/* Slice frame — tall narrow cards for differentiators */
.m-frame--slice {
  aspect-ratio: 1 / 1.25;
  border-radius: var(--r-lg);
}

/* Inline frame — flat snippet, no shadow */
.m-frame--inline {
  border-radius: var(--r-md);
  box-shadow: none;
}

/* Chrome bar — the "traffic light" row so it reads as app not screenshot */
.m-frame-chrome {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--hairline);
  background: var(--paper-soft, var(--paper));
}
.m-frame-chrome-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ink-faint);
}
.m-frame-chrome-dot:nth-child(2) { background: var(--ink-quiet); opacity: 0.5; }
.m-frame-chrome-dot:nth-child(3) { background: var(--coral); opacity: 0.7; }
.m-frame-chrome-label {
  margin-left: 12px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--ink-quiet);
}

/* Body — scrollable region inside a frame */
.m-frame-body {
  position: relative;
  height: 100%;
  overflow: hidden;
}
.m-frame-body > iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* Hero frame wrapper — anchors the coral wash behind the frame */
.m-hero-stage {
  position: relative;
  padding: 56px 0 96px;
}
.m-hero-wash {
  position: absolute;
  inset: -10% -5% 20% -5%;
  background:
    radial-gradient(60% 45% at 70% 0%, var(--coral-wash), transparent 70%),
    radial-gradient(45% 35% at 20% 30%, rgba(232,106,78,0.06), transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.m-hero-frame { position: relative; z-index: 1; }

/* Scripted overlay — for hero auto-loop messages appearing on top of iframe */
.m-frame-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 24px 28px 120px;
  gap: 14px;
  pointer-events: none;
}

/* Interactive toggle group (for handoff section) */
.m-toggle-group {
  display: inline-flex;
  padding: 4px;
  background: var(--paper-soft, var(--paper));
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  gap: 4px;
}
.m-toggle {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: all var(--dur-short) var(--ease-standard);
}
.m-toggle--active {
  background: var(--ink);
  color: var(--paper);
}
.m-toggle:hover:not(.m-toggle--active) { color: var(--ink); }

/* Section divider — matches chat's .day-divider pattern for cohesion */
.m-divider {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 48px 0;
  color: var(--ink-quiet);
}
.m-divider::before, .m-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--hairline);
}
.m-divider-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
}

/* Horizon line — the single grounding rule under the hero */
.m-horizon {
  height: 1px;
  background: var(--hairline);
  margin-top: -1px;
}

/* Responsive: kill the tilt on mobile, it gets weird */
@media (max-width: 900px) {
  .m-frame--big { transform: none; aspect-ratio: 4 / 5; }
  .m-hero-stage { padding: 32px 0 56px; }
}
