/* Specter's stylesheet. Hand-written, custom properties for light and dark,
   no framework (§2.3). Everything here is driven by the classes the server
   already emits; the file is grouped tokens → reset → layout → components. */

/* ---------------------------------------------------------------- tokens */

:root {
  /* Tell the browser both themes are supported, so form controls, scrollbars,
     the caret and native focus rings follow the theme instead of staying
     light (NFR-UX-02). */
  color-scheme: light dark;

  --bg: #ffffff;
  --bg-subtle: #f6f8fa;
  /* A well: what is sunk into the page, a code block or the issue's text. */
  --bg-inset: #eef1f4;
  /* A quiet surface on the page rather than sunk into it: a chip, inline
     code, a disabled button, an avatar's disc. In the dark theme it is
     lighter than the page, as a well is darker, so a neutral chip never
     outweighs a coloured one and a code span is no black slab. */
  --bg-raised: #eff2f5;

  /* Text. --fg-muted is the quiet colour for anything a reader needs, however
     small (a line number, a closed issue, a status); --fg-subtle falls short
     of 4.5:1 and is kept for disabled controls, which need not reach it
     (NFR-UX-04). */
  --fg: #1f2328;
  --fg-muted: #59636e;
  --fg-subtle: #818b98;

  --border: #d1d9e0;
  --border-strong: #afb8c1;
  /* A form field's edge, which must stand 3:1 off the page around it to be
     seen as a field at all (NFR-UX-04). Decorative borders keep --border. */
  --border-control: #818b98;

  /* What stands over the conversation rather than on it: an open list
     (More actions, FR-EDIT-08, and What these do, FR-EDIT-33), its edge and
     the shadow it casts; and the softer shadow the log's top edge casts on
     the messages scrolling under it while it continues above (FR-UI-15).
     In the light theme a list is the page's white on a black shadow; the
     dark theme draws it lighter than what it covers, with deeper shadows,
     since black barely shows on its page (NFR-UX-02). */
  --overlay-bg: var(--bg);
  --overlay-border: var(--border);
  --overlay-shadow: 0 4px 16px rgb(0 0 0 / 0.14);
  --scroll-cue-shadow: 0 0 6px 3px rgb(0 0 0 / 0.14);

  --accent: #0969da;
  --accent-bg: #ddf4ff;
  --accent-border: #b6e3ff;

  /* Filled buttons. The fills are darker than the text colours of the same
     name, so white on them reads at 4.5:1 in both themes (NFR-UX-04). */
  --accent-emphasis: #0969da;
  --ok-emphasis: #1a7f37;
  --err-emphasis: #cf222e;
  --fg-on-emphasis: #ffffff;

  --ok: #1a7f37;
  --ok-strong: #116329;
  --ok-bg: #dafbe1;
  --ok-border: #aceebb;

  --err: #cf222e;
  --err-strong: #a40e26;
  --err-bg: #ffebe9;
  --err-border: #ffcecb;

  --warn: #9a6700;
  --warn-strong: #7a5200;
  --warn-bg: #fff8c5;
  --warn-border: #eac54f;
  /* A warning's marker in the editor's gutter (FR-LINT-17): amber, with a
     dark edge that stands 3:1 off the gutter. */
  --lint-warn-fill: #eac54f;
  --lint-warn-edge: #7a5200;

  /* Changed-line marks (FR-EDIT-07) and diff tints. The tint is too faint
     to find a line by, so the rule carries the mark: at least 3:1 on --bg
     and on the tint. */
  --change-bg: #f2f9ff;
  --change-rule: #1f6feb;
  /* The same mark, see-through, for a line in the editor, whose selection
     is drawn under the line: on --bg it comes out as --change-bg. */
  --change-tint: color-mix(in srgb, var(--change-rule) 5%, transparent);
  --add-bg: #e6ffec;
  --del-bg: #ffebe9;
  /* The words an edited line changed, a stronger tint of its own
     (FR-VOTE-14). */
  --add-word-bg: #abf2bc;
  --del-word-bg: #ffcecb;
  /* The editor's cursor line: a neutral tint over whatever is under it,
     never the marks' colour (FR-EDIT-07). */
  --active-line: color-mix(in srgb, var(--fg) 5%, transparent);

  --focus: #0969da;

  /* The editor (NFR-UX-02): selected text, and the colours of Markdown's
     marks and of code, all readable on --bg and on --selection in their
     scheme (NFR-UX-04), since any of them can be selected. */
  --selection: #d5e8ff;
  --syntax-link: #0550ae;
  --syntax-keyword: #a40e26;
  --syntax-string: #0a3069;
  --syntax-literal: #116329;
  --syntax-escape: #953800;
  --syntax-name: #6639ba;
  --syntax-comment: #59636e;
  --syntax-invalid: #a40e26;
  /* An ID the editor's text references: a see-through tint of the link
     colour, so the selection under it still shows, faint enough that the
     link stays readable over the selection, a changed line and the cursor
     line at once (NFR-UX-04). */
  --ref-tint: color-mix(in srgb, var(--syntax-link) 8%, transparent);

  --font: ui-sans-serif, system-ui, sans-serif;
  --font-mono:
    ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --text-page: 1.75rem;
  --text-lg: 1.375rem;
  --text-md: 1.125rem;
  --text: 1rem;
  --text-sm: 0.8125rem;
  --text-xs: 0.75rem;
  /* What is typed in a field or the editor: small, as the controls' text,
     on a desktop; 16 px on a touch screen, below. */
  --text-field: var(--text-sm);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;

  --radius: 6px;
  --radius-lg: 10px;

  /* Motion. Short and quiet: things settle into place, nothing performs.
     Every duration, stagger and nudge below reads these tokens, and the
     reduced-motion block at the end of this file sets them to nothing and
     pauses the loops, which stops all of it in one place. */
  --ease: cubic-bezier(0.2, 0, 0, 1);
  /* A little overshoot, for things that pop: a vote, a chip, a chevron. */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 120ms;
  --duration: 200ms;
  --duration-slow: 320ms;
  /* The gap between items of a list arriving one after another. */
  --stagger: 40ms;
  /* How far a hovered button rises, and how far a pressed one gives. */
  --lift: -1px;
  --press: 0.97;
  --loop: running;

  /* The reading measure for spec prose. */
  --measure: 72ch;
  /* The column a conversation is read in: the editor's Chat view (FR-UI-22)
     and the exploration (X21). */
  --chat-column: 56rem;
  /* The width of the sidebar in the two-column pages (B.4, B.6). */
  --sidebar: 20rem;
  /* The width of the issue beside an exploration's conversation, where
     the page has its full width (X20). */
  --issue-aside: 18rem;
  --page-max: 78rem;
}

/* The screen's dark theme only: paper, and Save as PDF, are always light,
   whatever the system setting (NFR-UX-02). */
@media screen and (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --bg-subtle: #151b23;
    --bg-inset: #010409;
    --bg-raised: #262c36;

    --fg: #f0f6fc;
    --fg-muted: #9198a1;
    --fg-subtle: #6e7781;

    --border: #3d444d;
    --border-strong: #556066;
    --border-control: #656c76;

    /* A list over the conversation is lighter than the replies
       (--bg-subtle) and the blue boxes (--accent-bg) it covers, short of a
       chip's --bg-raised, so it reads as a menu above them, not a hole in
       them; its edge is the strong one, and its shadow and the log's top
       edge's are deep enough to show on this page. */
    --overlay-bg: #1d232c;
    --overlay-border: var(--border-strong);
    --overlay-shadow: 0 8px 24px rgb(1 4 9 / 0.8);
    --scroll-cue-shadow: 0 0 8px 4px rgb(1 4 9 / 0.8);

    --accent: #4493f8;
    --accent-bg: #121d2f;
    --accent-border: #1f3a5f;

    --accent-emphasis: #1f6feb;
    --ok-emphasis: #238636;
    --err-emphasis: #da3633;

    --ok: #3fb950;
    --ok-strong: #56d364;
    --ok-bg: #0f2417;
    --ok-border: #1b4721;

    --err: #f85149;
    --err-strong: #ff7b72;
    --err-bg: #2a1215;
    --err-border: #5c2a2a;

    --warn: #d29922;
    --warn-strong: #e3b341;
    --warn-bg: #272115;
    --warn-border: #5a4413;
    /* On the dark gutter the amber itself stands 3:1 off it. */
    --lint-warn-fill: #d29922;
    --lint-warn-edge: #7a5200;

    --change-bg: #101d2e;
    --change-rule: #316dca;
    --change-tint: color-mix(in srgb, var(--change-rule) 12%, transparent);
    --add-bg: #0f2417;
    --del-bg: #2a1215;
    --add-word-bg: #1d572b;
    --del-word-bg: #6b2226;

    --focus: #4493f8;

    --selection: #1a3353;
    --syntax-link: #79c0ff;
    --syntax-keyword: #ff7b72;
    --syntax-string: #a5d6ff;
    --syntax-literal: #7ee787;
    --syntax-escape: #ffa657;
    --syntax-name: #d2a8ff;
    --syntax-comment: #9ba2aa;
    --syntax-invalid: #ff7b72;
    /* The light link on the dark ground loses more to its own tint. */
    --ref-tint: color-mix(in srgb, var(--syntax-link) 6%, transparent);
  }
}

/* On a touch screen, what is typed in a field or the editor is 16 px: iOS
   Safari zooms the page in when a field under 16 px takes focus, and leaves
   it zoomed after the keyboard closes (FR-UI-12). Pinch zoom stays allowed;
   the viewport never limits it. */
@media (pointer: coarse) {
  :root {
    --text-field: max(1rem, 16px);
  }
}

/* ----------------------------------------------------------------- reset */

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* `hidden` means hidden, even where a rule below gives the element a display
   of its own (every button is inline-flex): without JavaScript the editor's
   preview toggle stays out of sight rather than showing as a dead button
   (NFR-UX-03). */
[hidden] {
  /* biome-ignore lint/complexity/noImportantStyles: nothing may show what is hidden */
  display: none !important;
}

body {
  color: var(--fg);
  background: var(--bg);
  font-family: var(--font);
  font-size: var(--text);
  line-height: 1.6;
  margin: 0;
}

a {
  color: var(--accent);
  text-underline-offset: 0.15em;
  transition-property: text-decoration-thickness, text-underline-offset, color;
  transition-duration: var(--duration-fast);
  transition-timing-function: var(--ease);
}

a:hover {
  text-decoration-thickness: 2px;
  text-underline-offset: 0.25em;
}

h1,
h2,
h3 {
  line-height: 1.3;
  letter-spacing: -0.01em;
}

/* One size scale for headings on every page (FR-UI-24), so none falls
   back to the browser's own, which differ with where a heading is nested:
   the page's title, its sections, their parts. The sidebar's panel titles
   keep their small bold style, and a spec, plan or notes shown inside a
   section step down one (after `.spec h3`). */
h1 {
  font-size: var(--text-page);
}

h2 {
  font-size: var(--text-lg);
}

h3 {
  font-size: var(--text-md);
}

/* A time is said whole (FR-UI-25): where the line has no room left for
   it, it drops under the line rather than breaking in two. */
time {
  white-space: nowrap;
}

/* One visible focus treatment everywhere, so keyboard users can always see
   where they are (NFR-UX-01). The ring follows the element's own corners, so
   nothing changes shape as it gains focus. */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  animation: focus-in var(--duration-fast) var(--ease);
}

/* Bypass the header's search box and nav on every page (NFR-UX-01). */
.skip-link {
  position: absolute;
  left: var(--space-2);
  top: var(--space-2);
  z-index: 10;
  padding: var(--space-2) var(--space-4);
  background: var(--bg);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  transform: translateY(-200%);
  transition: transform var(--duration) var(--ease);
}

.skip-link:focus {
  transform: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  white-space: nowrap;
  clip-path: inset(50%);
  border: 0;
}

/* FR-UI-13: the key a control answers to, named quietly beside it (Ctrl+S
   saves). The bundle shows it; without the bundle no key does anything. */
.key-hint {
  font-size: var(--text-xs);
  color: var(--fg-muted);
}

.key-hint kbd {
  padding: 0 var(--space-1);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: calc(var(--radius) / 2);
  background: var(--bg-subtle);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  white-space: nowrap;
}

/* Keys pressed one after the other (Esc then Tab) stay on one line with
   what they do, so a wrapped hint never parts them (FR-UI-13). */
.key-then {
  white-space: nowrap;
}

button + .key-hint {
  margin-inline-start: var(--space-2);
}

/* A touch-only device (no hover, a coarse pointer and no fine one) has none
   of these keys, so it shows no hint (FR-UI-13); a tablet with a keyboard
   and a trackpad has a fine pointer and keeps them. The keys still work. */
@media (hover: none) and (pointer: coarse) and (not (any-pointer: fine)) {
  .key-hint {
    display: none;
  }
}

/* ------------------------------------------------------------- controls */

button,
.button,
input,
select,
textarea {
  font: inherit;
  font-size: var(--text-sm);
  color: var(--fg);
}

input,
select,
textarea {
  font-size: var(--text-field);
}

/* Every radio and tick in Specter's own blue, rather than one page at a
   time (FR-SETUP-11, FR-PRJ-13). */
input[type="radio"],
input[type="checkbox"] {
  accent-color: var(--accent);
}

input[type="text"],
input[type="search"],
input[type="password"],
select,
textarea {
  min-height: 2.125rem;
  padding: var(--space-2) var(--space-3);
  background: var(--bg);
  border: 1px solid var(--border-control);
  border-radius: var(--radius);
  caret-color: var(--accent);
  transition-property: border-color;
  transition-duration: var(--duration-fast);
  transition-timing-function: var(--ease);
}

/* A field's hint is read text, in the muted text colour at full strength,
   focused or not, so it meets 4.5:1 in both themes just as the person reads
   it (NFR-UX-04), rather than the browser's grey, faded on focus. */
input::placeholder,
textarea::placeholder {
  color: var(--fg-muted);
  opacity: 1;
}

/* A hovered field's edge moves further from the page, in either scheme.
   Focus is the ring every control shows (NFR-UX-01), not a second border and
   halo of its own. */
input[type="text"]:hover,
input[type="search"]:hover,
input[type="password"]:hover,
select:hover,
textarea:hover {
  border-color: var(--fg-muted);
}

/* A field the browser found wrong once it was typed in or its form was
   sent, or one the server sent back refused: the error colour on its edge
   and a soft halo, beside the words that say why (FR-UI-10, FR-UI-11). As
   specific as the hover rule above and after it, so hovering keeps the red. */
:is(
  input[type="text"],
  input[type="search"],
  input[type="password"],
  select,
  textarea
):is(:user-invalid, [aria-invalid="true"]) {
  border-color: var(--err);
  box-shadow: 0 0 0 3px var(--err-bg);
}

textarea {
  min-height: 4rem;
  line-height: 1.5;
  resize: vertical;
}

/* The rule a field keeps ("Up to 2,000 characters"), written under it and
   tied to it with aria-describedby, rather than only in a placeholder that
   goes as you type (FR-UI-11). */
.hint {
  margin: 0;
  color: var(--fg-muted);
  font-size: var(--text-xs);
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 2.125rem;
  padding: var(--space-2) var(--space-4);
  font-weight: 500;
  text-decoration: none;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition-property:
    background-color, border-color, color, filter, transform, box-shadow;
  transition-duration: var(--duration-fast);
  transition-timing-function: var(--ease);
}

/* A hovered button rises a pixel onto a soft shadow, and a press gives
   under the finger, so a click is felt before the page answers. A disabled
   one does neither, nor one that is off but still reached with Tab (a
   blocked Approve, FR-VOTE-12). */
button:hover:not(:disabled, [aria-disabled="true"]),
.button:hover:not(:disabled, [aria-disabled="true"]) {
  border-color: var(--border-strong);
  transform: translateY(var(--lift));
  box-shadow:
    0 1px 2px rgb(0 0 0 / 0.06),
    0 3px 8px rgb(0 0 0 / 0.06);
}

button:active:not(:disabled, [aria-disabled="true"]),
.button:active:not(:disabled, [aria-disabled="true"]) {
  transform: scale(var(--press));
  box-shadow: none;
  transition-duration: calc(var(--duration-fast) / 2);
}

button.primary,
.button.primary {
  background: var(--accent-emphasis);
  border-color: var(--accent-emphasis);
  color: var(--fg-on-emphasis);
}

/* A hovered fill deepens rather than brightens: lighter, the dark scheme's
   blue would drop white text under 4.5:1 (NFR-UX-04). */
button.primary:hover:not(:disabled, [aria-disabled="true"]),
.button.primary:hover:not(:disabled, [aria-disabled="true"]) {
  filter: brightness(0.92);
}

/* The filled buttons catch the light when hovered: a soft sheen crosses
   them once. It resets without a transition, so it never sweeps back. */
button.primary,
.button.primary,
button.approve {
  position: relative;
  overflow: hidden;
}

button.primary::before,
.button.primary::before,
button.approve::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 30%,
    rgb(255 255 255 / 0.22) 50%,
    transparent 70%
  );
  transform: translateX(-110%);
  pointer-events: none;
}

button.primary:hover:not(:disabled, [aria-disabled="true"])::before,
.button.primary:hover:not(:disabled, [aria-disabled="true"])::before,
button.approve:hover:not(:disabled, [aria-disabled="true"])::before {
  transform: translateX(110%);
  transition: transform calc(var(--duration-slow) * 2) var(--ease);
}

/* Approve is the one affirmative action in the product; reject is outlined
   rather than filled, so the two never look interchangeable (B.6). */
button.approve {
  background: var(--ok-emphasis);
  border-color: var(--ok-emphasis);
  color: var(--fg-on-emphasis);
}

button.reject,
button.danger,
.button.danger {
  background: var(--bg);
  border-color: var(--err);
  color: var(--err-strong);
}

/* The last step of something that can't be taken back, once its name has
   been typed (Delete this project, FR-PRJ-10): filled in the danger colour,
   so it can't be mistaken for the outlined actions that only open a
   question. Hovered, the fill deepens, as the primary's does. */
button.danger-filled {
  background: var(--err-emphasis);
  border-color: var(--err-emphasis);
  color: var(--fg-on-emphasis);
}

button.danger-filled:hover:not(:disabled, [aria-disabled="true"]) {
  filter: brightness(0.92);
}

/* A quiet button offers a copy of something rather than acting on it (the
   spec's Copy markdown, Download .md, Copy GitHub link): smaller, without a
   ground or an edge until hovered, so it doesn't read as one of the page's
   actions (FR-UI-18). */
button.quiet,
.button.quiet {
  min-height: 1.75rem;
  padding: var(--space-1) var(--space-3);
  background: transparent;
  border-color: transparent;
  color: var(--fg-muted);
  font-size: var(--text-sm);
  font-weight: 400;
}

button.quiet:hover:not(:disabled, [aria-disabled="true"]),
.button.quiet:hover:not(:disabled, [aria-disabled="true"]) {
  background: var(--bg-subtle);
  color: var(--fg);
  box-shadow: none;
}

/* A button that can't be pressed looks it, whatever its variant: Save while
   a reply runs (FR-EDIT-10), a blocked Approve (FR-VOTE-01). This comes after
   every variant above, so none of them outranks it, and it takes away the
   lift, the shadow, the brightening and the sheen (NFR-UX-04). */
:is(button, .button):is(:disabled, [aria-disabled="true"]) {
  background: var(--bg-raised);
  color: var(--fg-subtle);
  border-color: var(--border);
  filter: none;
  transform: none;
  box-shadow: none;
  cursor: not-allowed;
}

:is(button, .button):is(:disabled, [aria-disabled="true"])::before {
  display: none;
}

/* The button that started a request, while it runs (marked by
   `frontend/src/motion.ts`). A reply can stream for a minute; the ring says
   the click was heard and the page is still working. */
button[aria-busy="true"] {
  cursor: progress;
}

button[aria-busy="true"]::after {
  content: "";
  flex: 0 0 auto;
  width: 0.875em;
  height: 0.875em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 999px;
  opacity: 0.75;
  animation: spin 700ms linear infinite var(--loop);
}

/* Forms are layout, not content: they should not force a line break of their
   own next to the button they wrap. */
form.inline {
  display: inline;
}

/* --------------------------------------------------------------- header */

.site-header {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding: var(--space-3) var(--space-5);
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--fg);
  text-decoration: none;
}

.brand-logo {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  transition: transform var(--duration-slow) var(--ease-spring);
}

/* The logo tips its hat when you reach for home. */
.brand:hover .brand-logo {
  transform: rotate(-8deg) scale(1.08);
}

.login-logo {
  width: 96px;
  height: 96px;
}

.goto-issue {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 1 1 auto;
  max-width: 32rem;
}

/* FR-PRJ-09: the box's name, on screen as B.2 draws it, so it doesn't read
   as a search box once the placeholder goes; a phone hides the words. */
.goto-label {
  font-size: var(--text-sm);
  color: var(--fg-muted);
  white-space: nowrap;
}

.goto-field {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
}

.goto-issue input {
  flex: 1 1 auto;
  min-width: 0;
}

/* FR-UI-13: `/` named inside the end of the box while it is empty and
   unfocused, on a wide screen with a keyboard; it never takes a click
   meant for the box. */
.goto-key {
  position: absolute;
  inset-inline-end: var(--space-2);
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

/* On a phone too; a touch-only device hides it as every key hint. */
@media (max-width: 600px) {
  .goto-key {
    display: none;
  }
}

.goto-field > input:is(:focus, :not(:placeholder-shown)) + .goto-key {
  display: none;
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-left: auto;
  font-size: var(--text-sm);
}

.site-header .user {
  color: var(--fg-muted);
}

/* FR-UI-13: the viewer's name leads to their preferences. The picture
   beside it keeps a link's line from reaching the name, so the name draws
   its own, and the current page's on the preferences page. */
.site-header .user .name {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.site-header .user:hover {
  color: var(--fg);
}

.site-header .user[aria-current] .name {
  color: var(--fg);
  font-weight: 600;
  text-decoration: underline 2px var(--accent);
  text-underline-offset: 0.3em;
}

/* The header's link to where the viewer is (Admin on the admin pages) is
   drawn as current, not only marked so: in the text colour, bold, with the
   accent underline the current tab has. */
.site-header nav > a[aria-current] {
  color: var(--fg);
  font-weight: 600;
  text-decoration: underline 2px var(--accent);
  text-underline-offset: 0.3em;
}

/* --------------------------------------------------------------- layout */

main {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--space-5);
}

/* The spec-beside-sidebar layout of B.4 and B.6. */
.columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--sidebar);
  gap: var(--space-6);
  align-items: start;
}

/* The sidebar stays in view beside a long spec or diff, but never grows past
   the window: with the issue's body open, or a blocked Approve and its lint
   list, the rest (Refresh issue, Reject, the votes) would sit below the fold
   until the page ended. A taller one scrolls within itself instead, and its
   end doesn't hand the scroll on to the page (FR-UI-12). The inset keeps a
   focus ring inside the box, which would otherwise clip it. */
.columns > aside {
  position: sticky;
  top: var(--space-4);
  max-height: calc(100dvh - 2 * var(--space-4));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-1);
  margin: calc(-1 * var(--space-1));
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  font-size: var(--text-sm);
}

/* Each panel keeps its full height. A panel clips its rounded corners
   (overflow: hidden), and a flex item that clips may shrink below its
   content, so under the cap the panels would each lose their end (Refresh
   issue, Reject, the last vote) instead of the sidebar scrolling. */
.columns > aside > * {
  flex-shrink: 0;
}

/* After a refused vote the vote panel comes first in the page, so the
   refusal at its top is read, and reached with Tab, before the diff
   (FR-VOTE-13); beside the diff it keeps its place on the right. */
.columns.vote-first > .diff-column {
  grid-column: 1;
  grid-row: 1;
}

.columns.vote-first > aside {
  grid-column: 2;
  grid-row: 1;
}

@media (max-width: 900px) {
  .columns {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Under the main column the sidebar is part of the page again. */
  .columns > aside {
    position: static;
    max-height: none;
    overflow-y: visible;
  }

  /* One column: the vote panel, first in the page after a refused vote,
     is drawn first too, above the diff rather than below all of it
     (FR-VOTE-13). */
  .columns.vote-first > .diff-column,
  .columns.vote-first > aside {
    grid-column: auto;
    grid-row: auto;
  }

  .site-header {
    flex-wrap: wrap;
  }
}

/* A phone (FR-UI-12): Specter and the nav share the first row and the
   pasted-issue box takes the full width under them, rather than three rows
   of header before any content; the side gutters narrow to 16 px. */
@media (max-width: 600px) {
  .site-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: var(--space-2) var(--space-4);
    padding: var(--space-3) var(--space-4);
  }

  .goto-issue {
    grid-column: 1 / -1;
    grid-row: 2;
    max-width: none;
  }

  /* The box says what it is in its placeholder and to a screen reader;
     the words beside it would cost the box a third of its width. */
  .goto-label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    white-space: nowrap;
    clip-path: inset(50%);
    border: 0;
  }

  .site-header nav {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--space-2) var(--space-3);
  }

  main {
    padding: var(--space-4);
  }
}

/* ------------------------------------------------------------ page head */

/* The shared identity block every spec page renders (B.4 … B.7), and the
   bootstrap run page and its coverage report, with their breadcrumb
   (FR-BOOT-17, FR-BOOT-20). */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.page-head > div {
  flex: 1 1 22rem;
  min-width: 0;
}

.page-head h1 {
  margin: var(--space-1) 0 0;
  font-size: var(--text-page);
}

/* Below 600 px the title is a step smaller, so a long issue title leaves
   the tabs, and the spec under them, on the first screen (FR-UI-12). */
@media (max-width: 600px) {
  .page-head h1 {
    font-size: var(--text-lg);
    line-height: 1.25;
  }
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

.breadcrumb .number {
  font-family: var(--font-mono);
}

.page-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin: var(--space-3) 0 0;
  font-size: var(--text-sm);
  color: var(--fg-muted);
  /* Cuts off a fact's dot that would start a wrapped row (below): the left
     edge is a focus ring's width out, so a focused link at a row's start
     keeps its whole ring, and the other edges 8 px out. The review page's
     Vote ↓, drawn over the line once focused, reaches further, so the line
     drops the clip while it has focus (below) (FR-UI-12). */
  clip-path: inset(-0.5rem -0.5rem -0.5rem calc(-1 * var(--space-1)));
}

/* What this page is ("Editing version 3", "Review of version 3, compared
   with version 2"), first under the spec's title on every tab: in the text
   colour, so it reads as the page's name and the facts after it as quieter
   (FR-UI-16). */
.page-label {
  color: var(--fg);
  font-weight: 500;
}

/* What a baseline spec records and how it is approved, one quiet sentence
   under its head on every tab, its run linked (FR-BOOT-22). */
.baseline-of {
  max-width: var(--measure);
  margin: var(--space-2) 0 0;
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

/* The Spec tab's facts after the status chip (B.4, FR-UI-16): the commit
   an implemented spec was implemented in, when and by whom the version was
   made, the votes, where it is stored, then Issue #4 ↗, each set off by a
   quiet dot, drawn only, not read. The dot sits in the gap before its
   fact, out of the fact's flow, and outside the issue's link, in the span
   around it, so it is neither underlined nor clicked with the link; the
   line's clip cuts it off where the fact starts a wrapped row (FR-UI-12). */
.page-meta > :is(.meta-implemented, .meta-changed, .meta-votes, .stored),
.page-meta
  > :is(.meta-implemented, .meta-changed, .meta-votes, .stored)
  ~ .meta-github {
  position: relative;
}

.page-meta
  > :is(.meta-implemented, .meta-changed, .meta-votes, .stored)::before,
.page-meta
  > :is(.meta-implemented, .meta-changed, .meta-votes, .stored)
  ~ .meta-github::before {
  content: "·" / "";
  position: absolute;
  right: 100%;
  width: var(--space-3);
  text-align: center;
  color: var(--fg-muted);
}

/* And how many of the spec's items later specs superseded (FR-UI-27),
   on the Spec tab and a version's page alike. */
.page-meta > .meta-superseded::before {
  content: "·" / "";
  margin-right: var(--space-3);
  color: var(--fg-muted);
}

/* That line stays one line while it can: the tabs drop below the head
   before it would wrap, and the title wraps in whatever width is left. */
.page-head:where(:has(.meta-votes)) > div {
  flex-basis: auto;
}

.page-head:where(:has(.meta-votes)) h1 {
  contain: inline-size;
}

/* The review page's way to its vote panel. Once the panel follows the diff
   (below 900 px), the link on the line under the title saves scrolling past
   all of it (FR-UI-12). Beside the diff the panel is in view, but the
   keyboard reaches it only after every link in the diff, so the link is
   still there, drawn only once it has focus, as the skip link is
   (FR-UI-26). */
@media (min-width: 901px) {
  .jump-to-vote:not(:focus) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    white-space: nowrap;
    clip-path: inset(50%);
  }

  .jump-to-vote:focus {
    position: absolute;
    z-index: 10;
    padding: var(--space-2) var(--space-4);
    background: var(--bg);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    white-space: nowrap;
  }

  /* Focused, its box and ring reach past the line's clip above and below;
     the review's line draws no dots, so dropping the clip cuts nothing
     (FR-UI-12). */
  .page-meta:has(> .jump-to-vote:focus) {
    clip-path: none;
  }
}

/* Edit / Review / History stop reading as prose and start reading as the
   navigation they are. */
.spec-nav {
  display: flex;
  flex-wrap: wrap;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.spec-nav > a,
.spec-nav > span {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  background: var(--bg-subtle);
  color: var(--fg);
  text-decoration: none;
  border-right: 1px solid var(--border);
  transition-property: background-color, box-shadow;
  transition-duration: var(--duration-fast);
  transition-timing-function: var(--ease);
}

.spec-nav > a:hover {
  background: var(--bg);
}

/* The strip clips what overflows its rounded corners, so a tab draws its
   focus ring inside itself rather than outside, where it would be cut off
   (NFR-UX-01). */
.spec-nav > a:focus-visible {
  outline-offset: -3px;
}

.spec-nav > :last-child {
  border-right: 0;
}

.spec-nav > [aria-current="page"] {
  background: var(--bg);
  font-weight: 500;
  box-shadow: inset 0 -2px 0 var(--accent);
}

/* A phone (FR-UI-12): the five tabs stay on one row across the width,
   sharing it, their sides narrower and their names centred; all five fit
   at 360 px. Should a name ever not fit, the strip scrolls sideways rather
   than wrapping, and the bundle brings the current tab into view
   (`frontend/src/tabs.ts`). */
@media (max-width: 600px) {
  .spec-nav {
    position: relative;
    flex: 1 1 100%;
    flex-wrap: nowrap;
    min-width: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
  }

  .spec-nav > a,
  .spec-nav > span {
    flex: 1 1 auto;
    padding-inline: var(--space-2);
    text-align: center;
    white-space: nowrap;
  }
}

/* On a page beneath a tab (a version under History, the plan's review
   under Architecture) the tab is a link back to its own page, marked as
   where you are: drawn as the current tab, and underlined on hover since
   it can be followed (FR-UI-16). */
.spec-nav > a[aria-current="location"] {
  background: var(--bg);
  font-weight: 500;
  box-shadow: inset 0 -2px 0 var(--accent);
}

.spec-nav > a[aria-current="location"]:hover {
  text-decoration: underline;
}

/* The architecture's own pages, a second row under the head on each of
   them (FR-ARCH-11): quieter than the spec's tabs, the current one
   underlined in the accent, a version's page marking History as where it
   is. */
.arch-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin: calc(-1 * var(--space-3)) 0 var(--space-5);
  border-bottom: 1px solid var(--border);
}

.arch-nav > a,
.arch-nav > span {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--fg-muted);
  text-decoration: none;
}

.arch-nav > a:hover {
  color: var(--fg);
  text-decoration: underline;
}

.arch-nav > a:focus-visible {
  outline-offset: -3px;
}

.arch-nav > [aria-current] {
  color: var(--fg);
  font-weight: 500;
  box-shadow: inset 0 -2px 0 var(--accent);
}

/* ----------------------------------------------------------------- chips */

.chip,
.label,
.state {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.125rem 0.5rem;
  font-size: var(--text-xs);
  border-radius: 999px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  color: var(--fg);
}

.chip.approved,
.chip.ready,
.state.open {
  background: var(--ok-bg);
  border-color: var(--ok-border);
  color: var(--ok-strong);
}

.chip.implemented {
  background: var(--accent-bg);
  border-color: var(--accent-border);
  color: var(--accent);
}

/* Muted by the fill, not by fading the words, which must still be read
   (NFR-UX-04). */
.chip.abandoned,
.chip.dropped,
.state.closed {
  background: var(--bg-subtle);
  color: var(--fg-muted);
}

/* The editor's text started from an older version (FR-EDIT-28), a
   bootstrap step waits to retry or stopped (FR-BOOT-17), a project's
   commits are paused (FR-PRJ-15), or a listed spec's issue is gone
   (FR-PRJ-08): the warning colours of the notice that says so. */
.chip.outdated,
.chip.waiting,
.chip.paused,
.chip.gone {
  background: var(--warn-bg);
  border-color: var(--warn-border);
  color: var(--warn-strong);
}

/* A baseline spec, beside its status in its head and in the lists
   (FR-BOOT-22): outlined rather than filled, so it reads as the kind of
   spec it is, not as another state. */
.chip.baseline {
  background: transparent;
  border-style: dashed;
  border-color: var(--accent-border);
  color: var(--accent);
}

/* ---------------------------------------------------------------- panels */

aside section,
.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

aside section > h2,
.panel > h2 {
  margin: 0;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
}

aside section > :not(h2),
.panel > :not(h2) {
  margin: 0;
  padding: var(--space-3) var(--space-4);
}

/* What the viewer's Refresh issue just did, and when the issue as shown
   was read from GitHub (FR-ISS-13): two quiet lines under the Issue
   panel's heading, close to each other; a promoted spec's way back to its
   exploration (X16) is a third. */
aside section > .refresh-outcome,
aside section > .fetched {
  padding-bottom: 0;
  font-size: var(--text-sm);
}

aside section > .refresh-outcome {
  color: var(--ok-strong);
}

aside section > .fetched {
  color: var(--fg-muted);
}

aside section > .explored {
  padding-bottom: 0;
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

/* Where a transferred issue went (FR-ISS-13): a quiet line under "Last
   read", its links in the link colour. */
aside section > .moved-to {
  padding-bottom: 0;
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

/* The verdict on whether the issue needs a spec (FR-ISS-14, FR-ISS-16):
   one quiet line under when the issue was fetched. */
aside section > .triage-verdict {
  margin: 0;
  padding-bottom: 0;
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

/* What blocks approval, under the viewer's vote on the Spec tab, close to
   it and in the warning colour the review page's notice uses; each count
   leads to its list there (FR-VOTE-11, FR-VOTE-12). */
aside section > .vote-blocked {
  padding-top: 0;
  font-size: var(--text-sm);
  color: var(--warn-strong);
}

aside dl {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: var(--space-1) var(--space-3);
}

aside dt {
  color: var(--fg-muted);
}

aside dd {
  margin: 0;
}

/* --------------------------------------------------------------- notices */

.notice,
.issue-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
}

.notice > p,
.issue-banner > p {
  margin: 0;
  flex: 1 1 18rem;
}

.notice > form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

/* An action in a notice that asks first (the editor's Return to draft…,
   FR-EDIT-26) sits beside the words until opened; opened, what it does and
   its button take a line of their own under them (FR-UI-18). */
.notice > .ask-first[open] {
  flex-basis: 100%;
}

/* A flag on the spec, or something that couldn't be checked just now
   ("Couldn't reach GitHub to check your access to 3 projects", FR-PRJ-11). */
.notice.flag,
.notice.warn {
  background: var(--warn-bg);
  border-color: var(--warn-border);
  border-left-color: var(--warn);
  color: var(--warn-strong);
}

.notice.gone,
.notice.error {
  background: var(--err-bg);
  border-color: var(--err-border);
  border-left-color: var(--err);
  color: var(--err-strong);
}

/* Something went through: "Saved version 7 · “note” · See what changed →"
   (FR-EDIT-27). */
.notice.done {
  background: var(--ok-bg);
  border-color: var(--ok-border);
  border-left-color: var(--ok);
  color: var(--ok-strong);
}

/* The note a registration's landing says once (FR-ADM-03): who can now use
   Specter, Copy address, and where specs start, each on a line of its own. */
.registered-note > p {
  flex-basis: 100%;
}

/* What blocks approval (FR-VOTE-12): a standing state of the spec, not a
   refusal just made, so it is drawn in the yellow of a flag, which blocks
   approval too, and it doesn't shake as a failure does. */
.notice.blocked {
  display: block;
  background: var(--warn-bg);
  border-color: var(--warn-border);
  border-left-color: var(--warn);
  color: var(--warn-strong);
}

/* A problem said beside the form or field it is about ("Enter the key.",
   "Could not list the App's repositories"): the same red box everywhere,
   left-aligned where it is read (FR-UI-10). A warning is its yellow twin. */
.error,
.warning {
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  border: 1px solid;
  border-left-width: 4px;
  border-radius: var(--radius);
}

.error {
  color: var(--err-strong);
  background: var(--err-bg);
  border-color: var(--err-border);
  border-left-color: var(--err);
}

.warning {
  color: var(--warn-strong);
  background: var(--warn-bg);
  border-color: var(--warn-border);
  border-left-color: var(--warn);
}

/* "The model is writing a reply started by alice. The spec is read-only
   until it finishes." (FR-EDIT-10). */
.notice.busy {
  background: var(--bg-subtle);
  border-color: var(--border);
  border-left-color: var(--fg-muted);
  color: var(--fg);
}

/* The model is writing right now: a slow pulse, so the banner reads as
   live rather than as a note left behind. */
.notice.busy::before,
.generation-status.busy::before {
  content: "";
  flex: 0 0 auto;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: currentColor;
  animation: pulse 1.6s ease-in-out infinite var(--loop);
}

/* --------------------------------------------------------- status colours */

.ok {
  color: var(--ok-strong);
}

.err {
  color: var(--err-strong);
}

/* The LLM connection test answers beside its button, as B.8 draws it
   ("[Test connection] → ok (1.8 s)", FR-LLM-07). */
.llm-test {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.llm-test .ok,
.llm-test .error {
  margin: 0;
}

.muted {
  color: var(--fg-muted);
  font-size: var(--text-sm);
}

.empty {
  padding: var(--space-6);
  text-align: center;
  color: var(--fg-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}

/* A whole page for a failure (FR-UI-10): what happened in words, one
   sentence, a way on, and the status code in small print. */
.error-page {
  max-width: 34rem;
  margin: var(--space-7) auto;
}

.error-page h1 {
  margin: 0 0 var(--space-3);
}

/* The no-spec page for a number that can't have a spec (a pull request,
   an issue moved, deleted or not found, FR-URL-05) ends the same way. */
.error-page .way-on,
.unusable-number .way-on {
  margin-top: var(--space-5);
}

.error-page .error-code,
.unusable-number .error-code {
  color: var(--fg-muted);
  font-size: var(--text-sm);
}

/* ----------------------------------------------------------------- votes */

.votes {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-left: 0;
}

/* In a sidebar panel the list takes the panel's inset, so each verdict sits
   inside the card, under the heading's text, not on its border. */
aside section > .votes {
  padding: var(--space-3) var(--space-4);
}

.vote {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}

.vote .verdict {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 999px;
  font-size: var(--text-xs);
  line-height: 1;
}

.vote.approved .verdict {
  background: var(--ok-bg);
  border: 1px solid var(--ok-border);
  color: var(--ok-strong);
}

.vote.rejected .verdict {
  background: var(--err-bg);
  border: 1px solid var(--err-border);
  color: var(--err-strong);
}

.vote .reason {
  display: block;
  color: var(--fg-muted);
  /* A reason may be several lines; show the breaks the author typed. */
  white-space: pre-wrap;
}

.tally .for {
  color: var(--ok-strong);
}

.tally .against {
  color: var(--err-strong);
}

/* A vote a Return to draft or its voter withdrew stays in the list, struck
   through by its `<s>` and quiet, verdict and all, under the words that
   say who withdrew it (FR-EDIT-15, FR-VOTE-08). */
.vote.withdrawn {
  color: var(--fg-muted);
}

.vote.withdrawn .verdict {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--fg-muted);
}

/* Who withdrew the votes under it, or which earlier version the votes
   under it are on (FR-VOTE-08): a quiet line close to its list. */
.withdrawn-votes > p,
.earlier-votes > p {
  margin: 0;
  color: var(--fg-muted);
}

.withdrawn-votes > .votes,
.earlier-votes > .votes {
  margin: var(--space-2) 0 0;
}

.earlier-votes > .withdrawn-votes {
  margin-top: var(--space-3);
}

/* A teammate's rejection of an older version that an approval would go
   over unanswered (FR-VOTE-08, FR-VOTE-11, FR-ARCH-11): quiet lines, in
   the panel under its votes and just above Approve, which they describe. */
.unanswered-rejections {
  display: grid;
  gap: var(--space-1);
  margin: var(--space-2) 0;
  padding: 0;
  list-style: none;
  color: var(--fg-muted);
  font-size: var(--text-xs);
}

/* In a sidebar panel, under its votes, the lines take the panel's inset. */
aside section > .unanswered-rejections {
  padding: 0 var(--space-4) var(--space-3);
}

/* Where the viewer stands on the version (FR-VOTE-11): in the text colour,
   and apart from the votes listed above it. */
.your-vote {
  color: var(--fg);
  font-weight: 500;
}

aside section > :not(h2) + .your-vote {
  border-top: 1px solid var(--border);
}

/* The head's maker is asked to get a teammate's review (FR-VOTE-11): under
   the line, close to it, a quiet Copy review link, its text in line with
   the line's, and Review and vote after it, quieter still. */
aside section > .your-vote + .review-ask {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-3);
  padding-top: 0;
}

.review-ask > button.quiet {
  margin-left: calc(-1 * var(--space-3));
}

/* The editor's saved line ends with the same button after its dot, its
   words a space from the dot as the link's before it are, and at the line's
   start when it wraps there, rather than a quiet button's inset away
   (FR-EDIT-27). */
.notice.done .copy-review > button.quiet {
  margin-left: calc(-1 * var(--space-3));
}

/* To everyone else, that a draft no one has voted on is ready for review
   (FR-VOTE-11): in the colour of a passing check, apart from the votes
   above it, with their vote line close under it. */
.ready-for-review {
  color: var(--ok-strong);
}

aside section > :not(h2) + .ready-for-review {
  border-top: 1px solid var(--border);
}

aside section > .ready-for-review + .your-vote {
  border-top: none;
  padding-top: 0;
}

.your-vote .reason {
  display: block;
  font-weight: 400;
  color: var(--fg-muted);
  white-space: pre-wrap;
}

/* On a baseline's review page, how it is approved follows where the viewer
   stands, and their rejection of an earlier version when it is quoted, with
   no gap between them (FR-BOOT-22, FR-VOTE-11). */
aside section > .your-vote + .baseline-moves,
aside section > .your-earlier-vote + .baseline-moves {
  padding-top: 0;
}

.baseline-moves > .baseline-approval {
  margin-top: 0;
}

/* The viewer's rejection of an earlier version, quoted under where they
   stand on the head: what the head was meant to answer (FR-VOTE-11). */
.your-earlier-vote {
  color: var(--fg-muted);
}

.your-earlier-vote .reason {
  display: block;
  white-space: pre-wrap;
}

/* A version's votes, under its text (B.7). */
.version-votes {
  max-width: var(--measure);
  margin: var(--space-6) 0 var(--space-4);
}

/* Where a version stands among the others (FR-HIST-12, B.7): ← v2,
   Version 3 of 7, v4 →, View current. */
.version-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  margin: 0 0 var(--space-4);
  font-size: var(--text-sm);
}

.version-of {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--fg-muted);
}

/* Its note, what it changed and its message, one quiet line over the
   text (FR-HIST-12). */
.version-facts {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1) var(--space-4);
  max-width: var(--measure);
  margin: 0 0 var(--space-4);
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

/* The key over its marked text: the marks' swatch and what they show
   (FR-HIST-12, FR-EDIT-07), a quiet line rather than the Spec tab's bar,
   since the page has no actions on the marks. */
.version-marks {
  max-width: var(--measure);
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

/* History's count of what a version changed, leading to its changes on
   its page (FR-HIST-07): kept on one line, its signs' colours kept. */
.diff-link {
  white-space: nowrap;
  text-underline-offset: 0.2em;
}

/* What it changed from its parent, under its text (FR-HIST-12). */
.version-changes {
  max-width: var(--measure);
  margin-top: var(--space-6);
}

/* Restore or Undo with what it will make said under it, or why neither
   applies (FR-HIST-12). */
.version-offer {
  max-width: var(--measure);
  margin: var(--space-4) 0;
}

.version-offer > .hint,
.version-offer > .error {
  margin-top: var(--space-2);
}

/* Why restore? (FR-HIST-09): its label over a row holding the one-line box
   and Restore this version beside it, the box taking the room the button
   leaves; on a narrow screen the button wraps under the box. */
.version-offer-note {
  display: block;
  margin-bottom: var(--space-1);
  font-size: var(--text-sm);
}

.version-offer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.version-offer-row > input {
  flex: 1 1 14rem;
  min-width: 0;
}

/* What Restore would change from the current version, folded under the
   line comparing them (FR-HIST-12). */
.version-compared-changes {
  margin-top: var(--space-2);
}

/* ------------------------------------------------------------ spec prose */

.spec {
  max-width: var(--measure);
  font-size: var(--text);
  /* A long code span or URL breaks onto the next line rather than running
     under the sidebar or off the page (FR-UI-12). `break-word` rather than
     `anywhere`, so a table cell keeps its words whole and the table scrolls
     instead of squeezing them letter by letter. */
  overflow-wrap: break-word;
}

.spec h1 {
  font-size: var(--text-page);
}

.spec h2 {
  font-size: var(--text-lg);
  margin-top: var(--space-6);
}

.spec h3 {
  font-size: var(--text-md);
}

/* A spec, a plan or notes shown inside one of the page's sections, under
   that section's own heading (the Architecture tab's plan and design
   notes, an abandoned spec's plan, the Spec tab's design notes): their
   headings step down one, so they read as its parts rather than as more of
   the page's sections (FR-UI-24). As specific as the rules above, which
   they follow. */
:where(section) .spec h1 {
  font-size: var(--text-lg);
}

:where(section) .spec h2 {
  font-size: var(--text-md);
}

:where(section) .spec h3 {
  font-size: var(--text);
}

/* Design notes and a plan step down in the markup as well (FR-UI-24):
   the notes two levels (`#` is an h3, under **Design notes**), a plan one
   (`##` is an h3, under **Version 1**). Keyed to their boxes, after the
   rules above, so they look as they did when the step was size alone; the
   notes' **Rejected** keeps its own rule, which outranks these. What were
   their h2s keep a spec's space above an h2, what were h2s and h3s the
   line height and spacing every h1 to h3 has, and both the browser's
   margins for an h2 and an h3 (0.83em, 1em) rather than a lower level's. */
.design-notes-text h3,
.arch-notes-text h3 {
  font-size: var(--text-lg);
}

.design-notes-text h4,
.arch-notes-text h4 {
  font-size: var(--text-md);
  margin-top: var(--space-6);
  margin-bottom: 0.83em;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.design-notes-text h5,
.arch-notes-text h5 {
  font-size: var(--text);
  margin-block: 1em;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.design-notes-text h6,
.arch-notes-text h6 {
  font-size: 1em;
}

.arch-plan h3 {
  font-size: var(--text-md);
}

.arch-plan h4 {
  font-size: var(--text);
}

/* Only a plan inside a section steps down: a version's own page, where it
   keeps its levels, has it in none, and its h3s stay as they were. */
:where(section) .arch-plan h3 {
  margin-top: var(--space-6);
  margin-bottom: 0.83em;
}

:where(section) .arch-plan h4 {
  margin-block: 1em;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.spec li {
  margin-bottom: var(--space-2);
}

article.spec .importance-line.importance-important,
article.spec li.importance-check.importance-important {
  background: var(--accent-bg);
  border-radius: var(--radius);
  box-shadow: 0 0 0 var(--space-1) var(--accent-bg);
}

article.spec .importance-line.importance-boilerplate,
article.spec li.importance-check.importance-boilerplate {
  opacity: 0.55;
}

article.spec
  li:has(> .importance-line.importance-boilerplate):hover
  > .importance-line,
article.spec
  li:has(> .importance-line.importance-boilerplate):hover
  > ul
  > li.importance-check,
article.spec
  li:has(> .importance-line.importance-boilerplate):hover
  > ol
  > li.importance-check {
  opacity: 1;
}

/* A fenced block in one item (a diagram, a schema) makes the whole list
   loose, wrapping every item's text in a paragraph with its own margins:
   the list then looks as a tight one does, each item close to its checks,
   with a small gap kept only around a block inside an item, and between
   two paragraphs of one item (design notes, a plan). As specific as a
   class and a paragraph, so the paragraph rules after it still win where
   they meet. */
.spec :where(li) > p {
  margin-block: 0;
}

.spec :where(li > p) + p {
  margin-top: var(--space-2);
}

.spec li > :is(pre, figure.diagram) {
  margin-block: var(--space-2);
}

.spec code,
.spec pre {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

.spec code {
  padding: 0.1em 0.35em;
  background: var(--bg-raised);
  border-radius: 4px;
}

.spec pre {
  position: relative;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-inset);
  border-radius: var(--radius);
  overflow-x: auto;
}

.spec pre code {
  padding: 0;
  background: none;
}

/* A table as wide as its content, up to the column, and past that it
   scrolls sideways in its own box (FR-UI-12). The cells keep their table
   layout inside it. */
.spec table {
  position: relative;
  display: block;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  border-collapse: collapse;
}

.spec th,
.spec td {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  text-align: left;
}

.spec blockquote {
  margin-inline: 0;
  padding-left: var(--space-4);
  border-left: 3px solid var(--border);
  color: var(--fg-muted);
}

/* A Mermaid block the bundle drew (FR-UI-19): the diagram, centred in the
   column and, should it be wider, scrolling sideways in its own box as a
   table does (FR-UI-12), with its source folded under it. */
.diagram {
  margin: var(--space-4) 0;
}

.diagram-drawing {
  position: relative;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.diagram-drawing > svg {
  display: block;
  margin-inline: auto;
}

/* On a dark page, a diagram's light copy, drawn for paper (diagrams.ts),
   which the print block shows in place of the dark drawing (NFR-UX-02). */
.diagram-drawing.for-print {
  display: none;
}

/* Keyed by class rather than `.diagram-source > summary`, which would
   descend below `aside details[open] > summary`. */
.diagram-source-summary {
  width: fit-content;
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

/* The one line under a block Mermaid couldn't draw, saying why. */
.diagram-error {
  margin-top: 0;
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

/* Where Mermaid lays a diagram out before it is shown: laid out, so it can
   measure the labels, but out of sight and out of the page's scroll. */
.diagram-scratch {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--measure);
  height: 0;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
}

/* @p IDs are the spec's addresses, and a reader scans for them, so every
   ID, wherever it is drawn (the spec, a version, the editor's preview, the
   review page, the conversation, the outline, lint), is one tag: the one
   the editor folds an item's anchor into, monospace and bold in the accent
   on a ground of its own, edged so it holds on any surface. Its own ground
   keeps its text's contrast whatever it sits on (NFR-UX-04); in forced
   colours the ground goes and the edge stays. An ID broken across lines
   keeps its edges on both. */
.p-id {
  font-family: var(--font-mono);
  font-size: 0.875em;
  font-style: normal;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  padding: 0 0.3em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* An ID that leads to its item (FR-URL-13): underlined, and its edge
   drawn in the accent, once it is pointed at or focused. The underline
   sits inside the tag, clear of its bottom edge, which would hide it. */
a.p-id {
  color: var(--accent);
  text-decoration: none;
}

a.p-id:hover,
a.p-id:focus-visible {
  text-decoration: underline;
  text-underline-offset: 0.12em;
  border-color: var(--accent);
}

/* An item's own ID links to itself (FR-URL-13): a click puts the item's
   address in the address bar to share, and lands on it. It reads as the
   item's label, its tag not underlined, until it is pointed at or
   focused. */
a.item-link {
  text-decoration: none;
}

a.item-link:hover .p-id,
a.item-link:focus-visible .p-id {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.12em;
  border-color: var(--accent);
}

/* An item a later implemented spec superseded (FR-UI-27) is drawn in
   the muted colour, its checks and children with it, but not struck
   through, so it stays readable. The line under its own line says which
   spec superseded it, or proposes to. */
li.superseded {
  color: var(--fg-muted);
}

.superseded-by {
  margin: var(--space-1) 0;
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

/* The Glossary and constitution page (FR-PRJ-19): under each term and
   item, a quiet line naming the specs that use it; under each file, its
   page on GitHub. Keyed to the page: the Spec tab's store state is also
   `.on-github`, a flex item of the line under the title that takes no
   margin. */
.glossary-page .used-by,
.glossary-page .on-github {
  margin: var(--space-1) 0;
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

.glossary-page .on-github {
  margin-bottom: var(--space-5);
}

/* A link around an ID (the outline's, a reference written as a link)
   underlines its words but not the tag, where the line would run inside
   the edge: decoration doesn't reach into an inline block, which at the
   font's own line height is the size the inline tag was. */
a:any-link:not(.item-link) > .p-id {
  display: inline-block;
  line-height: normal;
}

/* An ID among words a change marks (the summary's, a style review's, the
   conversation's) leaves the mark's ground showing, so the change still
   reads: it takes the text's colour there, which the mark is measured
   against (NFR-UX-04), and keeps its edge and weight. */
/* biome-ignore lint/style/noDescendingSpecificity: an item's own ID, which
   the more specific rules above draw, is never among a change's words */
:is(ins, del) > .p-id {
  color: inherit;
  background: none;
}

/* A suspected bug's item outside the specs here (FR-BOOT-18) is named but
   leads nowhere, so its tag takes the text's colours rather than the
   accent every followable ID has; so does an ID in a reason, a note or an
   event's line that no version of the spec ever had (FR-URL-13). */
.bug-item > span.p-id,
.bug-decided > span.p-id,
span.p-id.no-item {
  color: var(--fg);
  background: var(--bg-subtle);
  border-color: var(--border);
}

/* A section heading links to itself (FR-UI-23), as an item's own ID
   does: it reads as the heading until it is pointed at or focused, and a
   followed link lands with the heading clear of the window's top. */
a.section-link {
  color: inherit;
  text-decoration: none;
}

a.section-link:hover,
a.section-link:focus-visible {
  text-decoration: underline;
}

.spec h2[id^="section-"] {
  scroll-margin-top: var(--space-4);
}

/* An item a link lands on keeps the same room above it, so its tag's
   outline doesn't touch the window's edge (FR-UI-23). */
.spec a[id^="~"] {
  scroll-margin-top: var(--space-4);
}

/* The item a followed link landed on: its ID's tag fills in, so it stands
   out among the others (FR-URL-13). */
a[id^="~"]:target {
  background: var(--accent-bg);
  outline: 1px solid var(--accent-border);
  border-radius: var(--radius);
}

a[id^="~"]:target > .p-id {
  color: var(--fg-on-emphasis);
  background: var(--accent-emphasis);
  border-color: var(--accent-emphasis);
}

/* The filled tag is the mark, so the box around it, which fits the line's
   letters rather than the tag, goes. */
a[id^="~"]:target:has(> .p-id) {
  background: none;
  outline: none;
}

/* An item's own ID is a link, so Enter on it both targets and focuses it:
   the focus ring wins over the landing outline, as everywhere (NFR-UX-01). */
a.item-link:target:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* One item's history (FR-HIST-13): a quiet History link just over an
   item's own ID, taking no room, shown while the ID is pointed at or
   either is focused. A touch screen points at nothing, so there it is
   never drawn, and On this page's Items lead to the history instead.
   Faded out it is still in the text, so a copied line leaves it out. */
.item-tag {
  position: relative;
}

.item-history {
  position: absolute;
  bottom: 100%;
  left: 0;
  z-index: 1;
  padding: 0 var(--space-1);
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1.6;
  white-space: nowrap;
  color: var(--accent);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  opacity: 0;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
  transition: opacity var(--duration-fast) var(--ease);
}

.item-tag:hover > .item-history,
.item-tag:focus-within > .item-history {
  opacity: 1;
  pointer-events: auto;
}

@media (hover: none) {
  .item-history {
    display: none;
  }
}

/* What changed since the parent revision (FR-EDIT-07). A rule in the margin
   says "new since you last read this"; the browser's default <mark> says
   "error", and its yellow is unreadable against the dark theme. */
mark.change {
  display: inline;
  background: var(--change-bg);
  box-shadow:
    -0.75rem 0 0 var(--change-bg),
    -1rem 0 0 var(--change-rule);
  color: inherit;
  /* Jump to first change leaves room for its outline above it. */
  scroll-margin-top: var(--space-4);
}

/* A changed line that carries on a paragraph renders mid-line: the margin
   rule would land in the text and cover the words before it, and the tint
   alone is too faint to see, so the rule's colour underlines it instead. */
mark.change.cont {
  box-shadow: none;
  text-decoration-line: underline;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--change-rule);
  text-underline-offset: 0.3em;
}

/* An ID among those words takes no room of its own, as in the diff, so the
   underline, which skips a tag's padding and edge, runs under it unbroken. */
mark.change.cont .p-id {
  padding-inline: 0;
  margin-inline: -1px;
}

/* A change that starts a list item: the margin rule would sit where the
   item's bullet goes and hide it, so the rule is drawn on the item itself,
   to the left of its bullet, and the text keeps the tint (FR-EDIT-07). */
li > mark.change.item,
li > p:first-child > mark.change.item {
  box-shadow: none;
}

li:has(> mark.change.item, > p:first-child > mark.change.item) {
  position: relative;
}

li:has(> mark.change.item, > p:first-child > mark.change.item)::before {
  content: "";
  position: absolute;
  top: 0;
  left: -2.25rem;
  width: 0.25rem;
  height: 1lh;
  background: var(--change-rule);
  animation: mark-rule-in var(--duration-slow) var(--ease) both;
  animation-delay: var(--duration-slow);
}

/* Where Jump to first change lands. */
mark.change:target {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Over the highlighted spec, what the marks are, whose change it was and
   how much, with Jump, Undo and Dismiss (FR-EDIT-07): a quiet bar in the
   marks' own colours, as the editor's is. */
.highlight-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-3);
  max-width: var(--measure);
  margin: 0 0 var(--space-4);
  padding: var(--space-2) var(--space-3);
  border-left: 3px solid var(--change-rule);
  border-radius: var(--radius);
  background: var(--change-bg);
  font-size: var(--text-sm);
}

.highlight-bar > p {
  flex: 1 1 100%;
  margin: 0;
}

.highlight-bar > .highlight-facts {
  color: var(--fg-muted);
}

/* FR-EDIT-07: that Undo leaves the design notes the edit's call set, quiet
   as the facts above it. */
.highlight-bar > .highlight-notes {
  color: var(--fg-muted);
}

/* FR-EDIT-07: and that it leaves the glossary as it is, as quiet. */
.highlight-bar > .highlight-glossary {
  color: var(--fg-muted);
}

.highlight-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-1);
}

.highlight-actions > form {
  display: contents;
}

/* Where the bar was once its highlight is dismissed (FR-EDIT-07): one
   quiet line saying how much the latest version changed, leading to its
   changes. */
.highlight-dismissed {
  max-width: var(--measure);
  margin: 0 0 var(--space-4);
  font-size: var(--text-sm);
  color: var(--fg-muted);
  /* Dismiss highlight lands here, a little clear of the window's top. */
  scroll-margin-top: var(--space-4);
}

/* Its sentence is a paragraph of its own, which a dismissal's announcement
   reads without the link (FR-UI-14), but runs on into the link. */
.highlight-dismissed-words {
  display: inline;
}

/* A spec that is still the empty scaffold (FR-EDIT-32): over its bare
   headings, what comes next and the way to it, in the empty state's dashed
   box. Its text reads left to right as a sentence, not centred. */
.first-draft {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  max-width: var(--measure);
  margin: 0 0 var(--space-5);
  padding: var(--space-4) var(--space-5);
  text-align: left;
}

.first-draft > p {
  margin: 0;
  color: var(--fg);
}

/* The questions the model is waiting on (FR-EDIT-32), folded under the
   line that counts them, a line of their own in the notice. */
.waiting-answers > details {
  flex: 1 1 100%;
}

.waiting-questions > ol {
  margin: var(--space-2) 0 0;
  padding-left: var(--space-5);
}

/* ------------------------------------------------------------------ diff */

.diff {
  position: relative;
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.55;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}

/* A line that wraps continues under its own text, never under its sign,
   where the next line's starts (FR-VOTE-14): its rows after the first hang
   in by the sign and by its leading spaces and list marker, `--hang`, which
   the server counts (`ui::diff::hang`). The diff is monospace, so 1ch is a
   column. */
.diff-line {
  display: block;
  padding: 0 var(--space-3) 0 calc(var(--space-3) + 1ch + var(--hang, 0ch));
  text-indent: calc(-1ch - var(--hang, 0ch));
  white-space: pre-wrap;
  border-left: 3px solid transparent;
}

.diff-line:not(.add, .del) {
  transition: background-color var(--duration-fast) var(--ease);
}

.diff-line:not(.add, .del):hover {
  background-color: var(--bg-subtle);
}

.diff-line.add {
  background: var(--add-bg);
  border-left-color: var(--ok);
}

.diff-line.del {
  background: var(--del-bg);
  border-left-color: var(--err);
}

/* "Added:" or "Removed:" before a changed line, for screen readers
   (FR-VOTE-14), left out of a copied line, which reads as a diff. */
.diff-line > .visually-hidden {
  user-select: none;
}

/* The words an edited line changed (FR-VOTE-14): a stronger tint of the
   line's own, the removed ones struck through as the summary's are. */
.diff-line > ins,
.diff-line > del {
  border-radius: 2px;
}

.diff-line > ins {
  background: var(--add-word-bg);
  text-decoration: none;
}

.diff-line > del {
  background: var(--del-word-bg);
}

/* Forced colours and paper drop the tints, which would leave an added word
   with no mark at all: there it is underlined, as a removed one is struck
   through (FR-VOTE-14). */
@media print, (forced-colors: active) {
  .diff-line > ins {
    text-decoration: underline;
  }
}

/* An ID a shared line links (FR-URL-13) is the diff's own monospace, at the
   size of the text around it, so the columns stay aligned with the added
   and removed lines, which show the same ID unlinked. Its tag takes no
   room either: no padding, and its edge laid over the letters' sides
   (bold keeps a monospace letter's width). */
.diff a.p-id {
  font-size: inherit;
  padding: 0;
  margin-inline: -1px;
}

/* A run of unchanged lines folded under how many there are, one quiet bar
   that opens in place (FR-VOTE-14). Keyed by class rather than
   `.diff-fold > summary`, which would descend below
   `aside details[open] > summary`. */
.diff-fold-summary {
  padding: var(--space-1) var(--space-3);
  font-family: var(--font);
  font-size: var(--text-xs);
  color: var(--fg-muted);
  background: var(--bg-subtle);
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease);
}

.diff-fold-summary:hover {
  color: var(--fg);
}

/* Open, the lines follow the bar straight on, in the review page's vote
   panel too. */
.diff-fold[open] > .diff-fold-summary {
  margin: 0;
}

/* How many places the diff changed, after what it compares (FR-VOTE-14). */
.diff-changes {
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--fg-muted);
}

.diff-stat .added {
  color: var(--ok-strong);
}

.diff-stat .removed {
  color: var(--err-strong);
}

/* Over the empty scaffold the whole head is new, and the collapsed head
   above shows it all, so the diff waits in a closed fold under what it
   adds (FR-VOTE-09). Keyed by class rather than `.scaffold-diff > summary`,
   which would descend below `aside details[open] > summary`. */
.scaffold-base {
  max-width: var(--measure);
  color: var(--fg-muted);
}

.scaffold-diff-summary {
  width: fit-content;
  cursor: pointer;
}

.scaffold-diff[open] > .scaffold-diff-summary {
  margin-bottom: var(--space-3);
}

/* A head that is the empty scaffold has nothing to review: in place of
   the diff, the review page says so under the version, and leads to the
   editor to draft it (FR-VOTE-09). */
.scaffold-head {
  max-width: var(--measure);
  color: var(--fg-muted);
}

/* The spec's one-line summary at the head of its text (FR-UI-20). On the
   review page a changed one strikes the base version's through before the
   new, each tinted as the diff tints its lines. A missing one is `.none`,
   one quiet line, never `.empty`, which would draw the generic dashed
   empty-state box around it. */
.spec-summary {
  margin: 0 0 var(--space-4);
  color: var(--fg);
}

.spec-summary .summary-label {
  font-weight: 600;
}

.spec-summary.none {
  color: var(--fg-muted);
}

.spec-summary del,
.spec-summary ins {
  padding: 0 var(--space-1);
  border-radius: var(--radius);
}

.spec-summary del {
  background: var(--del-bg);
}

.spec-summary ins {
  background: var(--add-bg);
  text-decoration: none;
}

/* The editor's quiet line under the lint summary: the summary every save
   commits, which only the model writes, and how to change it
   (FR-EDIT-39). */
.editor-summary {
  margin: var(--space-2) 0 var(--space-3);
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

.editor-summary .summary-label {
  font-weight: 600;
}

/* Where Show in editor on an edit that changed only the summary lands
   (FR-UI-15). */
#editor-summary:target {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius);
}

/* ---------------------------------------------------------------- tables */

/* A list table wider than the window scrolls sideways in its own box, and
   the page doesn't (FR-UI-12). Like every box that scrolls sideways, it is
   positioned, so it holds what is positioned inside it: a column name or
   label read only to screen readers (`.visually-hidden`) is placed
   absolutely, and without a positioned box around it, it escapes the
   scroll box at its place in a wide row and widens the whole page. */
.table-scroll {
  position: relative;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.specs,
.history {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.specs caption,
.history caption {
  text-align: left;
  padding-bottom: var(--space-2);
  color: var(--fg-muted);
  font-size: var(--text-xs);
}

.specs th,
.history th {
  text-align: left;
  font-weight: 600;
  color: var(--fg-muted);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
}

.specs td,
.history td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--bg-inset);
}

/* A hovered row gains an accent rule at its edge, so the eye can follow it
   across a wide table. */
.specs td:first-child,
.history td:first-child {
  transition: box-shadow var(--duration-fast) var(--ease);
}

.specs tbody tr:hover td:first-child,
.history tbody tr:hover td:first-child {
  box-shadow: inset 2px 0 0 var(--accent);
}

.specs tbody tr,
.history tbody tr {
  transition: background-color var(--duration-fast) var(--ease);
}

.specs tbody tr:hover,
.history tbody tr:hover {
  background: var(--bg-subtle);
}

.history td:first-child a {
  font-family: var(--font-mono);
}

/* A spec list's row (FR-PRJ-08): the number labels it and the title is its
   link; the status chip and "2 hr. ago" stay on one line. */
.specs .number {
  font-family: var(--font-mono);
  color: var(--fg-muted);
  white-space: nowrap;
}

.specs .title a {
  font-weight: 500;
}

.specs .chip,
.specs time {
  white-space: nowrap;
}

/* Under a row's tally, a quiet line saying where the viewer stands on the
   spec and how many questions are open on it (FR-PRJ-14). Muted by
   colour, never faded. */
.specs .mine {
  display: block;
  margin-top: var(--space-1);
  color: var(--fg-muted);
  font-size: var(--text-xs);
}

/* Under a row's status chip, a muted line naming Specter's own part in the
   spec: drafting it now, or its draft that no person has worked on yet
   (FR-PRJ-08, FR-ISS-15), one saying what later specs superseded
   (FR-PRJ-08), and one naming where its plan stands (FR-ARCH-11). Muted
   by colour, never faded. */
.specs :is(.by-specter, .superseded-line, .plan-state) {
  display: block;
  margin-top: var(--space-1);
  color: var(--fg-muted);
  font-size: var(--text-xs);
}

.specs :is(.by-specter, .superseded-line) {
  white-space: nowrap;
}

/* The viewer's line and the plan's say one thing or several: in a column
   too narrow for all of it, they wrap between the things, each kept whole
   with the dot or comma after it, so the table stays inside the page's
   column (FR-PRJ-14, FR-ARCH-11). */
.specs :is(.mine, .plan-state) > .part {
  white-space: nowrap;
}

/* Compact project rows keep the issue and current state in view; secondary
   facts share one native disclosure (FR-PRJ-08, FR-PRJ-14). */
.compact-spec-list {
  table-layout: fixed;
}

.compact-spec-list th:first-child {
  width: 48%;
}

.compact-spec-list td {
  vertical-align: top;
  overflow-wrap: anywhere;
}

.spec-row-details {
  margin-top: var(--space-1);
  color: var(--fg-muted);
  font-size: var(--text-xs);
}

.spec-row-summary {
  width: fit-content;
  max-width: 100%;
  cursor: pointer;
}

.spec-row-details > .change {
  display: block;
  margin-top: var(--space-2);
}

.compact-spec-list .by-specter,
.specs .spec-row-details :is(.superseded-line, .part) {
  white-space: normal;
}

.row-version {
  display: block;
  margin-top: var(--space-1);
  color: var(--fg-muted);
}

@media (max-width: 600px) {
  .spec-list.compact-spec-list > tbody > tr > .title {
    flex-basis: 100%;
  }

  .compact-spec-list .row-version {
    margin-top: 0;
  }
}

/* A version's commit, linked to GitHub (FR-HIST-07, FR-STORE-03), and the
   commit an implemented spec was implemented in (FR-UI-16). */
.history .sha,
.stored .sha,
.meta-implemented .sha {
  font-family: var(--font-mono);
}

/* Each version's way to its message, and Undo beside it while a model edit
   is the head (B.7). */
.history .row-actions {
  white-space: nowrap;
}

.row-actions form {
  display: inline;
  margin-left: var(--space-2);
}

/* Lint as of then, said once under the table (FR-HIST-08). */
.table-scroll + .hint {
  margin-top: var(--space-2);
}

/* Newest and Older under a long history (FR-HIST-07). */
.pager {
  display: flex;
  gap: var(--space-4);
  margin-top: var(--space-3);
  font-size: var(--text-sm);
}

/* A phone (FR-UI-12): a spec list's row, and a History row, is two lines
   rather than a table wider than the screen. The spec list: the number and
   the title, then the status, the version, the votes and the last change,
   and a third line saying where the viewer stands when there is one;
   History: the version with its chips, how and by whom it was made, when,
   and its commit, then what it changed, its votes, its lint and its
   message. The column names stay for screen readers; on screen a dot sets
   the facts apart, and a value that needs its name says it (by bob, Lint:,
   Votes: none), drawn only, not read, since the column names are. */
@media (max-width: 600px) {
  .spec-list,
  table.history,
  .spec-list > tbody,
  table.history > tbody {
    display: block;
  }

  .spec-list > thead,
  table.history > thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    white-space: nowrap;
    clip-path: inset(50%);
  }

  .spec-list > tbody > tr,
  table.history > tbody > tr {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 1em;
    padding: var(--space-2) var(--space-1);
    border-bottom: 1px solid var(--bg-inset);
    /* The row's left padding is a focus ring's width: a dot that would
       start a wrapped line is cut off at the row's edge, and nothing else
       is (below). */
    clip-path: inset(-0.5rem -0.5rem -0.5rem 0);
  }

  /* A version's source and who made it read as one fact (Saved by bob),
     a word apart, as do a spec's number and its title. History's rows keep
     room at their end for the source that ends a line. */
  .spec-list > tbody > tr > .number,
  table.history > tbody > tr > .col-source {
    margin-right: calc(0.35em - 1em);
  }

  table.history > tbody > tr {
    padding-right: calc(1em - 0.35em);
  }

  /* The break between the two lines: the cells after it go below it. */
  .spec-list > tbody > tr::before,
  table.history > tbody > tr::before {
    content: "";
    flex-basis: 100%;
    order: 1;
  }

  .spec-list > tbody > tr > td,
  table.history > tbody > tr > td {
    padding: 0;
    border-bottom: 0;
  }

  .spec-list
    > tbody
    > tr
    > :is(.col-status, .col-version, .col-votes, .col-changed),
  table.history
    > tbody
    > tr
    > :is(.col-change, .col-votes, .col-lint, .row-actions) {
    order: 2;
  }

  /* The title takes the rest of the first line, and wraps under itself. */
  .spec-list > tbody > tr > .title {
    flex: 1 1 0;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  /* Where the viewer stands is a third line of the row, at its start,
     under the facts, and so are Specter's part in the spec, what later
     specs superseded and where its plan stands (FR-PRJ-14, FR-PRJ-08,
     FR-ARCH-11). The status and votes
     cells hand their parts to the row: the chips and the tally keep to the
     second line, and a break puts the quiet lines after it. They stay
     cells to a screen reader. */
  .spec-list > tbody > tr > :is(.col-status, .col-votes) {
    display: contents;
  }

  .spec-list > tbody > tr > :is(.col-status, .col-votes) > * {
    order: 2;
  }

  /* A status and the chips after it, baseline and a gone issue's, stay
     a word apart. */
  .spec-list > tbody > tr > .col-status > .chip:has(+ :is(.baseline, .gone)) {
    margin-right: calc(0.35em - 1em);
  }

  .spec-list
    > tbody
    > tr:has(.by-specter, .superseded-line, .plan-state, .mine)::after {
    content: "";
    flex-basis: 100%;
    order: 3;
  }

  .spec-list
    > tbody
    > tr
    > td
    > :is(.by-specter, .superseded-line, .plan-state, .mine) {
    order: 4;
    margin: var(--space-1) 0 0;
    white-space: normal;
  }

  .spec-list > tbody > tr > td > :is(.plan-state, .mine) > .part {
    white-space: normal;
  }

  /* The accent rule of a hovered row runs down both lines. */
  .spec-list > tbody > tr:hover > td:first-child,
  table.history > tbody > tr:hover > td:first-child {
    box-shadow: none;
  }

  .spec-list > tbody > tr:hover,
  table.history > tbody > tr:hover {
    box-shadow: inset 2px 0 0 var(--accent);
  }

  /* The dot sits in the gap before its fact, out of the fact's flow, so
     the row's clip cuts it off where the fact starts a wrapped line; a
     line never starts with a dot (FR-UI-12). After the fact, so a label
     can come before it. */
  .spec-list > tbody > tr > :is(.col-version, .col-changed),
  .spec-list > tbody > tr > .col-votes > :is(.tally, .mine),
  .spec-list > tbody > tr > .col-status > :is(.superseded-line, .plan-state),
  table.history
    > tbody
    > tr
    > :is(
      .col-source,
      .col-when,
      .col-commit,
      .col-votes,
      .col-lint,
      .row-actions
    ) {
    position: relative;
  }

  .spec-list > tbody > tr > :is(.col-version, .col-changed)::after,
  .spec-list > tbody > tr > .col-votes > :is(.tally, .mine)::after,
  .spec-list
    > tbody
    > tr
    > .col-status
    > :is(.superseded-line, .plan-state)::after,
  table.history
    > tbody
    > tr
    > :is(
      .col-source,
      .col-when,
      .col-commit,
      .col-votes,
      .col-lint,
      .row-actions:not(:empty)
    )::after {
    content: "·" / "";
    position: absolute;
    top: 0;
    right: 100%;
    width: 1em;
    text-align: center;
    color: var(--fg-muted);
  }

  table.history > tbody > tr > .col-by::before {
    content: "by" / "";
    margin-right: 0.35em;
    color: var(--fg-muted);
  }

  table.history > tbody > tr > .col-lint::before {
    content: "Lint:" / "";
    margin-right: 0.35em;
    color: var(--fg-muted);
  }

  /* "none" alone could be anything. */
  .spec-list > tbody > tr > .col-votes > .tally:has(> .muted)::before,
  table.history > tbody > tr > .col-votes:has(> .tally > .muted)::before {
    content: "Votes:" / "";
    margin-right: 0.35em;
    color: var(--fg-muted);
  }
}

/* A version that hasn't reached the docs branch, and why (FR-STORE-03). A
   standing state, not an alert, so it doesn't shake as .err does. */
.store-failed {
  color: var(--err-strong);
}

.store-failed p {
  max-width: 32ch;
  margin: var(--space-1) 0 0;
  white-space: normal;
}

.project {
  margin-bottom: var(--space-6);
  scroll-margin-top: var(--space-4);
}

/* What waits on the viewer, under the dashboard's heading and over its
   projects (FR-PRJ-18): one line each, the rest behind "4 more". */
.waiting-for-you {
  margin: 0 0 var(--space-6);
}

.waiting-for-you > h2 {
  margin: 0 0 var(--space-2);
}

.waiting-for-you > p {
  margin: 0;
}

.waiting-for-you > ul,
.waiting-more > ul {
  margin: 0;
  padding-left: var(--space-5);
  display: grid;
  gap: var(--space-1);
}

.waiting-more {
  margin-top: var(--space-2);
}

.waiting-more-summary {
  cursor: pointer;
  width: fit-content;
}

.waiting-more[open] > .waiting-more-summary {
  margin-bottom: var(--space-1);
}

/* On a touch screen the lines stand further apart and "4 more" is 44 px
   tall, so a tap finds what was meant. */
@media (pointer: coarse) {
  .waiting-for-you > ul,
  .waiting-more > ul {
    gap: var(--space-3);
  }

  .waiting-more-summary {
    padding-block: var(--space-3);
  }
}

/* With four or more projects, one line each over their sections, the
   project changed last first, its name leading to its section below
   (FR-PRJ-08). */
.project-index > ul {
  margin: 0 0 var(--space-5);
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--space-1);
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

/* On a touch screen the lines stand further apart, so a tap finds the
   project meant. */
@media (pointer: coarse) {
  .project-index > ul {
    gap: var(--space-3);
  }
}

/* A project's heading on the dashboard, with All specs beside it rather
   than inside it, so the heading reads as the project's name alone
   (FR-PRJ-08). */
.project-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-3);
  margin: var(--space-4) 0;
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
}

.project-head > h2 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-3);
  margin: 0;
  font-size: var(--text-lg);
}

.all-specs {
  margin-left: auto;
  font-size: var(--text-sm);
  font-weight: 400;
}

.paging {
  margin-top: var(--space-4);
}

/* A later page of the project's list says which specs it shows, under the
   status links, and leads back to the newest above its table as well as
   below it (FR-PRJ-08). */
.list-range {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

.paging:has(+ .table-scroll) {
  margin: 0 0 var(--space-3);
}

/* The project page's quiet row of links to the repository on GitHub,
   under its title (FR-PRJ-08). */
.github-links {
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

/* Each link is kept whole on its line, so a narrow window never leaves its
   ↗ alone at the start of the next (FR-PRJ-08). Keyed by the links' href
   rather than by a, which would sort below .history td:first-child a. */
.github-links > [href] {
  white-space: nowrap;
}

/* Plain links over the project page's list that narrow it to one status
   (FR-PRJ-16); the one shown reads as text, not as a link. */
.status-filter {
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

.status-filter > a[aria-current="page"] {
  color: var(--fg);
  font-weight: 600;
  text-decoration: none;
}

/* A project with no spec yet (FR-PRJ-12): one line on how a spec starts,
   the issue-number box with its rule under it, and the way to a new issue. */
.no-specs {
  display: grid;
  justify-items: center;
  gap: var(--space-2);
}

.no-specs > p {
  margin: 0;
  max-width: 40rem;
}

.open-issue {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

/* ------------------------------------------------------------ issue text */

/* The issue's body and comments are rendered Markdown, so they read as
   prose. They stay in a bounded, scrollable region rather than pushing the
   rest of the sidebar off the page. A long URL or word breaks onto the
   next line, so the box scrolls only up and down (FR-UI-12): `break-word`,
   as `.spec` has, rather than `anywhere`, so a table cell keeps its words
   whole. */
.issue-digest,
.issue-body {
  position: relative;
  max-height: 18rem;
  overflow: auto;
  font-size: var(--text-xs);
  line-height: 1.55;
  background: var(--bg-inset);
  border-radius: var(--radius);
  padding: var(--space-3);
  overflow-wrap: break-word;
}

.issue-body {
  max-height: 24rem;
  font-size: var(--text-sm);
  padding: var(--space-3) var(--space-4);
}

.issue-digest > :first-child,
.issue-body > :first-child {
  margin-top: 0;
}

.issue-digest > :last-child,
.issue-body > :last-child {
  margin-bottom: 0;
}

/* Code blocks and images come through GitHub issues constantly; neither may
   break out of the column it is read in. (`code` keeps the browser's own
   monospace: a rule for it here would sit below `.spec pre code` and never
   apply.) */
.issue-digest pre,
.issue-body pre {
  position: relative;
  padding: var(--space-2);
  background: var(--bg);
  border-radius: var(--radius);
  overflow-x: auto;
}

.issue-digest img,
.issue-body img {
  max-width: 100%;
  height: auto;
}

/* A table too wide for the box scrolls sideways by itself, holding all
   that is in it, rather than making the whole box scroll sideways
   (FR-UI-12). Its cells are edged as a spec's are, so a column's words
   don't run into the next (FR-UI-24), with the box's smaller spacing. */
.issue-digest table,
.issue-body table {
  position: relative;
  display: block;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  border-collapse: collapse;
}

.issue-digest th,
.issue-digest td,
.issue-body th,
.issue-body td {
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--border);
  text-align: left;
}

/* The issue's own headings, two levels down in the markup (FR-UI-24), at
   the box's text size, as a reply's are: none is larger than the text
   around it, in the sidebar's small panel or beside an exploration. */
.issue-digest :is(h1, h2, h3, h4, h5, h6),
.issue-body :is(h1, h2, h3, h4, h5, h6) {
  margin: var(--space-3) 0 var(--space-1);
  font-size: inherit;
  font-weight: 600;
}

/* A quote, with a spec's rule at its left rather than an indent alone. */
.issue-digest blockquote,
.issue-body blockquote {
  margin-inline: 0;
  padding-left: var(--space-3);
  border-left: 3px solid var(--border);
  color: var(--fg-muted);
}

/* A comment is its own block under the body, with the author and date
   above it: without the rule they run together as one long text. */
.issue-comment {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

/* A link to a comment lands on it marked by a rule at its left in the
   accent, which stands out from the page as a focus ring does, and is a
   border, which a contrast theme keeps where it drops shadows
   (FR-ISS-13, FR-PRJ-09). */
.issue-comment:target {
  border-left: 3px solid var(--accent);
  padding-left: var(--space-2);
}

/* The comment's time leads to it on GitHub, in the byline's own colour. */
.comment-link {
  color: inherit;
}

/* What the latest refresh did to a comment, after its byline (FR-ISS-13):
   a new one in the accent, an edited one plain. */
.byline .chip {
  margin-left: var(--space-1);
  font-weight: 500;
}

.chip.new {
  background: var(--accent-bg);
  border-color: var(--accent-border);
  color: var(--accent);
}

.byline {
  margin-bottom: var(--space-1);
  color: var(--fg-muted);
  font-weight: 600;
}

/* The rule divides a comment from what comes before it in the box, so a
   comment the box opens with, as the rest of a short issue on its page
   does (FR-URL-14), has none: its byline starts the box, as the body's
   first line does. */
.issue-body > .issue-comment:first-child {
  padding-top: 0;
  border-top: none;
}

.issue-body > .issue-comment:first-child > .byline {
  margin-top: 0;
}

.disclosure {
  font-size: var(--text-xs);
  color: var(--fg-muted);
}

/* The spec page's sidebar ends in a footnote rather than a panel (B.4):
   where replies come from (FR-LLM-08) and what the spec's replies have used
   so far (FR-HIST-05). */
.aside-footnote {
  padding: 0 var(--space-1);
}

.aside-footnote > .disclosure {
  margin: 0 0 var(--space-1);
}

/* The spec's outline (FR-UI-23): a quiet list after the sidebar's vote
   rather than one more panel. Each section leads to its heading, its
   count beside it, its items folded under it, children indented. */
.on-this-page {
  padding: 0 var(--space-1);
  color: var(--fg-muted);
}

.on-this-page > h2 {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.outline-sections,
.outline-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.outline-children {
  margin-top: var(--space-1);
  padding-left: var(--space-3);
}

.outline-items {
  margin: var(--space-1) 0 0 var(--space-3);
}

/* Below 900 px the sidebar follows the whole spec, so the outline is a
   closed disclosure above the spec instead, after the summary (FR-UI-23).
   One copy is drawn at each width, so a screen reader hears it once. */
.outline-top {
  display: none;
}

@media (max-width: 900px) {
  .outline-top {
    display: block;
    margin: 0 0 var(--space-4);
    font-size: var(--text-sm);
  }

  .outline-top > details > summary {
    font-weight: 600;
    color: var(--fg);
  }

  .outline-top > details > .outline-sections {
    margin-top: var(--space-2);
  }

  .columns > aside > .on-this-page {
    display: none;
  }
}

/* An item's own history from the outline (FR-HIST-13), on a touch
   screen only: elsewhere it is reached from the item's ID. There it
   stands apart from the item's own link and is padded to a thumb's 44 px
   (FR-UI-12), so a tap finds what was meant. */
.outline-history {
  display: none;
  font-size: var(--text-xs);
}

@media (hover: none) {
  .outline-history {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    margin-left: var(--space-2);
    padding: var(--space-2);
  }
}

/* Every disclosure gets one chevron of our own in place of the browser's
   triangle, so it can turn as the section opens. Every fold is a control,
   so it shows the hand, as a button does, never the text I-beam, whatever
   its size or colour. */
details > summary {
  list-style: none;
  cursor: pointer;
}

details > summary::-webkit-details-marker {
  display: none;
}

details > summary::before {
  content: "";
  display: inline-block;
  width: 0.4em;
  height: 0.4em;
  margin: 0 0.6em 0.15em 0.1em;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform var(--duration) var(--ease-spring);
}

details[open] > summary::before {
  transform: rotate(45deg);
}

aside details > summary {
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--accent);
}

aside details[open] > summary {
  margin-bottom: var(--space-2);
}

/* What a <details> reveals eases in rather than appearing at once. */
details[open] > :not(summary) {
  animation: enter var(--duration) var(--ease);
}

/* ----------------------------------------------- login, explore, bootstrap */

.login {
  max-width: 24rem;
  margin: var(--space-7) auto;
  text-align: center;
}

.login h1 {
  font-size: var(--text-page);
}

/* "You were signed out.", when a session ended unasked (FR-LOGIN-11), in
   the warning's colours. */
.login-signed-out {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius);
  background: var(--warn-bg);
  color: var(--warn-strong);
}

/* What a sign-out says once on the page it lands on (FR-LOGIN-12):
   a paragraph, read from its start like every notice. */
.login > .notice {
  text-align: start;
}

/* "Specter has no admin yet. … Set up Specter →", a quiet line under the
   sign-in button while no admin exists (FR-SETUP-06). */
.login-setup {
  margin-top: var(--space-4);
}

/* The setup wizard (spec §7.13, B.9). */
.setup {
  max-width: 36rem;
  margin: var(--space-7) auto;
}

.setup h1 {
  font-size: var(--text-page);
}

.setup-progress {
  color: var(--fg-muted);
  font-size: var(--text-sm);
}

.setup form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
}

.setup form input[type="text"],
.setup form input[type="password"] {
  width: 100%;
}

.setup .hint {
  margin: 0;
  color: var(--fg-muted);
  font-size: var(--text-sm);
}

.setup-steps li {
  margin-block: var(--space-3);
}

.setup-steps li.done {
  color: var(--fg-muted);
}

/* FR-SETUP-12: a finished step is ticked, as B.9 draws it; a screen reader
   hears "Done:" before it instead. The step to take next keeps its number,
   in the accent its primary button wears. */
.setup-steps li.done::marker {
  content: "✓ ";
  color: var(--ok);
}

.setup-steps li[aria-current="step"]::marker {
  color: var(--accent);
  font-weight: 600;
}

/* Where installing the App stands, from its installations ("Installed on
   3 repositories.", "Not installed yet."). */
.setup-steps .step-state {
  font-weight: 600;
}

/* Something set up that took effect ("Kagi answers with the configured
   key"): the green of a done step, ticked like one. */
.setup p.done {
  color: var(--ok-strong);
}

.setup p.done::before {
  content: "✓ ";
}

/* FR-SETUP-05: the setup code is hex, read and typed a character at a
   time. */
#setup-code {
  font-family: var(--font-mono);
}

/* The exploration (X21-X23): its transcript, what holds its input, the
   composer, the seed and the ways to end it, one under the other, in the
   column the editor's Chat view reads a conversation in, left-aligned under
   the head, so a line of talk on a wide window stays one the eye can follow
   (X21). */
.exploration {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  max-width: var(--chat-column);
}

/* The lock line, Generate seed and the seed's place take no room while
   they have nothing to say (X20, X22, X23). */
.exploration > .lock-status:empty,
.exploration > #seed-actions:empty,
.exploration > #seed-draft:empty {
  display: none;
}

.seed-review {
  padding: var(--space-3) var(--space-4);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.seed-review > h2 {
  margin: 0 0 var(--space-2);
  font-size: var(--text-md);
}

/* The seed under review is written and read at the box's full width, its
   label over it and what confirming does under that (X23). */
.seed-review > form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
}

.seed-review label {
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

.seed-review textarea {
  width: 100%;
  font-family: inherit;
  font-size: var(--text-field);
  line-height: 1.6;
}

/* X23: the seed under review grows to its whole text, up to 70% of the
   window's height, before it scrolls, so the page scrolls rather than a
   box inside it and no section is hidden at its foot. Where the browser
   can't size a field to its content, the bundle does (`fitMessageBox` in
   `frontend/src/composer.ts`). */
#seed-text {
  max-height: 70dvh;
  field-sizing: content;
  resize: none;
}

/* Over the seed's box when this browser's kept edits went back in it
   (X10): the sentence, and beside it the button that puts the model's seed
   back, wrapping under it on a phone. */
.seed-restored {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
}

/* Under the seed's box: that its Design notes and Rejected lines run past
   the 2,000 characters design notes hold (X23, X28), as wide as the box,
   in a warning's yellow; it takes no room while it says nothing. */
.seed-notes-over {
  align-self: stretch;
  margin: 0;
}

.seed-notes-over:empty {
  display: none;
}

/* Under the seed's heading (X24): when it was written and from how many
   messages, then, while messages came after it, a warning in the yellow
   of the one under the box that they aren't in it. */
.seed-facts {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  margin: 0 0 var(--space-2);
}

.seed-stale {
  margin: 0;
}

/* End this exploration (X23): the ways to close it without a seed, folded
   at the page's foot, each with what it does. */
.explore-endings-summary {
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 500;
}

.explore-endings-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.explore-ending {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}

/* Generate seed, and under it what the model is doing while it distils, or
   why a seed failed (X24); the line takes no room while it says nothing. */
#seed-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
}

.seed-status:empty {
  display: none;
}

.seed-note {
  margin: 0;
}

/* X24: how long the seed has run, counted by the bundle, in figures that
   keep their width as they change. */
.seed-busy .elapsed {
  font-variant-numeric: tabular-nums;
}

/* X22, X24: the starter's Cancel and its Esc stay together, in the lock
   line after "Writing a reply ·" and after the line under Generate seed. */
.explore-cancel {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

/* X22: in the lock line, the "·" before Cancel goes with it, so a line
   that wraps (a page that asks again) never ends on it. */
.lock-cancel {
  white-space: nowrap;
}

/* X24, X22: while the model writes a seed, the line under Generate seed
   says so, who asked and how long it has run, so the lock line isn't
   drawn: it stays for screen readers and for the controls it describes, as
   the editor's does beside the conversation's status (FR-EDIT-41). */
.lock-status.lock-seed {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  white-space: nowrap;
  clip-path: inset(50%);
  border: 0;
}

/* A seed kept in this browser, read-only, to copy (X24, X26): what was
   typed before a new seed replaced it, or a seed a closed exploration
   didn't use. Set apart in the warning's edge, since it is on this page
   only, as the editor's earlier text is (FR-EDIT-28). Inside a notice it
   takes a line of its own. */
.kept-seed {
  flex: 1 0 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  margin-top: var(--space-2);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--fg);
  background: var(--bg-subtle);
  border: 1px solid var(--warn-border);
  border-left: 4px solid var(--warn);
  border-radius: var(--radius);
}

/* Keyed by id rather than `.kept-seed textarea`, which would come after
   the more specific `.seed-review textarea` for the one under a seed. */
#earlier-seed,
#kept-seed {
  width: 100%;
  font-family: inherit;
  font-size: var(--text-field);
  line-height: 1.6;
}

/* The seed a closed exploration ended with, read-only after its transcript
   (X27): the one confirmed, its heading and the way to its message in the
   spec's conversation on one line, or the latest one it didn't use, with
   when it was written and its Copy button. Set out as the seed review is,
   its box at the column's full width. */
.closed-seed {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.closed-seed-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1) var(--space-2);
}

#closed-seed-title {
  margin: 0;
  font-size: var(--text-md);
}

.closed-seed-facts {
  margin: 0;
}

/* Its Markdown rendered as the spec chat's seed message is (X15, X27), at
   the conversation's reading size, its headings small; Copy the seed
   copies the Markdown from a hidden source beside it. */
#closed-seed-text {
  width: 100%;
  font-size: var(--chat-text, var(--text-sm));
  line-height: 1.6;
  overflow-wrap: anywhere;
}

/* The no-spec page's ways back to an abandoned exploration's transcript
   (FR-URL-14, X27) and to the issue's last abandoned spec (FR-EDIT-14),
   under the actions. */
.spec-past,
.exploration-past {
  margin: 0 0 var(--space-4);
}

/* The history page's list of the issue's abandoned specs, and the sections
   of an abandoned spec's read-only record (FR-EDIT-14), set apart as a
   version's changes are. */
.abandoned-specs,
.abandoned-architecture,
.abandoned-versions {
  margin-top: var(--space-6);
}

/* Under the exploration's head (X20): the issue, folded, and past four
   messages Latest message ↓ on the fold's line, at the end of the column
   the conversation is read in (X21), over the replies it leads down to.
   The fold keeps the whole width, so the issue's body opens as wide as it
   did; the link sits over the end of the fold's line. */
.exploration-top {
  display: grid;
  grid-template-columns: minmax(0, var(--chat-column)) minmax(0, 1fr);
  align-items: start;
  margin-bottom: var(--space-4);
}

.issue-fold {
  grid-area: 1 / 1 / 2 / -1;
}

.issue-fold-summary {
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 500;
}

.issue-fold > .issue-body {
  margin-top: var(--space-2);
}

.latest-message {
  grid-area: 1 / 1;
  justify-self: end;
  font-size: var(--text-sm);
}

/* The issue beside the exploration (X20, FR-UI-12): drawn only where the
   page has its full width, below; narrower, the fold above draws it. A
   panel as the spec's sidebar draws one, its title with View on GitHub ↗
   at the end of the title's bar, then the body, which takes the rest of a
   panel never taller than the window and scrolls within it. */
.exploration-issue {
  display: none;
}

.exploration-issue > section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: calc(100dvh - 2 * var(--space-4));
}

.exploration-issue h2 {
  grid-area: 1 / 1 / 2 / -1;
}

.exploration-issue-link {
  grid-area: 1 / 2;
  align-self: center;
  padding: 0 var(--space-4);
  font-size: var(--text-xs);
}

/* The panel's edges round it; the body's end doesn't hand the scroll on to
   the page, and its focus ring is drawn inside it, which the panel would
   otherwise clip. */
.exploration-issue .issue-body {
  grid-column: 1 / -1;
  max-height: none;
  border-radius: 0;
  overscroll-behavior: contain;
}

.exploration-issue .issue-body:focus-visible {
  outline-offset: -2px;
}

/* Where the page has its full 78 rem width, its 75 rem of content holds
   the conversation's column, narrowed to about 55 rem, and the issue,
   18 rem, beside it, which stays in view as the page scrolls (X20, X21).
   The fold, and the line it was on while Latest message ↓ doesn't share
   it, aren't drawn. On paper the fold is kept. */
@media screen and (min-width: 80rem) {
  .exploration-layout:has(> .exploration-issue) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--issue-aside);
    column-gap: var(--space-6);
    align-items: start;
  }

  .exploration-layout > :not(.exploration-issue) {
    grid-column: 1;
  }

  .exploration-issue {
    display: block;
    grid-column: 2;
    grid-row: 1 / span 2;
    position: sticky;
    top: var(--space-4);
  }

  .exploration-layout .issue-fold,
  .exploration-layout .exploration-top:not(:has(> .latest-message)) {
    display: none;
  }
}

/* The no-spec page's actions (B.3, FR-URL-14): one row of choices, each
   with the line under it that says what it does. */
.start-choices {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-3) var(--space-5);
  margin-bottom: var(--space-4);
}

.start-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-1);
  flex: 0 1 20rem;
  min-width: 0;
}

.start-choice > form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* Opened, the choices past an open exploration take a line of their own,
   as the lifecycle actions' do (FR-UI-18). */
.start-choice:has(> .create-spec[open]) {
  flex: 1 0 100%;
}

/* "The issue has no description.", and "The comments couldn't be loaded.
   Read them on GitHub ↗" (B.3). */
.issue-more {
  margin: var(--space-2) 0 0;
}

/* The issue's page (B.3): its first lines whole, the page scrolling rather
   than a box inside it, and the rest of a longer body and the comments
   opening in place under them, in a box of the same kind. */
.issue-body.issue-whole {
  max-height: none;
}

.issue-rest {
  margin-top: var(--space-2);
}

.issue-rest-summary {
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 500;
}

.issue-rest > .issue-body {
  margin-top: var(--space-2);
}

.no-spec {
  margin: var(--space-4) 0 var(--space-3);
}

/* A closed issue's quiet line over the actions, saying what a spec does
   for it (FR-URL-14). */
.issue-closed-note {
  margin: 0 0 var(--space-3);
  max-width: 48rem;
  color: var(--fg-muted);
}

/* An open exploration's quiet line under its head while the verdict says
   its issue needs no spec (X20, FR-ISS-16). */
.exploring-verdict {
  margin: 0 0 var(--space-3);
  max-width: 48rem;
  color: var(--fg-muted);
}

/* The verdict over the no-spec page's choices, and Needs no spec under
   them with the line that says what it does (FR-ISS-16). */
.triage-verdict {
  margin: var(--space-4) 0 0;
  max-width: 48rem;
}

.needs-no-spec {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
}

.needs-no-spec > .hint {
  margin: 0;
}

/* The box for why sits beside Needs no spec, and goes over it on a narrow
   screen (FR-ISS-16). The row takes the form's width, so the box's width
   is measured against it and the button still fits beside it. */
.needs-no-spec-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-self: stretch;
  gap: var(--space-2);
}

/* A one-line why, wide enough for a short sentence (FR-ISS-16). */
input.why {
  width: min(100%, 40ch);
}

/* The project page's open explorations, over its specs (FR-PRJ-17):
   headed and listed as the issues that need no spec are, under it. */
.explorations-in-progress {
  margin: 0 0 var(--space-6);
}

.explorations-in-progress > h2 {
  font-size: var(--text-lg);
  margin: 0 0 var(--space-2);
}

.explorations-in-progress > ul {
  margin: 0;
  padding-left: var(--space-5);
}

/* The project page's newest issues judged to need a spec that no one has
   started (FR-ISS-17), and to need no spec (FR-ISS-16). */
.waiting-for-spec,
.needing-no-spec {
  margin-top: var(--space-6);
}

.waiting-for-spec > h2,
.needing-no-spec > h2 {
  font-size: var(--text-lg);
  margin: 0 0 var(--space-1);
}

.waiting-for-spec > .hint,
.needing-no-spec > .hint {
  margin: 0 0 var(--space-2);
}

.waiting-for-spec > ul,
.needing-no-spec > ul {
  margin: 0;
  padding-left: var(--space-5);
}

/* What went wrong, in the error's own words, folded under the plain ones
   (FR-URL-14). */
.notice > .technical {
  flex: 1 0 100%;
}

.technical-summary {
  cursor: pointer;
}

.technical-text {
  margin: var(--space-2) 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: var(--text-xs);
}

/* Under a key form's plain words, the folded error keeps the field below
   apart from it, open or closed (FR-SETUP-08, FR-SETUP-10). Keyed by the
   key forms' ids, so Test connection's result keeps its own spacing. */
#llm-problem + .technical,
#kagi-problem + .technical {
  margin-bottom: var(--space-4);
}

/* Register a project (FR-PRJ-01, FR-PRJ-13): a list of repositories, one
   per row, then Start bootstrap and the button, stacked; on the branch-rule
   page (FR-PRJ-02), its confirmation and the button. */
form.register {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-4);
  max-width: 40rem;
  margin-block: var(--space-5);
}

.repo-picker {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.repo-picker legend {
  margin-bottom: var(--space-2);
  padding: 0;
  font-weight: 600;
}

/* A long installation list scrolls inside its box instead of pushing the
   confirmation and the button off the page. */
.repo-list {
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: 20rem;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.repo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease);
}

.repo + .repo {
  border-top: 1px solid var(--border);
}

.repo:hover {
  background: var(--bg-subtle);
}

.repo:has(input:checked) {
  background: var(--accent-bg);
}

.repo input,
.confirm input {
  flex: none;
  margin: 0;
}

/* The way to a repository that isn't listed, under the list (FR-PRJ-13). */
.repo-picker > .hint {
  margin-top: var(--space-2);
}

/* A plain option, Start bootstrap: its box and name, and what it does
   under the name. The yellow of .confirm is kept for the branch rules,
   which warrant a warning (FR-PRJ-13). */
.register-option {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  column-gap: var(--space-3);
  row-gap: var(--space-1);
  font-size: var(--text-sm);
}

#start-bootstrap {
  margin: 0;
}

.register-option > label {
  font-weight: 600;
  cursor: pointer;
}

.register-option > .hint {
  grid-column: 2;
}

/* Nothing to pick (FR-PRJ-13): why, then Install on GitHub and what
   happens after it. */
.register-empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  margin-block: var(--space-4);
}

.register-empty > p {
  margin: 0;
}

/* The branch-rule page's button, and the way back to the list beside it. */
.register-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
  margin: 0;
}

.confirm {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius);
  color: var(--warn-strong);
  font-size: var(--text-sm);
  cursor: pointer;
}

/* The checkbox sits on the first line of text, not above it. */
.confirm input {
  margin-top: 0.2em;
}

.confirm code,
.issue-links code {
  font-family: var(--font-mono);
}

/* The optional issue-links step reads as its own section, apart from the
   form above it. */
.issue-links {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

/* ---------------------------------------------------------------- admin */

/* The admin area's parts and the settings page's sections (B.8) stand
   apart, as the issue links do. */
.admin-part + .admin-part {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

/* A part's heading with its one action beside it: Projects and Register a
   project. */
.part-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.part-head > h2 {
  margin: 0;
}

/* Delete a project (FR-PRJ-10): what it holds is said first; the box for
   the repository's name sits on its own line under its label, and Cancel
   stands well apart from the button. */
.held-plans {
  margin-block: var(--space-1);
}

form.delete-project {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  max-width: 40rem;
  margin-top: var(--space-5);
}

form.delete-project input[type="text"] {
  width: min(100%, 24rem);
}

.delete-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-5);
  margin-top: var(--space-3);
}

/* The project list (FR-ADM-03): the docs head is read character by
   character, and what the sync check found sits under the state. */
.admin-projects .sha {
  font-family: var(--font-mono);
}

.admin-projects .sync-detail {
  display: block;
  font-size: var(--text-xs);
}

.admin-projects .row-actions {
  text-align: right;
}

/* A project the App is no longer installed on says so on a line of its
   own, above the way to install it again (FR-ADM-02). */
.admin-projects .uninstalled {
  display: block;
}

/* The GitHub part (FR-ADM-02, B.8): each project's rate limit on a line of
   its own, and a project whose jobs are slowed as a warning under them. */
.rate-limits {
  margin-block: var(--space-2);
  padding-left: var(--space-5);
}

.github-part .slowed {
  margin-block: var(--space-2);
}

/* A paused project's actions (FR-STORE-05, B.8): under what the check
   found, side by side, wrapping on a narrow window. */
.admin-projects .sync-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-1);
}

/* What Adopt glossary… names before it acts (FR-STORE-05): each term that
   differs on a line of its own, a long ID or term wrapping inside the
   panel; the sentence saying none differs, or that the branch couldn't be
   read, in the panel's own rhythm. */
.adopt-terms {
  margin: 0;
  padding-left: var(--space-5);
  overflow-wrap: anywhere;
}

.adopt-term + .adopt-term {
  margin-top: var(--space-2);
}

.adopt-terms-same,
.adopt-terms-unread {
  margin: 0;
}

/* Under a paused project's actions, what each one does, and the ruleset
   that keeps outside pushes from pausing it (FR-ADM-02, FR-STORE-09): small
   and quiet, and kept to a readable width inside the cell. */
.admin-projects .sync-help {
  max-width: 32rem;
  margin: var(--space-2) 0 0;
  color: var(--fg-muted);
  font-size: var(--text-xs);
}

/* The same recommendation under the table, for every project. */
.ruleset-hint {
  margin-top: var(--space-2);
}

/* The failed jobs (FR-ADM-04): what a job leaves behind sits under its
   name, a long error wraps rather than widening the table, and when it
   failed and its Retry now stay on one line. Past five rows the list folds
   under its count, which reads as the way to open it. */
.jobs-hint {
  margin-bottom: var(--space-3);
}

/* Retry all, between the sentence and the list it retries
   (FR-ADM-05). */
.jobs-hint + .ask-first {
  margin-bottom: var(--space-3);
}

.admin-jobs .job-effect,
.admin-active-jobs .job-effect {
  display: block;
  font-size: var(--text-xs);
}

.admin-jobs .job-error,
.admin-active-jobs .job-error {
  min-width: 16rem;
  overflow-wrap: anywhere;
}

.admin-jobs .failed-at,
.admin-jobs .row-actions {
  white-space: nowrap;
}

.admin-jobs .row-actions {
  text-align: right;
}

.jobs-fold-summary {
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--accent);
}

.jobs-fold[open] > .jobs-fold-summary {
  margin-bottom: var(--space-2);
}

/* Beside the table's headings a value's column name and the dot between
   two facts on a line are not drawn; a card on a phone says them. */
.card-label,
.card-sep {
  display: none;
}

/* On a phone (FR-UI-12, FR-ADM-03, FR-ADM-04, FR-JOB-05) each project and each
   job is a card, rather than a row whose actions sit off-screen: the name
   and Bootstrap, then "docs head 4be7a1 · In sync", then what the check
   found and the actions at the card's full width, Delete last; a job's
   name, its project and attempts, its error and when it failed, then Retry
   now; an active job has its status on its own line and no action. The facts
   that share a line run as text, so a long one wraps. */
@media (max-width: 700px) {
  .admin-projects thead,
  .admin-jobs thead,
  .admin-active-jobs thead {
    display: none;
  }

  .admin-projects,
  .admin-jobs,
  .admin-active-jobs,
  .admin-projects tbody,
  .admin-jobs tbody,
  .admin-active-jobs tbody,
  .admin-jobs caption,
  .admin-active-jobs caption {
    display: block;
  }

  .admin-projects tr,
  .admin-jobs tr,
  .admin-active-jobs tr {
    display: block;
    padding: var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
  }

  .admin-projects tr + tr,
  .admin-jobs tr + tr,
  .admin-active-jobs tr + tr {
    margin-top: var(--space-3);
  }

  .admin-projects td,
  .admin-jobs td,
  .admin-active-jobs td {
    display: block;
    padding: 0;
    border-bottom: 0;
  }

  .admin-projects td.title,
  .admin-projects td.bootstrap,
  .admin-projects td.head,
  .admin-projects td.sync,
  .admin-jobs td.job-project,
  .admin-jobs td.attempts,
  .admin-active-jobs td.job-project,
  .admin-active-jobs td.attempts {
    display: inline;
  }

  .admin-projects td.bootstrap {
    margin-left: var(--space-3);
  }

  /* The docs head starts the card's second line. */
  .admin-projects td.head::before {
    content: "";
    display: block;
    margin-top: var(--space-1);
  }

  .card-label,
  .card-sep {
    display: inline;
  }

  .card-label {
    color: var(--fg-muted);
  }

  /* No longer installed reads on, after the docs head. */
  .admin-projects td .uninstalled {
    display: inline;
  }

  .admin-jobs td.job-name,
  .admin-jobs td.job-error,
  .admin-active-jobs td.job-name,
  .admin-active-jobs td.job-error {
    margin-bottom: var(--space-1);
  }

  .admin-jobs td.job-error,
  .admin-active-jobs td.job-error {
    min-width: 0;
  }

  .admin-projects td.row-actions,
  .admin-jobs td.row-actions {
    margin-top: var(--space-3);
    text-align: left;
  }

  /* The hovered card's accent rule runs down its edge. */
  .admin-projects tbody tr:hover td:first-child,
  .admin-jobs tbody tr:hover td:first-child,
  .admin-active-jobs tbody tr:hover td:first-child {
    box-shadow: none;
  }

  .admin-projects tbody tr:hover,
  .admin-jobs tbody tr:hover,
  .admin-active-jobs tbody tr:hover {
    box-shadow: inset 2px 0 0 var(--accent);
  }
}

/* A settings form is a stack (B.8): its label, the field across, the rule
   under it, then its button, no wider than a key needs, so it reads the
   same on a phone. */
.stacked {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  max-width: 36rem;
  margin-bottom: var(--space-4);
}

/* Key fields go across; a radio or a tick keeps its own size. */
.stacked input:not([type="radio"], [type="checkbox"]) {
  width: 100%;
}

/* The provider and its model (FR-LLM-18): each provider a choice, with
   its lists under it as wide as a key's field (B.8). */
.provider-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
}

.provider-choice legend {
  padding: 0;
  margin-bottom: var(--space-1);
  font-weight: 600;
}

/* Each provider: its radio and its name on one line, tinted while it is
   chosen, as Register's repository rows are; then its model and effort
   lists and their hints, indented under the name. */
.provider {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  width: 100%;
}

.provider-pick {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-1) var(--space-2);
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease);
}

.provider-pick:has(input:checked) {
  background: var(--accent-bg);
}

.provider-pick:has(input:disabled) {
  cursor: default;
}

.provider-pick > input {
  flex: none;
  margin: 0;
}

/* A word with a hyphen in a provider's name, such as "sign-in", stays
   whole on a phone rather than leaving "in" on a line of its own. */
.provider-keep {
  white-space: nowrap;
}

.provider-lists {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  width: 100%;
  padding-left: 1.75rem;
}

/* FR-UI-12: on a touch screen the whole row is a thumb's target, as the
   chat's ticks are. */
@media (pointer: coarse) {
  .provider-pick {
    min-height: 2.75rem;
  }
}

.provider-choice select {
  width: 100%;
}

/* A ChatGPT sign-in's code (FR-LLM-17), large enough to read across a
   room and type on another device. */
.device-code-value {
  font-size: var(--text-lg);
  letter-spacing: 0.08em;
}

/* The admins, one to a line with Remove beside each; Remove me, opened,
   takes a line of its own under the viewer's row (FR-ADM-03). */
.admin-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0 0 var(--space-3);
  padding: 0;
  list-style: none;
}

.admin-list > li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.admin-list .ask-first[open] {
  flex-basis: 100%;
}

.you {
  color: var(--fg-muted);
}

/* ------------------------------------------------------- page components */

/* The lifecycle actions of B.4 are a row of choices, not a stack of forms;
   the one opened takes a line of its own where it stands, so the keyboard
   and the eye meet its panel in the same place (FR-UI-18). */
.lifecycle {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.lifecycle > .ask-first[open] {
  flex: 1 0 100%;
}

.lifecycle:empty {
  display: none;
}

/* FR-URL-12, FR-UI-18: one Copy or download disclosure at every width,
   quiet at the right end of the lifecycle row, apart from its actions. */
.copies-fold {
  margin-left: auto;
  max-width: 100%;
}

.copies-fold-summary {
  min-height: 1.75rem;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius);
  color: var(--fg-muted);
  font-size: var(--text-sm);
  cursor: pointer;
}

.copies-fold-summary:hover {
  background: var(--bg-subtle);
  color: var(--fg);
}

.copies-fold-body {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-1);
  padding-top: var(--space-1);
}

/* FR-ARCH-19: a quiet line under the combined download when the spec
   and plan may not agree. The disclosure stacks it under its buttons. */
.zip-note {
  max-width: var(--measure);
  margin: 0;
  padding: 0 var(--space-3);
  color: var(--fg-muted);
  font-size: var(--text-sm);
}

/* An action that asks once (FR-UI-18): its name as a disclosure drawn as
   the page's other buttons are, at their size, rising a pixel when hovered
   and giving when pressed; opened, what it does and the button that does
   it, in a panel of their own. */
.ask-first-summary {
  display: inline-flex;
  align-items: center;
  min-height: 2.125rem;
  padding: var(--space-2) var(--space-4);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition-property:
    background-color, border-color, color, transform, box-shadow;
  transition-duration: var(--duration-fast);
  transition-timing-function: var(--ease);
}

.ask-first-summary:hover {
  border-color: var(--border-strong);
  transform: translateY(var(--lift));
  box-shadow:
    0 1px 2px rgb(0 0 0 / 0.06),
    0 3px 8px rgb(0 0 0 / 0.06);
}

.ask-first-summary:active {
  transform: scale(var(--press));
  box-shadow: none;
  transition-duration: calc(var(--duration-fast) / 2);
}

/* One that can't be taken back is drawn in the danger button's colours,
   open or closed, as its button is. */
.ask-first-summary.danger {
  background: var(--bg);
  border-color: var(--err);
  color: var(--err-strong);
}

.ask-first[open] > .ask-first-summary:not(.danger) {
  background: var(--bg-inset);
}

.ask-first-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  max-width: 44rem;
  margin-top: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.consequence {
  margin: 0;
}

/* A refused SHA sits in the panel's own rhythm, as the hint under it does,
   not the global box's gap on top of the panel's (FR-UI-11). */
.ask-first-body > .error {
  margin: 0;
}

/* The merge commit's SHA is read character by character: monospace, and
   wide enough for all 40 (FR-EDIT-17). */
input.sha {
  width: min(100%, 44ch);
  font-family: var(--font-mono);
}

/* Why Return to draft withdraws the votes, and why a vote was withdrawn:
   the panel's width, room for a sentence or two (FR-EDIT-15, FR-VOTE-03).
   The withdraw box takes its own row in the vote panel's wrapping form,
   as the rejection reason does, its button under it. */
#return-to-draft-why {
  width: 100%;
}

#withdraw-reason {
  flex: 1 0 100%;
  min-width: 0;
}

/* The commits Mark implemented offers above its box (FR-EDIT-17): one a
   line, its short SHA a small button that fills the box, the rest quiet
   text after it that wraps under a phone's width. */
.sha-choices {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--text-sm);
}

.sha-choices > p {
  margin: 0;
}

.sha-choices-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-wrap: anywhere;
}

.sha-choice {
  min-height: 1.75rem;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-sm);
  font-weight: 400;
  text-align: start;
}

/* A commit an event names, linked to GitHub (FR-UI-18). */
.event-line .sha {
  font-family: var(--font-mono);
  font-size: 0.95em;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

/* What is blocking approval, listed rather than counted (B.6). */
.lint {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-left: 0;
  font-size: var(--text-sm);
}

.lint .where,
.lint .rule {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--fg-muted);
}

/* A plan rule shows its name in words, with its code in the title, so the
   name reads in the text's font and only a message's code looks like code
   (FR-ARCH-17). */
.lint .rule-name {
  font-family: inherit;
}

/* Each entry in the editor's lists says its severity in words, so it reads
   without its colour (FR-LINT-17, WCAG 1.4.1); the colour only repeats it. */
.lint .severity {
  display: inline-block;
  padding: 0 var(--space-1);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.5;
  color: var(--fg-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.lint .severity-error > .severity {
  color: var(--err-strong);
  background: var(--err-bg);
  border-color: var(--err-border);
}

.lint .severity-warning > .severity {
  color: var(--warn-strong);
  background: var(--warn-bg);
  border-color: var(--warn-border);
}

.lint .severity-note > .severity {
  color: var(--accent);
  background: var(--accent-bg);
  border-color: var(--accent-border);
}

/* What to do about a finding when its message doesn't say: a note and
   approval, an empty summary, an open flag (FR-LINT-17). */
.lint-hint {
  color: var(--fg-muted);
}

/* A send refused for the lint errors its unsaved edits add lists them on
   lines of their own under its sentence, each line number a button that
   shows it in the editor (FR-EDIT-03.1, FR-UI-04). */
.chat-alert > .lint {
  flex: 1 0 100%;
  margin: 0;
}

/* Answers typed for questions a teammate answered meanwhile (FR-EDIT-24):
   each question on a line of its own under the sentence, what was written
   for it under that, and Copy my answers after them. */
.chat-alert > .lost-answers {
  flex: 1 0 100%;
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.lost-answers p {
  margin: 0;
}

.lost-answers .q-text {
  font-weight: 600;
}

/* Under the review page's blocking lint errors, where they are fixed
   (FR-VOTE-12). */
.fix-link {
  font-size: var(--text-sm);
}

/* An open authoring note on the review page, its reason box and Dismiss
   together under it (spec-format.md § Dismissals). */
.open-note {
  margin-bottom: var(--space-3);
}

.open-note > p {
  margin: 0 0 var(--space-2);
}

/* A style review's note names its rule, titled with what it asks for
   (FR-EDIT-36). */
.open-note .rule {
  font-weight: 600;
}

.open-note > form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

/* The word at a note's reason box, so the box isn't named only by its
   placeholder; review's and the architecture review's (NFR-UX-04). */
.dismiss-reason-label {
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

/* Beside Dismiss, the way to fix the note instead: the editor at its line
   (FR-VOTE-12). */
.fix-note {
  margin-left: var(--space-2);
  font-size: var(--text-sm);
}

/* A dismissed authoring note: where it is, who dismissed it, when and why,
   with the note itself muted under it (FR-VOTE-12). */
.note-dismissed {
  margin-bottom: var(--space-3);
}

.note-dismissed > p {
  margin: 0;
}

.revisions {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-left: 0;
}

/* Each version between the review's start and the head: its link, how it
   came about, its note, what it changed and its message (FR-VOTE-09). */
.revisions li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1) var(--space-3);
}

.revisions .seq {
  font-family: var(--font-mono);
}

.revisions .note {
  color: var(--fg-muted);
}

/* The rejections standing on a version in between, each with its reason,
   on a row of their own under the version, so the rejection a later
   version answers stays in view (FR-VOTE-09). */
.between-rejections {
  flex-basis: 100%;
  margin: 0;
  padding-left: var(--space-4);
  list-style: none;
}

.revisions .between-rejection {
  display: block;
  color: var(--fg-muted);
}

.between-rejection .reason {
  white-space: pre-wrap;
}

/* One item's history (FR-HIST-13): each version that changed the item,
   its making on one line over the item's lines as the review diff draws
   them, and the rejections that named the item under those. */
.item-versions {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  margin: 0;
  padding: 0;
  list-style: none;
}

.item-version-head {
  margin: 0 0 var(--space-2);
}

.item-version-head .seq {
  font-family: var(--font-mono);
}

.item-version-head .note {
  color: var(--fg-muted);
}

.item-version > .between-rejections {
  margin-top: var(--space-2);
  padding-left: 0;
}

.item-version .between-rejection {
  color: var(--fg-muted);
}

/* The editor: the buffer is a box about the window's height that scrolls
   within itself, however long the spec, with its controls under it
   (FR-UI-15); below 600 px the box is only as tall as the text needs, up
   to that height (`--editor-box-height`, `--editor-max-height`). */
.editor-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* A jump to the editor leaves a little room above it. */
#editor {
  scroll-margin-top: var(--space-4);
}

#editor textarea {
  width: 100%;
  height: var(--editor-box-height, var(--editor-height));
  min-height: var(--editor-min-height);
  max-height: var(--editor-max-height, none);
  field-sizing: var(--editor-sizing, fixed);
  font-family: var(--font-mono);
  font-size: var(--text-field);
  line-height: 1.7;
  tab-size: 2;
}

/* Save and its note stay on screen: while the buffer's end is below the
   window they sit at its foot, over the buffer, on the page's own ground
   (FR-UI-15). The editor's script keeps the cursor clear of them. Above
   the buffer's text, below its completion list. */
.editor-actions {
  position: sticky;
  bottom: 0;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.editor-actions label {
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

.save-note-fold {
  flex: 1 1 14rem;
  max-width: 24rem;
  min-width: 0;
}

.save-note-summary {
  cursor: pointer;
  color: var(--fg-muted);
  font-size: var(--text-sm);
  padding-block: var(--space-2);
}

.save-note-fold input {
  width: 100%;
  min-width: 0;
}

.save-note-fold .hint {
  margin: var(--space-1) 0 0;
}

.editor-actions button {
  margin-left: auto;
}

/* Save, with where the text stands before it: "Unsaved changes", or "2
   errors: fix them to save" (FR-EDIT-27), together at the row's end. */
.editor-actions .save-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-left: auto;
}

/* The words before Save, laid out as the group's own from 600 px; below
   it they take the line under the note and Save (FR-UI-15). */
.save-facts {
  display: contents;
}

.editor-actions .save-state {
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

/* The lint summary again, a link down to the list, so it stays on screen
   with Save (FR-LINT-17): as small as the line beside it. */
.editor-actions .lint-count {
  font-size: var(--text-sm);
}

.editor-actions .save-state.blocked {
  color: var(--err-strong);
}

/* The text isn't kept (FR-EDIT-27, FR-EDIT-38): an autosave unanswered
   or refused, or the session ended. In the warning colour. */
.editor-actions .save-state.unkept {
  color: var(--warn-strong);
}

/* FR-EDIT-27: beside that line while the text holds changes of its own,
   Show my changes and Discard my changes…, two quiet buttons underlined as
   links are. They take the room left on their line, so they sit at its
   end, just before Save when they share its line. */
.my-changes-ways {
  display: inline-flex;
  flex-grow: 1;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

.editor-actions .my-changes-way {
  margin-left: 0;
  padding: 0 var(--space-2);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

/* The editor's keys, on a line of their own under Save (FR-UI-13). */
.editor-actions .key-hint {
  flex-basis: 100%;
  margin: 0;
  text-align: right;
}

/* With vim's keys, vim's mode starts that line (FR-UI-21), on one line. */
.key-hint .vim-mode {
  white-space: nowrap;
}

/* The preferences page (FR-UI-13, FR-UI-21): each choice a group, its name
   over its options, which every device shows, since the page is where a
   person goes to choose. */
.preference {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  margin: 0 0 var(--space-3);
  padding: 0;
  border: 0;
}

.preference legend {
  margin-bottom: var(--space-2);
  padding: 0;
  font-weight: 600;
}

.preference label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
}

/* On a touch screen each option is a row a thumb lands on (FR-UI-12). */
@media (pointer: coarse) {
  .preference label {
    min-height: 2.75rem;
  }
}

/* The outdated notice's change, folded under Show what changed and as wide
   as the notice (FR-EDIT-28). The diff scrolls in its own box rather than
   pushing the page sideways, in the page's colours, not the warning's. */
.outdated-diff {
  flex: 1 1 100%;
}

/* Keyed by class rather than `.outdated-diff > summary`, which would
   descend below `aside details[open] > summary`. */
.outdated-diff-summary {
  cursor: pointer;
}

.notice-diff {
  position: relative;
  max-height: 20rem;
  margin-top: var(--space-2);
  overflow: auto;
  color: var(--fg);
}

/* FR-EDIT-27: the fold Show my changes opens under the buffer, the text on
   screen against its version, drawn as the outdated notice's change is. */
.my-changes {
  margin: 0 0 var(--space-4);
}

/* Keyed by class rather than `.my-changes > summary`, as above. */
.my-changes-summary {
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

/* The text Start from latest replaced, read-only, to copy from
   (FR-EDIT-28): set apart in the warning's edge, since it is on this page
   only. */
.earlier-text {
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--warn-border);
  border-left: 4px solid var(--warn);
  border-radius: var(--radius);
}

.earlier-text > h2 {
  margin: 0;
  font-size: var(--text-md);
}

.earlier-text > p {
  margin: var(--space-2) 0;
  color: var(--fg-muted);
}

/* Keyed by id rather than `.earlier-text textarea`, which would descend
   below `#editor textarea`. */
#earlier-text {
  display: block;
  width: 100%;
  margin-bottom: var(--space-2);
  font-family: var(--font-mono);
  line-height: 1.6;
}

/* A person's own changes, one by one, each drawn as the version page draws
   a change with Copy these lines under it (FR-EDIT-28): in that panel and
   in the outdated notice's fold, in the page's colours, not the warning's. */
.own-changes {
  display: grid;
  gap: var(--space-3);
  margin: var(--space-3) 0;
  padding: 0;
  list-style: none;
}

.own-change {
  display: grid;
  gap: var(--space-2);
  justify-items: start;
  min-width: 0;
}

.own-change-diff {
  justify-self: stretch;
  color: var(--fg);
}

/* The whole earlier text, folded under its own line (FR-EDIT-28). Keyed by
   class rather than `.earlier-all > summary`, as above. */
.earlier-all {
  margin: var(--space-2) 0;
}

.earlier-all-summary {
  margin-bottom: var(--space-2);
  cursor: pointer;
}

/* ------------------------------------------------- the conversation pane */

/* B.5 draws the buffer and the conversation side by side. Below the two-pane
   width the conversation follows the buffer rather than squeezing beside it.
   The buffer is as tall as the window leaves once Save is under it, so with
   the page scrolled to the buffer both are in view (FR-UI-15). */
.editor-layout {
  --editor-height: calc(100dvh - 7rem);
  --editor-min-height: 20rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 28rem);
  gap: var(--space-6);
  align-items: start;
}

/* The ways between the buffer and the conversation, on the page once one
   follows the other (FR-UI-15), and, side by side, between the buffer and
   the message box (FR-UI-26). */
.jump-to-conversation,
.jump-to-editor,
.jump-to-message-box {
  font-size: var(--text-sm);
}

/* Once the conversation follows the buffer, Conversation ↓ leads down to
   it, to read, and the heading's Editor ↑ back; the keyboard's ways past
   the log, to the message box and back from it, are not on the page, so a
   phone doesn't open its keyboard over what it scrolled to (FR-UI-26). */
@media (max-width: 1100px) {
  .jump-to-message-box,
  .jump-from-box {
    display: none;
  }
}

/* Side by side, from 1100 px, the other pane is in view, but the keyboard
   reaches the message box only after every control under the buffer and
   every link in the log, and the buffer again only back through them, so
   the ways are still there, drawn only once they have focus, as the skip
   link is (FR-UI-26): Message box ↓ in Conversation ↓'s place, putting
   the cursor in the box, and Editor ↑ after Send as well as in the
   conversation's heading. */
@media (min-width: 1101px) {
  .editor-actions > .jump-to-conversation {
    display: none;
  }

  :is(.jump-to-message-box, .jump-to-editor):not(:focus) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    white-space: nowrap;
    clip-path: inset(50%);
  }

  :is(.jump-to-message-box, .jump-to-editor):focus {
    position: absolute;
    z-index: 10;
    padding: var(--space-2) var(--space-4);
    background: var(--bg);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    white-space: nowrap;
  }

  /* Editor ↑ after Send is drawn at the start of Send's row, which is
     empty there, rather than over Send, which the keyboard has just left. */
  .composer-actions {
    position: relative;
  }

  .composer-actions > .jump-from-box:focus {
    left: 0;
  }
}

/* Below 600 px Conversation ↓ is just before the views' choices at the end
   of the line under the spec's title, since the note and Save fill their
   row there (FR-UI-15). */
.views-jump {
  display: none;
  font-size: var(--text-sm);
}

@media (max-width: 1100px) {
  /* The conversation follows the buffer, and a shorter buffer keeps it one
     scroll away. */
  .editor-layout {
    --editor-height: 70dvh;
    grid-template-columns: minmax(0, 1fr);
  }
}

/* The buffer's column: the form, then lint and the preview under it (B.5). */
.editor-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  min-width: 0;
}

/* CodeMirror, once `frontend/src/editor.ts` has mounted it over the
   textarea. Its own look is kept to structure; colours come from here, so
   both schemes follow the tokens. */
#editor .cm-editor {
  height: var(--editor-box-height, var(--editor-height));
  min-height: var(--editor-min-height);
  max-height: var(--editor-max-height, none);
  font-size: var(--text-field);
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border-control);
  border-radius: var(--radius);
}

#editor .cm-editor.cm-focused {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

/* FR-UI-15: room below the text's last line as tall as Save's row
   (`--save-row`, its height, from the bundle), so the buffer can scroll its
   last lines above that row as it stays at the window's foot and the cursor
   is kept clear of it at the end of the text too. Not CodeMirror's
   scrollPastEnd: below 600 px the box is only as tall as its text, which
   that doesn't support, and it adds nearly a window of blank space. */
#editor .cm-content {
  padding-bottom: var(--save-row, 9rem);
}

/* While a reply holds the spec the text is read-only, and looks it: a
   quieter ground and a dashed edge (FR-EDIT-25). The text keeps its colours,
   and the caret and selection still work, for reading and copying. A spec
   that isn't a draft is drawn the same way, for good (FR-EDIT-26). */
#editor.locked .cm-editor {
  background: var(--bg-subtle);
  border-style: dashed;
}

#editor.locked .cm-content {
  cursor: not-allowed;
}

/* Without the script, the plain buffer of a spec that isn't a draft. */
#editor.locked textarea {
  background: var(--bg-subtle);
  border-style: dashed;
}

#editor .cm-scroller {
  font-family: var(--font-mono);
  line-height: 1.7;
}

/* CodeMirror draws its own caret and selection (the native ones are hidden),
   and its base theme paints them for a light page: a black caret and a pale
   selection. Here they follow the scheme (NFR-UX-02). */
#editor .cm-cursor,
#editor .cm-dropCursor {
  border-left-color: var(--fg);
}

/* Focused or not: the id outranks the base theme's rules for both. */
#editor .cm-selectionLayer .cm-selectionBackground {
  background: var(--selection);
}

/* Vim's block caret (FR-UI-21) is drawn pink with the letter's own colour
   over it, which a dark page makes unreadable: here it is the text's colour
   with the letter in the page's, readable in both schemes (NFR-UX-04).
   Vim draws the letter again on top of the text, so only the full caret of
   a focused editor repaints it: the short caret while an operator waits
   (d, c, y) and replace mode's are drawn with the letter transparent, as
   vim leaves them, or a second, shifted letter would garble the first. */
#editor .cm-fat-cursor {
  background: var(--fg);
}

#editor .cm-editor.cm-focused .cm-fat-cursor:not([style*="transparent"]) {
  /* biome-ignore lint/complexity/noImportantStyles: vim sets the letter's colour on the element */
  color: var(--bg) !important;
}

/* Unfocused, it is an outline, as vim draws it, in the text's colour, and
   the text under it shows through: the letter vim draws over it is kept
   transparent, whatever colour this sheet gives a focused one. */
#editor .cm-editor:not(.cm-focused) .cm-fat-cursor {
  background: none;
  outline: 1px solid var(--fg);
  /* biome-ignore lint/complexity/noImportantStyles: vim's own rule is !important too */
  color: transparent !important;
}

/* FR-UI-15: a line that wraps continues under its own text: its rows after
   the first hang in by its leading spaces and list marker, `--hang`, which
   the bundle counts as the diff does (FR-VOTE-14), past CodeMirror's own
   6 px. */
#editor .cm-line.cm-hang {
  padding-left: calc(6px + var(--hang));
  text-indent: calc(-1 * var(--hang));
}

/* An item anchor folded into its ID (spec-format.md § Identifiers): the
   editor is monospace already, so the ID keeps the line's size. */
#editor .cm-item-anchor {
  font-size: inherit;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  padding: 0 0.3em;
}

/* An ID named in the text, where it references an item: a link in the
   editor's own colours, which stay readable when selected (NFR-UX-04),
   bold on a see-through tint of that colour, so it stands out as an ID
   does everywhere else while a selection, drawn under the text, still
   shows through. It takes no room of its own (bold keeps a monospace
   letter's width), so the columns stay where they are. */
#editor .cm-item-ref {
  color: var(--syntax-link);
  font-weight: 600;
  background: var(--ref-tint);
  border-radius: 3px;
}

#editor .cm-item-ref:hover {
  text-decoration: underline;
}

#editor .cm-gutters {
  background: var(--bg-subtle);
  color: var(--fg-muted);
  border-right: 1px solid var(--border);
}

/* The selection is drawn under the text, so the cursor's line takes only a
   tint: a solid fill would hide what is selected on it. The tint is a
   neutral one, laid over the line's own colour, so the cursor on a line
   the model changed doesn't hide the mark (FR-EDIT-07), and a mark is
   never mistaken for the cursor's line. */
#editor .cm-activeLine {
  background: linear-gradient(var(--active-line), var(--active-line));
}

#editor .cm-activeLineGutter {
  background: linear-gradient(var(--active-line), var(--active-line));
}

/* The lines the model's edit changed (FR-EDIT-07), as the Spec tab marks
   them: the change tint, and a rule in their own gutter; where it removed
   lines, a rule between the two lines around the gap. The tint is
   see-through, as the cursor's line is, since a solid fill would hide a
   selection on the line. The gutter's rule is a border, so it stays in
   forced colours, where the tint and the rules in the text go. */
#editor .cm-changed-line {
  background-color: var(--change-tint);
}

#editor .cm-removed-before {
  box-shadow: inset 0 2px 0 var(--change-rule);
}

#editor .cm-removed-after {
  box-shadow: inset 0 -2px 0 var(--change-rule);
}

#editor .cm-change-gutter .cm-gutterElement {
  padding: 0 2px;
}

#editor .cm-change-marker {
  display: block;
  height: 100%;
  border-left: 3px solid var(--change-rule);
}

#editor .cm-change-marker.removed {
  height: 0;
  border-left-width: 0;
  border-top: 3px solid var(--change-rule);
  width: 0.5rem;
}

/* Over the marks, whose reply they are, with Show the changes, Undo and
   Dismiss marks (FR-EDIT-07): a quiet line in the marks' own colours, close
   above the buffer. */
.edit-marks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin-bottom: calc(var(--space-2) - var(--space-5));
  padding: var(--space-1) var(--space-3);
  border-left: 3px solid var(--change-rule);
  border-radius: var(--radius);
  background: var(--change-bg);
  font-size: var(--text-sm);
}

.edit-marks p {
  flex: 1 1 16rem;
  margin: 0;
}

.edit-marks form {
  display: contents;
}

/* The mark itself, as a key to the lines: the marks' tint with their rule,
   never the page's background, which read as an empty box. On the bar's
   tint the swatch's own tint lies over it, a shade deeper, and a faint edge
   in the rule's colour keeps its shape (FR-EDIT-07). */
.change-swatch {
  display: inline-block;
  width: 1em;
  height: 0.75em;
  margin-right: var(--space-2);
  border: 1px solid color-mix(in srgb, var(--change-rule) 40%, transparent);
  border-left: 3px solid var(--change-rule);
  background-color: var(--change-tint);
  vertical-align: -0.05em;
}

/* Forced colours (a Windows contrast theme) drop backgrounds and shadows,
   which draw what changed, its key and the current tab. There they are
   drawn again in the system's own colours (NFR-UX-04): a mark's Mark shows
   through the inline code it holds, a changed item's margin rule and a
   changed paragraph's are Highlight, the swatch is Mark, and the current
   tab is underlined in Highlight. Placed after the rules it redraws. */
@media (forced-colors: active) {
  mark.change code {
    background: transparent;
  }

  li:has(> mark.change.item, > p:first-child > mark.change.item)::before {
    forced-color-adjust: none;
    background: Highlight;
  }

  mark.change:not(.cont, .item) {
    border-left: 0.25rem solid Highlight;
  }

  .spec-nav > [aria-current],
  .arch-nav > [aria-current] {
    border-bottom: 3px solid Highlight;
  }

  .change-swatch {
    forced-color-adjust: none;
    background: Mark;
    border-color: CanvasText;
  }
}

#editor .cm-tooltip {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}

/* FR-EDIT-19: an ID suggestion reads as the ID and what it is (new item,
   or the item's statement), without CodeMirror's type letters. */
#editor .cm-tooltip-autocomplete .cm-completionIcon {
  display: none;
}

/* FR-EDIT-25: why the buffer refused a change while a reply holds the
   spec, said once at the cursor in the ID suggestions' box (above): a few
   lines of the page's own text, kept inside a phone's width. */
#editor .cm-tooltip.cm-lock-tip {
  max-width: min(28rem, calc(100vw - 2 * var(--space-4)));
  padding: var(--space-2) var(--space-3);
  font-family: var(--font);
  font-size: var(--text-sm);
  line-height: 1.5;
}

/* FR-EDIT-45: Ask about this, at the end of a selection in the buffer,
   in the ID suggestions' box (above), a small button with its key beside
   it (FR-UI-13). */
#editor .cm-tooltip.cm-ask-tip {
  display: flex;
  align-items: center;
  padding: var(--space-1) var(--space-2) var(--space-1) var(--space-1);
  font-family: var(--font);
}

/* FR-UI-15: CodeMirror's panels, in the page's colours and words' size
   rather than its own. Find opens at the buffer's top, inside its frame;
   a panel at its foot (vim's `:` and `/` prompt, FR-UI-21) stands just
   above Save's row as that row stays at the window's foot, never over it
   (`--save-row`, the row's height, from the bundle). */
#editor .cm-panels {
  background: var(--bg-subtle);
  color: var(--fg);
  font-family: var(--font);
  font-size: var(--text-sm);
}

#editor .cm-panels-top {
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
}

#editor .cm-panels-bottom {
  bottom: var(--save-row, 0px);
  border-top: 1px solid var(--border);
}

#editor .cm-panel.cm-search {
  padding: var(--space-2) var(--space-7) var(--space-1) var(--space-3);
}

#editor .cm-search > * {
  margin: 0 var(--space-2) var(--space-1) 0;
}

#editor .cm-search [type="checkbox"] {
  margin: 0;
}

#editor .cm-search > :has(> [type="checkbox"]) {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 2rem;
  font-size: inherit;
  vertical-align: middle;
}

#editor .cm-search .cm-textfield {
  min-height: 2rem;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-field);
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border-control);
  border-radius: var(--radius);
}

#editor .cm-search .cm-button {
  min-height: 2rem;
  padding: var(--space-1) var(--space-3);
  font-size: inherit;
  color: var(--fg);
  background: var(--bg);
  background-image: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

#editor .cm-search [name="close"] {
  top: var(--space-1);
  right: var(--space-1);
  margin: 0;
  min-width: 2rem;
  min-height: 2rem;
  font-size: var(--text-md);
  color: var(--fg-muted);
  border-radius: var(--radius);
}

/* Lint in the gutter, in Specter's colours rather than CodeMirror's fixed
   ones (FR-LINT-17): each marker stands at least 3:1 off the gutter in both
   schemes and is told apart by its shape too, so it still is in forced
   colours: a solid disc for an error, an amber diamond with a dark edge for
   a warning, a dotted ring for a note, and a hollow square for what
   approval adds (a hint to CodeMirror). CodeMirror draws its markers as
   images; these are boxes. */
#editor .cm-lint-marker {
  content: normal;
  box-sizing: border-box;
  width: 0.75em;
  height: 0.75em;
  margin: 0.125em;
}

#editor .cm-lint-marker-error {
  border: 2px solid var(--err);
  border-radius: 50%;
  background: var(--err);
}

#editor .cm-lint-marker-warning {
  border: 2px solid var(--lint-warn-edge);
  background: var(--lint-warn-fill);
  transform: rotate(45deg) scale(0.85);
}

#editor .cm-lint-marker-info {
  border: 2px dotted var(--accent);
  border-radius: 50%;
}

#editor .cm-lint-marker-hint {
  border: 2px solid var(--fg-muted);
}

/* The lines under the same colours: wavy for an error or a warning, dotted
   for a note. CodeMirror draws them as images in fixed colours. */
#editor .cm-lintRange {
  background-image: none;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-decoration-skip-ink: none;
  text-underline-offset: 0.25em;
}

#editor .cm-lintRange-error {
  text-decoration-style: wavy;
  text-decoration-color: var(--err);
}

#editor .cm-lintRange-warning {
  text-decoration-style: wavy;
  text-decoration-color: var(--warn);
}

#editor .cm-lintRange-info {
  text-decoration-style: dotted;
  text-decoration-color: var(--accent);
}

/* Each tooltip's entries carry the list's edge: solid for an error, dashed
   for a warning, dotted for a note, double for what approval adds. */
#editor .cm-diagnostic-error {
  border-left: 3px solid var(--err);
}

#editor .cm-diagnostic-warning {
  border-left: 3px dashed var(--warn);
}

#editor .cm-diagnostic-info {
  border-left: 3px dotted var(--accent);
}

#editor .cm-diagnostic-hint {
  border-left: 3px double var(--fg-muted);
}

/* What approval adds doesn't block saving, and on an early draft it is most
   lines, so it is marked in the gutter only, its tooltip there too
   (FR-LINT-17): no underline, unless a finding the save's rules make is on
   the same line. */
#editor .cm-lintRange.cm-approve-only:not(.cm-lint-saving) {
  background-image: none;
  text-decoration-line: none;
}

.editor-checks {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.editor-checks-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-3);
}

.editor-checks-head h2 {
  margin: 0;
  font-size: var(--text-md);
}

.lint-summary {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

/* What approval's own rules add, under the list of what refuses a save,
   with a heading saying it doesn't (FR-LINT-17). */
.lint-approval {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.lint-approval h3 {
  margin: 0;
  font-size: var(--text-sm);
}

.lint-approval-scope {
  font-weight: 400;
  color: var(--fg-muted);
}

/* How a spec is written, closed under the lint list for someone writing
   it by hand (FR-EDIT-32), drawn as a quiet link until it opens. Keyed by
   class rather than `.format-help > summary`, which would descend below
   `aside details[open] > summary`. */
.format-help {
  max-width: var(--measure);
  font-size: var(--text-sm);
}

.format-help-summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--accent);
}

.format-help-rules {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin: var(--space-2) 0;
  padding-left: var(--space-4);
}

.format-help-note {
  margin: var(--space-2) 0 0;
}

.format-help-code {
  padding: 0.1em 0.35em;
  background: var(--bg-raised);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.875em;
}

.format-help-key {
  padding: 0 var(--space-1);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: calc(var(--radius) / 2);
  background: var(--bg-subtle);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 0.875em;
  white-space: nowrap;
}

/* The example keeps its nesting, which is what it shows, and scrolls on
   its own on a phone rather than widening the page. */
.format-help-example {
  position: relative;
  max-width: 100%;
  margin: var(--space-1) 0 0;
  padding: var(--space-3) var(--space-4);
  overflow-x: auto;
  background: var(--bg-inset);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.875em;
}

#preview-toggle {
  margin-left: auto;
}

#preview-toggle[aria-pressed="true"] {
  background: var(--accent-bg);
  border-color: var(--accent-border);
}

/* The spec as the spec page will show it, under the lint list, as close to
   it as the list's own entries are (FR-EDIT-29). */
.preview {
  --preview-height: 70vh;
  position: relative;
  max-height: var(--preview-height);
  margin-top: calc(var(--space-3) - var(--space-5));
  overflow: auto;
  padding: var(--space-4) var(--space-5);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* Until a rendering arrives the preview holds the room it will take, so
   the page scrolls to all of it at once as it opens (FR-EDIT-29). */
.preview[aria-busy="true"] {
  min-height: var(--preview-height);
}

/* What the preview says until its first rendering arrives (FR-EDIT-29). */
.preview-pending {
  margin: 0;
  color: var(--fg-muted);
}

/* The conversation stays in view beside the buffer as the page scrolls, and
   reaches from its top to the window's foot, never below it: it is as tall
   as that from the first message, not only capped at it, so however short
   the conversation its message list takes what the rest leave, its entries
   at its top, and the composer sits at the pane's foot, at the window's,
   rather than mid-window under a short log and moving down after each early
   exchange (FR-UI-15). Before the page has scrolled the pane up to its
   place its top is lower, under the header and the spec's head, so the
   bundle says where the layout's top is in the window (`--layout-top`, from
   `frontend/src/conversation.ts`) and the pane ends at the window's foot
   from the first paint; without it the pane is as tall as it is once in
   place. Should the rest overfill it (a long applied edit and many
   questions on a short window), the pane scrolls within itself, and only
   the pane, like the sidebar, keeps that scroll from the page: the lists
   inside it hand theirs on. The inset keeps a focus ring inside the scroll
   box, which would otherwise clip it. */
.conversation {
  --pane-top: max(var(--space-4), var(--layout-top, 0px));
  position: sticky;
  top: var(--space-4);
  height: calc(100dvh - var(--pane-top) - var(--space-4));
  max-height: calc(100dvh - var(--pane-top) - var(--space-4));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-1);
  margin: calc(-1 * var(--space-1));
  scroll-margin-top: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

.conversation-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}

.conversation-head h2 {
  margin: 0;
  font-size: var(--text-md);
}

.conversation .earlier {
  font-size: var(--text-sm);
}

/* FR-EDIT-12: how much came since the viewer last took part, on a line of
   its own under the heading, closer to it than the heading's own gap. */
.conversation-head:has(> #since-last-link) {
  flex-wrap: wrap;
  row-gap: var(--space-1);
}

#since-last-link {
  flex-basis: 100%;
  margin: 0;
  font-size: var(--text-sm);
}

/* The conversation as one scroll: the messages, then the applied edit and
   the open questions after the newest of them. A long conversation scrolls
   inside the pane so the composer and the buffer stay where they were: it
   fills what the pane's height leaves, and keeps room for more than a
   message or two however much the composer takes (FR-UI-15). At either end
   it hands the scroll on, so below 1100 px, where it is a box in the page,
   the page still scrolls from over it to the composer. It is the containing
   block of what is positioned in it, the visually hidden words among them,
   which would otherwise reach out past its foot and make the pane scroll
   for nothing. */
.conversation-log {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: var(--space-3);
  min-height: 16rem;
  overflow-y: auto;
  border-top: 1px solid transparent;
}

/* While the log holds Send answers, sticky at its foot, a box or a Skip
   tick the keyboard reaches is scrolled clear of it, as the editor keeps
   its cursor clear of Save (FR-EDIT-22, FR-UI-15). */
.conversation-log:has(.answers-actions) {
  scroll-padding-bottom: 4.5rem;
}

/* The line under Send answers (FR-EDIT-22) makes the row taller while it
   shows, so what the keyboard reaches is kept clear of that too. */
.conversation-log:has(.blank-questions:not([hidden])) {
  scroll-padding-bottom: 7.5rem;
}

/* So does the send line's copy under it (FR-EDIT-28), and the two lines
   together. */
.conversation-log:has(.answers-send-state:not([hidden])) {
  scroll-padding-bottom: 7.5rem;
}

.conversation-log:has(.blank-questions:not([hidden])):has(
  .answers-send-state:not([hidden])
) {
  scroll-padding-bottom: 10rem;
}

/* So does a refusal of the answers over Send answers (FR-UI-02), which
   stays while the boxes are fixed, until the next answers are taken. */
.conversation-log:has(#answers-refusal > *) {
  scroll-padding-bottom: 14rem;
}

/* While the log is scrolled down from its top, it says it continues above
   (FR-UI-15): a rule at its top edge, which a transparent one keeps room
   for so nothing moves when it shows, and a soft shadow under it, cast by a
   line that stays at the top over the messages scrolling under it, deeper
   in the dark theme so it still shows there (NFR-UX-02). The bundle marks
   the log `data-scrolled`. */
.conversation-log::before {
  content: "";
  position: sticky;
  top: 0;
  z-index: 1;
  flex: none;
  height: 0;
  margin-bottom: calc(-1 * var(--space-3));
}

.conversation-log[data-scrolled] {
  border-top-color: var(--border-strong);
}

.conversation-log[data-scrolled]::before {
  box-shadow: var(--scroll-cue-shadow);
}

/* While the newest message's end is below the log's foot, the way back
   down to it (FR-UI-15): a small button over the middle of the log's foot,
   the messages scrolling under it, and above Send answers while that row
   is at the foot, by as much as the bundle says it takes there
   (`--newest-lift`). It follows the log as a line of no height, the pane's
   gap above it taken back, so nothing moves as it shows or goes, at any
   width and in every view. The bundle shows it; without the bundle the log
   is a plain scroll box. */
#newest-below {
  position: relative;
  z-index: 2;
  display: flex;
  flex: none;
  justify-content: center;
  align-items: flex-end;
  height: 0;
  margin-top: calc(-1 * var(--space-4));
}

#newest-below > .to-newest {
  min-height: 2rem;
  margin-bottom: calc(var(--space-2) + var(--newest-lift, 0px));
  padding: var(--space-1) var(--space-3);
  background: var(--bg);
  border-color: var(--border-strong);
  border-radius: 999px;
  box-shadow:
    0 1px 2px rgb(0 0 0 / 0.08),
    0 3px 8px rgb(0 0 0 / 0.1);
  white-space: nowrap;
}

/* A finger's size on a touch screen. */
@media (pointer: coarse) {
  #newest-below > .to-newest {
    min-height: 44px;
  }
}

/* The message list, part of the log's one scroll. */
.messages {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* The conversation's first-run guidance (FR-EDIT-32), after the events of
   the spec's creation: the empty state's dashed box, read as a sentence,
   held to the prose's measure in the Chat view (FR-UI-22). */
.messages > .first-run {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: var(--text-sm);
  max-width: var(--chat-measure, none);
}

/* FR-EDIT-12: where the conversation picks up since the viewer last took
   part, a quiet rule across the log, its words in the middle. */
#since-last-here {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--fg-muted);
  font-size: var(--text-sm);
}

#since-last-here::before,
#since-last-here::after {
  content: "";
  flex: 1 1 0;
  border-top: 1px solid var(--border);
}

/* Below the two-pane width the conversation follows the buffer and is part
   of the page again, as tall as what it holds, its list capped instead
   (FR-UI-15). */
@media (max-width: 1100px) {
  .conversation {
    position: static;
    height: auto;
    max-height: none;
    overflow-y: visible;
  }

  .conversation-log {
    max-height: 60vh;
  }
}

/* FR-VOTE-12: one list of concrete actions, shared by Spec, Review and
   the editor's saved-version disclosure. */
.approval-checklist-title {
  margin: 0;
  font-weight: 600;
}

.approval-checklist ul {
  margin: var(--space-2) 0 0;
  padding-left: var(--space-4);
}

.approval-checklist :where(li) + li {
  margin-top: var(--space-2);
}

.approval-readiness {
  grid-area: readiness;
  margin-top: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--text-sm);
}

.approval-readiness[open] > summary {
  margin-bottom: var(--space-3);
}

/* ------------------------------------------------- the editor's views */

/* FR-UI-22: one View disclosure keeps layout choices out of the header
   until needed. Its summary always names the layout on screen. */
.editor-views {
  position: relative;
  margin-left: auto;
  max-width: 100%;
}

/* The metadata clips separator dots at wrapped edges. An open menu must
   extend beyond that line and remain clickable above the editor. */
.page-meta:has(> .editor-views[open]) {
  clip-path: none;
}

.page-head:has(.editor-views[open]) {
  position: relative;
  z-index: 21;
}

.views-summary {
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--border-control);
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
}

.view-choices {
  position: absolute;
  right: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-width: 12rem;
  max-width: calc(100vw - 2rem);
  padding: var(--space-1);
  border: 1px solid var(--border-control);
  border-radius: var(--radius);
  background: var(--bg);
}

.view-choice {
  padding: var(--space-1) var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  text-decoration: none;
}

.view-choice:hover {
  background: var(--bg-subtle);
}

/* The view on screen is drawn as the current tab is (FR-UI-16): the page's
   ground, a little weight and the accent underline, not filled as a
   primary button, which would read as an action to press. */
.view-choice[aria-current="true"] {
  position: relative;
  background: var(--bg);
  font-weight: 500;
  box-shadow: inset 0 -2px 0 var(--accent);
}

/* Forced colours drop the underline's shadow (NFR-UX-04): the current view
   (FR-UI-22) is underlined in Highlight as the current tab is, a 3px bottom
   border that takes 2px from its padding, so the group keeps its height. */
@media (forced-colors: active) {
  .view-choice[aria-current="true"] {
    border-bottom: 3px solid Highlight;
    padding-bottom: calc(var(--space-1) - 2px);
  }
}

/* A full-page view is the editor's own window: no site header, no tabs and
   no page margins. The spec's head is one line at the window's top,
   "acme/shop#4 · Checkout discount codes · Editing version 3 · draft",
   the issue's title still the page's heading, the choices at its end. The
   notices (a save's outcome, the reply running, the text out of date)
   stay, under it. */
body:has(.editor-views:not([data-view="page"])) > .site-header {
  display: none;
}

/* With no header to skip, Skip to the message box takes the place of Skip
   to content; with the editor alone the message box is out of sight, so
   neither is there (FR-UI-26). */
body:has(.editor-views:not([data-view="page"]))
> .skip-link:not(.skip-to-control),
body:has(.editor-views[data-view="editor"]) > .skip-to-control {
  display: none;
}

main:has(.editor-views:not([data-view="page"])) {
  max-width: none;
  padding: var(--space-3) var(--space-4) var(--space-4);
}

.page-head:has(.editor-views:not([data-view="page"])) {
  margin-bottom: var(--space-3);
}

.page-head:has(.editor-views:not([data-view="page"])) > .spec-nav {
  display: none;
}

.page-head:has(.editor-views:not([data-view="page"])) > div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.page-head:has(.editor-views:not([data-view="page"])) .breadcrumb {
  gap: 0;
}

.page-head:has(.editor-views:not([data-view="page"]))
  .breadcrumb
  > [aria-hidden="true"] {
  display: none;
}

/* As specific as the head's own h1 rule, which it follows, and no more,
   so a reply's headings later on still outweigh it. */
.page-head:where(:has(.editor-views:not([data-view="page"]))) h1 {
  margin: 0;
  font-size: var(--text-sm);
}

.page-head:has(.editor-views:not([data-view="page"])) .page-meta {
  flex: 1 1 auto;
  margin: 0;
}

/* The dots between the number, the title and the line under it, which
   stand on one line here; drawn only, not read. */
.page-head:where(:has(.editor-views:not([data-view="page"]))) h1::before,
.page-head:has(.editor-views:not([data-view="page"])) .page-meta::before {
  content: "·" / "";
  color: var(--fg-muted);
  font-weight: 400;
}

/* The line under the title is a row of its own, spaced by its gap; the
   title's dot is inside it. */
.page-head:where(:has(.editor-views:not([data-view="page"]))) h1::before {
  margin-right: var(--space-2);
}

/* The buffer takes the window less the head's line and Save's row. */
.editor-layout:not([data-view="page"]) {
  --editor-height: calc(100dvh - 7.5rem);
}

/* Both panes: the conversation takes more of the wider window. */
.editor-layout[data-view="full"] {
  grid-template-columns: minmax(0, 3fr) minmax(24rem, 2fr);
}

/* The editor alone: the conversation is still on the page, so a reply
   comes in as it does, but out of sight. */
.editor-layout[data-view="editor"] {
  grid-template-columns: minmax(0, 1fr);
}

.editor-layout[data-view="editor"] > .conversation {
  display: none;
}

/* The conversation alone: a column a line of talk can be read across,
   from the bar to the window's foot at any width, as tall as that from the
   first message, so the composer is at the window's foot however short the
   log (FR-UI-22, FR-UI-15). The editor is still on the page, out of sight,
   so a send saves what it holds as it always does (FR-EDIT-28). */
.editor-layout[data-view="chat"] {
  grid-template-columns: minmax(0, var(--chat-column));
  justify-content: center;
}

.editor-layout[data-view="chat"] > .editor-main {
  display: none;
}

.editor-layout[data-view="chat"] > .conversation {
  position: sticky;
  height: calc(100dvh - var(--pane-top) - var(--space-4));
  max-height: calc(100dvh - var(--pane-top) - var(--space-4));
  overflow-y: auto;
}

.editor-layout[data-view="chat"] .conversation-log {
  max-height: none;
}

/* FR-UI-15, FR-UI-22: in a window under 500 px tall, a phone turned on its
   side, a pane fitted to the window leaves no room for the log and the
   composer both, so the Chat view's pane is part of the page, as it is
   below 1100 px wide: the page scrolls, its head with it, and the message
   box follows the log. The log is capped as it is there, without the
   least height it keeps elsewhere, which would outgrow the cap in a window
   this short. */
@media (max-height: 31.25rem) {
  .editor-layout[data-view="chat"] > .conversation {
    position: static;
    height: auto;
    max-height: none;
    overflow-y: visible;
  }

  .editor-layout[data-view="chat"] .conversation-log {
    min-height: 0;
    max-height: 60vh;
  }
}

/* Where a conversation is read rather than glanced at beside the buffer,
   the Chat view and the exploration (FR-UI-22, X21), its text is set as a
   spec's prose is: what the messages, the applied edit and the questions
   say at the page's reading size, their quiet lines a step under it,
   Recommended a step under those, and a message's paragraphs, lists,
   headings and quotes held to the prose's measure while code blocks and
   tables keep the column. The rules that read these name the pane's own
   sizes as what they fall back to, so the pane beside the editor keeps
   its 13 px and 12 px. */
.editor-layout[data-view="chat"] > .conversation,
.exploration {
  --chat-text: var(--text);
  --chat-quiet: var(--text-sm);
  --chat-chip: var(--text-xs);
  --chat-measure: var(--measure);
}

/* On a phone the conversation is the width of the screen in every view,
   and a reply is read at the size of what is typed under it (FR-UI-12,
   FR-UI-15). */
@media (max-width: 600px) {
  .editor-layout > .conversation {
    --chat-text: var(--text);
    --chat-quiet: var(--text-sm);
    --chat-chip: var(--text-xs);
  }
}

/* With one pane there is no other to lead to. */
.editor-layout:is([data-view="editor"], [data-view="chat"])
:is(.jump-to-conversation, .jump-to-editor, .jump-to-message-box) {
  display: none;
}

/* The editor alone with the preview open: the text and the preview side by
   side, each half the window and as tall as the buffer, so both are on
   screen together; the marks' bar spans both above them, and the lint
   follows under both (FR-EDIT-29, FR-UI-22). Narrower, as in the other
   views, the preview stays under the lint list. */
@media (min-width: 1101px) {
  .editor-layout[data-view="editor"]
    > .editor-main:has(> .preview:not([hidden])) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "form preview"
      "checks checks"
      "readiness readiness";
    align-items: start;
  }

  .editor-layout[data-view="editor"]
    > .editor-main:has(> .preview:not([hidden])):has(
      > .edit-marks:not([hidden])
    ) {
    grid-template-areas:
      "marks marks"
      "form preview"
      "checks checks"
      "readiness readiness";
  }

  .editor-layout[data-view="editor"] > .editor-main > .edit-marks {
    grid-area: marks;
  }

  .editor-layout[data-view="editor"] > .editor-main > .editor-form {
    grid-area: form;
  }

  .editor-layout[data-view="editor"] > .editor-main > .editor-checks {
    grid-area: checks;
  }

  .editor-layout[data-view="editor"] > .editor-main > .preview {
    --preview-height: var(--editor-height);
    grid-area: preview;
    height: var(--editor-height);
    min-height: var(--editor-min-height);
    max-height: none;
    margin-top: 0;
  }
}

@media (max-width: 1100px) {
  /* Both panes one after the other, as on the page. */
  .editor-layout[data-view="full"] {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* A phone gives the editor's text more of the screen (FR-UI-15,
   FR-EDIT-07). The buffer is as tall as its text, up to the height the
   view gives it (70 % of the window on the page), never less than a few
   lines. The note and Save share one row, the words before Save on the
   line under them, and Conversation ↓ is by the views' choices in the
   head instead. The marks' bar is one row, as tall as its buttons: the
   sentence, cut to two short lines, beside Show, Undo and Dismiss, whose
   names are still read out in full. */
@media (max-width: 600px) {
  .editor-layout {
    --editor-box-height: auto;
    --editor-max-height: var(--editor-height);
    --editor-min-height: 8rem;
    --editor-sizing: content;
  }

  .editor-actions {
    row-gap: var(--space-1);
  }

  .save-note-fold {
    flex: 1 1 0;
    min-width: 0;
    max-width: none;
  }

  /* The note's placeholder, "What changed? (optional)", fits the field
     beside Save (FR-EDIT-27): set at the quiet lines' size, with a little
     less room at the field's sides, while what is typed keeps the field's
     own size, which keeps a phone from zooming (FR-UI-12). */
  #save-note {
    padding-inline: var(--space-2);
  }

  #save-note::placeholder {
    font-size: var(--text-sm);
  }

  .editor-actions .save-group {
    display: contents;
  }

  .save-facts {
    display: flex;
    flex-wrap: wrap;
    flex-basis: 100%;
    order: 1;
    justify-content: flex-end;
    gap: 0 var(--space-2);
  }

  .editor-actions .key-hint {
    order: 1;
  }

  .editor-actions > .jump-to-conversation {
    display: none;
  }

  /* At the line's end, over the choices, which take the next line. */
  .views-jump {
    display: inline;
    margin-left: auto;
  }

  /* With one pane alone there is no other to lead to. */
  .page-meta:has(> .editor-views:is([data-view="editor"], [data-view="chat"]))
  > .views-jump {
    display: none;
  }

  /* FR-UI-22: in a full-page view the line under the title always starts
     a row of its own here, so no dot before it; the title's dot stays. */
  .page-head:has(.editor-views:not([data-view="page"])) .page-meta::before {
    content: none;
  }

  /* With Chat alone the conversation heading stays accessible without
     another visible label. Earlier messages keeps its own row's end. */
  .editor-layout[data-view="chat"] .conversation-head > h2 {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    white-space: nowrap;
    clip-path: inset(50%);
    border: 0;
  }

  .editor-layout[data-view="chat"] .conversation-head {
    display: contents;
  }

  .editor-layout[data-view="chat"] #earlier-messages {
    align-self: flex-end;
  }

  .edit-marks {
    flex-wrap: nowrap;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-2);
  }

  .edit-marks p {
    display: -webkit-box;
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    line-height: 1.3;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }

  .edit-marks button {
    flex: none;
    padding: var(--space-1) var(--space-2);
  }

  /* The rest of a button's name, after the word it shows. */
  .label-rest {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    white-space: nowrap;
    clip-path: inset(50%);
    border: 0;
  }
}

/* The exploration's transcript is part of its page, not a box that
   scrolls on its own as the editor's pane is (X21). */
.messages.exploration-messages {
  flex: none;
  min-height: 0;
  max-height: none;
  overflow-y: visible;
}

/* The exploration's opening line (X20) reads as a sentence, as the spec
   chat's first-run guidance does, held to the prose's measure as it is
   (X21); the first reply's stream takes it away. */
.messages > .exploration-hint {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: var(--text-sm);
  max-width: var(--chat-measure, none);
}

/* Under an exploration's newest message while the model didn't answer it
   (X21): a quiet line saying so, Answer it after it, read as how the
   conversation stands rather than as an alert; on a narrow window the
   button wraps under the words. */
.messages > .unanswered {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding: 0 var(--space-3);
  color: var(--fg-muted);
  font-size: var(--text-sm);
}

.unanswered > p {
  margin: 0;
}

/* FR-UI-12: on a touch screen Answer it is 44 px tall, as a chat alert's
   Try again is. */
@media (pointer: coarse) {
  .unanswered > .button {
    min-height: 2.75rem;
  }
}

/* Under the opening line, the questions to start with (X30), one row
   that wraps on a narrow window; each fills the message box. Only the
   bundle makes one fill it, so the server serves them hidden and the
   bundle shows them. */
.exploration-starters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

/* Their label, Start with a question:, small and on a line of its own
   over them, as the suggested answers' legend is. */
.starters-label {
  flex: 1 0 100%;
  margin: 0;
  color: var(--fg-muted);
  font-size: var(--text-xs);
}

/* X30: each question is drawn as a suggested answer is (FR-EDIT-22), a
   pill that reads as something to press without a hover to show it, as on
   a phone: a control's edge, rounded ends, the page's ground and the
   text's own colour inside the opening line's muted dashed box, its words
   from the left. Hovered, its edge darkens as a suggestion's does. */
.starter {
  justify-content: flex-start;
  padding: var(--space-1) var(--space-3);
  border-color: var(--border-control);
  border-radius: 999px;
  background: var(--bg);
  color: var(--fg);
  font-size: var(--text-sm);
  font-weight: 400;
  text-align: left;
  overflow-wrap: anywhere;
}

.exploration-starters > .starter:hover:not(:disabled) {
  border-color: var(--fg-muted);
}

/* Below 600 px each takes the box's full width. */
@media (max-width: 600px) {
  .exploration-starters > .starter {
    flex: 1 0 100%;
  }
}

/* FR-UI-12: on a touch screen each is 44 px tall, padded larger, as the
   suggested answers are. */
@media (pointer: coarse) {
  .exploration-starters > .starter {
    min-height: 2.75rem;
    padding: var(--space-2) var(--space-4);
  }
}

.message {
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: var(--chat-text, var(--text-sm));
  line-height: 1.6;
  transition: border-color var(--duration) var(--ease);
}

/* The message a version's "message →" led to (FR-EDIT-13). */
.message:target {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

/* A message, the live reply or a notice in the list that has the focus
   (the stored reply after the reply's end, the newest after Cancel, the
   oldest after Earlier messages, FR-UI-14) draws its ring just inside its
   edge: the log scrolls and the list has no padding, so a ring drawn
   outside a full-width entry would be cut off. */
.message:focus-visible,
.messages > .notice:focus-visible {
  outline-offset: -2px;
}

/* So do the diff's fold bars, full width in a box that scrolls sideways,
   and the folded applied edit's line, full width in the log: a ring drawn
   outside either would be cut off on all but one side (FR-UI-14). */
.diff-fold-summary:focus-visible,
.applied-edit-line:focus-visible {
  outline-offset: -2px;
}

/* A head that can't fit its time beside what it says drops the time under
   it, rather than squeezing it (FR-UI-25). It is a quiet line, 13 px
   wherever the text under it is set (FR-UI-22). */
.message-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
}

/* FR-EDIT-12, FR-UI-09: author and time on every message. A person is a
   disc with their GitHub picture laid over their initials, so a picture that
   is missing, blocked or fails to load leaves the initials rather than a
   broken image. The initials come from `data-initials` rather than text, so
   they are never copied with the name beside them; and the disc prints as
   drawn, since its picture and Specter's mark are backgrounds. */
.avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bg-raised);
  color: var(--fg-muted);
  font-size: var(--text-xs);
  line-height: 1;
  vertical-align: middle;
  print-color-adjust: exact;
}

.avatar::before {
  content: attr(data-initials);
}

/* The picture takes the disc's colour, so the initials under it don't show
   through a transparent one. */
.avatar > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: inherit;
}

/* A picture that fails or is blocked would draw the browser's broken-image
   icon. Browsers give only a broken image its ::after, so that draws the
   initials back over it, with or without JavaScript
   (frontend/src/avatars.ts then removes the picture altogether). */
.avatar > img::after {
  content: attr(data-initials);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: inherit;
}

/* The model has no GitHub picture; it wears Specter's mark, sized to sit
   inside the circle rather than be clipped by it, in a ring that keeps it
   visible on a light panel. */
.avatar.specter {
  background: var(--bg) url("logo.png") center / 82% no-repeat;
  box-shadow: inset 0 0 0 1px var(--border);
}

/* A person named in running text (a byline, a vote, the header): a smaller
   disc, then the name. */
.person {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  vertical-align: middle;
}

.person .avatar,
.vote .avatar {
  width: 1.25rem;
  height: 1.25rem;
  font-size: 0.625rem;
}

.vote .avatar {
  margin-right: var(--space-1);
}

/* The issue digest is a well, which in the light theme is all but the
   disc's own colour, so a disc there takes the page's instead, or one
   without a picture would vanish. */
.issue-digest .avatar {
  background: var(--bg);
}

.message .who {
  font-weight: 600;
}

.message .when {
  margin-left: auto;
  font-size: var(--chat-quiet, var(--text-xs));
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}

/* FR-EDIT-13: a stored entry's time is a link to the entry, read as the
   time it is: it takes the time's place at the head's end, quiet as the
   time, and is underlined under the pointer. */
.message .when-link {
  margin-left: auto;
  color: var(--fg-muted);
  text-decoration: none;
}

.message .when-link:hover {
  text-decoration: underline;
}

/* How long the live reply has run (FR-UI-02), counted by the bundle. */
.message .elapsed {
  font-size: var(--chat-quiet, var(--text-xs));
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}

.message-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Three weights, so a long thread has a rhythm rather than being a stack of
   identical boxes: what a person asked reads as a line of talk against the
   pane, the model's reply is the substantial thing and keeps the panel, and an
   event is a quiet note between them. */
.message.user {
  padding: var(--space-2) var(--space-3);
  border: 0;
  border-left: 2px solid var(--accent-border);
  border-radius: 0;
  background: none;
}

/* A reply from the model, set apart from what people wrote. */
.message.assistant {
  background: var(--bg-subtle);
}

.message.assistant:hover {
  border-color: var(--border-strong);
}

/* On the plain line the name carries the weight the panel gave the reply. */
.message.user .who {
  color: var(--fg-muted);
}

/* A person's disc takes the accent; Specter's keeps its mark, which this
   background would otherwise paint over (FR-EDIT-23). */
.message.user .avatar:not(.specter) {
  background: var(--accent-bg);
  color: var(--accent);
}

/* An event is what happened to the spec, so it reads as a line rather than
   as a message: a quiet one, 13 px wherever a message's text is set
   (FR-UI-22). */
.message.event {
  border: 0;
  padding: var(--space-1) var(--space-3);
  border-left: 2px solid var(--border);
  border-radius: 0;
  background: none;
  color: var(--fg-muted);
  font-size: var(--text-sm);
}

/* FR-UI-15: one line, as B.5 draws it: who, what happened, when. What
   happened takes the room between, and wraps there when it is long (a
   rejection's reason). */
.message.event .message-head {
  align-items: baseline;
  margin-bottom: 0;
}

/* FR-EDIT-24: the line Specter stored for a reply that failed reads as an
   event, its edge in the error colour so it stands out from the saves and
   votes around it; while the message it couldn't answer has no reply, it
   ends with Answer the last message, a quiet button as Regenerate is in a
   reply's footer. */
.message.event.reply-failed {
  border-left-color: var(--err);
}

/* FR-EDIT-24: on the page that streamed a failed reply, its alert stands
   in for that line, which goes in just before it: the line isn't drawn
   while the alert follows it, so the failure isn't said twice, and shows
   in its place once the next answer clears the alert (a reply starting, a
   refusal, a style review). */
#messages > .message.reply-failed:has(+ .chat-alert[data-reply-failed]) {
  display: none;
}

.message.event .avatar {
  align-self: center;
  width: 1.25rem;
  height: 1.25rem;
  font-size: 0.625rem;
}

/* FR-EDIT-10: a reply its starter cancelled before it wrote anything says
   only that, so it is drawn as an event's one line is: who, what happened,
   when, and Regenerate at its end while it is the newest reply. */
.message.assistant.cancelled-early {
  border: 0;
  padding: var(--space-1) var(--space-3);
  border-left: 2px solid var(--border);
  border-radius: 0;
  background: none;
  color: var(--fg-muted);
  font-size: var(--text-sm);
}

.message.assistant.cancelled-early .message-head {
  align-items: baseline;
  margin-bottom: 0;
}

.message.assistant.cancelled-early .avatar {
  align-self: center;
  width: 1.25rem;
  height: 1.25rem;
  font-size: 0.625rem;
}

/* What happened takes the room beside the name and the time while it can
   keep 10 rem of it; on a narrower pane the time drops under the line. */
.event-line {
  flex: 1 1 10rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* FR-BOOT-24: how a baseline was drafted folds its files under the
   event's line, the files it read and those it didn't, each list opened
   from its name. */
.drafted-files {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin: var(--space-1) 0 0;
  font-size: var(--text-sm);
}

.drafted-name {
  cursor: pointer;
}

.drafted-fold > ul {
  margin: var(--space-1) 0 0;
  padding-left: var(--space-4);
}

/* FR-EDIT-34: under a line saying a reply changed the design notes, the
   rejected alternatives it dropped, in the text colour so they aren't
   missed, then What changed: the change drawn as a version's page draws
   one, in a box that scrolls on its own, and Put back or Copy under it.
   Keyed by class, as the applied edit's fold is. */
.notes-replaced {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin: var(--space-1) 0 0;
  font-size: var(--text-sm);
}

.notes-dropped {
  margin: 0;
  color: var(--fg);
}

.notes-dropped-list {
  margin: 0;
  padding-left: var(--space-4);
  color: var(--fg);
}

.notes-changes-summary {
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease);
}

.notes-changes-summary:hover {
  color: var(--fg);
}

.notes-diff {
  position: relative;
  max-height: 20rem;
  overflow: auto;
  margin-top: var(--space-2);
  color: var(--fg);
}

.notes-put-back,
.notes-copy {
  margin: var(--space-2) 0 0;
}

/* FR-EDIT-23: what Specter wrote for someone reads as what they did. The
   line after their name says it ("ran Draft from issue", "answered 2
   questions"); it is the substance, so it keeps the text colour the muted
   name gives up. */
.message .did {
  min-width: 0;
  color: var(--fg);
}

/* FR-EDIT-46: a note between people is drawn as its writer's message,
   a quiet label after the name saying it asks for no reply. */
.message .note-label {
  color: var(--fg-muted);
  font-size: var(--text-xs);
}

/* FR-EDIT-03.1: what sending a message did to the spec first, a quiet
   line under what was sent in the event style: "Saved bob's edits as
   version 5 (+3 −1) first.", the version linked to its page. */
.sent-save {
  margin: var(--space-1) 0 0;
  color: var(--fg-muted);
  overflow-wrap: anywhere;
}

/* FR-EDIT-16: under a flag's or gap's sentence, what became of the flag,
   read as the conversation is drawn and said in words. While it is open
   the entry keeps the flag banner's warning colour on its rule and its
   state reads in the banner's text colour; once dismissed or cleared it
   stays muted, as other events are. */
.message.event.flag-open {
  border-left-color: var(--warn);
}

.flag-state {
  margin: var(--space-1) 0 0;
  overflow-wrap: anywhere;
}

.flag-open > .flag-state > strong {
  color: var(--warn-strong);
}

/* FR-EDIT-16, FR-UI-15: a flag's or gap's entry is a short head ("Specter
   flagged this spec", "Specter found a gap in 17~pagdeb while drafting the
   architecture") with what it raised under it at the entry's full width,
   in the text colour rather than the event's muted one, since it blocks
   approval: a flag's sentence, or a gap's own words, the drafting model's,
   set off as a quote so they don't read as Specter's. */
.flag-sentence {
  margin: var(--space-1) 0 0;
  color: var(--fg);
  overflow-wrap: anywhere;
}

.gap-quote {
  margin: var(--space-2) 0 0;
  padding-left: var(--space-3);
  border-left: 3px solid var(--border);
  color: var(--fg);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

/* FR-EDIT-16: under a reference flag's sentence, in its entry and its
   banner on the Spec tab, what the item or term said and says now, folded
   under "What changed" ("What it said" for a removal): each labelled, the
   words that changed marked on both as a style review's rewrite marks them
   (FR-EDIT-36), the old line in the event's muted colour and the new in
   the text colour; then, for a term, where the model edit that changed it
   was made. */
.flag-change {
  margin: var(--space-1) 0 0;
}

.flag-change-summary {
  cursor: pointer;
}

.flag-was,
.flag-now,
.flag-changed-by {
  margin: var(--space-1) 0 0;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.flag-now {
  color: var(--fg);
}

.flag-change-label {
  font-weight: 600;
}

.flag-was del {
  border-radius: 2px;
  background: var(--del-word-bg);
}

.flag-now ins {
  border-radius: 2px;
  background: var(--add-word-bg);
  text-decoration: none;
}

@media (forced-colors: active) {
  .flag-now ins {
    text-decoration: underline;
  }
}

/* In the banner the fold takes a row of its own under the sentence, before
   the note and Dismiss, since what to check comes before dismissing; its
   lines keep the banner's text colour. */
.notice > .flag-change {
  flex: 1 0 100%;
  margin: 0;
}

.notice > .flag-change > .flag-now {
  color: inherit;
}

/* The glossary terms a model edit's call added or changed, after the diff
   on its version's page and first in the applied edit's Show what changed
   (FR-HIST-12, FR-EDIT-31): each term's head, then its Was and Now as a
   flag's fold draws them, then the specs it flagged. */
.glossary-changes {
  margin: 0 0 var(--space-3);
}

.glossary-changes > h4 {
  margin: 0 0 var(--space-1);
  font-size: inherit;
}

.glossary-change-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.glossary-change + .glossary-change {
  margin-top: var(--space-3);
}

.glossary-change-head,
.glossary-change-flagged {
  margin: var(--space-1) 0 0;
  overflow-wrap: anywhere;
}

/* A preset's instructions, folded under the line that names it. */
.preset-instructions {
  font-size: var(--chat-quiet, var(--text-xs));
}

/* FR-EDIT-33: the note its sender typed with a preset reads as their
   message does, between the line that names the preset and its folded
   instructions. */
.preset-note {
  margin-bottom: var(--space-1);
}

/* Under Specter's own preset, drawn as an event's one line (FR-ISS-15),
   the fold keeps a little room from it. */
.message.event > .preset-instructions {
  margin-top: var(--space-1);
}

.preset-summary {
  cursor: pointer;
  color: var(--fg-muted);
}

.preset-text {
  margin-top: var(--space-2);
  padding: var(--space-2);
  border-radius: var(--radius);
  background: var(--bg-inset);
  color: var(--fg-muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* FR-EDIT-40: where the conversation was summarised, a quiet line as an
   event's is, the summary folded under it as a preset's instructions are,
   and opened read at a message's size where the chat is read (FR-UI-22).
   Keyed to the message, so it outranks the sidebar's disclosures. */
.compaction-summary {
  margin-top: var(--space-1);
  font-size: var(--chat-quiet, var(--text-xs));
}

.message .compaction-summary > summary {
  cursor: pointer;
  color: var(--fg-muted);
}

.compaction-text {
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  background: var(--bg-inset);
  color: var(--fg);
  font-size: var(--chat-text, var(--text-xs));
  overflow-wrap: anywhere;
}

/* FR-EDIT-12: three or more saves in a row by one person are one event
   line, each save's line folded under it as a summary is (above): a quiet
   line while closed, and once opened each save drawn as it is alone, a
   little apart from the next. */
.save-run-fold {
  margin-top: var(--space-1);
  font-size: var(--chat-quiet, var(--text-xs));
}

.message .save-run-fold > summary {
  cursor: pointer;
  color: var(--fg-muted);
}

.save-run-saves {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin: var(--space-1) 0 0;
  padding: 0;
  list-style: none;
}

/* An older summary's line ends with Latest summary ↓, kept whole on one
   line, its arrow with its words, as Answer below ↓ is. */
.latest-summary {
  white-space: nowrap;
}

/* FR-EDIT-21: the questions a reply asked, after its text, each leading to
   its answer box while it is open, so what was asked stays in the log. */
.reply-asked {
  margin-top: var(--space-2);
  font-size: var(--chat-text, var(--text-sm));
}

.reply-asked-head {
  margin: 0;
  font-weight: 600;
}

.reply-asked-list {
  margin: var(--space-1) 0 0;
  padding-left: var(--space-5);
}

.answer-below {
  font-size: var(--chat-quiet, var(--text-xs));
  white-space: nowrap;
}

/* FR-EDIT-21, FR-EDIT-31: a reply whose edit is the head says so after its
   text, drawn as the questions it asked are headed, its way down to the
   applied edit kept whole as "Answer below" is. */
.reply-made {
  margin: var(--space-2) 0 0;
  font-size: var(--chat-text, var(--text-sm));
  font-weight: 600;
}

.reply-made-link {
  font-size: var(--chat-quiet, var(--text-xs));
  font-weight: 400;
  white-space: nowrap;
}

/* Once closed, how: "· answered by alice" (linked to the answers message),
   "· skipped", "· closed unanswered", quieter than the question it follows
   (FR-EDIT-21). */
.asked-closed {
  font-size: var(--chat-quiet, var(--text-xs));
  color: var(--fg-muted);
}

/* X15: a confirmed seed, rendered as a reply is, its headings small; once
   a reply follows, its first section shows and the rest is folded under a
   quiet line, as a preset's instructions are. */
.seed-more {
  margin-top: var(--space-1);
}

.message .seed-more > summary {
  cursor: pointer;
  font-size: var(--chat-quiet, var(--text-xs));
  color: var(--fg-muted);
}

.seed-rest {
  margin-top: var(--space-2);
}

/* Answers: each question, quiet, over the answer given to it; where the
   chat is read, the question is read at the answer's size (FR-UI-22). */
.qa {
  display: grid;
  gap: var(--space-2);
  margin: 0;
}

.qa dt {
  font-size: var(--chat-text, var(--text-xs));
  color: var(--fg-muted);
}

.qa dd {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.qa-pair.skipped dd {
  color: var(--fg-muted);
  font-style: italic;
}

/* B.5 draws the reasoning collapsed. */
.reasoning {
  margin-bottom: var(--space-2);
  font-size: var(--chat-quiet, var(--text-xs));
}

.reasoning-summary {
  cursor: pointer;
  color: var(--fg-muted);
}

.reasoning-body {
  position: relative;
  margin-top: var(--space-2);
  padding: var(--space-2);
  border-radius: var(--radius);
  background: var(--bg-inset);
  color: var(--fg-muted);
  white-space: pre-wrap;
  max-height: 14rem;
  overflow: auto;
}

/* FR-UI-02: the live reply, the last entry of the list, which a reply
   streams into. It waits there empty and hidden; the reply's first event
   gives it a head, and it rises into place like any new entry. When the
   reply ends, the stored reply goes in just before it and it is emptied,
   which hides it again. */
.message.live {
  animation: enter var(--duration) var(--ease) both;
}

.message.live:has(> .message-head:empty) {
  display: none;
}

/* Its reasoning, folded, shows once there is some (FR-LLM-09). */
.message.live .reasoning:has(> .reasoning-body:empty) {
  display: none;
}

/* The text ends in a caret while it streams: a box, not a character, so a
   screen reader has nothing to read out. */
.message.live .message-body::after {
  content: "";
  display: inline-block;
  width: 0.45em;
  height: 1.1em;
  margin-left: 1px;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: pulse 1.2s ease-in-out infinite var(--loop);
}

/* A stream that stopped before the reply's end (FR-UI-02): the reply goes
   on without this page, which brings it in once it ends, so the entry
   stays a reply still to come, as one running elsewhere is (FR-EDIT-41):
   the clock counts on (reply.ts), the caret goes, the edge turns dashed,
   and one quiet line says where the reply will show. Once the reply is
   over but couldn't be brought in, the clock stops and the edge is solid
   again. */
.message.live.stalled .message-body::after {
  display: none;
}

.message.live.stalled:not(.over) {
  border-style: dashed;
}

.stalled-note {
  margin: var(--space-2) 0 0;
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

/* FR-LLM-05: nothing has come from the model for 30 s, said under the
   live reply's clock until the next event. */
.live-silence {
  margin: var(--space-1) 0 0;
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

/* One line per tool call: what the model is doing between its words. The
   newest is what it is doing now, so its dot pulses. */
.reply-activity {
  margin: 0 0 var(--space-2);
  padding: 0;
  list-style: none;
  font-size: var(--chat-quiet, var(--text-xs));
  color: var(--fg-muted);
}

.reply-activity:empty {
  display: none;
}

.reply-activity > li {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  overflow-wrap: anywhere;
}

.reply-activity > li::before {
  content: "";
  flex: 0 0 auto;
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.5;
}

.reply-activity > li:last-child::before {
  opacity: 1;
  animation: pulse 1.6s ease-in-out infinite var(--loop);
}

/* While a tool call is still being written (FR-UI-02), its line below the
   activity lines is the newest, so the last whole call's dot is done. */
#live-activity:has(+ #live-writing > li) > li:last-child::before {
  opacity: 0.5;
  animation: none;
}

/* FR-UI-02: one thing in the live reply says work is under way at a time,
   whichever it is doing now, as the stream marks it on #live-now: the
   reasoning's summary while the model thinks ("Thinking… 412 words"), the
   line for a call or findings being written, the newest activity line while
   its call runs, or the caret while the text streams, as before anything
   has come. So the caret goes while anything else is under way, and the
   newest line's dot rests while the model thinks or writes its text. */
#live-reply:has(> #live-now:not([data-now="text"])) .message-body::after {
  display: none;
}

#live-reply:has(> #live-now:is([data-now="thinking"], [data-now="text"]))
  .reply-activity
  > li:last-child::before {
  opacity: 0.5;
  animation: none;
}

/* A long reply's earlier steps fold while it runs (FR-UI-02): only its
   newest three lines show, under one line drawn as a stored reply's fold,
   "24 earlier steps", which opens to show every line in order. The fold
   shows once the stream gives it a summary. */
#live-earlier {
  margin-bottom: var(--space-2);
  font-size: var(--text-xs);
}

#live-earlier:has(> summary:empty) {
  display: none;
}

#live-earlier:not([open]) + #live-activity > li:nth-last-child(n + 4) {
  display: none;
}

/* A stored reply's steps (FR-EDIT-21): each round's reasoning, then a line
   per tool call, folded under one summary. They are done, so no dot pulses. */
.reply-steps {
  margin: var(--space-2) 0 0;
  padding: 0;
  list-style: none;
  color: var(--fg-muted);
}

.reply-steps > li {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  overflow-wrap: anywhere;
}

.reply-steps > li::before {
  content: "";
  flex: 0 0 auto;
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.5;
}

/* What came of a step (FR-UI-02, FR-EDIT-21), after its line: a refused
   or failed one says so in the error colour, live and stored alike. One
   that never ran, or whose result went unused because the reply's tool
   budget was spent (.step-skipped, §8.4 Running out), keeps the line's
   muted colour, as does the line saying the budget was spent. */
.step-refused .step-outcome,
.step-failed .step-outcome {
  color: var(--err);
}

/* FR-EDIT-11: a call Specter couldn't read folds what the model sent under
   its line, in the same flex item, so it lines up with the line's text and
   may shrink to the pane: where the parser stopped, then the arguments as
   plain text in a box that scrolls on its own, then how many more there
   were. */
.step-body {
  flex: 1 1 auto;
  min-width: 0;
}

.step-sent {
  margin-top: var(--space-1);
}

.step-sent-summary {
  cursor: pointer;
}

.step-sent-why,
.step-sent-more {
  margin: var(--space-1) 0 0;
}

.step-sent-text {
  position: relative;
  margin: var(--space-1) 0 0;
  padding: var(--space-2);
  border-radius: var(--radius);
  background: var(--bg-inset);
  font-family: var(--font-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 14rem;
  overflow: auto;
}

/* A stored reply's text, rendered from its Markdown (FR-EDIT-21): the
   spec's prose, set compactly for the pane. The streamed text keeps its line
   breaks as typed; this is HTML, whose own blocks space it. */
.reply-text {
  white-space: normal;
}

.reply-text > :first-child {
  margin-top: 0;
}

.reply-text > :last-child {
  margin-bottom: 0;
}

.reply-text p,
.reply-text ul,
.reply-text ol,
.reply-text pre,
.reply-text blockquote,
.reply-text table {
  margin: 0 0 var(--space-2);
}

.reply-text ul,
.reply-text ol {
  padding-left: var(--space-5);
}

.reply-text h1,
.reply-text h2,
.reply-text h3,
.reply-text h4,
.reply-text h5,
.reply-text h6 {
  margin: var(--space-3) 0 var(--space-1);
  font-size: var(--chat-text, var(--text-sm));
  font-weight: 600;
}

/* Where the chat is read in a wide column (FR-UI-22, X21), what a message
   says in sentences is held to the measure spec prose is read at, about 80
   characters a line: a reply's paragraphs, lists, headings and quotes, a
   person's message, the text streaming in, the questions it asked, the
   answers, the version it made and a summary. A reply's code blocks and
   tables keep the column. */
.reply-text :is(p, ul, ol, blockquote, h1, h2, h3, h4, h5, h6),
.message-body:not(.reply-text),
.compaction-text:not(.reply-text),
.reply-asked,
.reply-made,
.qa {
  max-width: var(--chat-measure, none);
}

.reply-text pre {
  position: relative;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-inset);
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.875em;
}

/* Keyed by the message too, so they outrank the spec's own code rules
   above rather than follow them with less weight; a closed exploration's
   seed is drawn as its message is (X27). */
.message .reply-text code,
.closed-seed .reply-text code {
  padding: 0.1em 0.3em;
  background: var(--bg-raised);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.875em;
}

.message .reply-text pre code,
.closed-seed .reply-text pre code {
  padding: 0;
  background: none;
  font-size: inherit;
}

.reply-text table {
  position: relative;
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

.reply-text th,
.reply-text td {
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--border);
  text-align: left;
}

.reply-text blockquote {
  padding-left: var(--space-3);
  border-left: 3px solid var(--border);
  color: var(--fg-muted);
}

/* A stored reply's code block with its Copy code, which the bundle adds
   (FR-EDIT-21): the box keeps the block's spacing, and the button sits at
   its top right, over the block, which scrolls sideways under it. Quiet
   until the block is pointed at or the keyboard reaches the button; always
   shown where nothing hovers, as on a touch screen. */
.reply-code {
  position: relative;
  margin: 0 0 var(--space-2);
}

.reply-text .reply-code > pre {
  margin: 0;
}

.reply-code > .copy-code {
  position: absolute;
  top: var(--space-1);
  right: var(--space-1);
  min-height: 0;
  padding: 0 var(--space-2);
  background: var(--bg-inset);
  font-size: var(--chat-quiet, var(--text-xs));
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease);
}

.reply-code:hover > .copy-code,
.reply-code:focus-within > .copy-code {
  opacity: 1;
}

@media (hover: none) {
  .reply-code > .copy-code {
    opacity: 1;
  }
}

/* A reply's token totals, a quiet footer under it (FR-HIST-05), Copy reply
   after them (FR-EDIT-21), and on the newest reply Regenerate (FR-HIST-04),
   wrapping under them where the pane is narrow. */
.reply-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1) var(--space-3);
  margin: var(--space-2) 0 0;
  font-size: var(--chat-quiet, var(--text-xs));
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}

/* The newest reply's Regenerate (FR-HIST-04): a quiet button, then what it
   does first in a sentence, kept together. */
.reply-regenerate {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1) var(--space-2);
}

.regenerate-reply {
  min-height: 1.75rem;
  padding: 0 var(--space-2);
  font-size: var(--chat-quiet, var(--text-xs));
}

/* A reply's Copy reply (FR-EDIT-21), in its footer before Regenerate: a
   quiet button, as the page's other copies are, at the footer's size. */
.reply-footer .copy-reply {
  min-height: 1.75rem;
  padding: 0 var(--space-2);
  font-size: var(--chat-quiet, var(--text-xs));
}

/* Why a reply stopped short (FR-EDIT-21): a sentence of its own over the
   token totals, in the footer's muted colour, which describes its Try
   again. */
.reply-stopped {
  flex-basis: 100%;
  color: var(--fg-muted);
}

/* The applied edit and the open questions: the two things a reply leaves
   behind that need an answer (FR-EDIT-05, FR-EDIT-07). Both are empty until
   a reply fills them, and an empty one takes no room. */
.applied-edit:empty,
.questions:empty,
.generation-status:empty {
  display: none;
}

/* Both follow the newest message in the log's one scroll, as whole as the
   messages are, rather than each scrolling in a box of its own and leaving
   the messages a sliver of the pane (FR-UI-15). Where the chat is read,
   their text is a message's size, their heads and quiet lines 13 px
   (FR-UI-22). */
.applied-edit,
.questions {
  flex-shrink: 0;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  background: var(--accent-bg);
  font-size: var(--chat-text, var(--text-sm));
}

/* Send answers ends the box, and draws its own foot (below): the widget
   is drawn only while a question is open, so it always has one. */
.questions {
  padding-bottom: 0;
}

.applied-edit h3,
.questions h3 {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
}

.edit-message {
  margin: 0 0 var(--space-1);
}

/* What the edit did (FR-EDIT-31): "+14 −3 · Lint: 1 warning · New IDs: …",
   on one wrapping line under its message. */
.edit-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-3);
  margin: 0 0 var(--space-1);
  padding: 0;
  list-style: none;
  color: var(--fg-muted);
  font-size: var(--text-sm);
}

.diff-stat {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* FR-EDIT-31: the summary the edit wrote, its first fact, on a line of its
   own and drawn as a page draws a changed summary (FR-UI-20): the one
   before it struck through, then the new. */
.edit-summary {
  flex-basis: 100%;
}

.edit-summary > .spec-summary {
  margin: 0;
}

/* FR-EDIT-31: an item the model's edit removed, in the applied edit's
   facts and a past edit's line, still leading to the version before it:
   in the removed colour on the diff's removed ground, struck through as a
   diff's removed words are (FR-VOTE-14). Its ID takes the colour and the
   ground (`:is(ins, del) > .p-id`); its edge is the removed one, so the
   tag reads as one with what it is. */
.removed-id {
  color: var(--err-strong);
  background: var(--del-bg);
  border-radius: var(--radius);
}

/* biome-ignore lint/style/noDescendingSpecificity: an item's own ID, which
   the more specific rules above draw, is never a removed one */
.removed-id > .p-id {
  border-color: var(--err-border);
}

.edit-target {
  margin: 0 0 var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--chat-quiet, var(--text-xs));
  color: var(--fg-muted);
}

/* FR-EDIT-31: what the edit changed, folded under Show what changed and
   drawn as the version's page draws it (FR-HIST-12): the summary, then the
   diff in a box that scrolls on its own, in the page's colours rather than
   the card's tint, so Show in editor and Undo stay near. Keyed by class
   rather than `.edit-changes > summary`, which would descend below
   `aside details[open] > summary`. */
.edit-changes {
  margin: 0 0 var(--space-3);
}

.edit-changes-summary {
  cursor: pointer;
  font-size: var(--chat-quiet, var(--text-xs));
  color: var(--fg-muted);
  transition: color var(--duration-fast) var(--ease);
}

.edit-changes-summary:hover {
  color: var(--fg);
}

.edit-changes[open] > .edit-changes-summary {
  margin-bottom: var(--space-2);
}

.edit-changes > .spec-summary {
  margin: 0 0 var(--space-2);
}

.edit-diff {
  position: relative;
  max-height: 20rem;
  overflow: auto;
  color: var(--fg);
}

.edit-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

/* FR-EDIT-31: under the heading, the reply that made the edit, one quiet
   line leading back to it; under the buttons, what Undo does, quiet too. */
.edit-from {
  margin: 0 0 var(--space-2);
  font-size: var(--chat-quiet, var(--text-xs));
  color: var(--fg-muted);
}

.edit-undo-says {
  margin: var(--space-2) 0 0;
  font-size: var(--chat-quiet, var(--text-xs));
  color: var(--fg-muted);
}

/* FR-EDIT-07, FR-EDIT-31: under that, while the text on screen differs
   from the head, that Undo would leave those edits out of date; quiet too,
   and only there while the script shows it. */
.edit-unsaved {
  margin: var(--space-1) 0 0;
  font-size: var(--chat-quiet, var(--text-xs));
  color: var(--fg-muted);
}

/* FR-EDIT-31: once a later reply has ended, the applied edit is one quiet
   line in its place, untinted, so it no longer fills the log under the
   reply that just finished (FR-UI-15). Closed, the message is cut to the
   line and its lines counted stay in view after it, on a phone too.
   Opened, its facts and buttons are the card, tinted as before; the line
   then wraps, so the whole message reads. */
.applied-edit.folded {
  padding: 0;
  border: 0;
  background: none;
}

.applied-edit-line {
  padding: var(--space-1) var(--space-2);
  scroll-margin-block: var(--space-1);
  cursor: pointer;
  color: var(--fg-muted);
  font-size: var(--chat-quiet, var(--text-xs));
}

.applied-edit-fold:not([open]) > .applied-edit-line {
  display: flex;
  align-items: center;
  white-space: nowrap;
}

/* Closed, the line is the log's last entry while no question is open, and
   the log scrolls by whole pixels while its height on a phone, a share of
   the window, rarely is one. Room under the line, as wide as the margin
   the line keeps when focus scrolls the log to it (above), keeps its whole
   ring in view (FR-UI-14). */
.applied-edit-fold:not([open]) {
  padding-bottom: var(--space-1);
}

.applied-edit-says {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The space before the count, which a flex row drops. */
.applied-edit-fold:not([open]) .applied-edit-count {
  flex: none;
  margin-inline-start: 0.25em;
}

.applied-edit-body {
  margin-top: var(--space-1);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  background: var(--accent-bg);
}

.question {
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-3);
  border-bottom: 1px solid var(--accent-border);
}

/* The question: the label of an open one's box, or, once answered or
   skipped (FR-EDIT-35), a paragraph of its own. An open one's is where
   "Answer below ↓" in the reply that asked it leads (FR-EDIT-21), the top
   of its group, and a jump to it stops a little short, clear of the rule
   and shadow the log draws at its top once scrolled (FR-UI-15). */
.question .q-text {
  display: block;
  font-weight: 600;
  margin: 0 0 var(--space-1);
  scroll-margin-top: var(--space-3);
}

.question .q-why {
  margin: 0 0 var(--space-2);
  font-size: var(--chat-quiet, var(--text-xs));
  color: var(--fg-muted);
}

/* FR-UI-15, FR-EDIT-22: an answer box starts at one row, since most
   answers are a word or a line, and grows with what is typed to six, then
   scrolls, as the message box does, with no grip to drag. Where the
   browser can't size a field to its content, the bundle does
   (`fitMessageBox` in `frontend/src/composer.ts`). */
.question .answer {
  width: 100%;
  min-height: calc(1lh + 2 * var(--space-2) + 2px);
  max-height: calc(6lh + 2 * var(--space-2) + 2px);
  font-family: inherit;
  font-size: var(--text-field);
  field-sizing: content;
  resize: none;
}

.question .skip {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
  font-size: var(--chat-quiet, var(--text-xs));
  color: var(--fg-muted);
}

/* FR-EDIT-22: how many are still unanswered, beside the heading, in the
   case it was written in. */
.q-count {
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
}

/* FR-EDIT-22: under the heading, the reply that asked the questions, one
   quiet line, its link kept whole. */
.q-asked {
  margin: 0 0 var(--space-2);
  font-size: var(--chat-quiet, var(--text-xs));
  color: var(--fg-muted);
}

.q-asked-reply {
  white-space: nowrap;
}

/* FR-EDIT-22: under the heading, the earlier questions closed unanswered
   and the reply that lists them, one quiet line. */
.q-earlier {
  margin: 0 0 var(--space-2);
  font-size: var(--chat-quiet, var(--text-xs));
  color: var(--fg-muted);
}

/* The items a question is about, and the answer it already has. Answering
   or skipping closes a question (FR-EDIT-35): it keeps this line, below the
   unanswered ones, and has no box. */
.question .q-about,
.question .q-answered {
  margin: 0 0 var(--space-2);
  font-size: var(--chat-quiet, var(--text-xs));
}

.question .q-about {
  color: var(--fg-muted);
}

.q-answer-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* An answer can be a whole pasted document. The answers message in the
   conversation holds all of it, so the line under the question is its
   start, never a page of text that buries the questions still open. */
.question > .q-answered {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}

/* Answered and skipped questions (FR-EDIT-35), folded under one line after
   the open ones: what they were asked and answered is settled, so it reads
   quieter than what still asks for an answer (FR-EDIT-22). */
.q-closed {
  padding-bottom: var(--space-3);
}

.q-closed-summary {
  cursor: pointer;
  font-size: var(--chat-quiet, var(--text-xs));
  color: var(--fg-muted);
}

.q-closed[open] > .q-closed-summary {
  margin-bottom: var(--space-2);
}

.question.answered .q-text {
  font-weight: 400;
}

.q-closed > .question:last-child {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: 0;
}

/* Suggested answers: a choice of one, drawn as buttons. Each radio stays in
   the page, under its label, for the keyboard and for a form sent without
   the bundle; picking one fills the answer box (frontend/src/questions.ts). */
.q-suggested {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  min-width: 0;
  margin: 0 0 var(--space-2);
  padding: 0;
  border: 0;
}

.q-suggested legend {
  margin-bottom: var(--space-1);
  padding: 0;
  font-size: var(--chat-quiet, var(--text-xs));
  color: var(--fg-muted);
}

.suggestion {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}

.suggestion input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: inherit;
}

.suggestion .pick {
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--border-control);
  border-radius: 999px;
  background: var(--bg);
  color: var(--fg);
  font-size: var(--chat-quiet, var(--text-xs));
  overflow-wrap: anywhere;
  transition:
    border-color var(--duration-fast) var(--ease),
    background-color var(--duration-fast) var(--ease);
}

.suggestion:hover .pick {
  border-color: var(--fg-muted);
}

.suggestion input:checked + .pick {
  border-color: var(--accent-emphasis);
  background: var(--accent-emphasis);
  color: var(--fg-on-emphasis);
}

.suggestion input:focus-visible + .pick {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* A skipped question sends no answer, so its box and picks are off while
   Skip is ticked; what they hold is kept, still readable, for if it is
   unticked. */
.suggestion input:disabled + .pick {
  border-color: var(--border);
  background: var(--bg-raised);
  color: var(--fg-muted);
  cursor: not-allowed;
}

/* FR-EDIT-22: a Clarify question's first suggestion is the model's
   recommended answer, and carries a small chip saying so, a step under the
   suggestion's size (11 px in the pane, 12 px where the chat is read,
   FR-UI-22); a screen reader hears "Recommended:" before it instead. */
.recommended-pick {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.recommended {
  padding: 0 0.375rem;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  background: var(--accent-bg);
  color: var(--accent);
  font-size: var(--chat-chip, 0.6875rem);
  font-weight: 600;
  line-height: 1.4;
}

/* Picked, the pill takes the accent, and the chip goes quiet on it. */
.suggestion input:checked + .pick > .recommended {
  border-color: currentColor;
  background: transparent;
  color: inherit;
}

/* FR-EDIT-22: a pick that kept the person's own answer in the box says so,
   one quiet line under the suggestions at the size of the question's other
   quiet lines, with a quiet button to use the suggestion instead. The
   bundle shows it (`questions.ts`). */
.q-kept {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 var(--space-2);
  margin: 0 0 var(--space-2);
  font-size: var(--chat-quiet, var(--text-xs));
  line-height: 1.4;
  color: var(--fg-muted);
}

.q-kept .q-use-pick {
  min-height: 1.75rem;
  padding: 0 var(--space-2);
  font-size: inherit;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.question .answer:disabled {
  background: var(--bg-inset);
  color: var(--fg-muted);
  cursor: not-allowed;
}

/* FR-EDIT-10, FR-EDIT-41: the running reply, drawn in the gray notice look
   of the lock line (.notice.busy) and the exploration's status, since a
   reply running is routine; the warning and error colours stay for a reply
   that stopped short or failed, in their own alerts. */
.generation-status.busy {
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-left: 4px solid var(--fg-muted);
  border-radius: var(--radius);
  background: var(--bg-subtle);
  color: var(--fg);
  font-size: var(--text-sm);
}

.generation-status p {
  margin: 0;
  flex: 1 1 14rem;
}

/* Cancel, and Esc beside it (FR-UI-13). */
.generation-status form {
  display: flex;
  align-items: center;
}

/* FR-EDIT-41: where the entry above says whose job it is, the status is
   short, "Writing a reply · Cancel Esc", its words and Cancel together. */
.generation-status:where(.short) p {
  flex: 0 1 auto;
}

.status-sep,
.elsewhere-sep,
.regenerated-sep,
.live-sep {
  color: var(--fg-muted);
}

/* FR-EDIT-41: the entry standing in for a reply another page streams,
   drawn as a reply still to come: a dashed edge, what runs and its time in
   the head, and one quiet line saying where the reply will be. */
.message.elsewhere {
  border-style: dashed;
}

.elsewhere-what {
  color: var(--fg-muted);
}

.elsewhere-note {
  margin: 0;
  color: var(--fg-muted);
}

/* FR-EDIT-41, FR-EDIT-25: while the conversation's status says the reply
   runs beside the buffer, or in its place, the lock line above them isn't
   drawn, so the sentence is said once; it stays for screen readers and for
   the controls it describes, and stays undrawn as the reply ends, when the
   status says the end in its place (below). Below 1100 px the conversation
   follows the buffer, out of sight, so the line stays there, as it does
   with the editor alone. A page that finds the spec held when it checks
   takes that status from the page served then (.coming until it has it),
   and the line waits undrawn meanwhile, so it doesn't show for a moment
   only to go. */
@media (min-width: 1101px) {
  .lock-status.busy:has(
    ~ .editor-layout:not([data-view="editor"])
      .generation-status:is(.busy, .coming)
  ) {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    white-space: nowrap;
    clip-path: inset(50%);
    border: 0;
  }
}

.lock-status.busy:has(
  ~ .editor-layout[data-view="chat"] .generation-status:is(.busy, .coming)
) {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  white-space: nowrap;
  clip-path: inset(50%);
  border: 0;
}

/* FR-EDIT-25, FR-UI-13: the starter's Cancel on the lock line is there for
   where the status's is out of sight, as in the Editor view, or far below
   the buffer, as under 1100 px. Where the line isn't drawn, beside the
   status or in the Chat view, its Cancel goes altogether, so Tab doesn't
   stop on a button no one can see and Esc presses the status's. */
@media (min-width: 1101px) {
  #lock-status.busy:has(
      ~ .editor-layout:not([data-view="editor"]) .generation-status.busy
    )
    > [action$="/generation/cancel"] {
    display: none;
  }
}

#lock-status.busy:has(
    ~ .editor-layout[data-view="chat"] .generation-status.busy
  )
  > [action$="/generation/cancel"] {
  display: none;
}

/* FR-EDIT-25: how long the job holding the spec has run, after what runs,
   counted by the bundle: "The model is writing a reply started by bob ·
   4:12. The spec is read-only until it finishes." */
.lock-clock {
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}

/* FR-EDIT-41, FR-EDIT-25: the reply ends where its start was shown. Where
   the status said it ran, beside the buffer from 1100 px and in its place
   in the Chat view, it says how it ended, one quiet line under the log,
   and the lock line stays undrawn, so nothing above the editor comes or
   goes as a reply starts or ends; the line keeps the end for screen
   readers. With no editor on screen the version leads to it instead of
   being said to be in it. Below 1100 px and with the editor alone the lock
   line says the end, as it said the start, and this line isn't drawn. */
.generation-status.ended {
  display: none;
  flex-shrink: 0;
  color: var(--fg-muted);
  font-size: var(--text-sm);
}

.ended-alone {
  display: none;
}

@media (min-width: 1101px) {
  .editor-layout:not([data-view="editor"]) .generation-status.ended {
    display: block;
  }

  .lock-status.ended:has(
    ~ .editor-layout:not([data-view="editor"]) .generation-status.ended
  ) {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    white-space: nowrap;
    clip-path: inset(50%);
    border: 0;
  }
}

.editor-layout[data-view="chat"] .generation-status.ended {
  display: block;
}

.editor-layout[data-view="chat"] .ended-beside {
  display: none;
}

.editor-layout[data-view="chat"] .ended-alone {
  display: inline;
}

.lock-status.ended:has(
  ~ .editor-layout[data-view="chat"] .generation-status.ended
) {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  white-space: nowrap;
  clip-path: inset(50%);
  border: 0;
}

/* The composer, and the presets above it (FR-EDIT-08). It is what the
   More actions list is placed against. */
.composer {
  position: relative;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: var(--space-2);
}

/* FR-EDIT-08, FR-UI-15: the presets are one row of small buttons, the rest
   folded under More actions, so the composer leaves the conversation its
   height. */
.presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.presets button {
  min-height: 1.75rem;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
}

/* More actions reads as a button of the row; its chevron turns as it
   opens. Keyed to the row, so it outranks the sidebar's disclosures. */
.presets .more-actions > summary {
  display: inline-flex;
  align-items: center;
  min-height: 1.75rem;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--fg);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}

.presets .more-actions > summary:hover {
  border-color: var(--border-strong);
}

/* Opened, its buttons stand in a list over the conversation's foot, just
   above the composer at its right edge, rather than pushing the message
   box down; a choice, a click elsewhere or Esc closes it (the bundle).
   Where the pane scrolls on its own, which clips what reaches above its
   top, the bundle fits the list to the room above the composer
   (`--room-above-composer`, from `frontend/src/composer.ts`), and a
   longer one scrolls within itself (FR-EDIT-08, FR-EDIT-33). It is drawn
   as what stands over the conversation: in the dark theme lighter than
   the replies it covers, with a deeper shadow (NFR-UX-02). */
.presets .more-actions-list {
  position: absolute;
  right: 0;
  bottom: 100%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-1);
  min-width: 14rem;
  max-height: var(--room-above-composer, none);
  overflow-y: auto;
  margin-bottom: var(--space-1);
  padding: var(--space-2);
  background: var(--overlay-bg);
  border: 1px solid var(--overlay-border);
  border-radius: var(--radius);
  box-shadow: var(--overlay-shadow);
}

.more-actions-list > button {
  justify-content: flex-start;
}

/* FR-EDIT-33: More actions' own line, at the top of its open list, says
   what the action in it under the pointer or the keyboard's focus does,
   since the list covers the line above the presets. The list grows up from
   the presets, so its actions stay put as the line comes and goes, and the
   line wraps to the list's width rather than widening it. */
.more-actions-list > .preset-hint {
  contain: inline-size;
  margin: 0;
  padding: 0 var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  color: var(--fg-muted);
  border-bottom: 1px solid var(--border);
}

.composer label {
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

/* FR-EDIT-33: the box's label, and What these do at the line's end. */
.message-box-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-1) var(--space-3);
}

/* What these do is a quiet disclosure, as the sidebar's are. Keyed to its
   line, so it outranks theirs. */
.message-box-head .presets-help > summary {
  font-size: var(--text-xs);
  color: var(--accent);
  cursor: pointer;
}

/* Opened, what each preset does stands over the conversation's foot, just
   above the composer and as wide as it, as More actions' list does. Where
   the pane scrolls on its own, the bundle fits it to the room between the
   pane's top and the composer (`--room-above-composer`), so it starts at
   its first entry and scrolls within itself to its last; without the
   bundle it is at most 60 % of the window (FR-EDIT-33). Its box is the
   region the keyboard scrolls it by (FR-UI-12). */
.message-box-head .presets-help-box {
  position: absolute;
  right: 0;
  bottom: 100%;
  left: 0;
  z-index: 2;
  max-height: var(--room-above-composer, 60vh);
  overflow-y: auto;
  margin: 0 0 var(--space-1);
  padding: var(--space-3);
  font-size: var(--text-xs);
  background: var(--overlay-bg);
  border: 1px solid var(--overlay-border);
  border-radius: var(--radius);
  box-shadow: var(--overlay-shadow);
}

.presets-help .presets-help-list {
  margin: 0;
}

.presets-help .presets-help-list > dt {
  font-weight: 600;
}

.presets-help .presets-help-list > dd {
  margin: 0 0 var(--space-2);
  color: var(--fg-muted);
}

.presets-help .presets-help-list > dd:last-child {
  margin-bottom: 0;
}

.composer .message-input {
  width: 100%;
  font-family: inherit;
  font-size: var(--text-field);
  line-height: 1.6;
}

/* FR-UI-15: the conversation's message box starts at two rows and grows
   with what is typed to six, then scrolls, so the log keeps the pane's
   height; so does the exploration's (X21). Where the browser can't size a
   field to its content, the bundle does (`fitMessageBox` in
   `frontend/src/composer.ts`). */
.conversation .message-input,
.exploration .message-input {
  min-height: calc(2lh + 2 * var(--space-2) + 2px);
  max-height: calc(6lh + 2 * var(--space-2) + 2px);
  field-sizing: content;
  resize: none;
}

/* FR-EDIT-35: while the model's questions are open and the box holds
   text, one quiet line just under the box says a message leaves them
   open, leading to them. The bundle shows it (`composer.ts`). */
.composer > .questions-left-open {
  margin: calc(-1 * var(--space-1)) 0 0;
  font-size: var(--text-sm);
  line-height: 1.4;
  color: var(--fg-muted);
}

/* FR-EDIT-33: Draft from issue and its tick are one control in one box,
   the button at its start, so the tick plainly belongs to it and not to
   the whole row. */
.presets .draft-control {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.draft-control > button {
  border-width: 0 1px 0 0;
  border-radius: var(--radius) 0 0 var(--radius);
}

/* Its tick and words on one line. */
.presets .skip-questions {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0 var(--space-3) 0 var(--space-2);
  font-size: var(--text-xs);
}

/* FR-EDIT-33: the line just above the presets says what the one under the
   pointer or the keyboard's focus does, and while the box holds text, that
   what is typed goes with it. It stands over the conversation's foot, as
   wide as the composer, as What these do's list does, so as it comes and
   goes the presets stay under the pointer and the log keeps its height;
   the pointer passes through it to the log. It is drawn as standing over
   the log in both themes, as the lists are (NFR-UX-02). */
.composer > .preset-hint {
  position: absolute;
  right: 0;
  bottom: 100%;
  left: 0;
  z-index: 2;
  margin: 0 0 var(--space-1);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--fg-muted);
  background: var(--overlay-bg);
  border: 1px solid var(--overlay-border);
  border-radius: var(--radius);
  box-shadow: var(--overlay-shadow);
  pointer-events: none;
}

/* FR-EDIT-19: the items the message box offers at a `~`, over the
   conversation's foot with their bottom at the box's top, where the bundle
   puts them (`frontend/src/ask.ts`), as wide as the composer and above the
   line the presets' descriptions take; a longer list scrolls within
   itself. Where the pane scrolls on its own, which cuts off what reaches
   above its top, the bundle caps it by the room above the box
   (`--room-above-box`), as What these do is (FR-EDIT-33). Each is its ID,
   as the conversation shows one, and the start of its statement, on one
   line. Drawn as standing over the log in both themes (NFR-UX-02). */
.composer > .message-ids {
  position: absolute;
  right: 0;
  left: 0;
  z-index: 3;
  max-height: min(16rem, 40vh, var(--room-above-box, 16rem));
  overflow-y: auto;
  margin: 0 0 var(--space-1);
  padding: var(--space-1);
  list-style: none;
  font-size: var(--text-sm);
  background: var(--overlay-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--overlay-shadow);
}

.message-ids > [role="option"] {
  overflow: hidden;
  padding: var(--space-1) var(--space-2);
  border-radius: calc(var(--radius) / 2);
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
}

/* The one Enter writes: on the selection's ground, edged at its start, and
   outlined in forced colours, where grounds go. */
.message-ids > [aria-selected="true"] {
  background: var(--selection);
  box-shadow: inset 2px 0 0 var(--accent);
  outline: 1px solid transparent;
}

.message-ids .message-id-statement {
  color: var(--fg-muted);
}

/* FR-EDIT-45: Quote, beside words selected in a reply, where the bundle
   puts it (`frontend/src/ask.ts`), its key beside it (FR-UI-13); a small
   button in a raised box, as Ask about this is in the buffer, drawn as
   standing over the conversation in both themes (NFR-UX-02). */
.quote-selection {
  position: fixed;
  z-index: 10;
  display: flex;
  align-items: center;
  padding: var(--space-1) var(--space-2) var(--space-1) var(--space-1);
  background: var(--overlay-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--overlay-shadow);
}

/* Both are small buttons, as the presets are. */
.ask-button {
  min-height: 1.75rem;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
}

/* The bundle empties the box once its message is on its way (FR-EDIT-20),
   and the browser still counts it as touched, so the empty box would wear
   the error colour until the next key. Empty, it is ready for the next
   message, not wrong: an empty Send is still caught, and the browser says
   why (FR-EDIT-24). Hovering it works as it does on any field. */
.composer .message-input:placeholder-shown:user-invalid {
  border-color: var(--border-control);
  box-shadow: none;
}

.composer .message-input:placeholder-shown:user-invalid:hover {
  border-color: var(--fg-muted);
}

.composer-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--space-3);
}

/* FR-EDIT-46: Post as a note keeps its label on one line beside Send;
   the key hint before it wraps instead. */
.composer-actions > .post-note {
  white-space: nowrap;
}

/* Send answers, and the key that sends them from a box (FR-UI-13). While
   more questions are below, it stays at the foot of the conversation's
   scroll, just over the composer (FR-UI-15). */
.answers-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  padding: var(--space-2) 0 var(--space-3);
  background: var(--accent-bg);
}

/* FR-UI-02: a refusal of the answers, on a line of its own over Send
   answers in its sticky row, so it shows where the answers are fixed
   however far the log reads from its end. Empty, it takes no room. */
#answers-refusal {
  flex: 1 0 100%;
  margin: 0 0 var(--space-2);
  padding: 0;
  list-style: none;
}

#answers-refusal:not(:has(> *)) {
  display: none;
}

#answers-refusal > .notice {
  margin: 0;
}

/* FR-EDIT-22: once one question is answered, picked or skipped while
   another is left blank, one quiet line in Send answers' row, under the
   button, says how many are blank and what becomes of them, at the size of
   the questions' other quiet lines. The bundle words and shows it
   (`questions.ts`). */
.blank-questions {
  flex: 1 0 100%;
  margin: var(--space-1) 0 0;
  font-size: var(--chat-quiet, var(--text-xs));
  line-height: 1.4;
  color: var(--fg-muted);
}

/* FR-EDIT-28, FR-EDIT-03.1: the line over Send, copied under Send answers
   in its row, since the composer may be out of view below the questions:
   quiet, as the line about blank questions is, in the send line's colours.
   The bundle keeps it a copy (`questions.ts`). */
.answers-send-state {
  flex: 1 0 100%;
  margin: var(--space-1) 0 0;
  font-size: var(--chat-quiet, var(--text-xs));
  line-height: 1.4;
  color: var(--fg-muted);
}

.answers-send-state.blocked {
  color: var(--err-strong);
}

.answers-send-state.outdated {
  color: var(--warn-strong);
}

/* FR-EDIT-25: a message held for the end of the reply holding the spec
   stays in its box, read-only, and looks it, as the locked buffer does: a
   quieter ground and a dashed edge. The line under it says it waits, in the
   muted colour, with Don't send (a button of the line's size, as every
   button is); given back unsent, it says why in the text's own colour. */
#message-text[readonly] {
  background: var(--bg-subtle);
  border-style: dashed;
}

#held-send {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  margin: 0;
  font-size: var(--text-sm);
}

#held-send.waiting {
  color: var(--fg-muted);
}

/* What a send does first to the editor's text (FR-EDIT-28): "Sending saves
   your edits as version 5 first.", over Send. The errors that would refuse
   it, or a text out of date, in the colours of the line beside Save. */
.composer > .send-state {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--fg-muted);
  text-align: right;
}

.composer > .send-state.blocked {
  color: var(--err-strong);
}

.composer > .send-state.outdated {
  color: var(--warn-strong);
}

/* Where what is sent goes (FR-LLM-08), one quiet line under the button
   that sends it, close under it; it wraps only where the pane is too
   narrow to hold it, since it must be read whole. */
.composer > .disclosure {
  margin: calc(-1 * var(--space-1)) 0 0;
  line-height: 1.4;
  text-align: right;
}

/* FR-UI-15, X21: a phone scrolls the focused box above its keyboard, but
   not the row under it, so below 600 px Send stands at the end of the
   message box's row, the box taking the rest of the width, and rises with
   it, level with the box's foot as it grows. The rest keeps a line of its
   own: what is above the box stays there, and the lines under the box
   (what each button does, FR-EDIT-46; a held message's, FR-EDIT-25; a
   kept one's, FR-EDIT-20; the questions left open, FR-EDIT-35), what a
   send does first (FR-EDIT-28), the key
   hint where a keyboard shows it (FR-UI-13) and where it is sent
   (FR-LLM-08) take the lines under the row. So it is in a window under
   500 px tall, a phone turned on its side, whatever its width. */
@media (max-width: 600px), (max-height: 31.25rem) {
  .composer {
    flex-flow: row wrap;
    align-items: flex-end;
  }

  .composer > * {
    flex: 1 0 100%;
  }

  .composer > .composer-actions {
    display: contents;
  }

  .composer > .message-input {
    flex: 1 1 0;
    min-width: 0;
  }

  .composer > .message-input ~ :not(.composer-actions),
  .composer-actions > .key-hint {
    flex-basis: 100%;
    order: 1;
  }

  /* Only the key hint, out of the actions row it ended, is put at the
     right, under Send; the sentences under the box still start at the
     left, as on a wider screen. */
  .composer-actions > .key-hint {
    text-align: right;
  }

  /* FR-EDIT-46: Post as a note, which a phone's keyboard needn't keep
     beside the box, takes a line of its own under the row, at its end. */
  .composer-actions > .post-note {
    order: 1;
    margin-left: auto;
  }

  /* FR-EDIT-25: while a reply runs, Send's longer label, Send when it
     finishes, wraps onto two lines within the button, so the box keeps its
     width as it is typed in rather than narrowing under the cursor at the
     first key; plain Send is a line. */
  .composer-actions > .button.primary {
    max-width: 6.5rem;
    text-align: center;
    text-wrap: balance;
  }
}

/* The Regenerate form draws no box of its own: its button, Answer the last
   message (FR-EDIT-09), is shown or hidden, and relabelled, as a reply ends
   (FR-HIST-04), and a hidden button leaves no gap in the panel. Like the
   composer and the status line it keeps its own height in the pane, so a
   label that wraps grows the button rather than spilling over its edge;
   the log takes what they leave (FR-UI-15). */
.regenerate {
  display: contents;
}

.regenerate button {
  align-self: flex-start;
  flex-shrink: 0;
  font-size: var(--text-sm);
}

/* FR-EDIT-24, FR-HIST-04: on the page that streamed a failed reply, its
   alert's Try again stands in for Answer the last message, so the button
   under the message box isn't drawn beside it. The next answer clears the
   alert (a refusal, a style review), and the button is there again to
   answer the message without a load. */
.conversation:has(#messages > .chat-alert[data-reply-failed])
#regenerate-button {
  display: none;
}

/* FR-EDIT-36: the Style review form draws nothing; its button sits with
   the presets and names it with `form`. */
.style-review-form {
  display: contents;
}

/* FR-UI-12: on a touch screen the conversation's controls are at least
   44 px tall, so a thumb lands on the one it aims for: its buttons, the
   View menu and its choices, the suggested answers, and
   the Skip this one and without questions first ticks, each a row around a
   20 px box. Its folds keep their look and take the height as padding.
   A desktop keeps every size above. */
@media (pointer: coarse) {
  .presets button,
  .presets .more-actions > summary,
  .regenerate-reply,
  .regenerate button,
  .composer-actions button,
  .answers-actions button,
  .explore-cancel > button,
  .edit-actions .button,
  .edit-actions form > button,
  .chat-alert > .button,
  .chat-alert > form > button,
  .generation-status form > button,
  .conversation .earlier {
    min-height: 2.75rem;
  }

  .view-choices > .view-choice {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
  }

  /* A fold's line keeps its text as it is and is
     44 px tall: the line's own height, the rest as padding above and
     below it. */
  .reasoning > .reasoning-summary,
  .message-box-head .presets-help > summary,
  .q-closed > .q-closed-summary,
  .message .seed-more > summary,
  .message .compaction-summary > summary,
  .message .save-run-fold > summary,
  .preset-instructions > .preset-summary,
  .message .replaced > summary,
  .message .flag-change > .flag-change-summary {
    min-height: 2.75rem;
    padding-block: calc((2.75rem - 1lh) / 2);
  }

  /* The 8 px between them stays. */
  .suggestion .pick {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
  }

  .question .skip,
  .presets .skip-questions {
    min-height: 2.75rem;
  }

  .question .skip > input,
  .presets .skip-questions > input {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
  }
}

/* FR-UI-12: and so are the rest of Specter's small links and folds a
   thumb taps all the time, each in its own rule's look. The folds take the
   height as padding, as the conversation's do: the sidebar's (Issue body
   and comments), the outline's Items, and below 900 px, where it is drawn
   above the spec rather than in the sidebar, its On this page (FR-UI-23),
   the issue page's Show the rest of the issue… (FR-URL-14) and the issue
   folded above an exploration's conversation (X20), Copy or download, Edit
   design notes, and on Review an item's checks and a diff's unchanged
   lines. The links and the marks bar's buttons stand 44 px tall in their
   row, keeping the room between neighbours, and Latest message ↓ stays on
   the folded issue's line; so do the editor's Show my changes and Discard
   my changes…, Copy review link and Review and vote → (FR-VOTE-11), and
   the commits Mark implemented offers (FR-EDIT-17), each keeping its quiet
   look. History's version link, and one item's history's (FR-HIST-13), is
   44 px wide too, and each ~ ID suggestion is a 44 px row. A desktop keeps
   every size. */
@media (pointer: coarse) {
  aside details > summary,
  .copies-fold-summary,
  .views-summary,
  .approval-readiness > summary,
  .spec-row-details > summary,
  .save-note-summary,
  .design-notes-edit > summary,
  .collapsed-checks-summary,
  .diff-fold-summary,
  .issue-rest-summary,
  .issue-fold-summary,
  .outline-top > details > summary,
  .outline-top .outline-items > summary {
    min-height: 2.75rem;
    padding-block: calc((2.75rem - 1lh) / 2);
  }

  .edit-marks button,
  .status-filter > a,
  .version-nav > a,
  .site-header nav > a,
  .latest-message,
  .review-ask > a.vote-jump {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
  }

  .sha-choice,
  .editor-actions .my-changes-way,
  .review-ask > button.quiet,
  .notice.done .copy-review > button.quiet {
    min-height: 2.75rem;
  }

  .history .col-version > a,
  .item-version-head > a.seq {
    display: inline-flex;
    align-items: center;
    min-width: 2.75rem;
    min-height: 2.75rem;
  }

  #editor .cm-tooltip-autocomplete li {
    display: flex;
    align-items: center;
    min-height: 2.75rem;
  }
}

/* A style review's message: what became of each finding, under the
   sentence that counts them. A rewritten line is marked as an edit, a note
   as a note, and each keeps its rule's name over the line it flags. */
/* Its sentence heads the findings under it. */
.message.style-review .message-body {
  font-weight: 600;
}

.review-findings {
  display: grid;
  gap: var(--space-2);
  margin: var(--space-2) 0 0;
  padding: 0;
  list-style: none;
}

.review-finding {
  padding: var(--space-2);
  border-left: 2px solid var(--border);
  border-radius: 0;
  background: var(--bg);
  font-size: var(--chat-text, var(--text-sm));
}

.review-finding.rewritten {
  border-left-color: var(--ok-border);
}

.review-finding.note {
  border-left-color: var(--warn-border);
}

/* FR-EDIT-36: a finding that no longer stands, a rewrite undone or a note
   gone with its line, dismissed, or replaced by a later review, is drawn
   quiet; a note still open says so in the warning colour. */
.review-finding.undone,
.review-finding.cleared {
  border-left-color: var(--border);
}

.review-finding.open .review-state {
  color: var(--warn-strong);
  font-weight: 600;
}

/* An older review's entry says its notes no longer apply, over its
   sentence; the current one's sentence leads to Review while they block
   approval. */
.review-replaced {
  margin: 0 0 var(--space-1);
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

.review-link {
  margin: var(--space-1) 0 0;
  font-size: var(--text-sm);
}

.review-finding > p {
  margin: 0;
}

.review-rule {
  font-size: var(--chat-quiet, var(--text-xs));
  color: var(--fg-muted);
}

.review-rule .rule {
  color: var(--fg);
  font-weight: 600;
}

/* What the rule asks for, in plain words, under its name (FR-EDIT-36). */
.review-meaning {
  font-size: var(--chat-quiet, var(--text-xs));
  color: var(--fg-muted);
}

.review-line,
.review-rewrite {
  font-family: var(--font-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.review-line {
  color: var(--fg-muted);
}

.review-rewrite {
  color: var(--fg);
}

.review-why {
  color: var(--fg-muted);
}

/* FR-EDIT-36: the words a rewrite changed, marked on both lines as the
   review diff marks an edited line (FR-VOTE-14), the removed ones struck
   through, so the change shows without its colour. */
.review-line > del {
  border-radius: 2px;
  background: var(--del-word-bg);
}

.review-rewrite > ins {
  border-radius: 2px;
  background: var(--add-word-bg);
  text-decoration: none;
}

@media (forced-colors: active) {
  .review-rewrite > ins {
    text-decoration: underline;
  }
}

/* A finding's line number, after its state, is a button that shows the
   line in the editor, drawn as a link as the lint list's are. */
.review-rule button.where {
  display: inline;
  min-height: 0;
  padding: 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--accent);
  background: none;
  border: 0;
  text-decoration: underline;
}

/* The rewrite a note held back, under why, with a button to copy it. */
.review-suggested {
  color: var(--fg-muted);
}

.review-suggested-line {
  font-family: var(--font-mono);
  color: var(--fg);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.review-suggested button {
  min-height: 0;
  padding: 0 var(--space-1);
  font-size: var(--text-xs);
}

/* The review page's own sections, which are not sidebar panels. Their
   headings are the page's sections, all of a size (FR-UI-24): the
   version, the diff, the authoring notes and the versions since the start. */
.columns > div > section {
  margin-bottom: var(--space-5);
}

.columns > div > section > h2 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-3);
  margin: 0 0 var(--space-3);
  font-size: var(--text-lg);
}

/* The Spec tab's design notes are a quieter panel under the spec, so their
   heading stays a step below the spec's own sections (FR-EDIT-34). */
.columns > div > .design-notes > h2 {
  font-size: var(--text-md);
}

.diff-stat {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 400;
}

/* Reject sits under its own label, and never looks like Approve. */
.columns > aside form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.columns > aside form label {
  flex: 1 0 100%;
  font-size: var(--text-xs);
  color: var(--fg-muted);
}

.columns > aside form input[type="text"] {
  flex: 1 1 8rem;
  min-width: 0;
}

/* The reason's rule and a refusal of it each take the panel's full width,
   under the box (FR-VOTE-02, FR-UI-11). */
.columns > aside form > .hint,
.columns > aside form > .error {
  flex: 1 0 100%;
  margin: 0;
}

/* The rejection reason is a paragraph, not a word: it takes the full width
   of the panel and stays resizable. Keyed by id rather than by
   `aside form textarea`, which would descend below `#editor textarea`. */
#reject-reason {
  flex: 1 0 100%;
  min-width: 0;
  min-height: 7rem;
}

/* An approval's note folds away under Approve, on a row of its own; open,
   its box takes the panel's width (FR-VOTE-01). Keyed by id, as
   #reject-reason is. */
#approve-note-fold {
  flex: 1 0 100%;
}

#approve-note {
  display: block;
  width: 100%;
  min-height: 4.5rem;
}

#approve-note-hint {
  margin: var(--space-1) 0 0;
}

/* A rejection refused once votes closed has no box to go back to, so it is
   kept beside the refusal, read-only, to copy (FR-VOTE-13); so is an
   architecture's rejection, discard or note dismissal refused where its
   form isn't drawn. Keyed by class and id rather than
   `.kept-reason > label` or `.kept-reason textarea`, which would descend
   below `.columns > aside form label` and `#editor textarea`. */
.kept-reason {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
}

.kept-reason-label {
  font-size: var(--text-xs);
  color: var(--fg-muted);
}

#arch-kept-reason,
#arch-kept-discard,
#arch-kept-note,
#kept-reason {
  width: 100%;
  min-height: 7rem;
}

/* What a form refused before its route ran had typed, kept on the 401,
   403 or 429 page to copy (FR-LOGIN-10), each box under the sentence. */
.unsent {
  margin-top: var(--space-4);
}

.unsent-text {
  width: 100%;
  min-height: 7rem;
}

/* A flag's dismissal that came second (FR-EDIT-16): who settled it, the
   note kept to copy and the way to the conversation, each on a line of its
   own in the alert; and one the store failed, said on the flag's banner on
   a line of its own above the note it kept. */
/* biome-ignore lint/style/noDescendingSpecificity: the editor's find
   panel, whose children the more specific rule above draws, is never in a
   flag's alert */
.notice.flag-settled > *,
.notice.flag > .error {
  flex-basis: 100%;
}

#flag-kept {
  width: 100%;
  max-width: 40rem;
  min-height: 5rem;
}

/* The model's open questions beside the vote, each as it was asked, and
   where they are answered (FR-VOTE-16, FR-VOTE-15). */
.vote-questions > h3 {
  margin: var(--space-3) 0 var(--space-2);
  font-size: var(--text-sm);
}

.vote-question-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0 0 var(--space-2);
  padding-left: var(--space-5);
}

/* The spec as reviewers read it, above the diff (FR-VOTE-16): the summary,
   Goal and Motivation in full, then each item as its one line, with what
   is nested under it folded beneath the line, open when it changed since
   the diff's start. The fold's bar is keyed by class rather than
   `.collapsed-checks > summary`, which would descend below
   `aside details[open] > summary`. */
.collapsed-hint {
  margin-bottom: var(--space-3);
}

.collapsed-items {
  margin: 0 0 var(--space-4);
  padding-left: 0;
  list-style: none;
}

.collapsed-children {
  margin: var(--space-2) 0 0;
  padding-left: var(--space-5);
}

.collapsed-checks {
  margin-top: var(--space-1);
}

.collapsed-checks-summary {
  width: fit-content;
  font-size: var(--text-xs);
  color: var(--fg-muted);
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease);
}

.collapsed-checks-summary:hover {
  color: var(--fg);
}

/* Why a fold is open, in words, so it reads without its colour. */
.collapsed-changed {
  color: var(--warn-strong);
}

.collapsed-fold {
  margin-top: var(--space-1);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-subtle);
  border-radius: var(--radius);
  font-size: var(--text-sm);
}

.collapsed-fold > ul {
  margin: 0;
  padding-left: var(--space-4);
}

.collapsed-fold > :last-child {
  margin-bottom: 0;
}

/* A dismissed note and its reason, quiet, beside the line it is on, or at
   the top for a note on the spec (spec-format.md § Authoring and review). */
.dismissed-note {
  margin: var(--space-1) 0 0;
  font-size: var(--text-xs);
  color: var(--fg-muted);
}

/* Under an item's line, what the page lists about it further on, its open
   authoring notes and the lint errors beside the vote, quiet, each count
   leading to the first (FR-VOTE-12). */
.collapsed-marks {
  margin: var(--space-1) 0 0;
  font-size: var(--text-xs);
  color: var(--fg-muted);
}

/* Where a note's or lint error's place, or an item's mark, lands
   (FR-VOTE-12), or a Suspected bugs reference (FR-BOOT-09), clear of the
   top: the item's ID fills in, as a followed ID's does on the Spec tab
   (FR-URL-13); the note or the lint error is outlined, as Jump to first
   change's landing is. */
.collapsed-item,
.open-note > p,
.lint > li {
  scroll-margin-top: var(--space-4);
}

.collapsed-item:target > .collapsed-line > .p-id {
  color: var(--fg-on-emphasis);
  background: var(--accent-emphasis);
  border-color: var(--accent-emphasis);
}

.open-note > p:target,
.lint > li:target {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius);
}

/* ---------------------------------------------------------------- motion */

/* What htmx swaps in (a message, a question, a banner) eases into place
   rather than popping in. `frontend/src/motion.ts` adds the class and, when
   one swap brings several things, numbers them so they arrive in turn;
   without JavaScript nothing is swapped, so nothing needs it. */
.entering {
  animation: enter var(--duration) var(--ease) both;
  animation-delay: calc(var(--i, 0) * var(--stagger));
}

/* A new message's initials land a beat after the message itself. */
.entering .avatar {
  animation: pop var(--duration-slow) var(--ease-spring) both;
  animation-delay: calc(var(--i, 0) * var(--stagger) + var(--duration-fast));
}

/* The editor's lint list is redrawn as you type; entries that rose into
   place on every pause would never sit still, so it never animates. */
.lint.live > li {
  animation: none;
  padding-left: var(--space-2);
  border-left: 3px solid var(--border);
}

/* The edge tells the severities apart by its style as well as its colour,
   so it still does in forced colours: solid for an error, dashed for a
   warning, dotted for a note (FR-LINT-17). */
.lint.live > li.severity-error {
  border-left-color: var(--err);
  border-left-style: solid;
}

.lint.live > li.severity-warning {
  border-left-color: var(--warn);
  border-left-style: dashed;
}

.lint.live > li.severity-note {
  border-left-color: var(--accent);
  border-left-style: dotted;
}

/* Each entry's line number is a button that moves the cursor there. */
.lint.live button.where {
  display: inline;
  min-height: 0;
  padding: 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--accent);
  background: none;
  border: 0;
  text-decoration: underline;
}

/* FR-UI-12: on a touch screen it is 44 px tall, the line its row. */
@media (pointer: coarse) {
  .lint.live button.where {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
  }
}

/* The current tab draws its underline as the page arrives. */
.spec-nav > [aria-current="page"] {
  animation: tab-in var(--duration-slow) var(--ease) both;
}

/* What changed since you last read it rules itself into the margin a beat
   after the page settles, so the eye is drawn to it. */
mark.change {
  animation: mark-in var(--duration-slow) var(--ease) both;
  animation-delay: var(--duration-slow);
}

/* A failure gives one small shake of the head. */
.notice.error,
.err {
  animation: nudge var(--duration-slow) var(--ease);
}

/* The logo that stands alone on the sign-in page breathes, very slowly. */
.login-logo {
  animation: float 5s ease-in-out infinite var(--loop);
}

/* While the browser leaves for another page (a link, a plain form post), a
   thin bar runs along the top: the click was heard. `motion.ts` sets the
   class and clears it when a page is shown again. */
html.navigating body::before {
  content: "";
  position: fixed;
  z-index: 20;
  top: 0;
  left: 0;
  width: 40%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  pointer-events: none;
  animation: progress 1.1s var(--ease) infinite var(--loop);
}

/* Jumps within a page scroll rather than cut. */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(0.25rem);
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
}

@keyframes tab-in {
  from {
    box-shadow: inset 0 0 0 var(--accent);
  }
}

@keyframes mark-in {
  from {
    background: transparent;
    box-shadow:
      -0.75rem 0 0 transparent,
      -1rem 0 0 transparent;
    text-decoration-color: transparent;
  }
}

@keyframes mark-rule-in {
  from {
    background: transparent;
  }
}

@keyframes nudge {
  25% {
    transform: translateX(-3px);
  }

  50% {
    transform: translateX(3px);
  }

  75% {
    transform: translateX(-1px);
  }
}

@keyframes float {
  50% {
    transform: translateY(-4px);
  }
}

@keyframes progress {
  from {
    transform: translateX(-100%);
  }

  to {
    transform: translateX(250%);
  }
}

@keyframes focus-in {
  from {
    outline-offset: 5px;
    outline-color: transparent;
  }
}

@keyframes spin {
  to {
    transform: rotate(1turn);
  }
}

@keyframes pulse {
  50% {
    opacity: 0.3;
  }
}

/* Honour the system's reduced-motion setting. Every transition, entrance,
   stagger and nudge takes no time, nothing rises or gives, and the loops
   hold still: a still ring and a still dot still say "working", and the
   navigation bar stands at full width instead of running. */
@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-fast: 0s;
    --duration: 0s;
    --duration-slow: 0s;
    --stagger: 0s;
    --lift: 0;
    --press: 1;
    --loop: paused;
  }

  html.navigating body::before {
    width: 100%;
    transform: none;
    opacity: 0.6;
  }
}

/* ----------------------------------------------------------------- print */

/* What paper prints for a word that names the viewer (FR-UI-25,
   `ui::version::for_viewer`): their login, drawn only in print. */
.as-printed {
  display: none;
}

@media print {
  /* Paper is light, so form controls and scrollbars are drawn light too
     (NFR-UX-02). */
  :root {
    color-scheme: light;
  }

  /* Paper is one frame, taken as soon as printing starts: nothing on it
     enters, fades or moves, as with reduced motion, or a fold printing
     opens (print.ts) would print its first frame, an empty gap where its
     checks fade in. Every animation runs on these tokens. */
  :root {
    --duration-fast: 0s;
    --duration: 0s;
    --duration-slow: 0s;
    --stagger: 0s;
    --loop: paused;
  }

  /* Ways around the screen and Specter's own footnotes: the tabs and
     sub-tabs, the outline, the versions' arrows, the editor's views, the
     downloads and the note under the .zip's (whose "it" is the download),
     the jumps to the vote and a dismissed highlight's to the changes, a
     gone issue's to Check again (or Try again) and Abandon…, and where
     replies come from, however a rule (some later in this file) draws
     them. The vote panel's sentences, a dismissed highlight's, a gone
     issue's, the Issue facts and the design notes print. */
  .site-header,
  .spec-nav,
  .lifecycle,
  .skip-link,
  .arch-nav,
  .arch-links,
  .zip-note,
  .arch-handover,
  .arch-next .button,
  .version-nav,
  .editor-views,
  .on-this-page,
  .aside-footnote,
  a.vote-jump,
  a.changes-jump,
  a.retry-jump,
  a.abandon-jump {
    /* biome-ignore lint/complexity/noImportantStyles: nothing in print shows a way around the screen */
    display: none !important;
  }

  /* A printed spec is a document, not a control panel: no control prints,
     however a rule draws it (every vote button and Send is a .button). The
     editor's form stays, as it holds the spec's text; its Note and Save go
     with .editor-actions. Fields go with their forms, and a task list's
     ticked box prints its tick. An exploration's message box isn't a form
     of its own: it goes with its label and where replies come from. The
     saved line's Copy review link goes with the dot before it. Every
     disclosure that asks first (Return to draft…) is a control, as are the
     plan's Edit section, a heading over two folds of forms, and the
     scaffold's Open the editor, a link drawn as a button; the sentences
     around them print. */
  form:not(.editor-form),
  .composer,
  button,
  .copy-review,
  .key-hint,
  .editor-actions,
  .ask-first,
  .arch-editor,
  .first-draft a.button {
    /* biome-ignore lint/complexity/noImportantStyles: nothing in print shows a control */
    display: none !important;
  }

  .columns {
    display: block;
  }

  /* Paper doesn't scroll: the sidebar, the tables and their scroll boxes
     print at their full size, and the jumps to the vote panel and to an
     exploration's latest message go. */
  .columns > aside {
    position: static;
    max-height: none;
    overflow-y: visible;
  }

  .spec table,
  .reply-text table {
    display: table;
    width: auto;
    overflow-x: visible;
  }

  /* A cell's long word breaks rather than widening its table past the
     page. */
  .spec th,
  .spec td,
  .reply-text th,
  .reply-text td {
    overflow-wrap: anywhere;
  }

  .issue-digest table,
  .issue-body table {
    display: table;
    overflow-x: visible;
  }

  .table-scroll {
    overflow-x: visible;
  }

  /* So does every other box that scrolls on screen, and a long line of
     code wraps rather than stopping at the paper's edge (FR-UI-12): the
     outdated notice's and a refused vote's diff, and what a step sent,
     too. */
  .issue-digest,
  .issue-body,
  .reasoning-body,
  .notes-diff,
  .edit-diff,
  .preview,
  .notice-diff,
  .step-sent-text {
    max-height: none;
    overflow: visible;
  }

  .spec pre,
  .diff,
  .reply-text pre,
  .issue-digest pre,
  .issue-body pre,
  .arch-example-code {
    overflow: visible;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  /* A diagram wider or taller than the page is scaled to fit one
     (FR-UI-19). */
  .diagram-drawing {
    overflow: visible;
  }

  .diagram-drawing > svg {
    max-width: 100%;
    max-height: 23cm;
    width: auto;
    height: auto;
  }

  /* A dark page's diagram prints its light copy, once drawn (NFR-UX-02). */
  .diagram-drawing:has(+ .diagram-drawing.for-print) {
    display: none;
  }

  .diagram-drawing.for-print {
    display: block;
  }

  /* A closed fold whose label is a control prints nothing, rather than a
     label that reads as a dead link: the diagram's source, editing the
     design notes, the issue's words. Review's checks and the rest of the
     issue on its own page, which is the page's content, are opened for
     print (print.ts); a diff's folded lines keep their count, which says
     what was left out. */
  details:not([open]) > summary.diagram-source-summary,
  .design-notes-edit,
  details:not([open]):has(> .issue-digest) > summary {
    display: none;
  }

  /* With them opened, Review's hint that the checks are folded goes too
     (print.ts marks <html> while printing), and so does the label over
     the rest of the issue, Show the rest of the issue…, which reads as a
     control; without JavaScript they print folded, under them. */
  html.printing .collapsed-hint,
  html.printing .issue-rest-summary {
    display: none;
  }

  /* A diagram, a sidebar panel, the design notes, a plan's file and its
     next step each keep to one page where they fit, and a heading, or an
     item's line over its diagram, stays with what follows it. */
  figure.diagram,
  .columns > aside > section,
  .design-notes,
  .arch-file,
  .arch-next {
    break-inside: avoid;
  }

  .spec h2,
  .spec h3,
  .spec li > p:has(+ figure.diagram) {
    break-after: avoid;
  }

  .jump-to-vote {
    display: none;
  }

  .latest-message {
    display: none;
  }

  /* What the marks are prints; what to do about them doesn't. */
  .highlight-actions {
    display: none;
  }

  /* Paper is narrower than 900 px, yet the closed disclosure above the
     spec doesn't print, nor does the sidebar's list, a way around the screen
     (above): paper can't follow the outline's links (FR-UI-23). */
  .outline-top {
    display: none;
  }

  /* The editor page's panes print whole too, without the ways between
     them (FR-UI-15). */
  .views-jump,
  .jump-to-conversation,
  .jump-to-editor,
  .jump-to-message-box {
    display: none;
  }

  .conversation {
    position: static;
    height: auto;
    max-height: none;
    overflow-y: visible;
  }

  /* The Chat view's pane too, which its own rule makes window high
     (FR-UI-22). */
  .editor-layout[data-view="chat"] > .conversation {
    position: static;
    height: auto;
    max-height: none;
    overflow-y: visible;
  }

  /* The buffer and the log print whole, not as their boxes on screen:
     CodeMirror lays out every line for print by itself. */
  #editor .cm-editor {
    height: auto;
    max-height: none;
  }

  #editor .cm-scroller {
    overflow: visible;
  }

  .conversation-log {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .spec {
    max-width: none;
  }

  /* Paper drops the fill, and would leave the landed ID's white letters
     on white: it prints as every other ID does, edged in the accent. */
  a[id^="~"]:target > .p-id {
    color: var(--accent);
    background: none;
    border-color: var(--accent);
  }

  /* So does the item a review page's note or a Suspected bugs reference
     led to (FR-VOTE-12, FR-BOOT-09). */
  .collapsed-item:target > .collapsed-line > .p-id {
    color: var(--accent);
    background: none;
    border-color: var(--accent);
  }

  mark.change {
    box-shadow: none;
    border-left: 3px solid #888888;
    padding-left: 0.5rem;
  }

  mark.change.cont {
    border-left: none;
    padding-left: 0;
    text-decoration-color: #888888;
  }

  li > mark.change.item,
  li > p:first-child > mark.change.item {
    border-left: none;
    padding-left: 0;
  }

  /* Paper drops backgrounds, so a changed item's rule is a border there. */
  li:has(> mark.change.item, > p:first-child > mark.change.item)::before {
    background: none;
    border-left: 0.25rem solid #888888;
  }

  /* Paper can't follow a link: one in the spec's text or the issue's words
     prints its address after it, unless its words are the address already
     (an autolink), it leads to code, whose words name the commit and path,
     or it is a commit Specter names by its short hash (.sha, the plan
     review's Code at b525153). The head's GitHub link prints where the
     issue lives. Item IDs and section links lead within Specter (a
     glossary or constitution ID to its Glossary and constitution page,
     FR-URL-13), and another file's ID in the issue's words to the docs
     branch: each prints as it is. */
  .spec a[href^="http"]:not([href*="/blob/"], .autolink, .sha)::after,
  .issue-digest
    a[href^="http"]:not([href*="/blob/"], .autolink, .p-id, .sha)::after {
    content: " (" attr(href) ")";
    font-size: var(--text-xs);
    color: var(--fg-muted);
    overflow-wrap: anywhere;
  }

  /* So does a comment's time, which leads to the comment on GitHub
     (FR-ISS-13) and isn't the issue's words. */
  .issue-digest .issue-comment a.comment-link[href]::after {
    content: none;
  }

  .page-github::after {
    content: " " attr(href);
  }

  /* A line that says you for the viewer prints their login (FR-UI-25). */
  .you-word {
    display: none;
  }

  .as-printed {
    display: inline;
  }
}

/* Background model work on the bootstrap page: a pulsing dot beside the
   status (--loop stops it when motion is reduced). */
.working {
  color: var(--fg-muted);
}

.working-dot {
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  border-radius: 999px;
  background: currentColor;
  vertical-align: 0.1em;
  animation: pulse 1.2s ease-in-out infinite var(--loop);
}

/* The bootstrap run's areas (FR-BOOT-17): one row each, its name and status
   chip first and its action at the row's end, then what it covers, where
   its draft is and how its job stands. */
.areas {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: 0 0 var(--space-5);
  padding-left: 0;
}

.area,
.start-step {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.area-head,
.start-step {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

/* An area's name heads its row (FR-BOOT-17), so heading navigation reaches
   each area and its buttons are described by it; drawn as the bold line it
   was, not at a section heading's size. */
.area-head > .area-name {
  margin: 0;
  font-size: var(--text);
  font-weight: 600;
}

.area-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-left: auto;
}

.area-description,
.area-files,
.area-links,
.area-note {
  margin: var(--space-1) 0 0;
  font-size: var(--text-sm);
}

.area-files,
.area-note {
  color: var(--fg-muted);
}

.area-files ul {
  margin: var(--space-1) 0 0;
  padding-left: var(--space-4);
}

/* FR-BOOT-17: the files an area's globs match, folded under its Files
   line, muted as the line is, each top-level folder in the coverage
   report's own fold. */
.area-file-list {
  margin: var(--space-1) 0 0;
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

.area-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
}

/* FR-BOOT-24: how much of the area the draft was written from, and at
   which commit, muted as the row's other facts are. */
.area-drafted {
  margin: var(--space-1) 0 0;
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

/* FR-BOOT-17, FR-BOOT-19: who approved an implemented area, at which
   commit, and what came of its suspected bugs, muted as the row's other
   facts are; the issues and items stay links. */
.area-approved,
.area-bug-issues {
  margin: var(--space-1) 0 0;
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

/* A failed attempt, said in its row: the red box of a problem beside what
   it is about (FR-UI-10), with Retry now at its end. */
.attempt-failed,
.area > .working {
  margin: var(--space-2) 0 0;
}

.start-step > .attempt-failed,
.start-step > .working,
.start-step > .run-constitution {
  flex: 1 1 100%;
  margin: 0;
}

/* FR-BOOT-26: a start's two steps, the constitution's and the survey's,
   one box each, stacked as the area rows are. */
.start-steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: 0 0 var(--space-5);
}

/* The areas Draft all would draft, listed before its button (FR-UI-18). */
.draft-all-areas {
  margin: 0;
  padding-left: var(--space-5);
  font-size: var(--text-sm);
}

/* What blocks an area's Approve baseline, under its row's head
   (FR-BOOT-18): the yellow of FR-VOTE-12's notice, close to the button it
   describes. */
.approve-blocked {
  margin: var(--space-2) 0 0;
}

/* Approve baseline asks first (FR-UI-18); opened, its actions take the
   row's whole width, so what it does and its button read below the area's
   name rather than squeezed beside it. */
.area-actions:has(> .ask-first[open]) {
  flex: 1 0 100%;
}

/* FR-BOOT-05: an area's changes while it isn't drafted yet, under its
   facts: Edit…, Remove from run… and its moves on one line, an opened
   disclosure taking the row's width for its panel. */
.area-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.area-tools > .ask-first[open] {
  flex: 1 0 100%;
}

.area-edit-field {
  width: 100%;
}

/* Globs are read character by character, as paths are. */
.area-edit-globs {
  font-family: var(--font-mono);
}

.area-move {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* FR-BOOT-05: who changed the run's areas, and how, muted under them, as
   the rows' other facts are. */
.area-edits {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin: 0 0 var(--space-5);
  padding-left: 0;
  list-style: none;
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

/* What reviewers made of a draft ready for review (FR-BOOT-21): its
   votes and its style review, under the row's head beside Approve
   baseline. */
.area-review {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin: var(--space-2) 0 0;
  font-size: var(--text-sm);
}

.area-review > p {
  margin: 0;
}

/* On a phone (FR-BOOT-21) a row's action comes after the links to its
   draft, so Approve baseline and what it asks first never sit above the
   way to read the draft. The name and its chip keep their line. */
@media (max-width: 600px) {
  .area {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: var(--space-2);
  }

  .area > .area-head {
    display: contents;
  }

  .area > :not(.area-head) {
    grid-column: 1 / -1;
  }

  .area-head > .chip {
    justify-self: start;
  }

  .area-head > .area-actions {
    grid-column: 1 / -1;
    order: 1;
    margin: var(--space-2) 0 0;
  }
}

/* Suspected bugs (FR-BOOT-09, FR-BOOT-18): each flagged item with its words
   and the model's reason, then how it was decided and the buttons that
   decide it; under its area on the run page, and beside a baseline draft
   for its reviewers. */
.area-flags {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

.area-flags > h4 {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
}

.bug-flags {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.area-flags > .bug-flags {
  margin: 0;
  padding: 0;
}

.bug-flag + .bug-flag {
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

.bug-text,
.bug-reason,
.bug-decision {
  margin: var(--space-1) 0 0;
  font-size: var(--text-sm);
}

.bug-text > p {
  margin: 0;
}

/* The model's reason and who may abandon the run are read after the
   item; muted by colour, never faded (NFR-UX-04). */
.bug-reason,
.bug-text.gone,
.run-abandon-who {
  color: var(--fg-muted);
}

.bug-label {
  font-weight: 500;
}

.bug-decide {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.run-abandon-who {
  font-size: var(--text-sm);
}

/* Who may retry or stop a run's start, said to anyone else (FR-BOOT-26):
   quiet, as who may abandon a run is. Muted by colour, never faded
   (NFR-UX-04). */
.start-stop-who {
  color: var(--fg-muted);
  font-size: var(--text-sm);
}

/* What a run-page form, or a decision on a suspected bug, just did
   (FR-BOOT-16, FR-BOOT-18): a quiet line, said once. Muted by colour,
   never faded (NFR-UX-04). */
.run-done,
.bug-decided {
  color: var(--fg-muted);
  font-size: var(--text-sm);
}

.bug-decided {
  margin: var(--space-1) 0 0;
}

/* The chip beside a flagged item's own ID in the spec (FR-BOOT-09): the
   warning yellow while undecided, red once kept as a bug, plain once
   intended; it leads to the item's entry in the panel. */
.bug-chip {
  margin-left: var(--space-1);
  text-decoration: none;
  vertical-align: 0.1em;
}

.chip.suspected {
  background: var(--warn-bg);
  border-color: var(--warn-border);
  color: var(--warn-strong);
}

.chip.bug {
  background: var(--err-bg);
  border-color: var(--err-border);
  color: var(--err-strong);
}

/* A refused approval check's page (FR-BOOT-18): the changed files, then
   the way on, one row. */
.changed-files {
  font-size: var(--text-sm);
}

.refused-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* The run's one line: who started a run that goes on, when, and how far it
   has got (FR-BOOT-17); or what a run that ended came to, its rows
   read-only, then whether another run has anything to survey (FR-BOOT-19). */
.run-summary {
  margin: 0 0 var(--space-3);
}

.run-covered {
  color: var(--fg-muted);
}

/* The coverage report (FR-BOOT-20): the way back and what it leaves out,
   then each list counted in its heading and folded by top-level folder,
   each fold counted too. */
.coverage-back,
.coverage-excluded {
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
}

.coverage-excluded,
.coverage-none {
  color: var(--fg-muted);
}

/* The commit the report read (FR-BOOT-20), above what it leaves out and
   muted as that is. */
.coverage-read {
  margin: 0 0 var(--space-1);
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

/* In the start's place while the files outside every area are those the
   last survey found nothing to make an area of in (FR-BOOT-23): said as
   the run page says it, muted by colour. */
.coverage-found-nothing {
  margin: var(--space-3) 0 0;
  color: var(--fg-muted);
}

.coverage-list {
  margin: 0 0 var(--space-6);
}

.coverage-folders {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: var(--space-2) 0 var(--space-3);
}

.coverage-folder {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.coverage-folder-name {
  cursor: pointer;
  font-size: var(--text-sm);
}

.coverage-folder > ul {
  margin: var(--space-2) 0 0;
  padding-left: var(--space-5);
  font-size: var(--text-sm);
}

/* ---------------------------------------------------------- architecture */

/* The Architecture tab (FR-ARCH-11): where the record stands, its open
   spec gaps, the head, the editor, the votes, the lifecycle and the
   discussion, one after another. The plan itself reads as the spec does
   (it carries `.spec`), at the reading measure. */
.arch-page {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* Where the plan stands and what to do next (FR-ARCH-11): the panel's
   parts one under another, the sentence first. */
.arch-state {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: var(--measure);
}

/* The sentence and the step beside it, in a box of their own: a rejection
   in the warning colours, an approved plan in the ok ones. */
.arch-next {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.arch-next.rejected {
  background: var(--warn-bg);
  border-color: var(--warn-border);
}

.arch-next.approved {
  background: var(--ok-bg);
  border-color: var(--ok-border);
}

.arch-next > p {
  margin: 0;
}

/* The sentence reads as the panel's lead. */
.arch-state-line {
  font-weight: 500;
}

/* An approved plan's download leads its line (FR-ARCH-12). */
.arch-handover {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

/* The plan's download and the spec's with it (FR-ARCH-19) keep together,
   going under the words as one when the line is too narrow for both. */
.handover-downloads {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.arch-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  margin: 0;
  font-size: var(--text-sm);
}

/* No architecture yet: what one is, and Start, with what it creates said
   under it (FR-ARCH-01). */
.arch-start {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  max-width: var(--measure);
}

.arch-start-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

/* Start and Draft side by side, each with its own form (FR-ARCH-04). */
.arch-start-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}

.arch-suggestion-words {
  margin: 0;
}

/* The spec page's lifecycle row: the architecture's line, or the
   suggestion to plan an approved spec, takes a line of its own above the
   spec's own actions (FR-ARCH-01, FR-ARCH-09). */
.arch-line,
.arch-suggestion {
  flex: 1 0 100%;
  margin: 0;
  font-size: var(--text-sm);
}

.arch-suggestion {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-subtle);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}

/* Start's and Draft's hints in the suggestion each take a line of their
   own under the buttons, as on the Architecture tab (FR-ARCH-01). */
.arch-suggestion-hint {
  flex: 1 0 100%;
  margin: 0;
}

/* What approval waits on, under the tab's panel (FR-ARCH-17): the
   review page's reasons in a quiet box, each finding under its count. The
   findings are keyed by class rather than `.arch-before .lint`. */
.arch-before {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: var(--measure);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.arch-before-words {
  margin: 0;
  font-weight: 500;
}

.arch-before-findings {
  margin: var(--space-1) 0;
  overflow-wrap: anywhere;
}

/* Open spec gaps, each a flag with its dismissal under it (FR-EDIT-16). */
.arch-gaps {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* Who made this version, when, what it is bound to and where it is stored:
   one quiet line over the plan, as a spec version's facts are. */
.arch-version-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1) var(--space-4);
  max-width: var(--measure);
  margin: 0 0 var(--space-4);
  font-size: var(--text-sm);
  color: var(--fg-muted);
}

/* The editor: the plan in plain form, full width and monospace, since
   code references and paths are read character by character. */
.arch-editor,
.arch-edit-form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-3);
}

.arch-edit-form {
  gap: var(--space-2);
  align-items: flex-start;
}

/* Before version 1, over the plan's box: the requirements the plan must
   cover, each with its text, and a folded example of an entry written
   out (FR-ARCH-06). */
.arch-plan-guide {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: var(--measure);
  margin-bottom: var(--space-3);
  font-size: var(--text-sm);
}

.arch-plan-guide-heading {
  margin: 0;
  font-size: var(--text);
}

.arch-plan-reqs {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin: 0;
  padding-left: var(--space-4);
}

.arch-plan-req-text {
  color: var(--fg-muted);
}

/* The example keeps its indentation, which says where a unit sits, and
   scrolls on its own on a phone rather than widening the page. */
.arch-example-code {
  position: relative;
  max-width: 100%;
  margin: var(--space-2) 0 0;
  overflow-x: auto;
  font-size: var(--text-sm);
}

/* The plan's box and Redraft each fold under a summary of their own
   (FR-ARCH-11), drawn as a quiet link so a drafted plan isn't followed by
   its whole text again. Keyed by class rather than `.arch-fold > summary`,
   which would descend below `aside details[open] > summary`. */
.arch-fold-summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--accent);
}

.arch-fold[open] > .arch-fold-summary {
  margin-bottom: var(--space-2);
}

/* Keyed by id rather than `.arch-edit-form textarea`, which would descend
   below `#editor textarea`. The plan's box is as tall as its text, 8 to 30
   rows, which the page sets (FR-ARCH-11). */
#arch-text,
#arch-kept {
  width: 100%;
  font-family: var(--font-mono);
  font-size: var(--text-field);
}

#arch-kept {
  min-height: 24rem;
}

/* Text this browser kept for the plan's box from an earlier version, shown
   to copy rather than put over the newer one (FR-ARCH-06): a quiet panel
   over the editor, as a kept seed is. */
.arch-plan-kept {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.arch-plan-kept-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* Keyed by id, as #arch-text is. */
#arch-plan-kept {
  width: 100%;
  font-family: var(--font-mono);
  font-size: var(--text-field);
}

/* Redraft: the instruction box, what the model reads, and the button
   (FR-ARCH-04). */
.arch-redraft {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  max-width: var(--measure);
}

#arch-instruction {
  width: 100%;
}

/* A drafting session's notice: who started it, with Cancel; or why a job
   ended without a plan, with Try again (FR-ARCH-11). */
.arch-drafting,
.arch-failed {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
}

/* How far the session has got, and the way to the instruction box: each a
   quiet line of its own under the words and their button (FR-ARCH-18).
   Keyed under the notice, which `.notice > p` would otherwise size. The
   hint quotes the person's own instruction, up to 2,000 characters, so a
   long URL in it breaks onto the next line instead of widening the page
   (FR-UI-12). */
.arch-drafting > .arch-progress,
.arch-failed > .arch-failed-hint {
  flex: 1 0 100%;
  order: 1;
  min-width: 0;
  color: var(--fg-muted);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

/* Rebind and Re-pin: what each does, said beside its button. */
.arch-rebind,
.arch-repin {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* Use spec version 4 and Update to the latest code (FR-ARCH-03,
   FR-ARCH-06): what moved, then what the button does, each a line of its
   own above it, spaced alike in both panels. */
.arch-rebind > p,
.arch-repin > p {
  flex: 1 0 100%;
  margin: 0;
}

/* What moved (FR-ARCH-17): a path's link to its change on GitHub stays
   whole on one line. */
.arch-see-change {
  white-space: nowrap;
}

.arch-design-notes,
.arch-votes,
.arch-discussion {
  max-width: var(--measure);
}

/* The design notes under the spec on the Spec tab (FR-EDIT-34): a quieter
   panel than the spec, so they never read as part of it, with the form
   that edits them folded until wanted. */
.design-notes {
  max-width: var(--measure);
  margin-top: var(--space-6);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle);
}

.design-notes-text {
  font-size: var(--text-sm);
}

/* The line that heads the alternatives a confirmed seed ruled out (X28),
   on the Spec tab and the Architecture tab: a small, quiet subheading, so
   they never read as more settled choices. Keyed under `.spec` to stand
   above `.spec h3`. */
.spec .design-notes-sub {
  margin: var(--space-4) 0 var(--space-1);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--fg-muted);
}

.design-notes-edit {
  margin-top: var(--space-3);
}

.design-notes-form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

/* Keyed by id rather than `.design-notes-edit textarea`, which would
   descend below `#editor textarea`. */
#design-notes-text,
#design-notes-kept {
  width: 100%;
  min-height: 10rem;
  font-family: var(--font-mono);
  font-size: var(--text-field);
}

.arch-discussion-list,
.arch-events,
.arch-versions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-sm);
}

/* Each of the tab's Events lines as tall as its text (FR-ARCH-11): the
   event-line class it shares with the chat keeps min-width and
   overflow-wrap, but its 10rem basis, meant for a line beside a name in a
   row, would be each line's height in this column. */
.arch-discussion-list > .event-line {
  flex: none;
}

/* History: each version on one line (v3, current, who and when, the spec
   version it is bound to, its base and its size), then the events. */
.arch-version {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1) var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--bg-inset);
}

/* A rejection or discard reason is the person's own words, so a long URL
   in it breaks onto the next line instead of widening the page (FR-UI-12). */
.arch-event {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* So does the discard reason quoted beside Start from version 3, on a
   draft with no version (FR-ARCH-06). */
.arch-start-from {
  min-width: 0;
  overflow-wrap: anywhere;
}

.arch-history {
  max-width: var(--measure);
  margin-bottom: var(--space-6);
}

/* A record that lapsed or was discarded is over, muted as an abandoned
   spec is: by the fill, not by fading the words. */
.chip.lapsed,
.chip.discarded {
  background: var(--bg-subtle);
  color: var(--fg-muted);
}

.chip.current {
  background: var(--accent-bg);
  border-color: var(--accent-border);
  color: var(--accent);
}

/* The architecture pages' head names both states, the plan's first:
   "Architecture [draft]" and "Spec [approved]", each kept on one line with
   its name, so a narrow screen never parts a chip from what it is about
   (FR-UI-16). */
.meta-arch,
.meta-spec {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

/* The exploration's head names both states, its own first:
   "Exploration [promoted]" and "Issue [open]", each kept on one line with
   its name, so an issue still open never reads as the exploration's state
   (X20). */
.meta-exploration,
.meta-issue {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

/* An exploration still open reads in the issue's open green; one promoted
   into a spec in the implemented accent, since it became one; an abandoned
   one is muted by the abandoned spec's rule (X20). */
.chip.open {
  background: var(--ok-bg);
  border-color: var(--ok-border);
  color: var(--ok-strong);
}

.chip.promoted {
  background: var(--accent-bg);
  border-color: var(--accent-border);
  color: var(--accent);
}

/* The review page (FR-ARCH-11), in §4.5's reading order: the summary
   first, in a box of its own, since it is what the rest is checked
   against. */
.arch-summary {
  padding: var(--space-3) var(--space-4);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* The card's short list: one fact a line, each read and checked on its
   own rather than run together into one sentence of counts. */
.arch-summary-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* A spec leaf with no unit or no test (AL-13): its row is tinted and the
   gap said in words, so it reads without the colour. */
.arch-lacking {
  background: var(--warn-bg);
}

.arch-missing {
  color: var(--warn-strong);
  font-weight: 600;
}

/* Each leaf's text under its ID in the coverage table, in small type, so
   it reads on touch screens and from the keyboard, which never show the
   link's title (FR-ARCH-11). Kept to a readable measure, so a long leaf
   wraps rather than widening the table. */
.arch-leaf-text {
  display: block;
  max-width: 40ch;
  min-width: 16ch;
  margin-top: var(--space-1);
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--fg-muted);
}

/* Under it, the leaf's checks, what its tests must prove (FR-ARCH-11): a
   small "Checks:" label, then one check a line in small code type,
   wrapping at the same measure as the text on a phone. */
.arch-leaf-checks {
  max-width: 40ch;
  min-width: 16ch;
  margin-top: var(--space-1);
  font-size: var(--text-sm);
  font-weight: 400;
}

.arch-leaf-checks-label {
  color: var(--fg-muted);
}

.arch-leaf-check-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Keyed by class, and by two, so it outranks `.spec li` without
   descending below `.lint.live > li`. */
.arch-leaf-check-list > .arch-leaf-check {
  margin: var(--space-1) 0 0;
  overflow-wrap: anywhere;
}

.arch-derived-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-left: var(--space-5);
}

.arch-note-form {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-left: var(--space-2);
}

/* Changes by file: each file a fold, open, with its units under it; a
   unit's code blocks folded under the unit, counted in their summary. */
.arch-changes {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.arch-file {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.arch-file-name {
  font-weight: 500;
  overflow-wrap: anywhere;
}

.arch-file-count {
  margin-left: var(--space-3);
  color: var(--fg-muted);
  font-size: var(--text-sm);
}

.arch-units {
  margin: var(--space-2) 0 0;
  padding-left: var(--space-5);
}

/* A derived unit serves no spec item directly: a dashed rule beside it,
   and the words "derived" in its text. */
.arch-unit.derived {
  padding-left: var(--space-2);
  border-left: 2px dashed var(--border-strong);
}

.arch-nested {
  margin: var(--space-1) 0 0;
  color: var(--fg-muted);
  font-size: var(--text-sm);
}

.arch-fence {
  margin-top: var(--space-1);
  font-size: var(--text-sm);
}

/* Why Approve is blocked, and what moved (FR-ARCH-08): each cited path
   with the commits that touched it. A long path breaks onto the next line
   rather than widening the notice or the sidebar (FR-UI-12). */
.arch-blockers,
.arch-stale {
  flex: 1 0 100%;
  min-width: 0;
  margin: 0;
  padding-left: var(--space-5);
  overflow-wrap: anywhere;
}

/* What a stale code check or a moved spec offers (FR-ARCH-03, FR-ARCH-08):
   the buttons side by side, wrapping. */
.arch-stale-actions,
.arch-spec-moved-actions {
  display: flex;
  flex: 1 0 100%;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* The spec's diff, folded under the tab's Spec moved (FR-ARCH-03), takes
   the block's full width. */
.arch-rebind > .arch-spec-diff {
  flex: 1 0 100%;
  min-width: 0;
}

.arch-stale-note {
  flex: 1 0 100%;
  margin: 0;
}

/* Under a commit that implements the spec itself, what that means for the
   plan (FR-ARCH-17): a line of its own, close under the commit. */
.arch-own-work-note {
  margin: var(--space-1) 0 0;
}

/* A refusal's list of findings or blockers takes the notice's full width
   under its words (FR-UI-11); a finding naming a long path breaks rather
   than sizing the list, and the page, to it (FR-UI-12). */
.arch-refusal {
  align-items: flex-start;
}

.arch-refusal > .lint {
  flex: 1 0 100%;
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

/* Who asked for the redraft the head came from, and what they asked, under
   the review page's diff heading (FR-ARCH-11). */
.arch-redrafted {
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
}

/* What moved since the version a diff starts from besides the plan's text
   (FR-ARCH-11): the spec's diff, and each cited file that changed with its
   commits and its change folded. A long path breaks onto the next line
   rather than widening the page (FR-UI-12). */
.arch-moved-words {
  margin: 0 0 var(--space-2);
}

.arch-moved-spec,
.arch-moved-code {
  margin-bottom: var(--space-4);
}

.arch-moved-files {
  margin: 0;
  padding-left: var(--space-5);
  overflow-wrap: anywhere;
}

.arch-moved-files > li:not(:first-child) {
  margin-top: var(--space-3);
}

.arch-moved-files ul {
  margin: var(--space-1) 0 0;
  padding-left: var(--space-4);
}

.arch-file-change {
  margin-top: var(--space-2);
  min-width: 0;
}

/* An AL-19 note's range at both commits, under its sentence (FR-ARCH-11):
   each a `.spec pre`, which scrolls sideways in its own box rather than
   widening the page. */
.arch-note-lines {
  margin: 0 0 var(--space-2);
}

.arch-note-at {
  margin: var(--space-2) 0 var(--space-1);
  font-size: var(--text-sm);
}

.arch-note-code {
  margin: 0;
}

/* The reject and discard reasons are paragraphs, not words. Keyed by id,
   as #reject-reason is. */
#arch-reject-reason,
#arch-discard-reason {
  flex: 1 0 100%;
  width: 100%;
  min-width: 0;
  min-height: 7rem;
}
