Skip to content

AI, fully local on your computer.

126 KB
Raw Blame
/*
 * App styles, expressed entirely in the role tokens from tokens.css.
 * No raw hex here; the only brand primitives used directly are the teal primary-button
 * fill + its dark-ink text and the switch-on track (see tokens.css). Theme switching is
 * purely `[data-theme]` flipping the role tokens.
 */

* { box-sizing: border-box; }

html, body, #root { height: 100%; margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
}

/* ---- Global accessibility baseline (guidelines §9) ---- */

/* Visible focus on everything: 2px ring with offset. An `outline` (not box-shadow)
   so Windows High Contrast Mode keeps it. */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Minimum hit targets (WCAG 2.5.8): every button ≥24×24 CSS px. Checkbox toggles
   stay 16px visually — their clickable <label> supplies the ≥24px target. */
button { min-width: 24px; min-height: 24px; }

/* Windows High Contrast Mode (forced colors): focus already survives because it is an
   `outline`. The two custom-drawn controls whose meaning lives in background colors get
   system-color borders so they stay visible; the words next to them carry the meaning
   (WCAG 1.4.1 — never color alone). */
@media (forced-colors: active) {
  .switch-track { border: 1px solid ButtonText; }
  .switch-thumb { border: 1px solid ButtonText; background: ButtonText; }
  .strength-seg { border: 1px solid CanvasText; }
  .strength-seg.on { background: Highlight; }
}

/* Non-essential motion off under prefers-reduced-motion (guidelines §4.5/§9). */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.app-shell {
  display: grid;
  /* A quiet, compact navigation RAIL (guidelines §2/§12.1): icon + short label, so the
     conversation canvas is the centre of gravity, not the chrome. The column is 106px —
     widened from 80px (Task A) and again by 6px (E-1, #149) so the longest SINGLE-word
     label in either locale ("Einstellungen", DE) fits on ONE line at the 12px text floor
     (§4.4) AT THE ACTIVE ROW'S 600 WEIGHT — the 100px rail was measured for the regular
     weight and the bold selected label clipped ~5px. Labels never break mid-word
     (`.nav-label hyphens:none`). Still far slimmer than the original ~220px panel. */
  grid-template-columns: 106px 1fr;
  height: 100vh;
}

.sidebar {
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 12px 8px;
  gap: 4px;
  /* #803, open-issues wave owner call G-9: at the 880px minimum width the rail foot (lock, indicator)
     fell under the window below ~670px of window height (~610px on a plaintext workspace; 26px
     more where the menu bar shows: 696/636); the rail scrolls instead, by wheel and Tab, with no
     bar taking label width. Owner round W5-6: never sideways (`overflow-y: auto` alone made x
     `auto` too), so a too-wide label clips at the edge. */
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  scrollbar-width: none;
}

/* Just the brand mark on the rail — the wordmark sits behind the tooltip/aria-label so
   the rail stays quiet and narrow. A BUTTON, not decoration (issue #47): a logo atop a
   column of clickable items reads as "go Home", so it navigates home like its rail
   siblings — hover fill + the global :focus-visible ring; the labelled Home item below
   keeps the active highlight (one lit selection on the rail, not two). */
.brand {
  display: flex;
  justify-content: center;
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  /* 6px+4px+margin ≈ the old 6px/14px asymmetric padding, so the rail rhythm holds
     while the hover fill stays snug around the mark. */
  padding: 6px 4px;
  margin-bottom: 4px;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}
.brand:hover { background: var(--surface-hover); }
/* The mark is the Home control (rail rework 2026-09-05): lit like a selected rail item on Home. */
.brand.active { background: var(--surface-hover); }
/* Brand mark / lockup (components/BrandMark.tsx): both images render; the CSS pair toggle
   shows the theme-correct one via [data-theme] — no JS theme read, so it works pre-unlock in
   the gate. The dot is always teal; the square ink flips with the background. */
.brand-img, .brand-lockup { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
.brand-img-light { display: block; }
.brand-img-dark { display: none; }
[data-theme='dark'] .brand-img-light { display: none; }
[data-theme='dark'] .brand-img-dark { display: block; }
.nav-list { list-style: none; padding: 0; margin: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
/* Bottom utility group (guidelines §2): Settings sits apart from the
   everyday destinations, above the lock button. */
.nav-list.nav-bottom { flex: 0 0 auto; border-top: 1px solid var(--border); padding-top: 6px; margin-top: 6px; }
/* Middle group (rail rework 2026-09-05): AI Model + Performance, "the machine", set apart from
   the everyday work group above by the same hairline the utility group uses. Does not flex:
   the work group above takes the slack so the two lower groups stay pinned together. */
.nav-list.nav-group { flex: 0 0 auto; border-top: 1px solid var(--border); padding-top: 6px; margin-top: 6px; }
/* #803, open-issues wave owner round W5-1: the rail scrolls before anything shrinks, else the
   global `button { min-height: 24px }` let the brand, lock and indicator squeeze to 24px. After
   `.nav-list { flex: 1 }` on purpose: same specificity, so the later rule holds the work group too. */
.sidebar > * { flex-shrink: 0; }
.nav-item, .lock-btn {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 8px 4px;
  border-radius: var(--radius-md);
  /* §4.4 12px text floor — the rail label sits exactly on it (was 11px). */
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
  text-align: center;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.nav-item:hover, .lock-btn:hover { background: var(--surface-hover); color: var(--text); }
/* Selected = soft neutral fill + full-strength text (guidelines §7: accent blue is
   reserved for the focus ring, not selection). */
.nav-item.active { background: var(--surface-hover); color: var(--text); font-weight: 600; }
/* Line icons in one calm accent (replacing the colorful OS emoji): the glyph stays
   accent-blue in every state; selection is carried by the label weight + row fill, not
   by tinting the icon. 19px reads cleanly at the rail's stroke weight. */
.nav-icon { width: 19px; height: 19px; color: var(--accent); flex-shrink: 0; }
/* Rail labels must NEVER break mid-word ("Docu-ments" / "Doku-mente" / "Einstel-lungen"
   read as broken). `hyphens: none` + `overflow-wrap: normal` + `word-break: normal` forbid
   every soft/auto hyphen and mid-word split, so the rail grid column (`.app-shell`) is sized
   to fit the longest SINGLE-word label in both locales on one line at the 12px floor
   ("Einstellungen", DE). Labels that contain a space or an existing hyphen ("AI Model",
   "KI-Modell") may still wrap cleanly to two lines at the space/hyphen. The button's title=
   carries the full name as a tooltip regardless. */
.nav-label {
  display: block;
  max-width: 100%;
  hyphens: none;
  overflow-wrap: normal;
  word-break: normal;
}
/* Lock sits at the very bottom, slightly muted — a utility, not a destination. */
.lock-btn { margin-top: 2px; }

/* Ambient "Local · Offline" signal (guidelines §7): quiet glyph + words in a
   neutral color — reassurance, not an alert. Hover/focus shows the tooltip; click opens
   Settings → Privacy & data. */
.local-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: var(--text-xs);
  line-height: var(--line-xs);
  border-radius: var(--radius-full);
  padding: 4px 10px;
  cursor: pointer;
  white-space: nowrap;
}
.local-indicator:hover { color: var(--text); border-color: var(--border); }
/* Inline lock glyph — inherits the indicator's muted text color (not accent: this is an
   ambient signal, not an action). */
.local-indicator-icon { width: 14px; height: 14px; flex-shrink: 0; }
/* Rail-foot variant (§12.1 #2): the single app-wide privacy signal, at the foot of the
   nav rail and styled to MATCH it — icon-over-short-label, centered, 12px floor, the
   same column metrics as `.nav-item`. Quiet/ambient (muted, not the accent the nav icons
   use): it is a state, not a destination. The short label can wrap cleanly at its space
   ("Downloads on" → two lines) like "AI Model" does; the full reassurance is the tooltip. */
.local-indicator-sidebar {
  flex-direction: column;
  gap: 3px;
  width: 100%;
  margin-top: 2px;
  padding: 8px 4px;
  border-color: transparent;
  border-radius: var(--radius-md);
  text-align: center;
  white-space: normal;
}
.local-indicator-sidebar:hover { background: var(--surface-hover); color: var(--text); border-color: transparent; }
.local-indicator-sidebar .local-indicator-icon { width: 19px; height: 19px; }
.local-indicator-sidebar .local-indicator-label {
  display: block;
  max-width: 100%;
  hyphens: none;
  overflow-wrap: normal;
  word-break: normal;
}

/* Tooltip (Radix Tooltip content — the indicator's reassurance line, and nav-rail
   destination labels on narrow widths via title attributes). */
.tooltip {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-2);
  padding: 8px 12px;
  font-size: var(--text-sm);
  line-height: var(--line-sm);
  max-width: 280px;
  z-index: 70;
}

/* Workspace unlock / onboarding gate */
.gate-shell {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}
.gate-card { width: 100%; max-width: 420px; margin-top: 0; }
/* Calmer hierarchy (guidelines §7): the title is a step down from the old hero size and
   sits centered under the vertical brand; the body hint inherits the muted tone. */
.gate-card h1 {
  margin-bottom: 8px;
  font-size: var(--text-xl);
  line-height: var(--line-xl);
  font-weight: 600;
  text-align: center;
}
.gate-card > .hint { text-align: center; }

/* Vertical brand lockup for the gate: diamond centered above the edition word so they
   read as one mark (the rail's horizontal `.brand` is a separate, quieter treatment). */
.gate-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 22px;
}
.gate-brand-edition {
  font-size: var(--text-xs);
  line-height: var(--line-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.gate-fields { display: flex; flex-direction: column; gap: 10px; margin: 20px 0; }
.gate-input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.gate-input:focus { border-color: var(--focus); }
.gate-card .btn.primary { width: 100%; margin-top: 8px; }

/* First-run flow (guidelines §2): hero title, Back|Create action row
   (primary on the RIGHT, §6), show-password toggle, strength meter. */
/* The first-run welcome keeps a true hero size — specific enough to win over the
   calmer `.gate-card h1` baseline above. */
.gate-card h1.gate-hero { font-size: var(--text-2xl); line-height: var(--line-2xl); font-weight: 700; }
.gate-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; }
.gate-actions .btn.primary { width: auto; margin-top: 0; }
.gate-actions-main { display: flex; gap: 10px; align-items: center; }
/* #1024: the start-failure card's one secondary action, centred under the text, with its status line below it. */
.gate-start-failed-actions { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 12px; }
/* The reveal toggle lives INSIDE the field (the expected pattern): the input reserves
   room on the right and the button is a real ~40px hit target pinned to that edge. */
.gate-pw-field { position: relative; display: flex; }
.gate-input-with-toggle { padding-right: 48px; }
.gate-pw-toggle {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
/* No hover fill — the ghost button's grey box would collide with the field border;
   the eye just shifts to the accent blue instead. */
.btn.ghost.gate-pw-toggle:hover:not(:disabled) { background: transparent; border-color: transparent; color: var(--accent); }
.gate-pw-toggle svg { display: block; }

/* Password-strength meter: 4 segments + a word — never color alone (WCAG 1.4.1).
   Advisory only; it never disables the Create button. */
.strength { display: flex; align-items: center; gap: 10px; min-height: 16px; }
.strength-bar { display: inline-flex; gap: 4px; }
.strength-seg {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
}
.strength-seg.on { background: var(--warning); }
.strength-seg.on.s1 { background: var(--error); }
.strength-seg.on.s3, .strength-seg.on.s4 { background: var(--success); }
.strength-label { font-size: var(--text-xs); line-height: var(--line-xs); color: var(--text-muted); }

/* Privacy & Offline screen */
.offline-statement { font-size: 15px; margin-bottom: 10px; max-width: 72ch; }
.offline-statement.on strong { color: var(--success); }
.offline-statement.off strong { color: var(--accent); }
.hint.warn { color: var(--warning); }

/* scrollbar-gutter (#171): reserve the scrollbar's width on BOTH edges, always — without it
   the centred screen column sits ~8px further left on scrolling pages (Models, Settings)
   than on non-scrolling ones, and its right edge shifts by the full ~15px scrollbar width
   between adjacent nav clicks. `both-edges` keeps §14's symmetric gutters exact whether or
   not a scrollbar is present. */
.content { overflow-y: auto; padding: 32px 40px; scrollbar-gutter: stable both-edges; }
/* Screen width (guidelines §14 as amended, #166/#171 owner decision): ONE width for every
   screen — 1180px, centred (margin auto — symmetric gutters, like the 720px chat transcript,
   which stays full-bleed as the sole exception). Every page shares the same frame; the
   READING measure is protected one level down instead — the prose roles (.lead, .hint,
   .offline-statement below) cap at 72ch so wide frames never mean 150-char text lines.
   Don't add per-screen max-widths; that is the drift §14 closed. */
.screen { max-width: 1180px; margin: 0 auto; }
h1 { font-size: 22px; margin: 0 0 8px; }
h2 { font-size: 15px; margin: 0 0 12px; }
/* The 72ch caps carry the reading measure inside the single 1180px frame (§14 amendment,
   #171 follow-up): explanatory prose stays at a readable line length while lists, cards and
   controls use the full width. */
.lead { color: var(--text-muted); margin-top: 0; max-width: 72ch; }
.hint { color: var(--text-muted); font-size: 13px; max-width: 72ch; }

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 22px 0;
}
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px; box-shadow: var(--shadow-1); }
.stat-label { font-size: 12px; color: var(--text-muted); }
.stat-value { font-size: 16px; margin-top: 4px; }
.stat-value.good { color: var(--success); }

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
/* CH-10 (#148): the token-spaced variant — replaces the chat area's one magic-number inline
   style (marginTop: 12 on the no-model actions row). */
.actions-spaced { margin-top: var(--space-3); }
/* SH-14 (#149): spacing/display utilities replacing the scattered inline style={{ margin… }}
   escapes in ModelsScreen/DiagnosticsTab (spacing comes from the token scale, not literals). */
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: var(--space-2); }
.hint-tight { margin: var(--space-1) 0 0; }
.hint-lede { margin: var(--space-1) 0 var(--space-2); }
.hint-block { display: block; }
/* #805, open-issues wave owner round W5-4: a phrase that must not break inside, such as the
   "(12 cores)" after a processor name (i18nNodes `keepTogether`); the line may break before it. */
.nowrap { white-space: nowrap; }
/* Buttons (guidelines §6): three levels — .btn = Secondary (default), .btn.primary,
   .btn.ghost. Screens use the Button component (components/Button.tsx). */
.btn {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 7px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  min-height: 36px;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
/* Brand-refresh primary: teal fill + DARK-INK text in BOTH themes (≈9.5:1). White text on
   teal is forbidden (1.9:1); this is the one rule that uses brand primitives directly
   rather than the per-theme --accent (which differs light vs dark). One primary per view. */
.btn.primary {
  background: var(--brand-teal);
  border-color: var(--brand-teal);
  color: var(--brand-ink-dark);
}
.btn.primary:hover:not(:disabled) { background: var(--brand-teal-hover); border-color: var(--brand-teal-hover); }
.btn.primary:active:not(:disabled) { background: var(--brand-teal-active); border-color: var(--brand-teal-active); }
/* Ghost: text only; hover/focus reveal a quiet surface. */
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--surface-hover); border-color: transparent; }
/* Destructive secondary (selection-toolbar Delete): error-toned text + outline, paired with
   the word "Delete" (never color alone, 1.4.1); the actual delete is behind a ConfirmDialog. */
.btn.danger { color: var(--error); border-color: var(--error); }
.btn.danger:hover:not(:disabled) { border-color: var(--error); background: var(--surface-hover); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 18px; margin-top: 16px; box-shadow: var(--shadow-1); }
.card.muted { color: var(--text-muted); }
.card code { background: var(--code-bg); padding: 2px 6px; border-radius: 4px; }
code, pre, kbd { font-family: var(--font-mono); }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 14px; margin: 0; font-size: 13px; }
.kv dt { color: var(--text-muted); }
/* overflow-wrap (not break-all): prose values wrap at word boundaries — break-all cut
   German sentences mid-word (i18n audit) — while over-long paths can still break. */
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* Settings → Privacy → Local API card (local-api wave P4). The two connect rows pair a
   monospace value with its copy button; the value wraps rather than pushing the button
   off a narrow card, and the German strings (~30% longer) get the same room. */
.local-api-connect { margin-top: var(--space-3); }
.local-api-connect h3 { font-size: 14px; margin: 0 0 4px; }
.local-api-value { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.local-api-value code { overflow-wrap: anywhere; }
.local-api-port { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: var(--space-3); }
.local-api-port label { margin: 0; }
/* Scoped so it beats `.text-input { width: 100% }` (declared later in this file) — a port
   is four digits and must not stretch across the card like a prose field. */
.local-api-port .local-api-port-input { width: 10ch; }

.toggle { display: flex; align-items: center; gap: 10px; font-size: 13px; cursor: pointer; min-height: 24px; }
.toggle input { width: 16px; height: 16px; accent-color: var(--accent); }

/* Home readiness hub (guidelines §2): icon + label/value rows ≥40px. */
.readiness-card { display: flex; flex-direction: column; gap: 4px; }
.readiness-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 6px 4px;
}
.readiness-row + .readiness-row { border-top: 1px solid var(--border); }
.readiness-icon { width: 22px; height: 22px; color: var(--accent); flex-shrink: 0; }
.readiness-text { flex: 1; min-width: 0; }
.readiness-label { font-size: var(--text-xs); line-height: var(--line-xs); color: var(--text-muted); }
.readiness-value { font-size: var(--text-base); line-height: var(--line-base); }
.readiness-action { flex-shrink: 0; }

/* Settings tabs: the segmented switcher between the three sections. */
.settings-tabs { margin: 12px 0 4px; }

/* AI Model screen (width: the shared `.screen` frame, §14) */
.model-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; padding: 12px 16px; }
.model-card > .tech-details { grid-column: 1 / -1; }
.model-row-actions { display: flex; align-items: center; gap: 8px; }
.model-row-actions:empty { display: none; }
.model-row-actions .download-progress { max-width: 320px; }
.model-library { margin-top: 24px; }
.model-library-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-top: 16px; }
.model-library-filters label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; min-width: 0; }
.model-library-filters .input, .model-library-filters .select { width: 100%; }
.model-library-filters .input { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 6px 10px; min-height: 32px; }
.model-library-filters .input::placeholder { color: var(--text-muted); }
.model-library-filters .select { min-height: 32px; }
.model-library-search { flex: 1 1 240px; }
.model-task-heading { margin: 20px 0 8px; font-size: 14px; }
.model-variant-group { border: 1px solid var(--border); border-radius: var(--radius-md); margin: 10px 0; overflow: hidden; }
.model-variant-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 16px; background: var(--surface-hover); }
.model-variant-heading h4 { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.model-variant-group > .model-card { margin: 0; border: 0; border-radius: 0; box-shadow: none; }
.model-variant-group > .model-card + .model-card { border-top: 1px solid var(--border); }
.model-library-empty { padding: 16px 0; }
.model-library-download { padding: 12px 16px; margin-top: 16px; border: 1px solid var(--border); border-radius: var(--radius-md); }
.model-library-download > strong { display: block; margin-bottom: 8px; }
/* F2: the retained terminal result's recovery row (Retry / Dismiss). */
.model-library-download-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
@media (max-width: 900px) {
  .model-card { grid-template-columns: minmax(0, 1fr); }
  .model-row-actions .download-progress { max-width: none; }
  .model-head { flex-wrap: wrap; }
}
/* Not-yet-downloaded cards render quieter (transparent fill + dashed border; text colors
   untouched so contrast stays intact). The old #35 boundary label (.model-group-title) was
   removed with the full-card picker (PR #302 F7) — the model library uses a view filter
   ("On this drive" / "Browse models", §15) instead of a subheading. */
.model-card-missing { background: transparent; border-style: dashed; box-shadow: none; }
.model-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.model-title { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.model-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.model-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 4px 14px; font-size: 12px; color: var(--text-muted); }
.model-meta b { color: var(--text); font-weight: 500; }
.model-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
/* In-app model download progress. */
.download-progress { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.download-progress .hint { margin: 0; flex-basis: 100%; }
/* In-app OCR files install (#410): the inline action / progress / outcome under a failed scan or
   photo row's banner and in the AI Model screen's quiet row. Tokens only. */
.ocr-install { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.ocr-install .hint { margin: 0; flex-basis: 100%; }
/* "Install the AI engine" banner body: stacked label + action/progress. */
.engine-install { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.engine-install progress { width: 100%; accent-color: var(--accent); }
/* #530: the voice engine cannot run — a quiet line under the speech-model card + Check again. */
.engine-problem-hint { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
/* #532: "Install … again" (or its progress + Cancel) and Check again on one row; the job's error
   and the download-gate reason wrap below both buttons instead of splitting them. */
.engine-problem-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; align-self: stretch; }
.engine-problem-actions > .hint { order: 1; margin: 0; }
/* The break: `.hint`'s max-width would cap a 100 % basis and keep the line beside the buttons. */
.engine-problem-actions:has(> .hint) { row-gap: 4px; }
.engine-problem-actions:has(> .hint)::after { content: ''; flex-basis: 100%; height: 0; }
.btn.sm { padding: 5px 11px; font-size: 12px; min-height: 24px; }
/* "Technical details" disclosure (guidelines §2/§3): checksums, paths, and
   runtime internals stay one click away, closed by default. */
.tech-details { margin-top: 2px; }
.tech-details summary {
  cursor: pointer;
  user-select: none;
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: var(--line-sm);
  padding: 4px 0;
  width: fit-content;
}
.tech-details summary:hover { color: var(--text); }
.tech-details-body {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:disabled:hover { border-color: var(--border-strong); }

.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.section-title { font-size: 13px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin: 24px 0 4px; }

/* ---- Chat screen (guidelines §3): collapsible conversation column,
   centered 720px transcript, composer with quiet footer affordances. ---- */
.chat-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 16px;
  height: calc(100vh - 64px);
}
.chat-layout.list-collapsed { grid-template-columns: 1fr; }
.chat-sidebar { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
/* History header: a quiet title + the collapse handle (guidelines §3 — a clear toggle
   affordance near the history header). */
.chat-sidebar-head { display: flex; gap: 6px; align-items: center; justify-content: space-between; padding: 2px 2px 0; }
.chat-sidebar-title {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.chat-sidebar-collapse {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 3px 7px;
}
.chat-sidebar-collapse:hover { background: var(--surface-hover); color: var(--text); }
.chat-new { width: 100%; }
.chat-conv-list { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; min-height: 0; padding-right: 2px; }
/* Conversation search: input atop the column; results replace the groups. */
.chat-search-input {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: var(--text-sm);
  width: 100%;
}
.chat-search-input:focus-visible { border-color: var(--focus); outline: 2px solid var(--focus); outline-offset: 1px; }
.chat-search-input::placeholder { color: var(--text-muted); }
/* Contextual "Results for 'x'" header above the search hits. */
.chat-search-head { padding: 2px 4px 4px; }
.chat-search-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  word-break: break-word;
}
.chat-search-empty {
  margin: 8px 4px;
  font-size: var(--text-sm);
  line-height: var(--line-sm);
  color: var(--text-muted);
}
/* A search result reads as a small card: title line + the matching snippet, which is
   given more room than a normal row so the match is obvious. */
.chat-search-result {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 8px 10px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  cursor: pointer;
  min-width: 0;
}
.chat-search-result:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }
.chat-search-result:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-search-result-title {
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-search-snippet {
  font-size: var(--text-xs);
  line-height: var(--line-xs);
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.chat-search-snippet mark {
  background: transparent;
  color: var(--text);
  font-weight: 600;
}
.chat-conv-group { display: flex; flex-direction: column; gap: 2px; }
.chat-conv-group-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 12px 4px 4px;
}
.chat-conv-group:first-child .chat-conv-group-label { margin-top: 2px; }
.chat-conv-row { display: flex; gap: 2px; align-items: stretch; min-width: 0; border-radius: var(--radius-md); }
.chat-conv-row .chat-conv { flex: 1; min-width: 0; }
/* Hover/selected fill spans the whole row (button + menu) so the menu button does not
   sit on a different background. */
.chat-conv-row:hover { background: var(--surface-hover); }
.chat-conv-row.active { background: var(--surface-hover); }
/* Row actions reveal on hover/focus (guidelines §6) — the button stays focusable. */
.chat-conv-menu-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  padding: 0 6px;
  flex-shrink: 0;
  align-self: center;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease);
}
.chat-conv-row:hover .chat-conv-menu-btn,
.chat-conv-menu-btn:focus-visible,
.chat-conv-menu-btn[data-state='open'] { opacity: 1; }
.chat-conv-menu-btn:hover:not(:disabled) { color: var(--text); background: var(--surface); }
.chat-conv-menu-btn:disabled { cursor: default; }
/* History row: a soft, structured row. Selected = a soft fill (no border outline that
   could read as keyboard focus); the accent ring is reserved for :focus-visible only
   (guidelines §7). Min height ≥40px. */
.chat-conv {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-height: 40px;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  cursor: pointer;
  min-width: 0;
}
.chat-conv:hover { color: var(--text); }
.chat-conv.active { color: var(--text); }
.chat-conv.active .chat-conv-title { font-weight: 600; }
.chat-conv:disabled { cursor: default; }
.chat-conv-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
/* Quiet document-Q&A affordance: a small glyph + "Documents" metadata line, replacing
   the loud filled DOC badge (guidelines §7: less visual weight). */
.chat-conv-meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  line-height: var(--line-xs);
  color: var(--text-muted);
}

/* Chat header: segmented mode control + overflow menu (+ the ambient-indicator slot).
   Wraps instead of clipping — the German mode label + indicator outgrow 880px (i18n
   text-expansion audit: fix with layout, never copy). */
.chat-header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chat-header-spacer { flex: 1; }
/* #36: the muted "model · GPU/CPU" one-liner in the header — caption-styled, no
   icon-noise, ellipsized so a long model id never crowds the mode switcher. */
.chat-runtime-hint {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40ch;
  cursor: default;
}
.chat-overflow-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 10px;
  min-height: 28px;
}
.chat-overflow-btn:hover, .chat-overflow-btn[data-state='open'] { color: var(--text); border-color: var(--border-strong); }

/* Dropdown menus (Radix DropdownMenu content, guidelines §4.5: --shadow-2). */
.menu {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-2);
  padding: 4px;
  min-width: 200px;
  z-index: 60;
}
.menu-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  line-height: var(--line-sm);
  color: var(--text);
  cursor: pointer;
  user-select: none;
  outline: none;
}
.menu-item[data-highlighted] { background: var(--surface-hover); }
.menu-item[data-disabled] { opacity: 0.5; cursor: default; }
.menu-item.danger { color: var(--error); }
.menu-item-hint { display: block; font-size: var(--text-xs); line-height: var(--line-xs); color: var(--text-muted); }
.menu-radio-mark { width: 12px; flex-shrink: 0; color: var(--accent); font-size: 9px; line-height: var(--line-sm); }

/* Popovers (Radix Popover content — the documents-scope picker). */
.popover {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-2);
  padding: 12px;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 60;
}
.popover-line { margin: 0; font-size: var(--text-sm); line-height: var(--line-sm); color: var(--text-muted); }
.popover-chips { display: flex; flex-wrap: wrap; gap: 6px; }
/* "Files in this chat" (plan §13.1): read-only attachment chips, visually distinct from the
   removable specific-doc selection chips above. A still-processing one is dimmed. */
.scope-attachments { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.scope-attachment { cursor: default; }
.scope-attachment.pending { opacity: 0.7; font-style: italic; }
/* #571: an attachment that failed still scopes the chat; its chip reads "(not readable yet)". */
.scope-attachment.failed { border-style: dashed; color: var(--text-muted); }
.popover-reset { align-self: flex-start; }

/* #803, open-issues wave owner call G-9: no min-content floor, so the `1fr` track fits the window;
   with the conversation list open, document mode ran Send, attach and the meter past the right edge. */
.chat-main { display: flex; flex-direction: column; min-height: 0; gap: 12px; position: relative; min-width: 0; }
/* Drag-drop intake target (plan §11.2): a calm dashed overlay while a file is dragged over
   the chat surface — never alarming, just "drop here". */
.chat-drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  border: 2px dashed var(--focus);
  border-radius: var(--radius-md);
  color: var(--text);
  font-weight: 600;
  pointer-events: none;
}
.chat-transcript {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding-right: 6px;
}
/* The conversation is the canvas: centered column, max-width 720px (§3). */
.chat-transcript-inner {
  max-width: 720px;
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chat-empty { margin: auto; width: 100%; }
.chat-empty .empty-state { border: none; background: transparent; }
/* Example-prompt chips hold full sentences — German ones outgrow the generic chip's
   240px ellipsis cap, so here they wrap to extra lines instead (i18n audit). */
.chat-empty .chip { max-width: 100%; height: auto; }
.chat-empty .chip-text { white-space: normal; overflow: visible; text-overflow: clip; }

.msg-block { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }
/* Calmer transcript (guidelines §7: fewer boxes, less accent). The assistant turn is
   borderless and shadowless — the role label + spacing carry the structure, so it reads
   as text on the page, not a nested card. */
.msg { background: transparent; border: 1px solid transparent; border-radius: var(--radius-md); padding: 4px 2px; box-shadow: none; }
/* The user turn gets a quiet tinted surface so it's distinguishable from the assistant
   without a strong blue outline that reads like a focused input (guidelines §4: neutral
   fills for message surfaces; accent reserved for focus/links/primary button). */
.msg.user {
  background: var(--surface-hover);
  border-color: var(--border);
  padding: 10px 14px;
}

/* Per-message action row (§3): revealed on hover or keyboard focus, never permanent. */
.msg-actions { display: flex; gap: 2px; align-items: center; opacity: 0; transition: opacity var(--dur-fast) var(--ease); }
.msg-block:hover .msg-actions,
.msg-actions:focus-within { opacity: 1; }
/* #613: "Send again" under a question with no answer stays visible — it exists only in that state, and
   it is the way on (design-guidelines §11.21 "#613 amendment"). */
.msg-actions.msg-actions-resend { opacity: 1; }
.msg-action {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  cursor: pointer;
  padding: 3px 8px;
  /* WCAG 2.5.8 (§9 audit, EP-1 P5): quiet text actions still need a ≥24px target. */
  min-height: 24px;
}
.msg-action:hover:not(:disabled) { color: var(--text); background: var(--surface-hover); }
.msg-action:disabled { opacity: 0.5; cursor: default; }

/* #286 — the per-code-block Copy/Save toolbar inside a persisted assistant answer. Same
   reveal grammar as .msg-actions (hover or keyboard focus, never permanent chrome), parked
   over the right end of Streamdown's code-block header row so it never covers code. The
   surface fill keeps the labels legible where a block has no header (bare ``` fences). */
.code-block { position: relative; }
.code-block-actions {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 1;
  display: flex;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease);
}
.code-block:hover .code-block-actions,
.code-block-actions:focus-within { opacity: 1; }
/* Streamdown renders each line of a code block as a <span class="block …"> with no newline
   between them, and leaves the line breaks to Tailwind's `block` utility, which this app does not
   load: without this rule every line of a block ran together into one. A blank line is a span
   holding "\n", which keeps a full line height inside the pre. */
[data-streamdown="code-block-body"] code > span { display: block; }

/* Composer footer affordances: quiet text-style menu/popover triggers. */
.footer-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  cursor: pointer;
  padding: 3px 8px;
  /* #340 nit: the trigger may shrink inside a narrow footer on its own, not only under
     .scope-footer-wrap — a long label inside it then ellipsises instead of overflowing. */
  min-width: 0;
  max-width: 100%;
}
/* Inline file glyph in the chat-scope footer button / conversation meta line — muted,
   sized to the surrounding text (not accent: these are quiet labels, not actions). */
.footer-menu-icon { width: 15px; height: 15px; flex-shrink: 0; }
.chat-conv-meta-icon { width: 13px; height: 13px; flex-shrink: 0; }
.footer-menu-btn:hover:not(:disabled), .footer-menu-btn[data-state='open'] { color: var(--text); background: var(--surface-hover); }
.footer-menu-btn:disabled { opacity: 0.5; cursor: default; }

/* Live Deep-mode reasoning, collapsed by default (never persisted) */
.msg-thinking {
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  padding: 6px 10px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.msg-thinking-toggle {
  cursor: pointer;
  user-select: none;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
}
.msg-thinking-text { white-space: pre-wrap; word-break: break-word; margin-top: 6px; line-height: 1.45; }
/* Quiet sender label — "You" / "HilbertRaum" (guidelines §4: no shouty uppercase
   role chips). Reads as a name, not a system tag. */
.msg-role {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}
/* Chat body reads at --text-md (guidelines §4.4: chat/document reading size). */
.msg-content { white-space: pre-wrap; word-break: break-word; font-size: var(--text-md); line-height: var(--line-md); }

/* Per-message skill glyph (skills plan §15/DS16): a quiet, labelled marker under the answer a
   skill shaped — icon + word (never colour-only, §9), muted so it never competes with the reply. */
.msg-skill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  font-size: var(--text-xs);
  line-height: var(--line-xs);
  color: var(--text-muted);
}
.msg-skill-icon { width: 14px; height: 14px; flex-shrink: 0; }
/* Honest-signal truncation notice (§L0): a quiet warning-toned line on a reply the model cut off at
   the context ceiling. Amber (not error-red) — the answer is incomplete, not broken; the tooltip
   explains what to do. Matches the .msg-skill vocabulary (small, inline, muted) with a warm accent. */
.msg-truncated {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  font-size: var(--text-xs);
  line-height: var(--line-xs);
  color: var(--warning, #b8860b);
  cursor: default;
}
.msg-truncated-glyph { flex-shrink: 0; font-size: 12px; }
/* #290: the per-answer speed line (decode tok/s · time to first token · tokens) — the same quiet
   muted metadata vocabulary as .msg-skill; numbers in tabular figures so lines align. */
.msg-speed {
  display: inline-flex;
  align-items: center;
  margin-top: 8px;
  font-size: var(--text-xs);
  line-height: var(--line-xs);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  cursor: default;
}
/* S13c (D3): the per-turn "answer without it" undo on an auto-fired turn — a quiet inline link, not a
   loud button, so an auto-applied skill is reversible without shouting. */
.msg-skill-undo {
  background: none;
  border: none;
  padding: 0;
  margin-left: 2px;
  font: inherit;
  color: var(--accent, var(--text-muted));
  text-decoration: underline;
  cursor: pointer;
}
.msg-skill-undo:hover:not(:disabled) { color: var(--text); }
.msg-skill-undo:disabled { cursor: default; opacity: 0.6; }
/* #80 (wave R80): the per-answer skill offer — same quiet .msg-skill vocabulary (icon + words,
   muted, never colour-only §9); the action reuses the .msg-skill-undo link style, so no new
   colour tokens. The provenance marker ("suggested by the local model") is a plain muted word
   pair — text IS the marker, per §9. */
.msg-skill-offer { flex-wrap: wrap; }
.msg-skill-offer-provenance { font-style: italic; }

/* Tier-2 tool-run bar (skills plan §12.2/§15, S11b): a calm row above the composer carrying the
   offer / busy / result. Quiet by default — muted text, a hairline top border, no alarm colour. */
.skill-run-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  /* Share the centered 720px conversation column so the offer/run row lines up with the
     composer + transcript above it (not flush-left against the full chat-main width). */
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 8px 4px 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.skill-run-status { display: inline-flex; align-items: center; gap: 8px; }
/* SKA-39 (U6): the live done/total progress — quiet, tabular, and non-shifting as the digits climb. */
.skill-run-progress { color: var(--text-muted); font-variant-numeric: tabular-nums; }
/* SKA-6 (U6): the quiet "a skill is working in another chat" chip; shares the 720px conversation column. */
.skill-run-elsewhere {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 8px 4px 0;
  font-size: var(--text-sm);
}
/* U-1 target-document chooser: a quiet footer-style trigger; long filenames truncate, never wrap. */
.skill-run-target { max-width: 16rem; }
.skill-run-target-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* #46: the first-selection skill info card — a calm bordered card above the composer stating what
   the picked skill does / needs / can't do. Shares the 720px conversation column; quiet surface,
   never an alarm colour. */
.skill-info-card {
  max-width: 720px;
  width: 100%;
  margin: 8px auto 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-size: var(--text-sm);
  color: var(--text);
}
.skill-info-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.skill-info-title { font-size: var(--text-sm); }
.skill-info-close {
  border: 0;
  background: none;
  padding: 0 2px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--text-sm);
}
.skill-info-close:hover { color: var(--text); }
.skill-info-line { margin: 4px 0 0; color: var(--text-muted); }
.skill-info-label { color: var(--text); font-weight: 500; }
.skill-info-foot { margin: 6px 0 0; }
.skill-info-more {
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent);
  cursor: pointer;
  font-size: inherit;
  text-decoration: underline;
}
/* #46: the picker's quiet ⓘ next to the active chip (mirrors the chip-clear ×). */
.footer-menu-btn.skill-info-btn { padding-inline: 6px; color: var(--text-muted); }
.footer-menu-btn.skill-info-btn:hover:not(:disabled) { color: var(--text); background: var(--surface-hover); }

/* Markdown-rendered assistant replies: markdown supplies its own block spacing, so
   pre-wrap (which would double every blank line) is turned off. The image-understanding
   answer (.image-turn-text.md) reuses the exact same rules — same shared renderer. */
.msg-content.md, .image-turn-text.md { white-space: normal; }
.msg-content.md > :first-child, .image-turn-text.md > :first-child { margin-top: 0; }
.msg-content.md > :last-child, .image-turn-text.md > :last-child { margin-bottom: 0; }
.msg-content.md p, .image-turn-text.md p { margin: 0 0 10px; }
.msg-content.md h1, .msg-content.md h2, .msg-content.md h3,
.msg-content.md h4, .msg-content.md h5, .msg-content.md h6,
.image-turn-text.md h1, .image-turn-text.md h2, .image-turn-text.md h3,
.image-turn-text.md h4, .image-turn-text.md h5, .image-turn-text.md h6 {
  margin: 14px 0 8px;
  line-height: 1.3;
}
.msg-content.md h1, .image-turn-text.md h1 { font-size: 18px; }
.msg-content.md h2, .image-turn-text.md h2 { font-size: 16px; }
.msg-content.md h3, .image-turn-text.md h3 { font-size: 15px; }
.msg-content.md h4, .msg-content.md h5, .msg-content.md h6,
.image-turn-text.md h4, .image-turn-text.md h5, .image-turn-text.md h6 { font-size: 14px; }
.msg-content.md ul, .msg-content.md ol,
.image-turn-text.md ul, .image-turn-text.md ol { margin: 0 0 10px; padding-left: 22px; }
.msg-content.md li, .image-turn-text.md li { margin: 3px 0; }
.msg-content.md li > p, .image-turn-text.md li > p { margin: 0; }
/* Every surface that renders AssistantMarkdown (its Streamdown root is `.assistant-md`), the Review
   item and the Translate outputs included, which have none of the rules above: there a list item's
   <p> kept the browser's 1em margins, and since Streamdown 2.7 unwraps an item's only <p>, one list
   came out uneven (measured: 0 / 16 / 16 px between its items; #685). */
.assistant-md li > p { margin: 0; }
.msg-content.md code, .image-turn-text.md code {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 13px;
}
.msg-content.md pre, .image-turn-text.md pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 10px;
  overflow-x: auto;
}
.msg-content.md pre code, .image-turn-text.md pre code { background: transparent; border: none; padding: 0; }
.msg-content.md blockquote, .image-turn-text.md blockquote {
  border-left: 3px solid var(--border-strong);
  margin: 0 0 10px;
  padding: 2px 0 2px 12px;
  color: var(--text-muted);
}
.msg-content.md table, .image-turn-text.md table { border-collapse: collapse; margin: 0 0 10px; max-width: 100%; }
.msg-content.md th, .msg-content.md td,
.image-turn-text.md th, .image-turn-text.md td {
  border: 1px solid var(--border);
  padding: 4px 10px;
  text-align: left;
}
.msg-content.md th, .image-turn-text.md th { background: var(--code-bg); }
.msg-content.md a, .image-turn-text.md a { color: var(--link); }
.msg-content.md hr, .image-turn-text.md hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.msg-content.md img, .image-turn-text.md img { max-width: 100%; }
.cursor { color: var(--accent); animation: blink 1s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }

/* Modal dialogs (guidelines §6): Radix Dialog renders overlay + content as
   portal siblings — the content centers itself. --shadow-3, --radius-lg; widths per §6
   (~480px confirm / 640px content / 760px reading). */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay); /* SH-14 (#149): tokenized scrim */
  z-index: 50;
}
.dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 51;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: min(640px, calc(100vw - 64px));
  max-height: calc(100vh - 96px);
  display: flex;
  flex-direction: column;
  padding: 16px 18px;
  gap: 8px;
  box-shadow: var(--shadow-3);
}
.dialog-wide { width: min(760px, calc(100vw - 64px)); }
.dialog-confirm { width: min(480px, calc(100vw - 64px)); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-title {
  font-weight: 600;
  font-size: 15px;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Dialog button row: primary action on the RIGHT (guidelines §1.6/§6). */
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
/* The scroll region inside a content dialog. flex:1 + min-height:0 lets it absorb the
   space the header/hints leave and scroll its own overflow — without flex:1 a long
   summary grew past the dialog's max-height with no scrollbar (the reported bug). */
.modal-body { flex: 1 1 auto; overflow-y: auto; min-height: 0; padding-right: 6px; }
/* DOC-10 (#150): PreviewModal's inner scroll region — its own name, no longer a nested copy
   of .modal-body (Modal wraps all children in one already; the copy doubled padding-right). */
.preview-scroll { flex: 1 1 auto; overflow-y: auto; min-height: 0; }
.preview-segment { margin-bottom: 12px; }
.preview-label {
  font-size: var(--text-xs); /* SH-13 (#149): 12px floor */
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.preview-text { white-space: pre-wrap; word-break: break-word; font-size: 13px; line-height: 1.55; }
/* FE-6: the "Show more" control + "Showing X of N" hint at the foot of a paginated preview. */
.preview-more { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
/* #538: the low-confidence OCR note + its "Read again (OCR)" action, under the OCR line. */
.preview-ocr-unsure { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 8px; }
/* Document summary disclosure inside the preview: collapsible, open by
   default when a summary exists, visually separated from the extracted text below. */
.doc-summary {
  margin: 0 0 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.doc-summary > summary {
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  font-size: var(--text-sm);
  line-height: var(--line-sm);
}
.doc-summary-body { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
/* Extracted-text disclosure reuses the summary container chrome; collapse the
   per-segment bottom margin since the flex `gap` already spaces them. */
.doc-rawtext .doc-summary-body .preview-segment { margin-bottom: 0; }

/* Small inline loading spinner (Models checksum check, runtime warm-up hints). */
.spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  vertical-align: -2px;
  margin-right: 4px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Inline "▸ Sources (N)" disclosure on grounded answers (guidelines §3). */
.sources { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 8px; }
.sources-toggle {
  background: transparent;
  border: none;
  color: var(--link);
  font-size: var(--text-sm);
  cursor: pointer;
  padding: 2px 0;
}
/* Source cards (guidelines §4: avoid cards-inside-heavy-cards). The assistant turn is
   borderless, so a light hairline-bordered surface here reads as one quiet level of
   nesting, not a box-in-a-box. Title · page/section · snippet preserved. */
.sources-cards { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.source-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: var(--text-sm);
  line-height: var(--line-sm);
}
.source-card-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.cite-label { color: var(--link); font-weight: 600; }
.source-card-title { font-weight: 500; word-break: break-all; }
.source-card-where { color: var(--text-muted); }
.source-card-snippet {
  margin-top: 6px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-muted);
}
/* Whole-document provenance list (Phase 5, FE-B): a quiet "Sections covered" caption marks
   the cards as document sections, not cited excerpts; "and N more sections" reveals the tail
   the ~24-card cap holds back (anti-jank for a ~1000-leaf provenance answer). */
.sources-caption { margin-top: 2px; }
.sources-more {
  background: transparent;
  border: none;
  color: var(--link);
  font-size: var(--text-sm);
  cursor: pointer;
  padding: 4px 0;
  text-align: left;
}

/* Per-answer knowledge-pack outcomes (#301 P4, M6/M7): a quiet collapsed note under the answer
   saying what happened to each ticked pack. Deliberately understated — it reports state, it is
   not an alert (guidelines §9). P6 owns the visual pass; this keeps it legible until then. */
.pack-outcomes { margin-top: 8px; font-size: var(--text-sm); }
.pack-outcomes-summary { color: var(--text-muted); }
.pack-outcomes-toggle {
  background: transparent;
  border: none;
  color: var(--link);
  font-size: var(--text-sm);
  cursor: pointer;
  padding: 2px 0;
  text-align: left;
  /* #301 P6 (plan §9.23 (d)): WCAG 2.5.8 minimum target, shared with .source-card-open —
     stays link-styled, never a loud button. */
  min-height: 24px;
}
.pack-outcomes-rows { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.pack-outcome-row { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.pack-outcome-title { font-weight: 500; word-break: break-word; }
.pack-outcome-state, .pack-outcome-count { color: var(--text-muted); }

/* Composer (guidelines §3/§6): centered with the transcript; auto-grow input,
   one Send/Stop button, quiet footer row. */
.composer { display: flex; flex-direction: column; gap: 6px; max-width: 720px; width: 100%; margin: 0 auto; }
/* The composer shell: one bordered unit holding the textarea, optional mic, and the
   Send/Stop button (guidelines §6 — looks like one composer, not a detached button). */
.composer-row {
  display: flex;
  gap: 4px;
  align-items: flex-end;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 6px 6px 6px 4px;
}
.composer-row:focus-within { border-color: var(--focus); outline: 2px solid var(--focus); outline-offset: -1px; }
/* Holds the textarea + the live dictation waveform overlay, taking the row's flex space. */
.chat-input-wrap { flex: 1; min-width: 0; position: relative; display: flex; }
.chat-input {
  flex: 1;
  width: 100%;
  resize: none;
  min-height: 40px;
  max-height: 220px;
  background: transparent;
  border: none;
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  font-family: inherit;
  font-size: var(--text-base);
  line-height: var(--line-base);
}
/* The shell owns the focus ring; the textarea itself shows none (no double ring). */
.chat-input:focus, .chat-input:focus-visible { outline: none; }
/* Vertically center Send/Stop (and the mic) in the row — with a single-line textarea
   flex-end left them sitting low against the field's bottom edge. */
.composer-row .btn { align-self: center; }
/* #803, open-issues wave owner round W5-3: at narrow widths a control that doesn't fit moves to the
   next row instead of squeezing the others. */
.composer-footer { display: flex; gap: 12px; align-items: center; min-height: 26px; padding: 0 4px; flex-wrap: wrap; row-gap: 4px; }
/* Push the context-window meter to the right edge of the footer (context-compaction §5.1). */
.composer-footer-spacer { margin-left: auto; display: inline-flex; align-items: center; }

/* Conversation-memory meter (context-compaction §5.1; #25/D69): a short LABEL + a thin quiet bar
   + a % readout. The label is what differentiates it from a progress bar (the #25 misreading) —
   it names the gauge as memory fullness, not task progress. Tone is the only signal that changes
   (calm → amber → near-full); calm stays neutral so it never reads as a warning at normal fullness. */
.context-meter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: default;
}
/* Visible short name ("Memory"/"Speicher") beside the bar. Quiet + dim like the % readout. */
.context-meter-label {
  font-size: var(--text-xs);
  line-height: var(--line-xs);
  color: var(--text-dim);
}
.context-meter-track {
  position: relative;
  width: 56px;
  flex-shrink: 0;
  height: 4px;
  border-radius: 999px;
  background: var(--row-selected-bar, var(--border));
  opacity: 0.5;
  overflow: hidden;
}
/* Always-visible % readout beside the bar. Quiet + tabular so it doesn't jitter while it climbs
   during streaming; tone tracks the meter (amber/near-full inherit the fill colour below). */
.context-meter-pct {
  font-size: var(--text-xs);
  line-height: var(--line-xs);
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  min-width: 3ch;
  text-align: right;
}
.context-meter-amber .context-meter-pct { color: var(--warning, #b8860b); }
.context-meter-near-full .context-meter-pct { color: var(--error, #c0392b); }
.context-meter-fill {
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
  border-radius: 999px;
  background: var(--text-dim);
  transition: width 160ms ease;
}
.context-meter-amber .context-meter-fill { background: var(--warning, #b8860b); }
.context-meter-near-full .context-meter-fill { background: var(--error, #c0392b); }

/* "Summarizing earlier messages…" status above the streaming bubble (context-compaction §5.2).
   Quiet, dim, matches the no-model spinner hint vocabulary. */
.chat-compaction-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 8px;
  color: var(--text-dim);
  font-size: var(--text-sm);
}

/* #39: the calm one-time "the first answer takes a little longer — warming up" line under the
   pending answer. Same quiet vocabulary as the compaction notice: dim, small, no icon-noise —
   reassurance, never an alert. Appears only after a few seconds of silent prefill on the first
   generation since model start; vanishes the instant anything streams. */
.chat-warmup-hint {
  margin-top: 8px;
  color: var(--text-dim);
  font-size: var(--text-sm);
}

/* Transcript summary marker (context-compaction §5.3, D-b): a subtle, non-bubble divider with an
   expandable summary. Centered, low-contrast — it documents the compression without shouting. */
.chat-summary-marker {
  margin: 10px 0;
  text-align: center;
}
.chat-summary-marker-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: var(--text-sm);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.chat-summary-marker-toggle:hover { color: var(--text); }
.chat-summary-marker-chevron { font-size: 0.9em; }
.chat-summary-marker-text {
  margin: 6px auto 0;
  max-width: 640px;
  text-align: left;
  white-space: pre-wrap;
  color: var(--text-dim);
  font-size: var(--text-sm);
  border-left: 2px solid var(--border);
  padding: 4px 0 4px 12px;
}

/* Voice-dictation mic: quiet ghost button beside Send; while recording it
   pulses so stopping is obvious (the OS mic indicator is the authoritative signal). */
.dictation-btn { min-width: 26px; padding-left: 3px; padding-right: 3px; }
/* #497: the "not installed" mic — the same glyph at the disabled opacity (guidelines §6), still
   focusable/clickable (aria-disabled, not disabled) so its click can explain what is missing. */
.dictation-btn.dictation-unavailable { opacity: 0.5; }
.btn.ghost.dictation-btn.dictation-unavailable:hover { opacity: 0.8; }
/* The explanation under the composer row: hint typography with the deep-link button inline. */
.composer-hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-1) 0 0;
}
/* Attach-files button: quiet ghost paperclip beside the mic/Send (plan §11.2). The
   icon is centered, so a wide box pushed it away from the mic — hug the glyph (the 24px
   global button min keeps the hit target; height carries the vertical target). */
.composer-attach {
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  padding: 0 2px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.composer-attach:hover:not(:disabled) { color: var(--accent); }
.composer-attach:disabled { opacity: 0.5; cursor: default; }
/* Same hover treatment as the password reveal eye (gate-pw-toggle): no grey ghost fill,
   the glyph just shifts to the accent blue. Skipped while recording so the pulsing
   accent-border state stays intact. */
.btn.ghost.dictation-btn:not(.dictation-recording):hover:not(:disabled) {
  background: transparent;
  border-color: transparent;
  color: var(--accent);
}
.dictation-btn.dictation-recording {
  color: var(--accent);
  border-color: var(--accent);
  animation: dictation-pulse 1.6s ease-in-out infinite;
}
/* Hovering while recording must not bring back the grey ghost fill — keep it transparent
   so only the accent border + pulse show. */
.btn.ghost.dictation-btn.dictation-recording:hover:not(:disabled) {
  background: transparent;
}
@keyframes dictation-pulse { 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) {
  .dictation-btn.dictation-recording { animation: none; }
}

/* Live mic waveform: a canvas overlaid on the input while dictating, so it is
   unmistakable that recording has started. The textarea text dims beneath it (the
   draft is preserved — dictation inserts at the cursor). Decorative + pointer-through;
   the mic button stays the authoritative, keyboard-reachable recording control. */
.dictation-waveform {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  border-radius: var(--radius-sm);
}
.composer-recording { border-color: var(--accent); }
.composer-recording .chat-input {
  color: var(--text-muted);
  opacity: 0.35;
}

/* ---- Responsive (guidelines §8): the conversation is the centre of gravity at desktop
   widths; narrower windows give the history column's space to the transcript. The
   history column auto-collapses below ~1150px in JS (ChatScreen LIST_AUTO_COLLAPSE_PX);
   these rules trim chrome so nothing overflows on the way down. ---- */
@media (max-width: 1280px) {
  /* Reclaim screen gutters for the canvas as the window narrows. The chat-layout height
     tracks the reduced vertical padding (2 × 24px) so the composer stays in view. */
  .content { padding: 24px 28px; }
  .chat-layout { gap: 12px; height: calc(100vh - 48px); }
}
@media (max-width: 1150px) {
  /* History is collapsed here (JS), so the transcript already spans the width; keep
     the gutters tight so the 720px column has room to breathe. */
  .content { padding: 20px 20px; }
  .chat-layout { height: calc(100vh - 40px); }
}

/* ---- Narrow windows: keep EVERY screen usable when the window is resized small, not
   just Chat (which collapses its history list in JS). These rules trim chrome, slim the
   nav rail, stack the key/value grids, and let the segmented switchers scroll so nothing
   on Home / AI Model / Documents / Settings / Diagnostics overflows the viewport. ---- */
@media (max-width: 760px) {
  /* The rail keeps its 100px label-fit width even on narrow windows: a single-word label
     ("Einstellungen") can't break mid-word (§4.4 floor + `hyphens:none`), so shrinking the
     column below the fit width would overflow it off-screen. Only the content gutters shrink. */
  .content { padding: 16px 14px; }
  /* Stack key/value rows so a fixed 140px label never squeezes long values off-screen. */
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dt { margin-top: 8px; }
  .kv dt:first-of-type { margin-top: 0; }
  /* Title + status badges stack instead of crowding (model/document cards, dialog heads). */
  .model-head,
  .doc-head { flex-wrap: wrap; }
  /* The settings/section segmented switcher scrolls instead of pushing past the edge. */
  .seg { max-width: 100%; overflow-x: auto; }
  .status-grid { gap: 10px; margin: 16px 0; }
}
@media (max-width: 520px) {
  /* Rail stays at the 100px label-fit width (see the 760px note); only chrome tightens. */
  .content { padding: 12px 10px; }
  .card { padding: 14px; }
  h1 { font-size: 20px; }
  /* On a phone-width window the centered column is the whole width. */
  .status-grid { grid-template-columns: 1fr 1fr; }
}

/* Documents screen — section rail + organization (document-organization plan §12) */
/* Width: the shared `.screen` frame (§14; §11.6's original "left-aligned, NOT centred"
   choice is superseded — containers centre via the `.screen` margin, #166). The doc list
   caps itself at ~1000px below. min-width:0 on the grid item is the grid-blowout guard: it
   lets the 1fr track shrink so a long, unbreakable filename ellipsizes instead of widening
   the row and pushing the trailing Preview/⋯ off the edge. */
.docs-layout { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: start; }
/* Collapsed sub-nav (§11.6): the rail is gone and the list takes the full width. */
.docs-layout.rail-collapsed { grid-template-columns: 1fr; }
/* Head (§11.16): the title beside the "My documents | Knowledge packs" segmented switch. */
.docs-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.docs-head h1 { margin: 0; }
/* #573: "‹ Back to chat" after a chat's "Go to Documents" — the Images/Review back-link shape. */
.docs-back { margin-bottom: 8px; padding-left: 0; }
/* Toolbar (§11.16): the name filter on the left, the quiet Refresh + bulk fixes + Import pair
   on the right (one primary, last in the row). Wraps on a narrow window. */
.docs-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.docs-toolbar-actions { margin-top: 0; }
/* #214: the header select-all checkbox and the name filter share one flex item so the
   toolbar's filter-left / actions-right `space-between` layout above is unaffected by adding it. */
.docs-select-all-and-filter { display: flex; align-items: center; gap: 8px; flex: 0 1 280px; min-width: 200px; }
.docs-select-all { width: 16px; height: 16px; accent-color: var(--accent); flex-shrink: 0; }
.docs-filter { position: relative; flex: 1 1 auto; min-width: 0; }
.docs-filter-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
/* #803, open-issues wave owner call G-9: two classes, so the icon's padding survives the later
   `.text-input { padding: 8px 10px }` the input also carries (it lost by source order). */
.text-input.docs-filter-input { padding-left: 32px; min-height: 36px; }
.docs-main { min-width: 0; }
.docs-rail { display: flex; flex-direction: column; gap: 1px; position: sticky; top: 0; }
/* Panel header: quiet title + the "«" collapse handle (mirrors the chat sidebar head). */
.docs-rail-head { display: flex; gap: 6px; align-items: center; justify-content: flex-end; padding: 0 2px 2px; }
.docs-rail-title { font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.docs-rail-collapse {
  background: transparent; border: 1px solid transparent; color: var(--text-muted);
  border-radius: var(--radius-sm); font-size: 14px; line-height: 1; cursor: pointer; padding: 3px 7px;
}
.docs-rail-collapse:hover { background: var(--surface-hover); color: var(--text); }
/* "»" handle that re-opens the collapsed sub-nav, parked at the top-left of the list. */
.docs-rail-show {
  align-self: flex-start; background: transparent; border: 1px solid transparent; color: var(--text-muted);
  border-radius: var(--radius-sm); font-size: 14px; line-height: 1; cursor: pointer; padding: 3px 7px; margin-bottom: 6px;
}
.docs-rail-show:hover { background: var(--surface-hover); color: var(--text); }
/* Denser nav rows (§6 — ≥36px): a comfortable hit target with a hover highlight, uniform
   across all groups. */
.docs-rail-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; text-align: left;
  background: none; border: none; color: var(--text-muted); padding: 6px 10px; border-radius: 6px; font-size: 13px;
  cursor: pointer; width: 100%;
}
/* §11.16: every rail entry carries its document count (visual only — aria-hidden). */
.docs-rail-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docs-rail-count { font-size: var(--text-xs); color: var(--text-muted); font-weight: 400; flex-shrink: 0; }
.docs-rail-new-project:disabled { cursor: not-allowed; opacity: 0.5; }
.docs-rail-item:hover { background: var(--surface-hover); color: var(--text); }
/* Active = a soft fill (the nav/history selection treatment, §11.6) + aria-current, NOT a ring
   (:focus-visible keeps the ring, so selection stays distinct from focus). */
.docs-rail-item.active { background: var(--row-selected-bg); color: var(--text); font-weight: 600; }
/* Tighter vertical rhythm between the four sub-nav sections (§11.6 follow-up): the rows are
   already ~36px, but the 8px inter-group margin read airy — 3px brings All documents / Projects
   / Locations / Views closer without losing the grouping. */
.docs-rail-group { display: flex; flex-direction: column; gap: 1px; margin: 3px 0 1px; }
.docs-rail-group-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 10px; }
/* 12px floor (§4.4) — was 11px. */
.docs-rail-group-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.docs-rail-add { background: none; border: none; color: var(--text-muted); font-size: 16px; line-height: 1; cursor: pointer; padding: 0 4px; }
.docs-rail-add:hover:not(:disabled) { color: var(--text); }
.docs-rail-empty { padding: 2px 10px; font-size: 12px; }
.docs-rail-project { display: flex; align-items: center; }
.docs-rail-project .docs-rail-project-name { flex: 1; }
.docs-rail-project.active .docs-rail-project-name { background: var(--row-selected-bg); color: var(--text); font-weight: 600; border-radius: 6px; }
.docs-rail-project.archived .docs-rail-project-name { opacity: 0.6; font-style: italic; }
.docs-rail-project-menu { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.docs-rail-project-menu:hover:not(:disabled) { color: var(--text); background: var(--surface-hover); }
/* Views "More" disclosure: a real quiet <button> (aria-expanded) — same height as a nav row. */
.docs-rail-more {
  display: flex; align-items: center; gap: 4px; min-height: 32px; text-align: left; background: none;
  border: none; color: var(--text-muted); padding: 4px 10px; border-radius: 6px; font-size: 12px; cursor: pointer; width: 100%;
}
.docs-rail-more:hover { background: var(--surface-hover); color: var(--text); }
.docs-rail-more-caret { font-size: 10px; }
.doc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.doc-chip { font-size: var(--text-xs); padding: 1px 8px; border-radius: 999px; background: var(--surface-hover); color: var(--text-muted); border: 1px solid var(--border); }
.text-input {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); color: var(--text); font-size: 14px;
}
/* Scope picker — multi-select source rows (plan §13.2) */
.scope-footer-wrap { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
/* #301 P6 (plan §9.23 (d)): the "Answering from: …" chip ellipsises a long pack title at a
   narrow width instead of overflowing the composer footer (the label stays the button's full
   accessible name). The trigger itself may shrink; the icon and the caret never do. */
.scope-footer-wrap .footer-menu-btn { min-width: 0; max-width: 100%; }
.scope-chip-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scope-dangling { font-size: 12px; }
.scope-sources { display: flex; flex-direction: column; gap: 4px; margin: 4px 0; }
.scope-source-row { display: flex; align-items: baseline; gap: 8px; font-size: 13px; cursor: pointer; }
/* #301 P6 (plan §9.23 (d)): a long / non-ASCII 200-char title wraps inside the 360px popover
   instead of forcing it wider. */
.scope-source-name { color: var(--text); overflow-wrap: anywhere; min-width: 0; }
.scope-source-hint { color: var(--text-muted); font-size: var(--text-xs); }
/* #301 P6: the Documents toggle's hint left the <label> (it must not be part of the checkbox's
   accessible name), so it is a block sibling — indent it under the label text. */
.scope-documents-toggle .scope-source-hint { margin-left: 22px; }
.scope-specific-toggle { background: none; border: none; cursor: pointer; text-align: left; }
/* Conversation list — creation-anchor project sections (plan §13.4) */
.chat-proj-group-label { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); padding: 8px 10px 2px; font-weight: 600; }

@media (max-width: 760px) {
  /* The section rail collapses to a horizontal scrolling strip above the list (plan §12 L4).
     The panel header (title + "«" collapse) is dropped — collapse is a wide-screen affordance. */
  .docs-layout { grid-template-columns: 1fr; }
  .docs-rail { flex-direction: row; overflow-x: auto; gap: 6px; position: static; padding-bottom: 6px; }
  .docs-rail-head { display: none; }
  .docs-rail-group { flex-direction: row; margin: 0; }
  .docs-rail-group-head { display: none; }
}

/* ---- Images screen (image-understanding §5/§11, Phase V3; width: the shared `.screen`
   frame, §14) ---- */
/* Drop zone (§5.2, FileDropZone): a large, calm drag target. Dashed border, centered stack, a clear
   drag-over highlight; its inner button is the one focusable control (#161). */
.image-dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  min-height: 260px; padding: 32px; margin-top: 8px;
  border: 2px dashed var(--border-strong); border-radius: var(--radius-md);
  background: var(--surface); color: var(--text-muted); cursor: pointer; text-align: center;
}
.image-dropzone:hover { background: var(--surface-hover); }
.image-dropzone.drag-over { border-color: var(--focus); background: var(--surface-hover); color: var(--text); }
.image-dropzone-title { font-size: var(--text-lg); line-height: var(--line-lg); font-weight: 600; color: var(--text); margin: 0; }
.image-dropzone-types { margin: 0; }
/* Two-pane workspace (§5.3): preview left, work pane right. */
.image-workspace { display: grid; grid-template-columns: minmax(0, 360px) 1fr; gap: 24px; align-items: start; margin-top: 12px; }
.image-pane-left { min-width: 0; position: sticky; top: 0; }
.image-pane-right { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
/* Preview pane: contained image, capped height, then filename + meta + actions. */
.image-preview { display: flex; flex-direction: column; gap: 8px; }
.image-preview-frame {
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface);
  padding: 8px; max-height: 420px; overflow: hidden;
}
.image-preview-img { max-width: 100%; max-height: 400px; object-fit: contain; border-radius: var(--radius-sm); }
.image-preview-name { font-family: var(--font-mono, monospace); font-size: var(--text-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.image-preview-meta { color: var(--text-muted); font-size: var(--text-sm); }
.image-preview-actions { display: flex; gap: 8px; }
/* Question composer (§5.3/§5.5): chips above, then the auto-grow composer row (reuses the
   chat .composer-row / .chat-input shell, but full-width — not centered). */
.image-composer { display: flex; flex-direction: column; gap: 8px; }
.image-composer .composer-row { width: 100%; }
.image-chips { display: flex; flex-wrap: wrap; gap: 6px; }
/* Answer thread (§5.4): ephemeral turns, each a quiet question + an answer block. */
.image-thread { display: flex; flex-direction: column; gap: 16px; }
.image-turn { display: flex; flex-direction: column; gap: 6px; }
.image-turn-question { font-weight: 600; margin: 0; }
.image-turn-answer { display: flex; flex-direction: column; gap: 8px; }
.image-turn-text { margin: 0; white-space: pre-wrap; line-height: var(--line-base); }
.image-turn-running { display: flex; align-items: center; gap: 12px; }
.image-turn-reading { display: inline-flex; align-items: center; gap: 8px; color: var(--text-muted); }
.image-turn-stopped { margin: 0; }
.image-turn-actions { display: flex; gap: 8px; }
.image-local-note { margin: 0; }
.stream-caret { opacity: 0.6; }

/* Image-analysis history (image-understanding history): a light text-row list under the drop
   zone — file name + question count, plus a delete that confirms via ConfirmDialog. */
/* Full-width, matching the upload drop zone above it (both fill the .images-screen column). */
.image-history { margin-top: 24px; }
/* #122 header row: title · total stored size · the quiet clear-all. Tokens only (both themes). */
.image-history-head { display: flex; align-items: baseline; gap: 12px; margin: 0 0 10px; }
.image-history-head .image-history-title { margin: 0; flex: 1; }
.image-history-total { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
/* Same subdued-until-hover destructive treatment as the per-entry delete below. */
.image-history-clear { flex-shrink: 0; color: var(--text-muted); }
.image-history-clear:hover:not(:disabled),
.image-history-clear:focus-visible:not(:disabled) { color: var(--error); border-color: var(--error); }
.image-history-title { font-size: 15px; margin: 0 0 10px; }
.image-history-empty { margin: 0; }
.image-history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.image-history-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 10px 12px;
  box-shadow: var(--shadow-1);
  transition: border-color 0.12s ease, background 0.12s ease;
}
.image-history-row:hover { border-color: var(--accent); }
/* The clickable body: icon tile + (name / meta) text column. */
.image-history-open {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  min-width: 0;
  color: inherit;
  font: inherit;
  padding: 0;
}
.image-history-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--accent);
}
.image-history-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.image-history-open:hover .image-history-name { text-decoration: underline; }
.image-history-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-history-meta { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.image-history-dot { opacity: 0.6; }
/* Quiet delete: a subdued ghost that turns to the error tone only on hover/focus. */
.image-history-delete { flex-shrink: 0; color: var(--text-muted); }
.image-history-delete:hover:not(:disabled),
.image-history-delete:focus-visible:not(:disabled) { color: var(--error); border-color: var(--error); }
/* The live in-flight analysis row: accent-tinted so it reads as active, not a saved entry. */
.image-history-row-running { border-color: var(--accent); background: var(--surface-2); }
/* Detail-view back link, above the preview. */
.image-back { margin-bottom: 8px; padding-left: 0; }

@media (max-width: 760px) {
  .image-workspace { grid-template-columns: 1fr; }
  .image-pane-left { position: static; }
}

/* ---- Translate screen (TranslateGemma wave, plan §2 D6, TG-4; width: the shared `.screen`
   frame, §14) ---- */
.translate-workspace { display: flex; flex-direction: column; gap: 16px; margin-top: 12px; }
/* Language bar: source select · swap · target select, centered on one calm row. */
.translate-langbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.translate-langbar label { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); }
/* Issue #42 reopen: the muted device one-liner (the chat #36 analogue) — caption-quiet,
   negative top margin tucks it under the language bar it annotates. */
.translate-device-hint { margin: -8px 0 0; font-size: 12px; cursor: default; }
.translate-swap { padding: 6px; }
/* Two equal panes: input left, output right (stacks on a narrow width). */
.translate-panes { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.translate-pane { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.translate-input {
  width: 100%; min-height: 320px; resize: vertical; padding: 12px;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface); color: var(--text);
  font-family: inherit; font-size: var(--text-md); line-height: var(--line-md);
}
/* SH-3 (#146): the global focus idiom — the old rule relied on an UNDEFINED ring token, so
   its hardcoded translucent-blue fallback always won (off-brand vs the §4.3 two-token
   accent), and a none-outline + box-shadow made the indicator vanish entirely under
   forced-colors (Windows High Contrast keeps outlines, drops shadows). Guarded by
   tests/unit/styles-focus-idiom.test.ts. */
.translate-input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-color: var(--focus); }
/* Output panel: same footprint as the input so the panes read as a pair. */
.translate-output {
  min-height: 320px; padding: 12px;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface); color: var(--text); overflow-wrap: anywhere;
}
/* The plain-text live buffer preserves the model's line breaks while streaming (Markdown is
   only parsed on completion, so half-written syntax never flickers). */
.translate-output-live { white-space: pre-wrap; }

/* Document drag-and-drop zone (TG-5, FileDropZone) — a compact dashed target under the input
   textarea, the Images zone's visual language at a smaller footprint (the text path is primary). */
.translate-dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 96px; padding: 16px;
  border: 2px dashed var(--border-strong); border-radius: var(--radius-md);
  background: var(--surface); color: var(--text-muted); cursor: pointer; text-align: center;
}
.translate-dropzone:hover { background: var(--surface-hover); }
.translate-dropzone.drag-over { border-color: var(--focus); background: var(--surface-hover); color: var(--text); }
.translate-dropzone-title { font-weight: 600; color: var(--text); margin: 0; }
.translate-dropzone-types { margin: 0; }
.translate-file-name { margin: 0; font-style: italic; }

@media (max-width: 760px) {
  .translate-panes { grid-template-columns: 1fr; }
}

/* Documents screen — compact list rows (§6 lists/tables; §11.6). Each row: checkbox ·
   file-type icon · filename + muted meta · [trailing cluster: chips · status badges ·
   inline Preview · "⋯"]. Rows are ≥40px (target ~56px for the two-line name+meta) so ~3×
   more docs fit a screen. */
/* Reading column (§11.6 refinement): cap the list width and keep it left-aligned with the
   screen gutter (no auto margins → never centred), so names get room and the trailing
   Preview/⋯ column stays close to the content on wide displays. */
.doc-list { max-width: 1000px; }
.doc-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px 10px 8px 12px;
  border-bottom: 1px solid var(--border);
  /* The selected/left-bar treatment lives in a 3px inset border that is transparent until
     the row is selected, so the row text never shifts when selection toggles. */
  border-left: 3px solid transparent;
}
.doc-row:hover { background: var(--surface-hover); }
/* Selected row: soft fill + accent left bar (the nav/history selection treatment, §12.1 #3),
   NOT an outline ring — :focus-visible keeps the ring so focus stays distinct from selection. */
.doc-row.selected { background: var(--row-selected-bg); border-left-color: var(--row-selected-bar); }
.doc-select { width: 16px; height: 16px; accent-color: var(--accent); flex-shrink: 0; }
.doc-row-icon { width: 22px; height: 22px; color: var(--text-muted); flex-shrink: 0; }
.doc-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.doc-row-title {
  font-size: var(--text-base);
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Technical meta strip is visually secondary (§6): muted, --text-xs. Ellipsizes (never
   char-wraps) when a dense row's chips/badges squeeze the main column. */
.doc-row-meta {
  font-size: var(--text-xs);
  line-height: var(--line-xs);
  color: var(--text-muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-row-cap { margin: 2px 0 0; }
/* In-context row banners (a failed import's error, the stale-embeddings notice) are COMPACT
   (§11.6 follow-up): the default banner padding/margin made a failed row tower over the clean
   ~56px rows. Tighter padding + margin + --text-xs keep the semantic left border + icon (§6)
   while the row stays close to its neighbours. */
.doc-row-main .banner {
  margin: 4px 0 0;
  padding: 4px 8px;
  gap: 6px;
  font-size: var(--text-xs);
  line-height: var(--line-xs);
}
.doc-row-main .banner-text p { margin: 0 0 3px; }
/* Trailing cluster (§11.6 refinement): right-aligned, never shrinks. Holds, in order, the tag
   chips, the status badges, then Preview + "⋯". Because it is shrink:0 and the name column
   takes the flex space, the name breathes and the Preview/⋯ pair aligns in a column down the
   list. */
.doc-row-trailing { display: flex; align-items: center; gap: 10px; flex-shrink: 0; justify-content: flex-end; }
/* Chips are bounded so a doc with several project tags can't crowd the filename out. */
.doc-row-chips { display: flex; flex-wrap: wrap; gap: 6px; max-width: 220px; justify-content: flex-end; }
.doc-row-badges { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.doc-row-actions { display: flex; gap: 6px; align-items: center; }
/* Quieter row tag chips (§11.6 refinement / FIX 2): a subtle filled neutral, NO hard border,
   --text-xs muted — clearly distinct from the bordered Secondary Preview button so a tag never
   reads as clickable. Scoped to the row so the popover/example Chip is untouched. Muted text on
   --surface-hover computes ≥4.6:1 in both themes (AA text ✓). */
.doc-row-chips .chip {
  background: var(--surface-hover);
  border-color: transparent;
  color: var(--text-muted);
  font-size: var(--text-xs);
  padding: 2px 8px;
  max-width: 160px;
}
/* The "⋯" overflow trigger: revealed on hover/focus, but ALWAYS keyboard-focusable and
   tabbable (the opacity never removes it from the tab order). ≥24px hit target (2.5.8). */
.doc-row-menu-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  min-width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease);
}
.doc-row:hover .doc-row-menu-btn,
.doc-row-menu-btn:focus-visible,
.doc-row-menu-btn[data-state='open'] { opacity: 1; }
.doc-row-menu-btn:hover:not(:disabled) { color: var(--text); background: var(--surface-hover); }
.doc-row-menu-btn:disabled { cursor: not-allowed; }

/* Quiet icon button (Refresh, §6/Task 7): no fill, ≥24px target, focus ring from baseline. */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  cursor: pointer;
}
.icon-btn:hover:not(:disabled) { color: var(--text); background: var(--surface-hover); }
.icon-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Selection toolbar (Task 6): ONE sticky, non-stacking bar for the multi-document ops.
   Reuses the selected-row fill so it reads as "these selected rows' actions". */
.docs-selbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 10px 0 4px;
  padding: 8px 12px;
  background: var(--row-selected-bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--row-selected-bar);
  border-radius: var(--radius-md);
}
.docs-selbar-count { font-size: var(--text-sm); color: var(--text-muted); margin-right: 4px; }

/* Bulk re-index progress: the determinate bar grows to fill the row, Cancel sits at the end. */
.docs-reindex-progress { display: flex; align-items: center; gap: 8px; }
.docs-reindex-progress > :first-child { flex: 1 1 auto; }

/* Overflow menu separator (Radix DropdownMenu.Separator). */
.menu-sep { height: 1px; background: var(--border); margin: 4px 6px; }

/* The deterministic skill suggestion pinned atop the composer picker (skills plan §10.2/S8): a calm
   accent tint so it reads as an OFFER, not a warning. Still a plain menu item — one tap accepts. */
.menu-item.skill-suggest { color: var(--accent); font-weight: 600; }
/* U-3: the same offer surfaced on the CLOSED picker trigger — a quiet accent-tinted footer affordance
   (reuses .footer-menu-btn) so a user who never opens the picker still sees the nudge. One tap selects
   the skill; it is never auto-applied. */
.footer-menu-btn.skill-suggest-hint { color: var(--accent); }
.footer-menu-btn.skill-suggest-hint:hover:not(:disabled) { color: var(--accent); background: var(--surface-hover); }
/* #803, open-issues wave owner rounds W5-1…W5-5: the "Skill: … ▾" trigger stays on one line (it
   wrapped to three at 880px). Its group never shrinks, so the footer wraps the group to the next
   row; only a name longer than that whole row makes the trigger give way and end in "…". */
.footer-menu-btn.skill-picker-trigger { white-space: nowrap; }
/* #803, open-issues wave owner round W5-5: the trigger and its ⓘ ✕ wrap as one (the 12px gap is
   the footer's column gap, so one row looks as before); ⓘ ✕ keep their size beside a long name. */
.skill-picker-group { display: inline-flex; align-items: center; gap: 12px; flex-shrink: 0; min-width: 0; max-width: 100%; }
.skill-picker-group > .skill-info-btn, .skill-picker-group > .skill-chip-clear { flex-shrink: 0; }
/* A name longer than a whole row (`.footer-menu-btn`'s max-width: 100%) ends in "…" (visual only:
   the button's name keeps the full text). The caret is not reset, so it keeps its width. */
.skill-picker-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* U3 (audit §4.3): the persistent composer chip's × — a quiet, compact clear button sitting right
   after the "Skill: … ▾" trigger, so the active per-turn skill is always visible AND one tap clears
   it (override + saved default). Muted like the other footer affordances; never alarming. */
.footer-menu-btn.skill-chip-clear { padding-inline: 6px; color: var(--text-muted); }
.footer-menu-btn.skill-chip-clear:hover:not(:disabled) { color: var(--text); background: var(--surface-hover); }
/* U3: the in-picker "keep for this conversation" opt-in — a plain checkbox menu item (reuses the
   radio-mark slot for its check indicator), so persisting a pick as the default is explicit. */
.menu-item.skill-keep { color: var(--text-muted); }

/* ---- Evidence review workspace (EP-1 plan §7 — ReviewScreen.tsx) ---- */
/* Two-pane layout (spec §11.1): the answer is the canvas (flexible), evidence a fixed
   sidebar. Below the narrow breakpoint the JS swaps the aside for a Modal drawer, so no
   display:none dance is needed here — the pane simply isn't mounted. */
/* Width: the shared `.screen` frame (§14). */
.review-screen { display: flex; flex-direction: column; min-height: 0; }
.review-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.review-title {
  font-size: var(--text-lg);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 40ch;
}
.review-rename-input {
  font-size: var(--text-md);
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  min-width: 220px;
}
/* Status chip: text + glyph, never color-only (guidelines §9). */
.review-status-chip,
.msg-review-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-sm);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 1px 10px;
  white-space: nowrap;
}
.review-save-state { font-size: var(--text-sm); color: var(--text-muted); margin-left: auto; }
.review-save-error { color: var(--error); }
/* P4 freshness overlay (spec §15.5/§18.4): the Outdated chip joins Draft/Ready (never
   replaces it) and the banner names the drift — border + glyph + text, never color-only. */
.review-outdated-chip { border-color: var(--warning, var(--border)); }
.review-outdated-banner {
  border: 1px solid var(--border);
  border-left: 4px solid var(--warning, var(--text-muted));
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 10px 14px;
  margin-top: 10px;
}
.review-outdated-title { margin: 0 0 4px; }
.review-outdated-facts { margin: 0 0 6px; padding-left: 1.2em; font-size: var(--text-sm); }
.review-outdated-acked { margin: 4px 0 0; }
.review-source-freshness { display: inline-flex; gap: 4px; }
.review-source-context-action { margin-top: 6px; }
.review-export-outdated-hint { margin: 0 0 6px; }
/* Source-in-context modal (D-5): stored text with the persisted excerpt highlighted. */
.review-source-context { max-width: 70ch; }
.review-context-doc { margin: 0 0 4px; }
.review-context-hash { margin: 0 0 8px; }
.review-context-text {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: var(--text-sm);
  max-height: 50vh;
  overflow-y: auto;
}
.review-context-dim { color: var(--text-muted); }
.review-context-match {
  background: var(--surface-hover);
  color: var(--text);
  font-weight: 600;
  outline: 1px solid var(--accent);
  border-radius: 2px;
}
.review-context-excerpt-head { margin: 10px 0 4px; font-size: var(--text-md); }
.review-context-snippet {
  margin: 0;
  padding: 8px 12px;
  border-left: 3px solid var(--border);
  background: var(--surface);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: var(--text-sm);
}
.review-panes {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 20px;
  flex: 1;
  min-height: 0;
  padding-top: 12px;
}
.review-panes.narrow { grid-template-columns: minmax(0, 1fr); }
.review-answer-pane { min-width: 0; overflow-y: auto; }
.review-evidence-pane { min-width: 0; overflow-y: auto; border-left: 1px solid var(--border); padding-left: 20px; }
.review-question-text {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  margin-top: 6px;
  font-size: var(--text-sm);
}
.review-bulk-row { margin: 10px 0; }
.review-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
/* One review item: a quiet card; the selected item gets the accent hairline so the
   evidence pane's "Link to item" target is visible (plus aria-current for AT). */
.review-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  background: var(--surface);
}
.review-item.selected { border-color: var(--accent); box-shadow: var(--shadow-1); }
.review-item-note { margin: 6px 0 0; }
.review-item-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.review-item-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-sm);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 1px 8px;
  color: var(--text-muted);
}
.review-link-origin { color: var(--text-muted); font-size: var(--text-sm); }
/* Decision chips: the SegmentedControl vocabulary, but wrapping (6 values). */
.review-decisions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.review-decision-chip {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: var(--text-sm);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
}
.review-decision-chip:hover:not(:disabled) { color: var(--text); background: var(--surface-hover); }
.review-decision-chip.selected {
  background: var(--surface-hover);
  border-color: var(--accent);
  color: var(--text);
  font-weight: 600;
}
.review-note-label { display: block; margin-top: 8px; }
.review-note-input,
.review-reviewer-input {
  display: block;
  width: 100%;
  margin-top: 4px;
  font: inherit;
  font-size: var(--text-sm);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  resize: vertical;
}
/* P5 reviewer text selections (spec §12.1): the tag/remove head, the quoted slice, and the
   read-only source-text selection surface (the string the stored offsets index into). */
.review-selection-head { display: flex; align-items: center; gap: 8px; }
.review-selection-tag { font-size: var(--text-xs); font-weight: 500; color: var(--text-muted); }
.review-selection-text {
  margin: 6px 0 0;
  padding: 4px 10px;
  border-left: 3px solid var(--border-strong);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: var(--text-base);
}
.review-selection-composer { margin-top: 8px; }
.review-select-surface {
  display: block;
  width: 100%;
  margin-top: 4px;
  font: inherit;
  font-size: var(--text-sm);
  line-height: 1.5; /* §23: readable line height on the selectable source text */
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  resize: vertical;
  white-space: pre-wrap;
}
.review-selection-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
/* Persistent live regions mount EMPTY (FIX-5a) — collapse them until they carry text. */
.review-selection-refused { margin: 6px 0 0; }
.review-selection-refused:empty,
.review-evidence-filter-none:empty { margin: 0; }

/* P5 evidence-pane filter + stepped reveal (spec §25.6). */
.review-evidence-filter { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; }
.review-evidence-filter-input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: var(--text-sm);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  min-height: 28px;
}
.review-evidence-filter-none { margin: 0 0 10px; }
.review-evidence-shown { margin: 4px 0 0; }
.review-linking-item { margin: 0 0 8px; }

.review-evidence-title { font-size: var(--text-md); margin: 0 0 6px; }
.review-evidence-caption { margin: 0 0 4px; }
.review-disclaimer { margin: 0 0 10px; }
.review-source-card { margin-bottom: 8px; }
.review-source-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; color: var(--text-muted); font-size: var(--text-sm); }
.review-source-state { color: var(--text-muted); }
.review-source-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.review-relation select {
  font-size: var(--text-sm);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
}
.review-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 12px;
}
.review-foot-spacer { flex: 1; }
.review-summary section { margin-bottom: 16px; }
.review-summary h3 { font-size: var(--text-md); margin: 0 0 6px; }
.review-summary-counts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; font-size: var(--text-sm); }
.review-summary-meta { display: grid; grid-template-columns: max-content 1fr; gap: 2px 14px; font-size: var(--text-sm); margin: 0; }
.review-summary-meta dt { color: var(--text-muted); }
.review-summary-meta dd { margin: 0; }
.review-summary-exports { list-style: none; margin: 0; padding: 0; font-size: var(--text-sm); }
.review-export-hash { margin-left: 8px; display: inline-flex; align-items: center; gap: 6px; }
.review-hash-mono { font-family: ui-monospace, Consolas, Menlo, monospace; font-size: 0.9em; color: var(--text-muted); }
.review-summary-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.review-gate-hint { margin: 0; }
/* Phase 3 (plan §8.4): the inline export panel above the actions row. */
.review-export-panel {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--surface-2, var(--surface, transparent));
}
.review-export-warning { margin: 0 0 8px; }
.review-export-options { border: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.review-export-options legend { padding: 0; margin-bottom: 4px; }
.review-export-option { font-size: var(--text-sm); display: flex; align-items: center; gap: 6px; }
.review-export-error { margin: 0 0 8px; }
.review-export-actions { display: flex; gap: 10px; }
/* The quiet sources-disclosure footer entry (spec §9.2) — the .sources-more idiom. */
.sources-review {
  align-self: flex-start;
  background: none;
  border: none;
  color: var(--link);
  font-size: var(--text-sm);
  cursor: pointer;
  padding: 2px 0;
}
.sources-review:hover:not(:disabled) { text-decoration: underline; }
.sources-review:disabled { opacity: 0.5; cursor: default; }

/* ---- Settings → Skills (skills plan §15) ---- */
/* Width: the shared `.screen` frame (§14). Skills is a top-level rail destination and
   SkillsScreen is SkillsTab's only render site — this section keeps its historical
   "Settings →" name only. */
/* Toolbar: the intro line takes the flex space, the Import action stays right + shrink:0. */
.skills-toolbar { display: flex; align-items: flex-start; gap: 16px; }
.skills-intro { flex: 1; margin: 0; }
.skills-toolbar > .btn { flex-shrink: 0; }
/* The list is a card with hairline-separated rows (the Documents §11.6 row pattern). The
   card already paints the border/shadow, so the rows only need separators. */
.skills-list { padding: 4px 0; }
/* Compact rows (≥40px): icon · clickable title/desc · trailing chips/switch/⋯. */
.skill-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
}
.skill-row:last-child { border-bottom: none; }
.skill-row-icon { width: 22px; height: 22px; color: var(--text-muted); flex-shrink: 0; }
/* The title/description double as the drawer trigger — a plain text button, full row height. */
.skill-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: transparent;
  border: none;
  padding: 4px 0;
  text-align: left;
  cursor: pointer;
  color: inherit;
}
.skill-row-main:hover .skill-row-title { color: var(--accent); }
.skill-row-title {
  font-size: var(--text-base);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.skill-row-desc {
  font-size: var(--text-xs);
  line-height: var(--line-xs);
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.skill-row-trailing { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
/* The permission ✓/✕ block (calm, legible — guidelines §6). Marks are icon + word; the
   word carries the meaning, the glyph is aria-hidden (§9). */
.skill-perm-heading { font-size: var(--text-sm); margin: 16px 0 4px; }
.skill-perm-title { font-size: var(--text-sm); font-weight: 600; margin: 10px 0 4px; }
.skill-perm-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.skill-perm-list li { display: flex; align-items: baseline; gap: 8px; font-size: var(--text-sm); }
.skill-perm-mark { flex-shrink: 0; font-weight: 700; }
.skill-perm-mark.can { color: var(--success); }
.skill-perm-mark.cannot { color: var(--text-muted); }
.skill-import { display: flex; flex-direction: column; gap: 10px; }

/* Benchmark / diagnostics */
.hint.error { color: var(--error); }
.benchmark-warnings { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 8px; }
.benchmark-warnings li {
  border-left: 3px solid var(--accent);
  background: var(--surface-2);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}

/* Diagnostics: local log tail (M14) */
.log-tail {
  margin-top: 10px;
  max-height: 320px;
  overflow: auto;
  font-size: var(--text-xs); /* SH-13 (#149): 12px floor */
  line-height: 1.5;
  font-family: var(--font-mono);
  background: var(--code-bg);
  border-radius: var(--radius-sm);
  padding: 10px;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Diagnostics: audit-log Activity panel */
.activity-list {
  list-style: none;
  padding: 0;
  margin: 10px 0;
  max-height: 320px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.activity-list li {
  border-left: 3px solid var(--border-strong);
  background: var(--code-bg);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}
.activity-time { opacity: 0.7; font-variant-numeric: tabular-nums; }

/* ---- Shared component layer (guidelines §6) ---------------------------- */

/* Native <select> — the shared token treatment (guidelines §6 "Inputs", §4.4 typography).
   DV-1: a bare <select> renders in the UA's own skin (Arial, square corners, UA border and
   fill) and so reads as foreign on both themes. This is the ONE place that maps a dropdown
   onto the role tokens; every picker-style <select> in the app should carry `.select`.
   Deliberately NOT a bare-element `select { … }` rule: the app also renders selects on
   surfaces this treatment has not been eyeballed on, so the opt-in class keeps the blast
   radius where it was reviewed. Sizing is kept at the UA's compact footprint on purpose —
   only the tokens change — with a 28px floor so the control clears the 24px target
   minimum (§9 / WCAG 2.5.8). The native control is kept as-is: no custom dropdown. */
.select {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  min-height: 28px;
}

/* Badge — status pill: icon + word, never color-only (WCAG 1.4.1). */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--text-xs);
  line-height: var(--line-xs);
  font-weight: 500;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  color: var(--text-muted);
  white-space: nowrap;
}
.pill-success { color: var(--success); border-color: var(--success); }
.pill-warning { color: var(--warning); border-color: var(--warning); }
.pill-error { color: var(--error); border-color: var(--error); }
.pill-accent { color: var(--accent); border-color: var(--accent); }

/* Coverage meter (whole-document-analysis §5.2): breadth pill + a muted depth line. */
.coverage-meter {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.coverage-depth { font-size: var(--text-xs); line-height: var(--line-xs); }

/* Banner — persistent in-context notice: semantic left border + icon + text. */
/* Visually-hidden, still in the a11y tree (screen-reader-only). Used by the streaming
   live region (audit L7) and any other off-screen announcement text. The standard
   clip-rect recipe — never display:none, which removes it from the a11y tree too. */
.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;
}

/* ErrorBanner (audit M-U1): always-mounted role="alert" wrapper. Empty when there is no
   message — no padding/margin of its own, so it collapses to zero height; the inner
   Banner carries the visible spacing. */
.error-banner-region { display: contents; }

.banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: var(--text-sm);
  line-height: var(--line-sm);
  color: var(--text);
  margin: 10px 0;
}
.banner-icon { flex-shrink: 0; }
.banner-info { border-left-color: var(--accent); }
.banner-info .banner-icon { color: var(--accent); }
.banner-success { border-left-color: var(--success); }
.banner-success .banner-icon { color: var(--success); }
.banner-warning { border-left-color: var(--warning); }
.banner-warning .banner-icon { color: var(--warning); }
.banner-error { border-left-color: var(--error); }
.banner-error .banner-icon { color: var(--error); }
.banner-text { flex: 1; min-width: 0; }
.banner-text p { margin: 0 0 6px; }
.banner-text p:last-child { margin-bottom: 0; }
.banner-action { flex-shrink: 0; }
.banner-dismiss {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  font-size: var(--text-sm);
  border-radius: var(--radius-sm);
}
.banner-dismiss:hover { color: var(--text); }

/* Toast — transient confirmation over a polite live region (host in App.tsx). */
.toast-host {
  position: fixed;
  bottom: var(--space-5);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 100;
  pointer-events: none;
}
.toast {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-2);
  padding: 8px 16px;
  font-size: var(--text-sm);
  line-height: var(--line-sm);
  max-width: min(480px, calc(100vw - 48px));
}

/* SegmentedControl — pill track; the selected segment gets surface + shadow + weight. */
.seg {
  display: inline-flex;
  gap: 2px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 3px;
}
.seg-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: var(--text-sm);
  padding: 4px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
}
.seg-btn:hover:not(:disabled) { color: var(--text); }
.seg-btn.selected {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: var(--shadow-1);
  color: var(--text);
  font-weight: 600;
}
.seg-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Switch — binary settings. The real checkbox input is visually hidden but keeps
   native keyboard/label behavior; the track mirrors :checked/:focus-visible. */
.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  cursor: pointer;
  min-height: 24px;
  position: relative;
}
.switch-input {
  position: absolute;
  opacity: 0;
  width: 36px;
  height: 20px;
  margin: 0;
  cursor: pointer;
}
.switch-track {
  flex-shrink: 0;
  width: 36px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--border-strong);
  position: relative;
  transition: background var(--dur-fast) var(--ease);
}
.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  background: var(--n-0);
  box-shadow: var(--shadow-1);
  transition: transform var(--dur-fast) var(--ease);
}
/* On-track uses the DARK teal in both themes: the thumb is white (--n-0), and white on
   bright teal is only 1.9:1 — on dark teal it clears ≥3:1 (and stays clearly "on"). */
.switch-input:checked + .switch-track { background: var(--brand-teal-dark); }
.switch-input:checked + .switch-track .switch-thumb { transform: translateX(16px); }
.switch-input:disabled + .switch-track { opacity: 0.5; }
.switch-input:disabled ~ .switch-label { opacity: 0.5; }
.switch-input:focus-visible + .switch-track { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Chip — --radius-sm, --text-sm; the remove ✕ reveals on hover/focus only. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  font-size: var(--text-sm);
  max-width: 240px;
}
.chip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-action { cursor: pointer; }
.chip-action:hover:not(:disabled) { border-color: var(--accent); }
.chip-action:disabled { opacity: 0.5; cursor: not-allowed; }
.chip-remove {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: var(--text-xs);
  cursor: pointer;
  padding: 2px 4px;
  opacity: 0;
  /* WCAG 2.5.8 (§9 audit, EP-1 P5): the ✕ needs a ≥24×24 target even though it renders small. */
  min-width: 24px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.chip:hover .chip-remove,
.chip:focus-within .chip-remove,
.chip-remove:focus-visible { opacity: 1; }
.chip-remove:hover:not(:disabled) { color: var(--text); }

/* EmptyState — friendly headline + one line + one primary action. */
.empty-state {
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: var(--space-6) var(--space-5);
  margin-top: 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.empty-state-title { font-size: var(--text-lg); line-height: var(--line-lg); font-weight: 600; margin: 0; }
.empty-state-line { color: var(--text-muted); font-size: var(--text-base); line-height: var(--line-base); margin: 0; }
.empty-state-action { margin-top: 8px; display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* Progress — determinate bar with an always-visible plain label. */
.progress { display: flex; flex-direction: column; gap: 6px; flex: 1 1 220px; min-width: 160px; }
.progress-label { font-size: var(--text-sm); line-height: var(--line-sm); color: var(--text-muted); }
.progress progress { width: 100%; height: 8px; accent-color: var(--accent); }
/* ---- Performance screen (design-guidelines §2, the machine group; benchmark.md
   "Performance screen"): the hardware check's answer as three tiles, then the figures
   observed in real use, then one row per other computer the drive has been in. ---- */
.perf-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.perf-card-head h2 { margin: 0 0 4px; }
.perf-verdict { font-size: var(--text-base); line-height: var(--line-base); margin: 0 0 14px; max-width: 72ch; }
.perf-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1100px) { .perf-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .perf-tiles { grid-template-columns: minmax(0, 1fr); } }
.perf-tile { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px; background: var(--surface); min-width: 0; }
.perf-tile-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.perf-tile-label { font-size: var(--text-xs); line-height: var(--line-xs); color: var(--text-muted); }
.perf-tile-value { font-size: var(--text-xl); line-height: var(--line-xl); font-weight: 600; overflow-wrap: anywhere; }
.perf-tile-value small { font-size: var(--text-sm); font-weight: 400; color: var(--text-muted); margin-left: 4px; }
.perf-tile-sub { font-size: var(--text-xs); line-height: var(--line-xs); color: var(--text-muted); overflow-wrap: anywhere; }
.perf-actions { align-items: center; margin-top: 14px; }
.perf-actions .hint { margin-left: auto; }
.perf-rows { display: flex; flex-direction: column; }
.perf-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 16px; align-items: center; padding: 10px 0; }
.perf-row + .perf-row { border-top: 1px solid var(--border); }
.perf-row-main { grid-column: 1; grid-row: 1; font-size: var(--text-base); line-height: var(--line-base); overflow-wrap: anywhere; }
.perf-row-sub { grid-column: 1; grid-row: 2; font-size: var(--text-xs); line-height: var(--line-xs); color: var(--text-muted); overflow-wrap: anywhere; }
.perf-row-side { grid-column: 2; grid-row: 1 / span 2; display: flex; align-items: center; gap: 6px; }
.perf-steps { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 8px; }
/* #437: the list is a live region and is therefore mounted even when idle (a region created
   together with its content is not announced). Empty ⇒ no box at all, so the idle card looks
   exactly as it did — never display:none on a non-empty one, which would drop it from the
   accessibility tree along with the announcement. */
.perf-steps:empty { display: none; }
.perf-step { display: flex; align-items: flex-start; gap: 10px; font-size: var(--text-sm); line-height: var(--line-sm); }
.perf-step-icon { width: 18px; height: 18px; flex-shrink: 0; }
.perf-step-done .perf-step-icon { color: var(--success); }
.perf-step-active .perf-step-icon { color: var(--accent); }
.perf-step-todo .perf-step-icon { color: var(--n-500); }
.perf-step-todo { color: var(--text-muted); }
.perf-footer { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.perf-model { margin-top: 12px; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; align-items: center; }
.perf-model-title { grid-column: 1; font-size: var(--text-xs); line-height: var(--line-xs); color: var(--text-muted); }
.perf-model-line { grid-column: 1; font-size: var(--text-base); line-height: var(--line-base); overflow-wrap: anywhere; }
.perf-model-verdict { grid-column: 1; font-size: var(--text-sm); line-height: var(--line-sm); overflow-wrap: anywhere; }
.perf-model-note { grid-column: 1; font-size: var(--text-sm); line-height: var(--line-sm); overflow-wrap: anywhere; }
.perf-model-side { grid-column: 2; grid-row: 1 / span 3; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.perf-models { margin-top: 12px; }
.perf-models .perf-row { padding: 8px 0; }
.perf-models-summary { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.perf-models-summary-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: var(--text-sm); line-height: var(--line-sm); }
/* ---- Knowledge packs (ZIM wave) --------------------------------------------------- */
/* Scope popover: the packs source group gets a little separation from the doc sources. */
.scope-packs { margin-top: 8px; }

/* Source card: the quiet "Open article" affordance on archive citations (link-styled,
   like .sources-review — never a loud button inside the disclosure). */
.source-card-open {
  background: none;
  border: none;
  padding: 0;
  margin-left: auto;
  color: var(--accent);
  font-size: var(--text-sm);
  cursor: pointer;
  /* #301 P6 (plan §9.23 (d)): WCAG 2.5.8 minimum target — stays link-styled, never a loud
     button; shared with .pack-outcomes-toggle below. */
  min-height: 24px;
}
.source-card-open:hover { text-decoration: underline; }

/* #418 (ruling C3's second half): the "Save to my documents" shortcut beside "Open article".
   Same quiet link styling and the same WCAG 2.5.8 24 px minimum target — never a loud button
   inside the disclosure. It needs no `margin-left: auto` of its own: `.source-card-open`
   already pushes the pair to the end of the head row. */
.source-card-save {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-size: var(--text-sm);
  cursor: pointer;
  min-height: 24px;
}
.source-card-save:hover:not(:disabled) { text-decoration: underline; }
.source-card-save:disabled { color: var(--text-muted); cursor: default; }
/* The save outcome (saved / already saved / the friendly failure) takes the whole next line of
   the wrapping head row, so a filed title never squeezes the citation's own title and badges. */
.source-card-save-state { flex-basis: 100%; margin: 4px 0 0; }

/* Packs management panel (Documents screen). Cards reuse the shared .card chrome. */
.packs-panel { display: flex; flex-direction: column; gap: 12px; max-width: 1000px; }
/* `.packs-list` is a <ul> (#301 P6, plan §9.23 (b)7 — list semantics); reset native list
   chrome so the visual stays the plain stacked-card layout it was as a <div>. */
.packs-list { display: flex; flex-direction: column; gap: 10px; list-style: none; margin: 0; padding: 0; }
.packs-card { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; }
/* #301 P6 (plan §9.23 (d)): a 200-char title plus two badges (enabled/disabled AND the
   no-full-text-index badge) wraps instead of overflowing the card. */
.packs-card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.packs-card-title { font-weight: 500; overflow-wrap: anywhere; }
.packs-card-missing .packs-card-title { color: var(--text-muted); }
/* #301 P6 (plan §9.23 (b)/(c)5): the same reason text a Badge only carried in its `title`
   tooltip, now also visible and reachable without a mouse. */
.packs-card-reason { margin: 0; }
.packs-card-desc { margin: 0; }
.packs-card-meta { margin: 0; }
.packs-card-actions { display: flex; gap: 8px; margin-top: 4px; align-items: center; }
/* §11.16: the panel head — summary + lead on the left, Refresh + the primary on the right. */
.packs-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.packs-head-text { flex: 1 1 360px; min-width: 0; }
.packs-summary { margin: 0 0 2px; font-size: var(--text-base); line-height: var(--line-base); }
.packs-head-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
/* §11.16: the first-run setup card (the tools-missing notice with a title and one primary). */
.packs-setup { margin-top: 0; }
.packs-setup-title { font-size: var(--text-lg); line-height: var(--line-lg); font-weight: 600; margin-bottom: 4px; }
/* §11.16: the per-row Switch sits at the end of the head row; the "⋯" is always visible here
   (a card, not a hover-revealed list row) and right-aligned. */
.packs-card-head .switch { margin-left: auto; }
.packs-card-menu { opacity: 1; margin-left: auto; }

/* #382: the screen-level "Check all model files" action — the button, its consequence line
   and the in-place hashing bar, stacked as a quiet row rather than a Banner. */
.models-verify-all { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.models-verify-all > .hint { margin: 0; }
.models-verify-all > .progress { align-self: stretch; }
/* #420: the Stop-checking button sits under the bar — the same Progress + Cancel pairing the
   download panels use — with a little more air than the 4px row gap so it reads as its own
   action rather than as part of the bar. */
.models-verify-all > .progress + .btn { margin-top: 4px; }

/* Offline article viewer: readable measure inside the wide modal; scrolls in the modal. */
.pack-article { display: flex; flex-direction: column; gap: 8px; }
.pack-article-source { margin: 0; }
/* #340 Tier-2: the save action row — button, inline spinner or the failure line beside it. */
.pack-article-save { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pack-article-save .hint { margin: 0; }
.pack-article-body { max-width: 68ch; }
.pack-article-heading { font-size: var(--text-md); margin: 14px 0 4px; }
.pack-article-para { margin: 0 0 10px; white-space: pre-wrap; }
/* #662: the archive's own license line closes the article, set apart from its last section. */
.pack-article-notice { margin: 0; max-width: 68ch; padding-top: 8px; border-top: 1px solid var(--border); }