/* GBv2 chat UI — dim warm-taupe DUAL theme (light + dark), WCAG-AA, token-based.
   Served stylesheet (no inline <style>) so the CSP can stay strict. Design language from the
   signed-off mockup (mockup/gbv2-chat-mockup.html). State is carried by border + weight + icon,
   not color alone. Honors prefers-color-scheme / contrast / reduced-motion / forced-colors. */

:root {
  --bg: #c7bda6; --surface: #d2c9b4; --surface-2: #c6bca3; --surface-3: #b7ac90;
  --ink: #15202b; --ink-soft: #3b4651; --ink-faint: #49535f;
  --line: #b2a78f; --line-strong: #5a6675;
  --brand: #123f94; --brand-strong: #0d3178; --brand-ink: #fff; --brand-bubble: #234e95;
  --accent: #055f44;
  --success: #055f44; --warning: #704700; --danger: #9e1d14; --info: #123f94; --focus: #123f94;
  --warn-fill: #fdf3e2; --info-fill: #eaf1fd; --danger-fill: #fcebe9; --success-fill: #e7f5ef;
  --scrim: rgba(21, 32, 43, 0.42);
  --radius: 14px; --radius-sm: 10px; --radius-lg: 20px; --radius-pill: 999px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px;
  --tap: 46px; --maxw: 1200px;
  --fs-700: clamp(1.2rem, 1rem + 0.6vw, 1.45rem);
  --fs-500: 1.0625rem; --fs-400: 1rem; --fs-300: 0.9375rem; --fs-200: 0.8125rem;
  --sh-1: 0 1px 2px rgba(21, 32, 43, 0.12);
  --sh-2: 0 6px 20px rgba(21, 32, 43, 0.16);
  --sh-3: 0 16px 40px rgba(21, 32, 43, 0.22);
  --dur: 0.22s; --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
  --bg: #0d141c; --surface: #141b24; --surface-2: #1c2531; --surface-3: #243040;
  --ink: #e8eef6; --ink-soft: #a7b6c8; --ink-faint: #8495a9;
  --line: #2a3747; --line-strong: #3a4a5e;
  --brand: #5aa0ff; --brand-strong: #2f7fe6; --brand-ink: #061018; --brand-bubble: #1d3f74;
  --accent: #39c08c; --success: #39c08c; --warning: #e0a93a; --danger: #cf3b32;
  --info: #5aa0ff; --focus: #5aa0ff;
  --warn-fill: #2a2114; --info-fill: #14233c; --danger-fill: #331715; --success-fill: #122a22;
  --scrim: rgba(0, 0, 0, 0.55);
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

@media (forced-colors: active) {
  .btn, .ghost, .mini, .send, .cbtn, .panel, .subpanel, .bubble, .affordance { border: 1px solid; }
}

* { box-sizing: border-box; }
/* The HTML `hidden` attribute must always win over component display rules (e.g. .entry/.stage
   set display:flex, which would otherwise override the UA [hidden]{display:none}). */
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }

body {
  font-family: var(--font); font-size: var(--fs-400); line-height: 1.5; color: var(--ink);
  background: var(--bg); -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column; align-items: center;
}

button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
svg.ic { width: 20px; height: 20px; display: block; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.app {
  width: 100%; max-width: var(--maxw); padding: var(--sp-4);
  display: flex; flex-direction: column; gap: var(--sp-4); flex: 1; min-height: 0;
}

/* ---------- alerts ---------- */
.alert {
  background: var(--danger-fill); color: var(--danger); border: 1px solid var(--danger);
  border-left-width: 3px; border-radius: var(--radius-sm); padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-300);
}
/* Slice A1 (requirement B): the dark-box maintenance banner — visually distinct from the red
   .alert (warning palette, bolder) so a non-operator clearly reads "the system is going offline
   for maintenance". Theme tokens only (no new color literal); the element also carries .alert. */
.alert.maintenance {
  background: var(--warn-fill); color: var(--warning); border-color: var(--warning);
  font-weight: 700;
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: var(--sp-2); z-index: 5; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--sh-1);
  padding: var(--sp-2) var(--sp-3); display: flex; align-items: center; gap: var(--sp-3);
  white-space: nowrap; width: 100%;
  /* UX-C1: let the bar wrap to a second line on a narrow viewport instead of overflowing
     horizontally with no affordance (the bar carried five pills before; now two + the burger). */
  flex-wrap: wrap;
}
.brand {
  display: flex; align-items: center; gap: var(--sp-2); font-weight: 700; font-size: var(--fs-500);
  color: var(--ink); background: none; border: none; padding: 4px 8px; border-radius: 10px;
}
.brand:hover { background: var(--surface-2); }
.brand .logo { width: 30px; height: 30px; border-radius: 9px; display: block; }
.brand b { color: var(--brand); }
.brand .theme-hint { font-size: 11px; color: var(--ink-faint); font-weight: 400; margin-left: 2px; }
.who {
  margin: 0 auto; color: var(--ink-soft); font-size: var(--fs-300);
  display: flex; align-items: center; gap: var(--sp-2);
}
.role-chip {
  font-size: var(--fs-200); font-weight: 700; letter-spacing: 0.02em; padding: 2px 8px;
  border-radius: var(--radius-pill); background: var(--info-fill); color: var(--brand);
  border: 1px solid var(--line); text-transform: uppercase;
}
.pending-chip { background: var(--warn-fill); color: var(--warning); border-color: var(--warning); }
/* UX-C1: the toggle group also wraps (row-gap keeps spacing when it does) as a narrow-width net. */
.bar-actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }

.btn {
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  padding: 0 var(--sp-3); height: 38px; border-radius: var(--radius-pill);
  display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-300);
}
.btn:hover { border-color: var(--line-strong); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand-strong); font-weight: 600; }
.btn.icon { width: 38px; height: 38px; padding: 0; justify-content: center; }
.btn.danger { background: var(--danger-fill); color: var(--danger); border-color: var(--danger); }
.btn:disabled { opacity: 0.55; cursor: default; }
/* Commit/Save: a brand-filled primary action, clearly distinct from the dim utility .mini.
   Intentionally the SAME brand fill as the existing .btn.primary (above) + one layout utility
   (align-self), so the two stay a single visual treatment — keep them in sync if brand tokens
   change. (Equivalent alternative: class="btn primary" + an align-self utility; the named
   .btn.commit is preferred because it documents "the one Save per form" intent.) */
.btn.commit, button.commit {
  background: var(--brand); color: var(--brand-ink); border: 1px solid var(--brand-strong);
  font-weight: 600; align-self: flex-start;      /* sits on its own, not inline-blended */
}
.btn.commit:hover, button.commit:hover { background: var(--brand-strong); }
.btn.commit:disabled, button.commit:disabled { opacity: 0.55; cursor: default; }
.danger-text { color: var(--danger); }

.yolo {
  display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-200);
  color: var(--ink-soft); border: 1px solid var(--line); border-radius: var(--radius-pill);
  padding: 3px 10px 3px 8px; background: var(--surface-2);
}
.yolo .sw {
  width: 30px; height: 18px; border-radius: 999px; background: var(--line-strong);
  position: relative; transition: background var(--dur);
}
.yolo .sw::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px;
  border-radius: 50%; background: #fff; transition: transform var(--dur);
}
.yolo[aria-pressed="true"] { color: var(--warning); border-color: var(--warning); }
.yolo[aria-pressed="true"] .sw { background: var(--warning); }
.yolo[aria-pressed="true"] .sw::after { transform: translateX(12px); }

/* ---------- entry gate ---------- */
.entry {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--sh-2); padding: var(--sp-5); max-width: 520px; width: 100%; margin: 0 auto;
  display: flex; flex-direction: column; gap: var(--sp-3);
}
.entry h2 { margin: 0; font-size: var(--fs-700); }
.entry-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.entry-tab {
  border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius-pill);
  padding: 6px 14px; font-size: var(--fs-300); color: var(--ink-soft);
}
.entry-tab[aria-selected="true"] {
  background: var(--brand); color: var(--brand-ink); border-color: var(--brand-strong);
  font-weight: 600;
}
.entry-pane { display: flex; flex-direction: column; gap: var(--sp-3); }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: var(--fs-300); color: var(--ink-soft); font-weight: 600; }
.field input, .field textarea, .field select, .inline-form input, .inline-form textarea,
form textarea, form input[type="text"], form input[type="email"], form input[type="password"],
form select {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: var(--radius-sm); padding: 8px 10px; font: inherit;
}
/* LLM pane per-mode field groups (slice 24): same column/gap as .pbody so switching the provider
   dropdown shows/hides a group with no jarring layout jump, and the Kiro refresh block reads as a
   grouped control. Matches the existing pane idiom (no new layout idiom introduced). */
.llm-mode-group { display: flex; flex-direction: column; gap: var(--sp-2); }
.llm-mode-group[hidden] { display: none; }
/* Web Connections sub-sections (AIV-Dev / Admin / User): same column/gap as the LLM mode groups so
   each role-gated block reads as one grouped control. No new layout idiom. */
#web-connections-section section { display: flex; flex-direction: column; gap: var(--sp-2); }
#web-connections-section section[hidden] { display: none; }
.questions {
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--sp-3);
  display: flex; flex-direction: column; gap: var(--sp-2);
}
.questions legend { font-size: var(--fs-300); color: var(--ink-soft); padding: 0 6px; }
.subtitle { color: var(--ink-soft); font-size: var(--fs-300); margin: 0; }
.otp-sent { color: var(--success); font-size: var(--fs-300); margin: 0; }

/* ---------- chat stage ---------- */
.stage {
  flex: 1; min-height: 0; display: flex; width: 100%;
}
.stage-inner {
  position: relative; flex: 1; min-height: 0; display: flex; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--sh-2);
  overflow: hidden; width: 100%;
}
.chat-main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.chat-bar {
  display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--line);
}
.chat-bar .spacer { flex: 1; }
.ghost {
  background: transparent; border: 1px solid transparent; color: var(--ink-soft); height: 32px;
  border-radius: var(--radius-pill); padding: 0 10px; font-size: var(--fs-300);
  display: inline-flex; align-items: center; gap: 6px;
}
.ghost:hover { background: var(--surface-2); border-color: var(--line); }
.ghost svg { width: 16px; height: 16px; }

.log {
  flex: 1; min-height: 0; overflow-y: auto; padding: var(--sp-4);
  display: flex; flex-direction: column; gap: var(--sp-4);
}
.empty-state {
  margin: auto; text-align: center; color: var(--ink-faint); font-size: var(--fs-300);
  max-width: 42ch;
}

/* drag-drop overlay */
.drop-overlay {
  position: absolute; inset: 0; z-index: 7; display: none; place-items: center;
  background: color-mix(in srgb, var(--brand) 14%, var(--surface));
  border: 3px dashed var(--brand); border-radius: var(--radius-lg); color: var(--brand);
  font-weight: 700; font-size: var(--fs-500);
}
.stage-inner.dragover .drop-overlay { display: grid; }

/* messages */
.row { display: flex; gap: var(--sp-3); max-width: 100%; }
.row.me { flex-direction: row-reverse; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: var(--fs-200);
}
.avatar.eva { background: radial-gradient(circle at 30% 30%, var(--brand), var(--accent)); }
.avatar.user { background: var(--accent); }
.bubble-wrap { min-width: 0; max-width: 64ch; }
.who-label {
  font-size: 13px; font-weight: 700; color: var(--brand); margin: 0 0 3px;
  letter-spacing: 0.03em;
  /* UX-2a: name + timestamp on one baseline row. The name keeps the original uppercase styling;
     the timestamp is muted, non-uppercased, and sits at the end. */
  display: flex; align-items: baseline; gap: 8px;
}
.who-label .who-name { text-transform: uppercase; }
/* The per-bubble timestamp (UX-2a): quiet, small, non-uppercased; pushed to the row's end. */
.bubble-time {
  margin-left: auto; font-size: var(--fs-200); font-weight: 500; letter-spacing: 0;
  color: var(--ink-faint); text-transform: none; white-space: nowrap;
}
.row.me .who-label { flex-direction: row-reverse; color: var(--accent); }
.row.me .bubble-time { margin-left: 0; margin-right: auto; }
.bubble {
  position: relative; background: var(--surface-2); color: var(--ink); border: 1px solid var(--line);
  padding: var(--sp-3) var(--sp-4); border-radius: var(--radius); word-wrap: break-word;
}
.row:not(.me) .bubble::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px;
  background: linear-gradient(var(--brand), var(--accent));
}
.row:not(.me) .bubble { padding-left: calc(var(--sp-4) + 3px); border-top-left-radius: 6px; }
.row.me .bubble {
  background: var(--brand-bubble); color: #fff; border-color: var(--brand-strong);
  border-top-right-radius: 6px; white-space: pre-wrap;
}

/* safe rich content inside a bubble (sanitized markdown subset + owned chart) */
.md > *:first-child { margin-top: 0; }
.md > *:last-child { margin-bottom: 0; }
.md p { margin: 0 0 var(--sp-2); }
.md strong { font-weight: 700; }
.md em { font-style: italic; }
.md ul { margin: 0 0 var(--sp-2); padding-left: 1.2em; }
.md li { margin: 2px 0; }
.md a { color: var(--brand); }
.md code {
  font-family: var(--mono); font-size: 0.9em; background: var(--surface-3); padding: 1px 5px;
  border-radius: 5px;
}
.md pre {
  margin: var(--sp-2) 0; background: #0d141c; color: #e8eef6; border-radius: var(--radius-sm);
  padding: var(--sp-3); overflow: auto;
}
.md pre code { background: none; padding: 0; color: inherit; }
.md .fig { margin: var(--sp-2) 0 0; }
.md .fig img, .md .fig svg {
  max-width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--line); display: block;
}
.md .cap { font-size: 11px; color: var(--ink-faint); margin-top: 4px; }
.md .bar {
  display: flex; align-items: flex-end; gap: 8px; height: 120px; padding: var(--sp-2);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.md .bar i {
  flex: 1; background: linear-gradient(var(--brand), var(--accent)); border-radius: 4px 4px 0 0;
  display: block; animation: grow 0.6s var(--ease) both;
}
.md .inert { color: var(--ink-faint); font-size: var(--fs-200); font-style: italic; }
@keyframes grow { from { height: 0; } }

/* agent steps strip */
.agent-steps {
  margin-top: var(--sp-2); border: 1px dashed var(--line); border-radius: var(--radius-sm);
  background: var(--surface);
}
.agent-steps > summary {
  list-style: none; cursor: pointer; padding: 6px var(--sp-3); font-size: var(--fs-200);
  color: var(--ink-soft); display: flex; align-items: center; gap: 8px;
}
.agent-steps > summary::-webkit-details-marker { display: none; }
.agent-steps[open] > summary { border-bottom: 1px dashed var(--line); }
.step { display: flex; gap: 8px; padding: 8px var(--sp-3); font-size: var(--fs-300); color: var(--ink-soft); }
.step .lane {
  font-weight: 700; font-size: var(--fs-200); padding: 1px 7px; border-radius: var(--radius-pill);
  color: #fff; flex: none; height: fit-content;
}
.lane.eva { background: var(--brand); }
.lane.worker { background: #5a6675; }
.lane.reviewer { background: #704700; }
.badge-once { margin-left: auto; font-size: 11px; color: var(--success); font-weight: 700; }

/* FEAT-003 live agent-discussion panel (expanded while the job runs, collapsed on completion).
   CSS-only; the fade-in is disabled under prefers-reduced-motion by the global rule above. */
.agent-live {
  margin-top: var(--sp-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); overflow: hidden;
}
.agent-live-head {
  padding: 6px var(--sp-3); font-size: var(--fs-200); color: var(--ink-soft);
  border-bottom: 1px dashed var(--line); display: flex; align-items: center; gap: 8px;
}
/* UX-4: the user-facing provider chip on the live panel header ("Local LLM" / "External LLM").
   Pushed to the header's end; quiet pill, not a status alarm. */
.agent-live-head .panel-provider {
  margin-left: auto; font-size: var(--fs-200); font-weight: 600; letter-spacing: 0.02em;
  color: var(--ink-soft); background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-pill); padding: 1px 8px; white-space: nowrap;
}
.agent-live .step {
  flex-direction: column; gap: 4px; border-bottom: 1px dashed var(--line);
  animation: live-step-in 0.25s ease-out;
}
.agent-live .step:last-child { border-bottom: none; }
.agent-live .step-label { font-weight: 600; font-size: var(--fs-200); color: var(--ink-soft); }
.agent-live .step-body { font-size: var(--fs-300); color: var(--ink); }
/* UX-1: per-step timing meta (completion time + elapsed/running timer). The .agent-live .step is a
   column flexbox (lane, label, meta, body stacked); the meta sits right-aligned as a quiet chip
   pair. A RUNNING step shows a live-counting elapsed (accented) + a small pulsing "working" dot; a
   COMPLETED step shows a frozen elapsed + a muted clock time. */
.agent-live .step-meta {
  align-self: flex-end; display: inline-flex; align-items: center; gap: 8px;
  font-size: var(--fs-200); color: var(--ink-faint); margin-top: -2px;
}
.agent-live .step-elapsed { font-variant-numeric: tabular-nums; white-space: nowrap; }
.agent-live .step-elapsed.running { color: var(--brand); font-weight: 700; }
.agent-live .step-elapsed.running::before {
  content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px;
  border-radius: 50%; background: var(--brand); vertical-align: middle;
  animation: step-working 1s ease-in-out infinite;
}
.agent-live .step-time { color: var(--ink-faint); white-space: nowrap; }
@keyframes step-working { 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) {
  /* Keep the "working" dot visible (it signals activity) but stop it pulsing. */
  .agent-live .step-elapsed.running::before { animation: none; }
}
@keyframes live-step-in { from { opacity: 0; } to { opacity: 1; } }

/* D-S44 Pillar B: token-stream caret + inline tool rows. The caret blinks while an agent streams;
   the global prefers-reduced-motion rule above freezes all animation, so under reduced motion the
   caret is a static block and tokens simply appear per-chunk. */
.caret {
  display: inline-block; width: 7px; height: 1.05em; margin-left: 1px;
  vertical-align: text-bottom; background: var(--ink); animation: caret-blink 1s step-end infinite;
}
@keyframes caret-blink { 50% { opacity: 0; } }
.agent-live .tool {
  display: flex; align-items: center; gap: 8px; margin: 6px 0;
  font-size: var(--fs-300); color: var(--ink-soft);
}
.agent-live .tool .spin {
  width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--brand);
  border-radius: 50%; animation: tool-spin 0.8s linear infinite; flex: none;
}
@keyframes tool-spin { to { transform: rotate(360deg); } }
.agent-live .tool .tool-ok { color: var(--success); font-weight: 700; }
.agent-live .tool .tool-fail { color: var(--danger, #c0392b); font-weight: 700; }
/* A3: a clean no-results search is NEUTRAL (muted ∅), never a scary red cross. */
.agent-live .tool .tool-empty { color: var(--ink-soft); font-weight: 700; }

/* A6: the live discussion is a native <details> so "collapse" is a pure show/hide of the REAL
   streamed content (no DOM removal, no hardcoded recap). The summary is the one-line label; the
   caret rotates to indicate open/closed. */
.agent-live-details > summary {
  list-style: none; cursor: pointer;
}
.agent-live-details > summary::-webkit-details-marker { display: none; }
.agent-live-details > summary::before {
  content: "▾"; display: inline-block; margin-right: 6px; color: var(--ink-soft);
}
.agent-live-details:not([open]) > summary::before { content: "▸"; }
/* The summary IS the former head bar; keep its border only while expanded. */
.agent-live-details:not([open]) .agent-live-head { border-bottom: none; }

/* A direct-answer note + a raise-reason line (both inert, API-token/text only). */
.direct-note {
  margin-top: var(--sp-2); font-size: var(--fs-200); color: var(--ink-soft); font-style: italic;
}
.raise-reason { margin-top: 4px; font-size: var(--fs-200); color: var(--ink-soft); }

.thinking { display: inline-flex; align-items: center; gap: 10px; color: var(--ink-soft); font-size: var(--fs-300); }
.thinking .dots span {
  display: inline-block; width: 6px; height: 6px; margin: 0 1px; border-radius: 50%;
  background: var(--brand); animation: dot 1.2s infinite ease-in-out;
}
.thinking .dots span:nth-child(2) { animation-delay: 0.15s; }
.thinking .dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-4px); opacity: 1; }
}
/* Reduced motion: the global rule above freezes the animation; hide the now-static dot row so
   only the "Eva is thinking…" text announces (a frozen low-opacity dot row reads as broken). */
@media (prefers-reduced-motion: reduce) {
  .thinking .dots { display: none; }
}

/* inline affordances — state by border + weight + icon (not color alone) */
.affordance {
  border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: var(--radius-sm);
  background: var(--surface); padding: var(--sp-3) var(--sp-4); display: flex;
  flex-direction: column; gap: var(--sp-2); max-width: 64ch; margin-left: 48px;
}
.affordance .tag {
  font-family: var(--mono); font-size: var(--fs-200); font-weight: 700; letter-spacing: 0.03em;
  color: var(--brand);
}
.affordance.needs_choice { border-left-color: var(--brand); }
.affordance.needs_input { border-left-color: var(--info); }
.affordance.raised { border-left-color: var(--accent); background: var(--success-fill); }
.affordance.raised .tag { color: var(--success); }
.affordance.error { border-left-color: var(--danger); background: var(--danger-fill); }
.affordance.error .tag { color: var(--danger); }
.affordance.done { border-left-color: var(--success); }
.affordance .acts { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.affordance .field { gap: 6px; }
/* Answered needs_input: the question stays as an inert record (D-S19 #6), muted to read as past. */
.affordance.answered { opacity: 0.72; border-left-color: var(--line); }
/* Hire plan (slice 25): role/purpose/tools as a compact definition list — inert text only. */
.hire-plan { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 2px var(--sp-3); }
.hire-plan dt { font-weight: 700; color: var(--ink-soft); font-size: var(--fs-200); }
.hire-plan dd { margin: 0; font-size: var(--fs-300); }
.opt {
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  padding: 8px var(--sp-3); border-radius: var(--radius-pill); font-size: var(--fs-300);
}
.opt:hover { border-color: var(--brand); }

/* composer */
.composer {
  flex: none; border-top: 1px solid var(--line); padding: var(--sp-3);
  padding-bottom: max(var(--sp-3), env(safe-area-inset-bottom));
}
.pill {
  display: flex; align-items: flex-end; gap: var(--sp-2); border: 1px solid var(--line);
  background: var(--surface-2); border-radius: 22px; padding: 6px 6px 6px var(--sp-2);
  transition: border-color var(--dur), box-shadow var(--dur);
}
.pill:focus-within {
  border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);
}
.pill .cbtn {
  width: 40px; height: 40px; flex: none; border-radius: 50%; border: 1px solid transparent;
  background: transparent; color: var(--ink-soft); display: grid; place-items: center;
}
.pill .cbtn:hover { background: var(--surface-3); color: var(--ink); }
.pill .cbtn.rec { color: var(--danger); }
.pill textarea {
  flex: 1; border: none; background: transparent; color: var(--ink); font-family: inherit;
  font-size: var(--fs-400); line-height: 1.4; resize: none;
  outline: none; max-height: 140px; min-height: 24px; padding: 9px 4px;
}
.send {
  background: var(--brand); color: var(--brand-ink); border: 1px solid var(--brand-strong);
  border-radius: var(--radius-pill); height: 40px; padding: 0 var(--sp-4); font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
}
.send:disabled { opacity: 0.6; cursor: default; }
.hint { font-size: var(--fs-200); color: var(--ink-faint); margin: 6px 0 0 14px; }

/* Chat-attach (Option A): staged attachment chips above the hint. Inert DOM built by app.js
   (createElement/textContent only); theme tokens only, no new color literals. A degraded/received/
   failed chip is VISIBLY distinct (S2) — never a bare "Attached". */
.composer-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0 14px; }
.composer-chips .note { font-size: var(--fs-200); color: var(--ink-faint); }
.composer-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  font-size: var(--fs-200); padding: 3px 4px 3px 9px; border-radius: var(--radius-pill);
  border: 1px solid var(--line); background: var(--surface-3); color: var(--ink-soft);
}
.composer-chip .name { font-weight: 600; color: var(--ink); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.composer-chip .size { color: var(--ink-faint); }
.composer-chip .status { color: var(--ink-faint); }
/* grounded = Eva can read it (readable context). degraded/received = stored but not usable.
   failed = the upload itself failed. Each has a distinct border/status colour so the user can
   never mistake a non-readable file for a usable attachment. */
.composer-chip.grounded { border-color: var(--success); }
.composer-chip.grounded .status { color: var(--success); }
.composer-chip.degraded { border-color: var(--warning); }
.composer-chip.degraded .status { color: var(--warning); }
.composer-chip.received .status { color: var(--ink-faint); }
.composer-chip.failed { border-color: var(--danger); }
.composer-chip.failed .status { color: var(--danger); }
.composer-chip .x {
  display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px;
  border: none; border-radius: 50%; background: transparent; color: var(--ink-faint);
  cursor: pointer; font-size: 13px; line-height: 1; padding: 0;
}
.composer-chip .x:hover { background: var(--surface); color: var(--ink); }
.chip-spin {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--brand);
  animation: chip-spin 0.7s linear infinite;
}
@keyframes chip-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .chip-spin { animation: none; } }

/* The inert "📎 Attached: …" note under a user bubble (chat-attach). */
.attach-note { font-size: var(--fs-200); color: var(--ink-faint); margin-top: 4px; }

/* history drawer — overlay that auto-collapses on outside click; anchored to the LEFT edge,
   under the History button, so the user doesn't cross to the far side to pick a session. */
.drawer-hist {
  position: absolute; top: 0; left: 0; height: 100%; width: 280px; background: var(--surface);
  border-right: 1px solid var(--line); box-shadow: var(--sh-2); display: flex; flex-direction: column;
  min-height: 0; transform: translateX(-100%); transition: transform var(--dur) var(--ease); z-index: 8;
}
.drawer-hist.open { transform: none; }
.drawer-hist .dh-head {
  display: flex; align-items: center; gap: 8px; padding: var(--sp-3); border-bottom: 1px solid var(--line);
}
.drawer-hist .dh-head h3 { margin: 0; font-size: var(--fs-300); color: var(--ink-soft); flex: 1; }
.hist-list { overflow-y: auto; padding: var(--sp-2); display: flex; flex-direction: column; gap: 4px; }
.hist-empty { padding: var(--sp-3); color: var(--ink-faint); font-size: var(--fs-300); }
.hist-item {
  position: relative; display: flex; align-items: center; gap: 6px; background: transparent;
  border: 1px solid transparent; border-radius: var(--radius-sm); padding: 8px 6px 8px 10px;
  color: var(--ink); font-size: var(--fs-300); text-align: left; width: 100%;
}
.hist-item.active, .hist-item:hover { background: var(--surface-2); border-color: var(--line); }
.hist-item .label { flex: 1; min-width: 0; background: none; border: none; color: inherit; text-align: left; font: inherit; padding: 0; }
.hist-item .label small { display: block; color: var(--ink-faint); font-size: 11px; }
.hist-item .rename-input {
  flex: 1; min-width: 0; width: 100%; border: 1px solid var(--brand); border-radius: 6px;
  padding: 6px 8px; font: inherit; font-size: var(--fs-300); background: var(--surface); color: var(--ink);
}
.kebab {
  flex: none; width: 26px; height: 26px; border-radius: 6px; border: none; background: transparent;
  color: var(--ink-faint); display: grid; place-items: center;
}
.kebab:hover { background: var(--surface-3); color: var(--ink); }

/* near-cursor confirm popover + triple-dot row menu */
.confirm-pop {
  position: fixed; z-index: 30; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); box-shadow: var(--sh-3); padding: var(--sp-3); width: 230px;
}
.confirm-pop p { margin: 0 0 var(--sp-2); font-size: var(--fs-300); color: var(--ink); }
.confirm-pop .cacts { display: flex; gap: var(--sp-2); justify-content: flex-end; }
.mini {
  height: 30px; padding: 0 10px; border-radius: 8px; font-size: var(--fs-200);
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
}
.mini:hover { border-color: var(--line-strong); }
.mini.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.rowmenu {
  position: fixed; z-index: 30; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); box-shadow: var(--sh-3); padding: 4px; min-width: 140px;
}
.rowmenu button {
  width: 100%; text-align: left; background: none; border: none; color: var(--ink);
  padding: 8px 10px; border-radius: 6px; font-size: var(--fs-300);
}
.rowmenu button:hover { background: var(--surface-2); }

/* shared accessible dialog */
.dialog {
  position: fixed; z-index: 40; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius);
  box-shadow: var(--sh-3); padding: var(--sp-5); width: min(420px, 92vw);
  display: flex; flex-direction: column; gap: var(--sp-3);
}
.dialog-title { margin: 0; font-size: var(--fs-500); }
.dialog-body { margin: 0; color: var(--ink-soft); font-size: var(--fs-300); }
.dialog-acts { display: flex; gap: var(--sp-2); justify-content: flex-end; flex-wrap: wrap; }

/* right menu drawer */
.scrim {
  position: fixed; inset: 0; background: var(--scrim); opacity: 0; pointer-events: none;
  transition: opacity var(--dur); z-index: 9;
}
.scrim.open { opacity: 1; pointer-events: auto; }
.menu {
  position: fixed; top: 0; right: 0; height: 100%; width: min(420px, 92vw); background: var(--surface);
  border-left: 1px solid var(--line); box-shadow: var(--sh-3); transform: translateX(100%);
  transition: transform var(--dur) var(--ease); z-index: 10; display: flex; flex-direction: column;
}
.menu.open { transform: none; }
.menu header {
  display: flex; align-items: center; justify-content: space-between; padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--line);
}
.menu header h2 { margin: 0; font-size: var(--fs-500); }
.menu .body { overflow-y: auto; padding: var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-3); }

.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); overflow: hidden; }
.panel > summary {
  list-style: none; cursor: pointer; padding: var(--sp-3) var(--sp-4); font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.panel > summary::-webkit-details-marker { display: none; }
.panel > summary .chev { margin-left: auto; color: var(--ink-faint); transition: transform var(--dur); }
.panel[open] > summary .chev { transform: rotate(90deg); }
.panel .pbody {
  padding: 0 var(--sp-4) var(--sp-4); color: var(--ink-soft); font-size: var(--fs-300);
  display: flex; flex-direction: column; gap: var(--sp-2);
}
.panel .pbody form { display: flex; flex-direction: column; gap: var(--sp-2); }
.lock { font-size: 11px; color: var(--brand); border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 1px 7px; }
.panel .pbody h3.sub { margin: 0 0 var(--sp-1); font-size: var(--fs-300); color: var(--ink-soft); font-weight: 600; }

/* Sub-card: a contained, collapsible sub-section inside a .panel .pbody. Gives grouping (a visible
   boundary + header band) + one-open-at-a-time collapse (native <details>, wired by the drawer
   accordion controller in app.js) in one structure. Theme tokens only. */
.panel .pbody .subpanel {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);            /* inset vs the panel's --surface-2 body */
  border-left: 2px solid var(--line);    /* thin quiet rail — subordinate to the top-level 3px */
  overflow: hidden;
}
.panel .pbody .subpanel > summary {
  list-style: none; cursor: pointer;
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-300); font-weight: 600; color: var(--ink);
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid transparent;
}
.panel .pbody .subpanel[open] > summary { border-bottom-color: var(--line); }
.panel .pbody .subpanel > summary::-webkit-details-marker { display: none; }
.panel .pbody .subpanel > summary .chev {
  margin-left: auto; color: var(--ink-faint); transition: transform var(--dur);
}
.panel .pbody .subpanel[open] > summary .chev { transform: rotate(90deg); }
/* Sub-card banding = the GENERAL render-layer zebra (applyDrawerBanding in app.js). The resting
   fill is driven by a [data-band] marker the JS stamps on the VISIBLE rows of every banding
   container in document order — NOT by nth-of-type, which counts role-hidden siblings (they stay
   in the DOM with the `hidden` attribute) and so breaks the moment a row is hidden or added. The
   JS indexes over the visible rows only, so the A/B/A/B parity survives role-hiding, adding,
   removing, and reordering. Uses the SAME two surface tokens as the top-level `.grp > .panel`
   zebra (--surface-2 / --surface-3) so the whole drawer shares ONE palette. Scoped under
   [data-band-group] (the structural container marker in index.html) and gated to :not([open]) so
   the resting stripe can never win over the selected/open brand tint below. The hover is a quiet
   neutral ink lift (distinct from selected). Tokens only; both themes + forced-colors covered. */
[data-band-group] [data-band="0"]:not([open]) > summary { background: var(--surface-2); }
[data-band-group] [data-band="1"]:not([open]) > summary { background: var(--surface-3); }
.panel .pbody .subpanel > summary:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.panel .pbody .subpanel[open] { border-left: 3px solid var(--brand); }
.panel .pbody .subpanel[open] > summary { background: color-mix(in srgb, var(--brand) 14%, var(--surface)); font-weight: 700; }
.panel .pbody .subpanel[open] > summary .chev { color: var(--brand); }

/* Global Settings sub-menu — ONE consistent ALTERNATING banded group (banding fix, superseding the
   earlier UNIFORM rule from 7ff413a which the user rejected — they want alternation, not one flat
   colour). The rows the user reads as the Global Settings "sub-menu" are a MIX of element types
   inside #global-settings-section's .pbody: the "Global web policy"/"Organisation web policy"
   sub-cards (.subpanel, wrapped in section.gws-group) PLUS the nested operator rows (.panel:
   LLM / SMTP / OCR / Browser / Maintenance). They no longer paint from two different systems:
   applyDrawerBanding() collects ALL of them as ONE ordered list of banding rows and stamps the
   alternating [data-band] marker over the VISIBLE ones, so every row — the web-policy sub-card and
   the sibling nested panels alike — shares the ONE --surface-2 / --surface-3 zebra palette and
   alternates A/B/A/B. No per-id, per-label, per-position, or nth-of-type rule: the pattern is
   computed generically at runtime and recomputes on hide/add/reorder. The resting fill is the
   [data-band] rule above; the selected/open brand treatment (.subpanel[open] 3px rail + 14% tint,
   .panel[open] rail + tint) is untouched and wins via the :not([open]) gate. Tokens only; both
   themes + forced-colors are covered by the base .panel/.subpanel rules. */

/* `.gws-group` wraps the Global Settings sub-cards (an operator grouping in the DOM). It had NO
   CSS, so it defaulted to `display: block` with no gap — the sub-cards inside it stacked TIGHT
   (touching), unlike the Settings sub-cards which are direct flex children of `.pbody` (gap
   var(--sp-2)). THAT was the real "doesn't look like Settings" difference (proven by measuring:
   identical width/left, but 8px gap vs 0). Make the wrapper a flex column with the SAME gap so its
   sub-cards are spaced identically to every other panel's. The .subpanel nth-of-type zebra counts
   within this section fine (the sub-cards are its direct .subpanel-type children). */
.panel .pbody .gws-group { display: flex; flex-direction: column; gap: var(--sp-2); }

/* Sub-card body = the former sub-section contents. */
.panel .pbody .subpanel .sbody {
  padding: var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-2);
}
.panel .pbody .subpanel .sbody form { display: flex; flex-direction: column; gap: var(--sp-2); }
/* Mini group label inside a sub-card: separates related field clusters (e.g. "Region & time" vs
   "Chat input") so a lone control never looks orphaned. Quiet, uppercase, tokens only. The first
   one has no top margin (the summary band already spaces it); later ones get a divider gap. */
.panel .pbody .subpanel .sbody h4.sub-group {
  margin: var(--sp-2) 0 0; font-size: var(--fs-200); font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--ink-faint);
}
.panel .pbody .subpanel .sbody h4.sub-group:first-child { margin-top: 0; }

/* Drawer = Option-1 persistent accordion: a type-to-filter box, three concept GROUPS, and the
   existing <details class="panel"> items styled as accordion rows (open-one-collapse-others is
   enforced in app.js). Reuses existing tokens only. */
.filter-wrap { position: relative; margin-bottom: var(--sp-1); }
.filter-wrap svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--ink-faint); pointer-events: none;
}
.filter {
  width: 100%; min-height: var(--tap); border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); border-radius: var(--radius-pill); padding: 0 var(--sp-4) 0 40px; font: inherit;
  font-size: 16px;
}
.filter::placeholder { color: var(--ink-faint); }
.grp { display: flex; flex-direction: column; gap: var(--sp-2); }
.grp > h3 {
  display: flex; align-items: center; gap: var(--sp-2); margin: var(--sp-2) 0 0; padding: 0 var(--sp-1);
  font-size: var(--fs-200); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-faint);
}
.grp > h3 .lock { text-transform: none; letter-spacing: 0; }
.grp.filtered-out { display: none; }
/* Top-level accordion rows — the banding SYSTEM (open-sibling collapse is a JS controller):
   CLEARER zebra so the stripe reads in dark (--surface-2 / --surface-3); a quiet NEUTRAL hover
   lift (an ink tint, distinct from selected); and an UNMISTAKABLE selected/open state — the left
   rail turns --brand and thickens to 4px, plus a clear brand tint on the summary. Tokens only —
   both themes + forced-colors covered. */
.grp > .panel:nth-of-type(odd)  { background: var(--surface-2); }
.grp > .panel:nth-of-type(even) { background: var(--surface-3); }
.grp > .panel { border-left: 3px solid var(--line); }
/* hover = quiet neutral lift (distinct from selected) */
.panel > summary:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
/* selected/open = brand rail (thicker) + clear brand tint */
.grp > .panel[open] { border-left: 4px solid var(--brand); }
.panel[open] > summary { background: color-mix(in srgb, var(--brand) 18%, var(--surface-2)); color: var(--ink); font-weight: 700; border-bottom: 1px solid var(--line); }
.panel[open] > summary .chev { color: var(--brand); }
.panel[open] > summary:first-child { border-top-left-radius: var(--radius); border-top-right-radius: var(--radius); }
/* Locked Admin pane (honest read-only state from the server). */
.scope-note.locked { border-left-color: var(--warning); background: var(--warn-fill); color: var(--warning); }
/* Sign out: a caution-colored (danger) top-bar action so it is not pressed by reflex when not
   needed — theme tokens only (reuses the established destructive-action red, like .btn.danger). */
.bar-actions .btn.ghost#sign-out { color: var(--danger); border-color: var(--danger); }
.bar-actions .btn.ghost#sign-out:hover { background: var(--danger-fill); border-color: var(--danger); }
/* Notification dot on the hamburger when there are pending approvals. */
.bar-actions .btn.icon#burger { position: relative; }
.dot-badge {
  position: absolute; top: 5px; right: 5px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--danger); border: 2px solid var(--surface);
}
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-pill);
  padding: 5px 12px; font-size: var(--fs-200); color: var(--ink-soft);
}
.tab[aria-selected="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand-strong); }
.scope-note {
  font-size: var(--fs-200); color: var(--ink-faint); border-left: 3px solid var(--info);
  padding: 4px 10px; background: var(--info-fill); border-radius: 6px; margin: 0;
}
.doc-result { color: var(--success); font-size: var(--fs-200); margin: 0; }
.doc-degraded { color: var(--warning); font-size: var(--fs-200); margin: 0; }
.muted { color: var(--ink-faint); font-size: var(--fs-200); margin: 0; }

.rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rows li {
  display: flex; flex-direction: column; gap: var(--sp-1); padding: var(--sp-2) var(--sp-3);
  min-height: var(--tap); border: 1px solid var(--line);
  border-radius: var(--radius-sm); font-size: var(--fs-300);
  border-left: 3px solid var(--line);
}
/* Overlay vertical-list banding: zebra + neutral rail (top-level treatment). No selected rule —
   the DOM sets no row-level selected marker on .rows li (confirmed read-only in app.js). */
.rows li:nth-of-type(odd)  { background: var(--surface-2); }
.rows li:nth-of-type(even) { background: var(--surface-3); }
/* The rejected danger rail must still WIN over the neutral rail above (same specificity, later). */
.rows li[data-status="rejected"] { border-left: 3px solid var(--danger); }
.rows li .skill-name, .rows li .search-meta, .rows li .pending-text, .rows li .vault-name { font-weight: 600; }
.rows li .skill-meta, .rows li .pending-meta, .rows li .search-passage, .rows li .skill-desc {
  color: var(--ink-soft); font-size: var(--fs-200);
}
.rows li .skill-actions, .rows li .pending-actions {
  display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px;
}
.btn-approve { color: var(--success); border: 1px solid var(--success); background: var(--surface-2); border-radius: 8px; padding: 4px 10px; font-size: var(--fs-200); }
.btn-edit { color: var(--brand); border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; padding: 4px 10px; font-size: var(--fs-200); }
.btn-reject { color: var(--danger); border: 1px solid var(--danger); background: var(--surface-2); border-radius: 8px; padding: 4px 10px; font-size: var(--fs-200); }
.btn-reject:disabled { opacity: 0.6; cursor: default; }
.inline-form { gap: var(--sp-2); }

/* knowledge-redesign slice: compact dense rows + collapsible source groups. Token-only; pills
   stay scoped under .chips (the D-S69 collision lesson). No style= anywhere. */
.knowledge-group { padding: 0; border: 0; background: none; gap: 2px; }
.knowledge-group-head {
  display: flex; width: 100%; gap: var(--sp-2); background: none; border: 0; cursor: pointer;
  color: inherit; font-weight: 600; padding: 6px 0; font-size: var(--fs-300);
}
.knowledge-group-rows { margin: 0 0 var(--sp-2); }
.knowledge-row {
  display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3);
  min-height: var(--tap); border: 1px solid var(--line);
  border-radius: var(--radius-sm); flex-direction: row;
  border-left: 3px solid var(--line);
}
/* Overlay vertical-list banding: zebra + neutral rail (top-level treatment). No selected rule —
   the DOM sets no row-level selected marker on .knowledge-row (confirmed read-only in app.js). */
.knowledge-row:nth-of-type(odd)  { background: var(--surface-2); }
.knowledge-row:nth-of-type(even) { background: var(--surface-3); }
.knowledge-expand {
  display: flex; align-items: center; gap: var(--sp-2); flex: 1; min-width: 0;
  background: none; border: 0; text-align: left; cursor: pointer; color: inherit;
}
.knowledge-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.knowledge-sub { color: var(--ink-soft); font-size: var(--fs-200); white-space: nowrap; }
.knowledge-body {
  flex-basis: 100%; margin: 4px 0 2px; color: var(--ink-soft); font-size: var(--fs-200);
  white-space: pre-wrap;
}
.knowledge-remove { color: var(--danger); background: none; border: 0; cursor: pointer; }
.knowledge-remove:disabled { opacity: 0.6; cursor: default; }
.chips .pill.src-web { background: var(--info-fill); color: var(--brand); }
.chips .pill.src-file { background: var(--surface-3); color: var(--ink-soft); }
.chips .pill.src-paste { background: var(--surface-3); color: var(--ink-soft); }
.chips .pill.src-agent { background: var(--info-fill); color: var(--brand); }
.chips .pill.src-untagged { background: var(--surface-3); color: var(--ink-soft); }

/* D-S14 Sources footer: source attributions under a grounded agent reply. */
.sources {
  margin-top: var(--sp-3); padding-top: var(--sp-2); border-top: 1px solid var(--line);
  font-size: var(--fs-200);
}
.sources-head { font-weight: 600; color: var(--ink-soft); margin-bottom: 4px; }
.sources-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.source-item { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.source-id {
  font-weight: 600; color: var(--brand); border: 1px solid var(--line);
  border-radius: var(--radius-pill); padding: 0 7px; font-size: 11px;
}
.source-chip { color: var(--ink-soft); }
.sources a { color: var(--brand); text-decoration: underline; }

/* ==========================================================================
   CAP-1 Capabilities browser — full-viewport overlay + catalog grid.
   Rules adapted VERBATIM from .agents/design/mockups/capabilities-browser.html,
   tokens only (no new color literals). Reuses the shipped .tab[aria-selected],
   .field, .scrim, .btn primitives. Mobile-first / Safari-safe.
   ========================================================================== */
.cap-overlay { position: fixed; inset: 0; z-index: 20; display: flex; }
.cap-overlay[hidden] { display: none; }
.cap-stage {
  position: relative; margin: 2vh 2vw; flex: 1; min-height: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--sh-2); display: flex; flex-direction: column; overflow: hidden;
}
.ov-head {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.ov-head h2 { margin: 0; font-size: var(--fs-700); }
.ov-head .spacer { flex: 1; }
/* Back-to-origin control in an overlay header (cross-opened overlays only). Reuses .btn.ghost
   tokens; margin-right pushes it ahead of the title. No new colors. */
.ov-head .ov-back { margin-right: var(--sp-2); }

.help-wrap { position: relative; }
.help-pop {
  position: absolute; left: 0; top: 48px; width: min(360px, 86vw);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  box-shadow: var(--sh-3); padding: var(--sp-3); z-index: 11;
}
.help-pop[hidden] { display: none; }
.help-pop h4 { margin: 0 0 var(--sp-2); font-size: var(--fs-300); }
.help-tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-200); }
.help-tbl th, .help-tbl td { text-align: left; padding: 5px 7px; border-bottom: 1px solid var(--line); vertical-align: top; }
.help-tbl th { color: var(--ink-soft); font-weight: 700; }
.help-tbl td:first-child { font-weight: 700; color: var(--ink); white-space: nowrap; }
.help-note { margin: var(--sp-2) 0 0; font-size: 11px; color: var(--warning); }

.toolbar {
  padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: var(--sp-3);
}
.lane {
  display: flex; align-items: center; gap: 6px; overflow-x: auto;
  -webkit-overflow-scrolling: touch; scrollbar-width: thin; padding-bottom: 2px;
}
.lane::-webkit-scrollbar { height: 5px; }
.lane::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.lane > * { flex: none; }
.seg {
  display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-3);
  border-radius: var(--radius-pill); width: fit-content;
}
.seg button, .fm-tab {
  border: none; background: transparent; color: var(--ink-soft); padding: 8px 16px;
  border-radius: var(--radius-pill); font-size: var(--fs-300); font-weight: 600;
  min-height: 40px; white-space: nowrap; cursor: pointer;
}
.seg button[aria-selected="true"], .fm-tab[aria-selected="true"] { background: var(--brand); color: var(--brand-ink); }
.row2 { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.search {
  flex: 1; min-width: 180px; display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius-pill);
  padding: 0 var(--sp-3); min-height: 40px;
}
.search input { flex: 1; border: none; background: transparent; color: var(--ink); font-family: inherit; font-size: 16px; outline: none; }
.search svg { width: 16px; height: 16px; color: var(--ink-faint); }
.facet-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-faint); margin-right: 2px; flex: none;
}
.sortsel { margin-left: auto; }
.sortsel select, .catsel select {
  font-family: inherit; font-size: 16px; color: var(--ink); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px 10px; min-height: 40px;
}
.catsel { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.catsel .facet-label { margin-right: 0; }
.catsel select { max-width: min(60vw, 320px); }
.catsel[hidden] { display: none !important; }
.catsel-newcat { display: inline-flex; align-items: center; gap: 6px; }
.catsel-newcat input {
  font-family: inherit; font-size: 16px; color: var(--ink); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px 10px;
  min-height: 40px; max-width: min(60vw, 240px);
}
.meter {
  display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-200);
  color: var(--ink-soft); border: 1px solid var(--line); background: var(--surface);
  border-radius: var(--radius-pill); padding: 4px 12px;
}
.meter b { color: var(--ink); }
.meter .bar { width: 70px; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.meter .bar i { display: block; height: 100%; background: var(--accent); }

.cap-stage .body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: var(--sp-4); flex: 1; min-height: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--sp-4); }
.card {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--sp-3) var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-2);
  text-align: left; color: inherit; min-width: 0; width: 100%;
}
.card:hover { border-color: var(--line-strong); box-shadow: var(--sh-1); }
.card .top { display: flex; align-items: flex-start; gap: var(--sp-2); }
.card .top > div { min-width: 0; }
.card .nm { font-weight: 700; font-size: var(--fs-400); }
.card .desc {
  color: var(--ink-soft); font-size: var(--fs-300); display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card .owner { font-size: 11px; color: var(--ink-faint); }
.card .cap-attr { font-size: 11px; color: var(--ink-faint); }
.card .hints { display: flex; gap: 5px; flex-wrap: wrap; font-size: 11px; color: var(--ink-faint); }
.card .hints .hint { border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; background: var(--surface); }
.card .foot { display: flex; align-items: center; gap: var(--sp-2); margin-top: 2px; flex-wrap: wrap; }
.card .foot .spacer { flex: 1; min-width: 0; }

.ic-type {
  width: 34px; height: 34px; flex: none; border-radius: 9px; display: grid;
  place-items: center; background: var(--surface-3); color: var(--brand);
}
.ic-type svg { width: 20px; height: 20px; }

/* Capability catalog badge pills. SCOPED to `.chips` so they never collide with the composer's
   pre-existing `.pill` input-bar class (an unscoped `.pill` here overrode the composer pill —
   wrong padding/radius/font on the chat input bar). The badges always render inside a `.chips`. */
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chips .pill { font-size: 11px; font-weight: 700; letter-spacing: 0.02em; padding: 2px 8px; border-radius: var(--radius-pill); border: 1px solid var(--line); }
.chips .pill.type { background: var(--info-fill); color: var(--brand); }
.chips .pill.cat { background: var(--surface-3); color: var(--ink-soft); font-weight: 600; }
.chips .pill.official { background: var(--info-fill); color: var(--brand); border-color: var(--brand); }
.chips .pill.scan-clean { background: var(--success-fill); color: var(--success); border-color: var(--success); }
.chips .pill.scan-rejected { background: var(--danger-fill); color: var(--danger); border-color: var(--danger); }
.chips .pill.scan-pending { background: var(--warn-fill); color: var(--warning); border-color: var(--warning); }

.sw-btn {
  display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-200);
  color: var(--ink-soft); border: 1px solid var(--line); border-radius: var(--radius-pill);
  padding: 0 12px 0 10px; min-height: 34px; background: var(--surface);
}
.sw-btn .sw { width: 30px; height: 18px; border-radius: 999px; background: var(--line-strong); position: relative; transition: background var(--dur); flex: none; }
.sw-btn .sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform var(--dur); }
.sw-btn[aria-pressed="true"] { color: var(--success); border-color: var(--success); }
.sw-btn[aria-pressed="true"] .sw { background: var(--success); }
.sw-btn[aria-pressed="true"] .sw::after { transform: translateX(12px); }
.sw-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.fav {
  width: 34px; height: 34px; min-width: 34px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-faint); display: grid; place-items: center;
  font-size: 15px; line-height: 1;
}
.fav[aria-pressed="true"] { color: var(--warning); border-color: var(--warning); background: var(--warn-fill); }
.kebab {
  width: 34px; height: 34px; min-width: 34px; border-radius: 7px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-faint); display: grid; place-items: center;
}
.noresult { text-align: center; color: var(--ink-soft); padding: var(--sp-6); }
.noresult[hidden] { display: none; }

/* Capability detail reuses the shared #dialog; a modifier widens it + lets it scroll + stacks
   above the overlay. Base .dialog is untouched (other callers unaffected). */
.dialog.cap-detail {
  width: min(620px, 94vw); max-height: 92vh; overflow: auto; -webkit-overflow-scrolling: touch;
  z-index: 42;
}
.cap-detail .cap-section { display: flex; flex-direction: column; gap: var(--sp-2); }
.cap-detail .cap-section h3 { margin: 0; font-size: var(--fs-300); color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.04em; }
.cap-detail .cap-meta { color: var(--ink-soft); font-size: var(--fs-300); margin: 0; }
.cap-detail .cap-findings { font-family: var(--mono); font-size: var(--fs-200); margin: 0; }
.cap-detail .cap-findings.clean { color: var(--success); }
.cap-detail .cap-findings.flagged { color: var(--danger); }
.cap-detail .cap-mdbody { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--sp-3); font-size: var(--fs-300); color: var(--ink); }
.cap-detail .cap-skillbody { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--sp-3); font-family: var(--mono); font-size: var(--fs-200); color: var(--ink); max-height: 50vh; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.cap-detail .cap-warn { font-size: var(--fs-200); color: var(--warning); border-left: 3px solid var(--warning); padding: 4px 10px; background: var(--warn-fill); border-radius: 6px; margin: 0; }
.cap-detail .cred-row { display: flex; align-items: center; gap: 8px; }
.cap-detail .cred-row input { flex: 1; }
.cap-detail .cred-set { font-size: 11px; color: var(--success); }
.cap-detail .cap-status { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-200); color: var(--ink-soft); }
.cap-detail .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-faint); }
.cap-detail .field input, .cap-detail .field select { font-size: 16px; }
.cap-detail .field .hint { font-size: 11px; color: var(--ink-faint); }

@media (max-width: 640px) {
  .cap-stage { margin: 0; border-radius: 0; border-left: none; border-right: none; min-height: 100vh; min-height: 100dvh; height: -webkit-fill-available; }
  .grid { grid-template-columns: 1fr; }
  .cap-stage .toolbar, .cap-stage .body { padding: var(--sp-3); }
  .sortsel { margin-left: 0; width: 100%; }
  .sortsel select { width: 100%; }
  .ov-head h2 { font-size: var(--fs-500); }
  .dialog.cap-detail { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; left: 0; top: 0; transform: none; border-radius: 0; }
}

/* ==========================================================================
   Files & Folders overlay (slice 2) — reuses .cap-overlay / .cap-stage / .ov-head / .scrim /
   .toolbar / .rowmenu. Tokens only (no new color literals); no inline styles (CSP-safe). A
   reserved empty grid cell (.fm-ragseam) holds space for the slice-3 RAG tick.
   ========================================================================== */
.fm-row2 { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.fm-crumbs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; flex: 1; min-width: 160px; }
.crumb {
  background: none; border: 1px solid transparent; color: var(--brand); cursor: pointer;
  padding: 3px 8px; border-radius: var(--radius-pill); font-size: var(--fs-300);
}
.crumb:hover { background: var(--surface-2); border-color: var(--line); }
.crumb-sep { color: var(--ink-faint); font-size: var(--fs-300); }

/* In-overlay section tabs (Problem 2) — reuse the shipped .seg pill-group look; a hidden tab
   button drops out via [hidden]. Tokens only; no inline style (CSP-safe). */
.fm-tabs { margin-bottom: var(--sp-3); }
/* .fm-tab reuses the .seg button pill rules (grouped above) — one source of truth, no duplicate. */
.fm-tab[hidden] { display: none; }
.fm-panel[hidden] { display: none; }

/* In-overlay file viewer (Problem 1). A bordered pane below the list; header carries Download +
   Back-to-files; the body holds the inline image / text / markdown / code (object URL as a
   property, revoked on close). Tokens only; no inline style (CSP-safe). */
.fm-viewer {
  margin-top: var(--sp-3); border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); overflow: hidden;
}
.fm-viewer[hidden] { display: none; }
.fm-viewer-head {
  display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap;
  padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--line); background: var(--surface);
}
.fm-viewer-head .spacer { flex: 1; }
.fm-viewer-title {
  margin: 0; font-size: var(--fs-400); color: var(--ink); min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.fm-viewer-body { padding: var(--sp-3); max-height: 60vh; overflow: auto; -webkit-overflow-scrolling: touch; }
.fm-viewer-body .fig img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.fm-viewer-body pre { white-space: pre-wrap; word-break: break-word; }

.fm-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.fm-item {
  display: grid;
  grid-template-columns: auto auto 1fr auto auto auto;
  align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3); border: 1px solid var(--line);
  border-radius: var(--radius-sm); min-height: var(--tap);
  border-left: 3px solid var(--line);
}
/* Overlay vertical-list banding: zebra + neutral rail + quiet hover (top-level treatment). No
   selected rule — selection is tracked by the .selbox checkbox + a JS Set, not a row-level DOM
   marker (confirmed read-only in app.js), so there is nothing to style for "selected". */
.fm-item:nth-of-type(odd)  { background: var(--surface-2); }
.fm-item:nth-of-type(even) { background: var(--surface-3); }
.fm-item:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.fm-item .selbox { width: 18px; height: 18px; accent-color: var(--brand); }
.fm-item .fico { font-size: 18px; line-height: 1; }
.fm-item .name {
  background: none; border: none; color: var(--ink); text-align: left; cursor: pointer;
  font-size: var(--fs-300); padding: 4px 2px; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.fm-item .name:hover { color: var(--brand); text-decoration: underline; }
.fm-ragseam { width: 0; }  /* SLICE-3 RAG tick seam — reserved, empty (folders / shared / guest) */
/* Per-file RAG membership tick (Workspace slice 3/3). Ported from the mockup .ragtick/.ragkey
   RULES only — the mockup's inline style= attributes are NOT copied (CSP: _UI_CSP forbids inline
   style). The non-interactive legend ticks use the .inert class below (not pointer-events inline). */
.ragtick {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: calc(var(--tap) - 10px); padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--radius-pill);
  background: var(--surface); color: var(--ink-faint);
  font-size: 11px; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.ragtick .box {
  width: 16px; height: 16px; border: 1.5px solid var(--line-strong); border-radius: 4px;
  display: inline-grid; place-items: center; color: transparent;
}
.ragtick[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent); border-color: var(--accent);
}
.ragtick[aria-pressed="true"] .box {
  background: var(--accent); border-color: var(--accent); color: var(--brand-ink);
}
.ragtick[disabled] { opacity: 0.5; cursor: not-allowed; }
.ragtick.inert { pointer-events: none; }
.ragkey {
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  font-size: var(--fs-200); color: var(--ink-soft);
  border-left: 3px solid var(--accent); background: var(--success-fill);
  border-radius: 6px; padding: 6px 10px; margin-bottom: var(--sp-3);
}
.ragkey .k { display: inline-flex; align-items: center; gap: 6px; }
/* OCR availability indicator (slice ocr-engine). Read-only status line + language chips. The chip
   class is SCOPED under .ocr-indicator (D-S69 .chips .pill collision lesson — never a bare class).
   Theme tokens only; no new palette; no inline style (CSP). */
.ocr-indicator {
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  font-size: var(--fs-200); color: var(--ink-soft);
  border-radius: 6px; padding: 6px 10px; margin-bottom: var(--sp-3);
}
.ocr-indicator.ocr-off { color: var(--warning); }
.ocr-indicator .ocr-label { font-weight: 600; }
.ocr-indicator .ocr-chip {
  font-size: 11px; font-weight: 700; letter-spacing: 0.02em; padding: 2px 8px;
  border-radius: var(--radius-pill); border: 1px solid var(--line);
  background: var(--info-fill); color: var(--brand);
}
/* OCR language-pack management rows (slice ocr-lang-packs, OCR-2). Operator pane under Global
   Settings. Theme tokens only; no inline style (CSP). Scoped classes (never a bare .name/.state). */
.ocr-pack-list { list-style: none; margin: var(--sp-3) 0 0; padding: 0; display: flex;
  flex-direction: column; gap: var(--sp-2); }
.ocr-pack-row { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  min-height: var(--tap); padding: var(--sp-2) var(--sp-3); font-size: var(--fs-200);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  border-left: 3px solid var(--line); }
/* Overlay vertical-list banding: zebra + neutral rail (top-level treatment). No selected rule —
   these are read-only status rows with no selected marker in the DOM. */
.ocr-pack-row:nth-of-type(odd)  { background: var(--surface-2); }
.ocr-pack-row:nth-of-type(even) { background: var(--surface-3); }
.ocr-pack-row .name { font-weight: 600; min-width: 120px; }
.ocr-pack-row .state { font-size: 11px; font-weight: 700; letter-spacing: 0.02em; padding: 2px 8px;
  border-radius: var(--radius-pill); border: 1px solid var(--line); }
.ocr-pack-row .state.installed { background: var(--info-fill); color: var(--brand); }
.ocr-pack-row .state.missing { color: var(--ink-faint); }
.ocr-pack-row .configured-note { font-size: var(--fs-200); color: var(--ink-faint);
  font-style: italic; }
.fm-item .sz { font-size: var(--fs-200); color: var(--ink-faint); white-space: nowrap; }

/* Browser capability status rows (slice NG-B4). Read-only operator diagnostics under Global
   Settings. Each row is a `.chips` flex row (reusing .chips + .chips .pill scan-clean/scan-rejected
   badge tokens). Scoped .name/.value (never a bare class). Theme tokens only; no inline style. */
#browser-status-body { display: flex; flex-direction: column; gap: var(--sp-2);
  margin-bottom: var(--sp-3); }
#browser-status-body .name { font-weight: 600; min-width: 140px; font-size: var(--fs-200);
  color: var(--ink-soft); }
#browser-status-body .value { font-size: var(--fs-200); color: var(--ink-soft); }

/* FIX 2: the chat-transcript browser-run link. A browse result is surfaced in the transcript as a
   plain text link into the Browser activity viewer (not an inline thumbnail). .linklike is a button
   reset styled as a link so the CSP-safe <button> reads as text. Theme tokens only, no color
   literals. */
.browser-link { margin-top: var(--sp-2); font-size: var(--fs-200); }
.linklike {
  background: transparent; border: 0; padding: 0; font: inherit;
  color: var(--brand); text-decoration: underline; cursor: pointer;
}
.fm-item .kebab {
  background: none; border: 1px solid transparent; color: var(--ink-soft); cursor: pointer;
  width: 32px; height: 32px; border-radius: 8px; font-size: 18px; line-height: 1;
}
.fm-item .kebab:hover { background: var(--surface-3); border-color: var(--line); }

.selbar {
  display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap;
  padding: var(--sp-2) var(--sp-3); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--info-fill);
}
.selbar .count { font-size: var(--fs-200); font-weight: 700; color: var(--brand); }

.dropzone {
  border: 2px dashed var(--line-strong); border-radius: var(--radius-sm);
  padding: var(--sp-3); text-align: center; color: var(--ink-soft);
  font-size: var(--fs-300); cursor: pointer; background: var(--surface);
}
.dropzone.over { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, var(--surface)); color: var(--brand); }

.renamepop { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 220px; padding: var(--sp-3); }
.rename-input {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: var(--radius-sm); padding: 8px 10px; font: inherit; width: 100%;
}
.rename-actions { display: flex; gap: var(--sp-2); justify-content: flex-end; }

/* Agents overlay (FEAT-003 item D) — schedule line + inline cadence form. Tokens only, no inline
   style (CSP). The rows themselves reuse .rows / .skill-item / .skill-actions. */
.agent-sched { color: var(--ink-soft); }
.cadence-form {
  display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-2);
  padding: var(--sp-3); border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.cadence-params { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: flex-end; }
.cadence-weekdays { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.cadence-weekdays .cadence-wlabel { font-size: var(--fs-200); color: var(--ink-soft); }
.cadence-wday { display: inline-flex; align-items: center; gap: 2px; font-size: var(--fs-200); }

/* Move/Copy folder-picker modal */
.picker-scrim {
  position: fixed; inset: 0; z-index: 25; background: var(--scrim);
  display: flex; align-items: center; justify-content: center; padding: var(--sp-4);
}
.picker-scrim[hidden] { display: none; }
.picker {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--sh-3); width: min(480px, 94vw); max-height: 86vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.pk-head {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--line);
}
.pk-head h3 { margin: 0; font-size: var(--fs-500); flex: 1; }
.pk-crumbs {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  padding: var(--sp-2) var(--sp-4); border-bottom: 1px solid var(--line);
}
.pk-tree {
  padding: var(--sp-3) var(--sp-4); overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; gap: 4px; flex: 1; min-height: 80px;
}
.pk-folder {
  text-align: left; border: 1px solid var(--line);
  border-radius: var(--radius-sm); color: var(--ink); padding: 10px var(--sp-3);
  cursor: pointer; font-size: var(--fs-300); min-height: var(--tap);
  border-left: 3px solid var(--line);
}
/* Overlay vertical-list banding: zebra + neutral rail (top-level treatment). No selected rule —
   the picker tracks no row-level selected marker in the DOM. */
.pk-folder:nth-of-type(odd)  { background: var(--surface-2); }
.pk-folder:nth-of-type(even) { background: var(--surface-3); }
/* Keep the existing hover border-color cue and ADD a quiet neutral bg; a disabled folder gets
   neither (the :not([disabled]) guard). */
.pk-folder:hover:not([disabled]) { border-color: var(--line-strong); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.pk-folder[disabled] { opacity: 0.45; cursor: not-allowed; }
.pk-empty { padding: 0 var(--sp-4) var(--sp-3); color: var(--ink-faint); font-size: var(--fs-200); }
.pk-foot {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--line);
}
.pk-foot .spacer { flex: 1; }

@media (forced-colors: active) {
  .fm-item, .crumb, .pk-folder, .dropzone, .picker { border: 1px solid; }
}
@media (max-width: 640px) {
  .fm-item { grid-template-columns: auto auto 1fr auto; gap: var(--sp-2); }
  .fm-item .fico { display: none; }
}

/* ---------- Voice (Tier A: TTS toggle + STT listening cue + Voice settings) ---------- */
/* The chat-bar TTS mute/stop toggle. Reuses .ghost; 'muted' state dims to match the yolo/sw-btn
   pressed-state idiom. app.js keeps it hidden unless speechSynthesis exists. */
#tts-toggle { font-size: 16px; line-height: 1; }
#tts-toggle[aria-pressed="false"] { color: var(--ink-faint); }
#tts-toggle[aria-pressed="true"] { color: var(--accent); }

/* Mic listening cue: a subtle pulse while recording, ONLY when the user has not requested reduced
   motion (the global prefers-reduced-motion:reduce rule also freezes it; this gate keeps the cue
   static there). The color change (not motion) is the always-on listening signal. */
.pill .cbtn.recording { color: var(--danger); }
@media (prefers-reduced-motion: no-preference) {
  .pill .cbtn.recording { animation: mic-pulse 1.1s var(--ease) infinite; }
  @keyframes mic-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
  }
}

/* The aria-live listening status line sits just above the composer; reuses the scope-note look. */
.mic-status {
  margin: 0 auto var(--sp-2); max-width: 64ch; padding: 4px 10px;
  font-size: var(--fs-200); color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--surface-2);
  text-align: center;
}

/* Voice settings sub-section: range inputs span the field width like the other settings fields. */
#voice-section input[type="range"] { width: 100%; }

/* Live numeric readout beside the rate/pitch slider labels (matches the .hint muted look). */
.rangeval { font-size: var(--fs-200); color: var(--ink-faint); font-weight: 400; margin-left: 6px; }
