/* web/css/settings.css
 *
 * Settings (web/settings/): its groups, the shortcut table, Claude Code's
 * own settings and memory files, a project's commands, and the snippet editor
 * and dialogs.
 *
 * Linked from web/index.html in the order the sections had in the old
 * web/styles.css, and concatenated in that order they reproduce it exactly, so
 * the cascade is unchanged. A rule that moves between these files moves in the
 * cascade too: check what it now comes before and after.
 */

/* ── settings ────────────────────────────────────────── */
/* A column of grouped rows rather than a board, because this is the one panel
   read top to bottom instead of scanned: you arrive knowing which setting you
   came for, and the group titles are how you find it.

   One row anatomy throughout: label and note down the left, the control at the
   right edge (see .settings-row). A control no right-hand column is the right
   width for — a list, a run of pills — goes under its label at the full measure
   instead (.is-wide), with the label, note and Clear exactly where a plain row
   has them. */

/* One scroll container, one centred column. The panel is read rather than
   scanned, so it gets a measure — the head, the file it writes and the groups
   all line up inside the same one, instead of the title sitting at the far left
   of the window with the scope pickers at the far right.

   **The contents list takes no part in the centring.** It hangs outside the
   column (see `.settings-toc`), so the settings are centred on the pane and the
   aside occupies the space that leaves — rather than the *pair* being centred,
   which puts the thing you are reading right of centre.

   Which means the column has to leave room for it on both sides, because equal
   gutters is what centred means. `--set-aside` is that room, and the `min()` is
   what spends it: the column takes its measure when the pane is wide enough and
   gives width back when it is not, so the aside stays put instead of vanishing
   at some particular window size. Below the narrow breakpoint the aside becomes
   a strip above and `--set-aside` goes to zero, which hands the width back. */
.settings-shell {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    --set-aside: 196px;
    /* So a contents jump lands a group under the pinned head rather than behind
       it. --set-top-h is measured by a ResizeObserver in app.js, because the
       head's height moves with the project picker and the file line's tags. */
    scroll-padding-top: var(--set-top-h, 0px);
}
.settings-col {
    width: min(880px, calc(100% - 2 * var(--set-aside)));
    margin: 0 auto;
    padding: 0 var(--pane-x, 28px);
}

/* The head and the file line, pinned. Sticky inside .settings-col, which spans
   the whole scroll height, so it has the full length of the pane to travel. It
   paints the pane's own surface so the groups pass underneath rather than
   through it; the rule under it is what says "this stays". */
.settings-top {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--s1);
    border-bottom: 1px solid var(--outline-soft);
    margin-bottom: var(--sp-6);
}
.settings-head { padding: var(--sp-8) 0 var(--sp-6); }
.settings-title { margin: 0; font: 400 var(--fs-2xl)/var(--lh-tight) var(--sans); color: var(--text); }

/* Contents beside the groups, and deliberately out of flow: `right: 100%` puts
   it entirely to the left of the centred column, so its width cannot shift what
   it is a contents list *of*.

   Full height rather than hugging its links, because the sticky thing is the
   list inside it and a sticky element only travels within its parent's box.

   The list sticks at the offset it opens at — the pinned head's height plus the
   head's margin-bottom — so it holds still from the first scroll rather
   than sliding up beside the title once the head is pinned. */
.settings-cols { position: relative; }
.settings-toc {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 100%;
    width: calc(var(--set-aside) - var(--sp-8));
    margin-right: var(--sp-8);
}
.settings-toc-list { position: sticky; top: calc(var(--set-top-h, 0px) + var(--sp-6)); display: flex; flex-direction: column; gap: 1px; }
/* Wide enough for the longest entry on one line, indent included: "While you
   were away" and "Conversation toolbar" wrapped at 172px, hence 196px. */
.settings-toc-link {
    position: relative;
    background: none;
    border: 0;
    border-radius: var(--r-sm);
    padding: var(--sp-4) var(--sp-6);
    font: 400 var(--fs-md) var(--sans);
    color: var(--text-3);
    text-align: left;
    cursor: pointer;
}
.settings-toc-link:hover { background: var(--s2); color: var(--text); }
/* A square bar, not an inset shadow: on a rounded button the shadow follows the
   corner radius and comes out as a curved sliver that reads as a stray glyph. */
.settings-toc-link::before {
    content: "";
    position: absolute;
    left: 0;
    top: var(--sp-2);
    bottom: var(--sp-2);
    width: 2px;
    border-radius: var(--pill);
    background: transparent;
}
.settings-toc-link.on { color: var(--text); }
.settings-toc-link.on::before { background: var(--blue); }
/* A category over its groups. The same small capitals as .settings-cat in the
   body, so the two read as one heading seen twice; the groups under it are
   indented by their padding rather than by a margin, so the lit bar still sits
   on the list's left edge and lines up down the whole column. */
.settings-toc-cat {
    background: none;
    border: 0;
    border-radius: var(--r-sm);
    margin-top: var(--sp-6);
    padding: var(--sp-2) var(--sp-6) var(--sp-2);
    font: 500 var(--fs-xs)/var(--lh-tight) var(--sans);
    color: var(--text-4);
    text-align: left;
    cursor: pointer;
}
.settings-toc-cat:first-child { margin-top: 0; }
.settings-toc-cat:hover, .settings-toc-cat.on { color: var(--text-2); }
.settings-toc-cat + .settings-toc-link, .settings-toc-link + .settings-toc-link { padding-left: calc(var(--sp-6) + var(--sp-4)); }
/* A narrower right side than left: the contents column is 152px, and with an
   even 12px both sides "Session status line" wrapped onto a second line. */
.settings-toc-link { padding-top: var(--sp-2); padding-bottom: var(--sp-2); padding-right: var(--sp-4); }

.settings-picks { display: flex; flex-wrap: wrap; gap: var(--sp-5); margin-top: var(--sp-6); }
.settings-pick { display: flex; flex-direction: column; gap: var(--sp-2); }
/* The Descriptions picker is about this page rather than the file, so it
   stands apart from the two that choose what gets written. */
.settings-pick-end { margin-left: auto; }
/* A label over one value, so sentence case at meta size rather than an overline. */
.settings-pick > span { font-size: var(--fs-sm); color: var(--text-3); }
.settings-pick select {
    appearance: none;
    background: var(--s3);
    color: var(--text);
    border: 0;
    border-radius: var(--pill);
    padding: var(--sp-4) var(--sp-6);
    font: 400 var(--fs-md) var(--sans);
    max-width: 260px;
    cursor: pointer;
}
.settings-pick select:hover { background: var(--s4); }

/* The file being written, named out loud. The panel is a better way into a file
   that is still the interface, so it says which one — and clicking copies it,
   which is the whole of what a "reveal" button would have been for. */
.settings-file {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--sp-4);
    padding: 0 0 var(--sp-6);
    font-size: var(--fs-sm);
    color: var(--text-4);
}
.settings-file-lede { color: var(--text-4); }
.settings-file-path {
    background: none;
    border: 0;
    padding: 0;
    font: 400 var(--fs-sm) var(--mono);
    color: var(--text-2);
    cursor: pointer;
    text-align: left;
}
.settings-file-path:hover { color: var(--blue); text-decoration: underline; }
.settings-file-none { font-style: italic; }
.settings-file-tag {
    background: var(--s3);
    border-radius: var(--pill);
    padding: var(--sp-1) var(--sp-4);
    font-size: var(--fs-xs);
    color: var(--text-3);
}
.settings-file-tag.bad { background: var(--s2); color: var(--red); }

/* Values a file carried that a key does not allow. Above the controls rather
   than beside them, because the file is what has the problem and the control
   showing the default is behaving correctly. */
.settings-problems {
    margin: 0 0 var(--sp-6);
    padding: var(--sp-5) var(--sp-6);
    background: var(--s2);
    border-radius: var(--r);
    box-shadow: inset var(--edge-w) 0 0 var(--yellow);
    font-size: var(--fs-sm);
    line-height: var(--lh-prose);
    color: var(--text-3);
    max-width: 860px;
}
.settings-problem + .settings-problem { margin-top: var(--sp-2); }
.settings-problems code { font: 400 var(--fs-xs) var(--mono); color: var(--text-4); }

.settings-body {
    min-width: 0;
    padding: 0 0 var(--sp-10);
    display: flex;
    flex-direction: column;
    gap: var(--sp-6);
}
.settings-empty, .settings-error { padding: var(--sp-4) 0; font-size: var(--fs-md); color: var(--text-3); }
.settings-error { color: var(--red); }

/* Each group is a card, one step up the surface ramp from the pane. It used to
   be painted --s1 on an --s1 pane, which is a card nobody can see, and the rows
   inside it were the only structure left to read.

   **Everything inside a card moves up the ramp with it.** The rules below this
   point were written against the pane — a pill on --s2, a field on --s3 — and
   on an --s2 card half of them would vanish. So the card redefines the ramp for
   its own subtree, one step up, and none of them has to change. The --set-*
   copies are taken at :root, where var() resolves to the real tokens: written
   as `--s2: var(--s3)` on the card itself the chain would resolve through the
   card's own redefinitions and every step would come out --s5. A sub-card
   (.cfg-sub) is also a .settings-group, so it takes the same ramp from :root
   rather than stepping twice. */
:root { --set-s2: var(--s2); --set-s3: var(--s3); --set-s4: var(--s4); --set-s5: var(--s5); }
.settings-group {
    --s1: var(--set-s2);
    --s2: var(--set-s3);
    --s3: var(--set-s4);
    --s4: var(--set-s5);
    background: var(--s1);
    border: 1px solid var(--outline-soft);
    border-radius: var(--r-lg);
    padding: var(--sp-7) var(--sp-8) var(--sp-4);
}
/* The heading over a run of cards — Workspace, Input, and the rest; see
   SETTINGS_CATEGORIES. Quiet on purpose: it is a signpost, and the card titles
   are what you read. The margin is larger than the gap between cards so the
   heading belongs to what follows it. */
.settings-cat {
    margin: var(--sp-7) 0 calc(-1 * var(--sp-2)) var(--sp-1);
    font: 500 var(--fs-xs)/var(--lh-tight) var(--sans);
    color: var(--text-4);
}
.settings-cat:first-child { margin-top: 0; }
.settings-group[data-locked] .settings-row { opacity: 0.5; }
.settings-group-title { margin: 0; font: 400 var(--fs-lg)/var(--lh-tight) var(--sans); color: var(--text); }
.settings-group-note {
    margin: var(--sp-2) 0 0;
    max-width: 620px;
    font-size: var(--fs-sm);
    line-height: var(--lh-prose);
    color: var(--text-4);
}
.settings-locked {
    margin: var(--sp-5) 0 0;
    padding: var(--sp-4) var(--sp-6);
    background: var(--s2);
    border-radius: var(--r-sm);
    font-size: var(--fs-sm);
    line-height: var(--lh-prose);
    color: var(--text-3);
}
.settings-locked code { font: 400 var(--fs-xs) var(--mono); color: var(--text-2); }

/* Label down the left, control at the right edge, and the "Clear" or "default"
   line under the control. The controls then form one column the eye can run
   down — which they cannot when each one starts where its own label ended. */
.settings-row { display: flex; align-items: flex-start; gap: var(--sp-9); padding: var(--sp-6) 0; }
.settings-row + .settings-row { border-top: 1px solid var(--outline-soft); }
.settings-row-text { flex: 1; min-width: 0; }
.settings-row-label { font-size: var(--fs-md); color: var(--text); }
.settings-row-note { margin-top: var(--sp-2); font-size: var(--fs-sm); line-height: var(--lh-prose); color: var(--text-4); }
.settings-row-warn { margin-top: var(--sp-3); font-size: var(--fs-sm); line-height: var(--lh-prose); color: var(--yellow); }
.settings-row-warn code { font: 400 var(--fs-xs) var(--mono); }
.settings-row-ctl {
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--sp-2);
    padding-top: 1px;
}
.settings-row-side { font-size: var(--fs-sm); text-align: right; }
.settings-row-from { color: var(--text-4); }
/* Where a value came from, only for the row you are at. `visibility` rather
   than `display`, so the row does not change height or reflow as the pointer
   crosses it; `:focus-within` is what brings it back for the keyboard, since
   Clear is a button you have to be able to reach. The "Overridden by" line is
   not in here — that one is a problem, and stays in view. */
.settings-row-side.is-origin { visibility: hidden; opacity: 0; transition: opacity var(--dur-fast) var(--ease-standard); }
.settings-row:hover .settings-row-side.is-origin,
.settings-row:focus-within .settings-row-side.is-origin { visibility: visible; opacity: 1; }
/* And beside the control rather than under it: under it, the hidden line still
   held its height, and every row carried an empty line's worth of padding. */
.settings-row-ctl:has(> .settings-row-side.is-origin) {
    flex-direction: row-reverse;
    align-items: center;
    gap: var(--sp-6);
}

/* A description behind an ⓘ — settingTip() in general.js. The popover is the
   button's own ::after, off `data-tip`, so the hand-written groups in
   web/index.html get one with no script. It is positioned against the row's
   text column rather than the button, so it opens under the label at the
   label's own left edge and can use the width of the column, rather than
   starting wherever a long label happened to end. */
.settings-row-text, .settings-subhead-title, .settings-group-title { position: relative; }
.set-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    margin: 0 0 0 var(--sp-4);
    padding: 0;
    border: 1.5px solid currentColor;
    border-radius: 50%;
    background: none;
    color: var(--text-4);
    font: italic 600 var(--fs-2xs)/1 Georgia, serif;
    vertical-align: -2px;
    cursor: help;
}
.set-tip::before { content: "i"; }
.set-tip:hover, .set-tip:focus-visible { color: var(--text-2); }
.set-tip:focus-visible { outline: var(--focus-w) solid var(--focus-colour); outline-offset: var(--focus-offset); }
.set-tip::after {
    content: attr(data-tip);
    position: absolute;
    z-index: 4;
    left: 0;
    top: calc(100% + 6px);
    width: max-content;
    max-width: min(420px, 100%);
    min-width: min(240px, 100%);
    padding: var(--sp-4) var(--sp-6);
    background: var(--set-s5);
    border-radius: var(--r-sm);
    box-shadow: var(--shadow-pop);
    font: 400 var(--fs-sm)/var(--lh-prose) var(--sans);
    font-style: normal;
    color: var(--text-2);
    text-align: left;
    white-space: normal;
    pointer-events: none;
    visibility: hidden;
    opacity: 0;
    transition: opacity var(--dur-fast) var(--ease-standard);
}
.set-tip:hover::after, .set-tip:focus-visible::after { visibility: visible; opacity: 1; }

/* Which of the two shows is the Descriptions picker's — `data-notes` on
   #settings, set by paintSettingsNotes(). Anything marked `settings-desc` is a
   description that has an ⓘ twin; a note without the class is a state (a
   warning, a count) and shows either way. */
.settings[data-notes="tips"] .settings-desc { display: none; }
.settings:not([data-notes="tips"]) .set-tip { display: none; }

/* The exception: a control no right-hand column is the right width for. The
   text and the Clear go across the top and the control gets the whole measure
   underneath — which for the verb groups is the difference between four pills
   per line and a list you scroll. */
.settings-row.is-wide { flex-direction: column; gap: 0; }
.settings-row-head { display: flex; align-items: flex-start; gap: var(--sp-9); width: 100%; }
.settings-row-head .settings-row-side { flex: none; padding-top: 1px; }
.settings-row-wide { width: 100%; margin-top: var(--sp-6); }

/* A long row folded away — settings/fold.js. The label is the button, so it
   keeps the look of whatever it labels and only gains a caret in front; the
   caret hangs in the gutter so a folded label lines up with a plain one. */
.set-fold {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    /* Hangs the caret (12px) and its gap in the gutter, left of the label. */
    margin-left: calc(-1 * (12px + var(--sp-2)));
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
}
.set-fold:hover { color: var(--text); }
.set-fold:focus-visible { outline: var(--focus-w) solid var(--focus-colour); outline-offset: var(--focus-offset); border-radius: var(--r-2xs); }
.set-fold-caret {
    display: inline-flex;
    flex: none;
    width: 12px;
    color: var(--text-4);
    transition: transform var(--dur-fast) var(--ease-standard);
}
.set-fold[aria-expanded="true"] .set-fold-caret { transform: rotate(90deg); }
/* Inside a bordered block (the inherited lists) there is no gutter to hang in. */
.set-fold.is-quiet, .set-fold.is-card { margin-left: 0; }
.set-fold.is-quiet:hover { color: var(--text-2); }
.set-fold-sum { margin-top: var(--sp-2); font-size: var(--fs-sm); color: var(--text-4); }
.set-fold-sum.is-inline { margin: 0 0 0 var(--sp-4); text-transform: none; letter-spacing: 0; }
.settings-row.is-folded .settings-row-head { align-items: center; }
.cmd-card.is-folded .cmd-card-head { margin-bottom: 0; }

/* No stripe on a row this scope has set, though there was one. At User scope
   almost every row is set, so the bar ran the whole length of every group and
   read as a border somebody had drawn badly rather than as a fact about a row.
   The right-hand column already says it in a word — "Clear" against
   "default" — and that word is beside the control it belongs to. */

.settings-check { flex: none; position: relative; display: inline-flex; cursor: pointer; }
.settings-check input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.settings-check input:disabled { cursor: default; }
.settings-box {
    position: relative;
    width: 17px;
    height: 17px;
    border-radius: var(--r-2xs);
    border: 2px solid var(--outline);
    transition: background var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard);
}
/* The tick is drawn rather than shipped: an inline SVG per checkbox is a lot of
   nodes for one glyph, and two borders of a rotated box are the same picture.
   It has to be a tick and not a filled square — a filled square reads the same
   whether it means "on" or "this control is busy", and the first version of
   this was an inset ring that read as neither. */
.settings-box::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 0;
    width: 4px;
    height: 8px;
    border: solid var(--bg);
    border-width: 0 2px 2px 0;
    transform: rotate(40deg) scale(0.4);
    opacity: 0;
    transition: transform var(--dur-fast) var(--ease-standard), opacity var(--dur-fast) var(--ease-standard);
}
.settings-check input:checked + .settings-box,
.settings-group-pick input:checked + .settings-box {
    background: var(--blue);
    border-color: var(--blue);
}
.settings-check input:checked + .settings-box::after,
.settings-group-pick input:checked + .settings-box::after {
    transform: rotate(40deg) scale(1);
    opacity: 1;
}
.settings-check input:focus-visible + .settings-box,
.settings-group-pick input:focus-visible + .settings-box { outline: var(--focus-w) solid var(--focus-colour); outline-offset: var(--focus-offset); }

.settings-num, .settings-text, .settings-select {
    flex: none;
    background: var(--s3);
    color: var(--text);
    border: 0;
    border-radius: var(--r-sm);
    padding: var(--sp-3) var(--sp-5);
    font: 400 var(--fs-md) var(--sans);
}
.settings-num { width: 88px; text-align: right; font-family: var(--mono); }
/* A width, not a max-width: an <input type=text> defaults to about twenty
   characters, and the one field here is a filesystem path — so it came out
   clipped at exactly the point where reading it matters. */
.settings-text { width: 340px; max-width: 100%; font-family: var(--mono); font-size: var(--fs-sm); }
/* The pairing link is 43 characters of token on top of a hostname, and the
   remembered host is a URL — both belong in a field the width of the row rather
   than one you scroll sideways through. */
.settings-text.is-long { width: 100%; }
.pair-acts { display: flex; gap: var(--sp-8); }
/* The pairing QR (web/pairing-qr.js). The code brings its own white ground and
   quiet zone, so nothing here may tint or round into it. */
.pair-qr { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-8); margin-top: var(--sp-6); }
.pair-qr[hidden] { display: none; }
.pair-qr-code svg { display: block; width: 240px; height: 240px; }
.pair-qr .settings-row-note { flex: 1; min-width: 20ch; }
/* A list typed one entry per line — the preview's domains and URLs. */
.settings-list { display: block; width: 100%; resize: vertical; line-height: var(--lh-base); }

/* The notification rules, and the sentence that replaces them when the browser
   is refusing. Same slot, so the group does not change height. */
.settings-row-note.is-warn { color: var(--yellow); }
.settings-select { max-width: 320px; cursor: pointer; }

/* A run of rows inside a group that belong together — the live board's
   visibility over each screen. Ruled off from the rows above like a row is. */
.settings-subhead { padding: var(--sp-7) 0 var(--sp-2); border-top: 1px solid var(--outline-soft); }
.settings-subhead-title { margin: 0; font: 500 var(--fs-base)/var(--lh-tight) var(--sans); color: var(--text); }
.settings-subhead + .settings-row { border-top: 0; }
.settings-row-ctl .seg-btn:disabled { color: var(--text-4); cursor: default; }

/* One choice of a few, all in view — radios rather than a select, so a column
   of them reads as a table of what each screen does. */
.settings-radios { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-2) var(--sp-7); }
/* The control column is `flex: none`, which is right for a box or a select and
   wrong for a run of radios: in a narrow window "Open to" pushed its last two
   options out past the card's edge instead of wrapping them. */
.settings-row-ctl:has(.settings-radios) { flex: 0 1 auto; min-width: 0; }
.settings-radio { display: inline-flex; align-items: center; gap: var(--sp-3); font-size: var(--fs-md); color: var(--text-2); cursor: pointer; }
.settings-radio input { margin: 0; accent-color: var(--blue); cursor: pointer; }
.settings-radio input:disabled, .settings-radio input:disabled + span { cursor: default; color: var(--text-4); }
.settings-num:disabled, .settings-text:disabled, .settings-select:disabled { color: var(--text-4); cursor: default; }

/* A slider, for the one setting that is a strength rather than a count. The
   readout beside it is what makes it a setting rather than a guess, and it is
   tabular so the row does not twitch as the number changes width. */
.settings-range { display: flex; align-items: center; gap: var(--sp-5); flex: none; }
.settings-range input { width: 160px; accent-color: var(--blue); }
.settings-range input:disabled { cursor: default; }
.settings-range output {
    width: 36px;
    text-align: right;
    font: 400 var(--fs-sm) var(--mono);
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
}

/* The spinner groups. A wrapping row of pills across the full measure, because
   there are over a hundred of them: down one column they are a page and a half
   to scroll.

   Wrapping flex rather than a grid, which was tried first and is worse here.
   A grid gives every pill one width, so the column has to be as wide as
   "Theater / Stage Manager Phrases" or that name gets clipped — and at a width
   that fits it, "Pirate" is mostly empty space. Letting each pill be its own
   size packs more per line *and* clips nothing, which is the rare case where
   the denser layout is also the more readable one. */
.settings-groups { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); }
.settings-groups-none, .settings-groups-foot { font-size: var(--fs-sm); color: var(--text-4); }
.settings-groups-foot { flex-basis: 100%; margin-top: var(--sp-3); }
.settings-group-pick {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-4);
    background: var(--s2);
    border-radius: var(--pill);
    padding: var(--sp-2) var(--sp-6) var(--sp-2) var(--sp-4);
}
/* The pill stopped being one `<label>` when the chosen ones grew a number box.
   The checkbox is an invisible overlay filling its label, which is what makes
   the whole pill clickable — so anything the overlay covers cannot be reached,
   and the weight box has to sit outside the label rather than inside it. */
.settings-group-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: var(--sp-4);
    cursor: pointer;
}
/* Never wrapped mid-name: a pill is one label, and the line breaks between
   pills instead. Nothing is clipped, because each pill is as wide as its name. */
.settings-group-name { white-space: nowrap; }
.settings-group-pick:hover { background: var(--s3); }
.settings-group-toggle input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.settings-group-pick .settings-box { width: 14px; height: 14px; border-radius: var(--r-2xs); }
.settings-group-name { font-size: var(--fs-sm); color: var(--text-2); }
.settings-group-count { font: 400 var(--fs-xs) var(--mono); color: var(--text-4); }
/* Wide enough for three digits and no wider: it holds 0 to 1000, and every
   pill on the line is competing for the same row. */
.settings-group-weight {
    flex: none;
    width: 38px;
    padding: 1px var(--sp-2);
    text-align: right;
    font: 400 var(--fs-xs) var(--mono);
    color: var(--text);
    background: var(--s4);
    border: 0;
    border-radius: var(--r-sm);
}
.settings-group-weight:disabled { color: var(--text-4); }
.settings-group-share { font: 400 var(--fs-xs) var(--mono); color: var(--text-3); min-width: 24px; }
.settings-group-share.is-muted { color: var(--text-4); }

/* ── the shortcut table ───────────────────────────────── */
/* Rows rather than cards: thirteen of them, all the same shape, read by looking
   for one name. The chord sits in a fixed column so the whole set can be
   scanned for a collision without reading a single label. */

.settings-keys { padding: var(--sp-6) 0 var(--sp-3); border-top: 1px solid var(--outline-soft); }
.settings-keys-head { display: flex; flex-direction: column; gap: var(--sp-2); padding-bottom: var(--sp-4); }
.settings-keys-head > span:first-child { font-size: var(--fs-md); color: var(--text); }
.settings-keys-note { max-width: 620px; font-size: var(--fs-sm); line-height: var(--lh-prose); color: var(--text-4); }
.settings-keys-group { padding-top: var(--sp-3); }
.settings-keys-group-name {
    padding: var(--sp-3) 0 var(--sp-1);
    font-size: var(--fs-xs);
    color: var(--text-4);
}

.settings-key-row { display: flex; align-items: center; gap: var(--sp-6); padding: var(--sp-2) 0; }
.settings-key-label { flex: 1; min-width: 0; font-size: var(--fs-md); color: var(--text-2); }
.settings-key-combo {
    flex: none;
    width: 150px;
    background: var(--s3);
    border-radius: var(--r-xs);
    padding: var(--sp-2) var(--sp-4);
    font: 400 var(--fs-sm) var(--mono);
    color: var(--text);
    text-align: center;
}
.settings-key-row[data-clash] .settings-key-combo { background: var(--s2); color: var(--yellow); }
.settings-key-recording {
    flex: none;
    width: 150px;
    padding: var(--sp-2) var(--sp-4);
    font-size: var(--fs-xs);
    color: var(--blue);
    text-align: center;
}
.settings-key-row[data-recording] { background: var(--blue-tint); border-radius: var(--r-xs); }
.settings-key-acts { flex: none; display: flex; gap: var(--sp-5); min-width: 150px; justify-content: flex-end; }

/* The Toolbar group: one row per bar button, dragged or stepped into order. */
.settings-bar { display: flex; flex-direction: column; gap: var(--sp-1); padding-top: var(--sp-3); }
.settings-bar-row {
    display: flex;
    align-items: center;
    gap: var(--sp-6);
    padding: var(--sp-2) var(--sp-4);
    border-radius: var(--r-xs);
}
.settings-bar-row:hover { background: var(--s2); }
.settings-bar-row.dragging { opacity: 0.4; }
.settings-bar-row[draggable="true"]:active .snip-grip { cursor: grabbing; }
.settings-bar-row[data-place="hidden"] .settings-bar-name { color: var(--text-4); }
.settings-bar-name { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--sp-4);
    font-size: var(--fs-md); color: var(--text-2); }
.settings-bar-name svg { flex: none; color: var(--text-3); }
.settings-bar-noglyph { flex: none; width: 14px; }
.settings-bar-note { display: block; font-size: var(--fs-xs); color: var(--text-4); }
.settings-bar-row .snip-move:disabled { opacity: 0.3; cursor: default; background: transparent; }
.settings-bar-label { flex: none; display: flex; align-items: center; gap: var(--sp-3);
    width: 110px; font-size: var(--fs-sm); color: var(--text-3); }
.settings-bar-place { flex: none; width: 130px; }
.settings-bar-fixed { flex: none; width: 130px; font-size: var(--fs-xs); color: var(--text-4); }
.settings-bar-row.group-start { margin-top: var(--sp-3); }
.settings-bar-foot { display: flex; justify-content: flex-end; padding-top: var(--sp-4); }

/* A text-only button, for the actions inside a row where a pill would be three
   times the weight of the word in it. */
.linkish {
    background: none;
    border: 0;
    padding: 0;
    font: 400 var(--fs-sm) var(--sans);
    color: var(--blue);
    cursor: pointer;
}
.linkish:hover { text-decoration: underline; }
.linkish:disabled { color: var(--text-4); cursor: default; text-decoration: none; }

/* ── Claude Code's own settings ───────────────────────────────────────────
   One group in the panel, several cards deep, because it stands for four files
   and nine sections rather than one block of keys. The sub-cards are cards like
   any other, stepped in from the left edge, so "everything under this heading
   is about somebody else's settings" reads at a glance rather than needing the
   heading to be re-read. They used to be the one lighter ground on the page,
   back when the groups themselves were the colour of the pane; now that every
   group is a card, a lighter one read as a different kind of thing. */

.cfg-sub { margin-left: var(--sp-7); padding: var(--sp-7) var(--sp-8) var(--sp-3); }
.cfg-sub .settings-group-title { font-size: var(--fs-base); color: var(--text-2); }

/* Which of the four files, and which of the two ways of looking at it. One row,
   with the view toggle pushed to the far end: the left half picks a *file* and
   the right half picks a *lens*, and a gap says so better than a label would. */
.cfg-tabs { display: flex; align-items: center; gap: var(--sp-2); margin: var(--sp-6) 0 0; flex-wrap: wrap; }
.cfg-tabs-spacer { flex: 1; min-width: 12px; }
.cfg-tab {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    background: var(--s3);
    color: var(--text-3);
    border: 0;
    border-radius: var(--pill);
    padding: var(--sp-2) var(--sp-6);
    font: 400 var(--fs-sm) var(--sans);
    cursor: pointer;
    transition: background var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard);
}
.cfg-tab:hover { background: var(--s4); color: var(--text-2); }
.cfg-tab.on { background: var(--blue-cont); color: var(--text); }
.cfg-tab-tag {
    font: 400 var(--fs-2xs) var(--mono);
    color: var(--text-4);
}
.cfg-tab.on .cfg-tab-tag { color: var(--text-3); }

/* The sentence that answers "I changed it and nothing happened" before it is
   asked. Yellow-tinted rather than plain, because it is a caveat about every
   control below it and not a note about one. */
.cfg-reach {
    margin: var(--sp-6) 0 0;
    padding: var(--sp-4) var(--sp-6);
    background: var(--s2);
    border-left: 2px solid var(--yellow);
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    font-size: var(--fs-sm);
    line-height: var(--lh-prose);
    color: var(--text-3);
}
.cfg-sub .cfg-reach { background: var(--s3); }
.cfg-reach strong { color: var(--text-2); font-weight: 400; }
.cfg-reach-more { color: var(--text-4); }

/* A conflict. Red-edged and on the page rather than in a toast: it is the one
   message here that says a write did *not* happen, and it has to survive being
   looked away from. */
.cfg-stale {
    margin: var(--sp-6) 0 0;
    padding: var(--sp-6) var(--sp-6);
    background: var(--s2);
    border-left: 2px solid var(--red);
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    font-size: var(--fs-sm);
    line-height: var(--lh-prose);
    color: var(--text-3);
}
.cfg-stale-head { color: var(--text); }
.cfg-stale p { margin: var(--sp-2) 0 0; color: var(--text-4); }
.cfg-stale summary { margin-top: var(--sp-4); cursor: pointer; color: var(--text-3); }
.cfg-stale-text {
    margin: var(--sp-4) 0 0;
    max-height: 220px;
    overflow: auto;
    padding: var(--sp-4) var(--sp-6);
    background: var(--bg);
    border-radius: var(--r-sm);
    font: 400 var(--fs-xs)/var(--lh-prose) var(--mono);
    color: var(--text-3);
    white-space: pre-wrap;
}

/* The key's real name beside its label. Everything on this page maps to a line
   in a file somebody may have to open, and a label alone does not say which. */
.cfg-path {
    margin-left: var(--sp-4);
    font: 400 var(--fs-xs) var(--mono);
    color: var(--text-4);
}
.cfg-merged { color: var(--text-3); }
.cfg-raw-value {
    font: 400 var(--fs-xs) var(--mono);
    color: var(--text-3);
    overflow-wrap: anywhere;
}

/* A list of opaque strings — permission rules, directories, model names. One
   row per entry rather than a textarea of lines: a textarea makes
   twenty-eight rules into one draft where a single bad paste replaces the lot,
   and per row a delete is one write and a mistake loses one rule. Each row is
   a textarea because an entry is not always short. */
.cfg-list { display: flex; flex-direction: column; gap: var(--sp-2); width: 100%; }
.cfg-list-row { display: flex; align-items: flex-start; gap: var(--sp-3); }
.cfg-list-value {
    flex: 1;
    min-width: 0;
    resize: none;
    overflow: hidden;
    background: var(--bg);
    color: var(--text-2);
    border: 0;
    border-radius: var(--r-xs);
    padding: var(--sp-2) var(--sp-4);
    font: 400 var(--fs-sm)/var(--lh-base) var(--mono);
}
.cfg-list-value:focus { outline: 0; box-shadow: var(--ring-inset); }
.cfg-list-value:disabled { color: var(--text-4); }
.cfg-list-x {
    flex: none;
    width: 26px;
    height: 26px;
    background: transparent;
    color: var(--text-4);
    border: 0;
    border-radius: var(--r-xs);
    font: 400 var(--fs-base)/var(--lh-none) var(--sans);
    cursor: pointer;
    transition: background var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard);
}
.cfg-list-x:hover { background: var(--s4); color: var(--red); }
.cfg-list-x:disabled { color: var(--s5); cursor: default; background: transparent; }
.cfg-list-none { padding: var(--sp-3) 0; font-size: var(--fs-sm); color: var(--text-3); }
.cfg-list-add { display: flex; gap: var(--sp-4); align-items: center; margin-top: var(--sp-4); flex-wrap: wrap; }
/* Same trap as .cfg-kv-newvalue below: `is-long` means 100% of the row, which
   in a flex row is 100% *and* whatever it sits next to. */
.cfg-list-add > .settings-text.is-long { width: auto; flex: 1 1 200px; min-width: 0; }

/* What the other files in the chain contribute. Indented and dimmed rather
   than mixed in with the editable rows, because these lists add up across
   files and an entry another file owns is not one this scope can remove —
   showing it as an editable row with no × would be a worse lie than not
   showing it at all. */
.cfg-inherit { margin-top: var(--sp-5); padding-left: var(--sp-5); border-left: 1px solid var(--outline); }
.cfg-inherit-head {
    display: flex;
    align-items: baseline;
    gap: var(--sp-4);
    flex-wrap: wrap;
    font-size: var(--fs-xs);
    color: var(--text-4);
}
.cfg-inherit-head code { font: 400 var(--fs-2xs) var(--mono); color: var(--text-4); }
.cfg-inherit-row {
    margin-top: var(--sp-2);
    font: 400 var(--fs-xs)/var(--lh-prose) var(--mono);
    color: var(--text-4);
    overflow-wrap: anywhere;
}

/* Name and value rows — `env`, and anything shaped like it. */
.cfg-kv { display: flex; flex-direction: column; gap: var(--sp-2); width: 100%; }
.cfg-kv-row { display: flex; align-items: center; gap: var(--sp-4); }
.cfg-kv-name {
    flex: none;
    width: 180px;
    font: 400 var(--fs-sm) var(--mono);
    color: var(--text-2);
    overflow-wrap: anywhere;
}
.cfg-kv-add { display: flex; gap: var(--sp-4); align-items: center; margin-top: var(--sp-4); flex-wrap: wrap; }
.cfg-kv-newname { width: 180px; flex: none; }
/* `is-long` is `width: 100%`, which inside a flex row means "as wide as the row"
   *plus* whatever sits beside it — so the name field and the Add button pushed
   the row past the column and gave the whole panel a horizontal scrollbar.
   Flexing into what is left is what that class means here. */
.cfg-kv-newvalue { width: auto; flex: 1 1 160px; min-width: 0; }

/* Whether the script a hook names is still there — the one question a text
   editor cannot answer. */
.cfg-script { font-size: var(--fs-xs); color: var(--green); overflow-wrap: anywhere; }
.cfg-script.bad { color: var(--red); }

.cfg-statusline { width: 100%; }
.cfg-statusline .settings-row-note { max-width: 620px; }
.cfg-statusline code { font: 400 var(--fs-xs) var(--mono); }

/* The file itself. A textarea, deliberately — see claudeRawCard() for why a
   vendored editor was the wrong trade. */
.cfg-json {
    width: 100%;
    min-height: 260px;
    max-height: 70vh;
    resize: vertical;
    margin-top: var(--sp-6);
    background: var(--bg);
    color: var(--text-2);
    border: 0;
    border-radius: var(--r-sm);
    padding: var(--sp-6) var(--sp-6);
    font: 400 var(--fs-sm)/var(--lh-prose) var(--mono);
    tab-size: 2;
}
.cfg-json:focus { outline: 0; box-shadow: var(--ring-inset); }
.cfg-json:disabled { color: var(--text-4); }
.cfg-json-foot {
    display: flex;
    align-items: center;
    gap: var(--sp-7);
    padding: var(--sp-5) 0 var(--sp-6);
}
.cfg-json-note { flex: 1; min-width: 0; font-size: var(--fs-sm); line-height: var(--lh-base); color: var(--text-4); }
.cfg-json-note.bad { color: var(--red); font-family: var(--mono); font-size: var(--fs-xs); }
.cfg-json-acts { display: flex; align-items: center; gap: var(--sp-6); flex: none; }

/* ── Claude Code's memory files ───────────────────────────────────────────
   The same group furniture as the settings above it — tabs, file line, stale
   banner, foot — so only the box, the rendered view and the full-height dialog
   are new. */

/* Prose, not JSON: `pre-wrap` because a paragraph in a CLAUDE.md is one long
   line and horizontal scrolling to read a sentence is not editing. Otherwise
   the same box as .cfg-json, and shorter, because the panel's own scroll has to
   stay usable with a 23KB file in here — Expand is where the height is. */
.cfg-md {
    width: 100%;
    min-height: 220px;
    max-height: 60vh;
    resize: vertical;
    margin-top: var(--sp-6);
    background: var(--bg);
    color: var(--text-2);
    border: 0;
    border-radius: var(--r-sm);
    padding: var(--sp-6) var(--sp-6);
    font: 400 var(--fs-sm)/var(--lh-prose) var(--mono);
    white-space: pre-wrap;
    tab-size: 2;
}
.cfg-md:focus { outline: 0; box-shadow: var(--ring-inset); }
.cfg-md:disabled { color: var(--text-4); }

/* The rendered view — in place of the box under Preview, beside it under
   Split. Capped and scrolling on its own, because .prose sets no height of its
   own. */
.cfg-md-preview {
    margin-top: var(--sp-6);
    max-height: 60vh;
    overflow: auto;
    padding: var(--sp-2) var(--sp-6) var(--sp-6);
    background: var(--bg);
    border-radius: var(--r-sm);
}
.cfg-md-preview > :first-child { margin-top: var(--sp-6); }

/* Split: the box and what it renders to, side by side and the same height.
   Fixed rather than grown — see docsEditorCard — so the two tops line up and
   each pane scrolls on its own. `min-width: 0` because a grid track otherwise
   refuses to shrink below a long unbroken line in the preview. The panel is a
   column, so this is two halves of it; Expand is where there is room, and the
   narrow-window rule stacks them. */
.cfg-md-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--sp-6);
    margin-top: var(--sp-6);
}
.cfg-md-split > .cfg-md,
.cfg-md-split > .cfg-md-preview {
    height: 60vh;
    min-height: 220px;
    max-height: none;
    margin-top: 0;
    resize: none;
}

/* The other file, which also applies. Quieter than the yellow reach note above
   it — it is orientation rather than a warning. */
.cfg-md-both code { font: 400 var(--fs-xs) var(--mono); color: var(--text-3); }

.cfg-md-count { flex: none; font: 400 var(--fs-xs) var(--mono); color: var(--text-4); }

/* The full-height editor. `.tall` is the modal shape this needs and nothing
   else does: as wide as the window sensibly allows and as tall, because the
   whole reason to open it is that 60vh in a column was not enough.
   Split is two of the single-pane shape side by side, so it gets nearly the
   whole window: at 1000px each half was under 500px, narrower than the
   settings column it was meant to escape. One pane stops at 1200px, which is
   already a long line of prose. */
.modal.tall {
    width: min(1200px, 100%);
    max-height: 94vh;
    height: 94vh;
}
.modal.tall:has(> .modal-body[data-view="split"]) { width: min(1800px, 100%); }
/* `flex: 1` and `min-height: 0` together are what make the box fill the
   dialog: .modal is already a column, but .modal-body does not grow on its
   own, and without min-height a flex child refuses to shrink below its
   content — which for a 23KB file is the whole point. */
.modal.tall .modal-body {
    flex: 1;
    min-height: 0;
    display: flex;
    overflow: hidden;
    padding-bottom: var(--sp-6);
}
.memo-title { font: 400 var(--fs-base)/var(--lh-snug) var(--mono); color: var(--text-2); }
.cfg-md.big {
    flex: 1;
    min-height: 0;
    max-height: none;
    resize: none;
    margin-top: 0;
    font-size: var(--fs-md);
}
/* The dialog's two panes are both always in the DOM and `data-view` picks
   which show, so switching never rebuilds the textarea — its caret and its
   undo history survive the trip. `flex-basis: 0` splits the width evenly
   whatever either pane holds. */
.cfg-md-preview.big {
    flex: 1 1 0;
    min-width: 0;
    min-height: 0;
    max-height: none;
    margin-top: 0;
}
.modal.tall .modal-body[data-view="split"] { gap: var(--sp-6); }
.modal.tall .modal-body[data-view="split"] > .cfg-md.big { flex: 1 1 0; min-width: 0; }
.modal.tall .modal-body[data-view="edit"] > .cfg-md-preview { display: none; }
.modal.tall .modal-body[data-view="preview"] > .cfg-md { display: none; }
/* The view tabs sit at the right of the head beside the ✕. The ✕'s own
   `margin-left: auto` is what normally pushes it right; the tabs take that job
   over, so the two stay together. */
.memo-views { margin: 0 var(--sp-6) 0 auto; flex-wrap: nowrap; }
.memo-views + .modal-close { margin-left: 0; }
.memo-views .cfg-tab { font-size: var(--fs-sm); }

@media (prefers-reduced-motion: reduce) {
    .cfg-tab, .cfg-list-x, .set-fold-caret { transition: none; }
}

/* ── the commands a project declares ──────────────────────────────────────
   The same group furniture again — tabs, file line, stale banner, foot — so
   what is new here is the card per command and the field inside it. A field is
   a row rather than the label-left/control-right shape the settings rows use:
   a command's values are long (a shell line, a range, a list of variables) and
   there is no right-hand column wide enough for them that is not also mostly
   empty for `cwd`. */

.cmd-card {
    padding: var(--sp-6) var(--sp-6) var(--sp-6);
    margin-top: var(--sp-5);
    background: var(--s2);
    border: 1px solid var(--outline-soft);
    border-radius: var(--r);
}
.cmd-card.bad { border-color: var(--red); }
.cmd-card-head { display: flex; align-items: center; gap: var(--sp-4); }
/* Collapsed by default: a file of eight commands was eight screens of fields
   before you could see the list. The toggle is everything in the head but the
   delete button, which stays a sibling — a button cannot hold a button. */
.cmd-card:not(.open) { padding-bottom: var(--sp-6); }
.cmd-card-toggle {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    background: none;
    border: 0;
    padding: 0;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.cmd-card-toggle::before {
    content: "";
    flex: none;
    width: 6px;
    height: 6px;
    margin: 0 var(--sp-2) 0 1px;
    border-right: 1.5px solid var(--text-4);
    border-bottom: 1.5px solid var(--text-4);
    transform: rotate(-45deg);
    transition: transform var(--dur-fast) var(--ease-standard);
}
.cmd-card-toggle[aria-expanded="true"]::before { transform: rotate(45deg); }
.cmd-card-toggle:hover .cmd-card-id { color: var(--text); }
.cmd-card-spacer { flex: 1; min-width: 0; }
.cmd-card-id { font: 400 var(--fs-sm) var(--mono); color: var(--text-2); }
.cmd-card-name { font-size: var(--fs-sm); color: var(--text-4); }
.cfg-tab-tag.bad { color: var(--red); }

.cmd-orphan {
    margin: var(--sp-4) 0 0;
    padding: var(--sp-4) var(--sp-5);
    font-size: var(--fs-sm);
    line-height: var(--lh-prose);
    color: var(--text-3);
    background: var(--s3);
    border-radius: var(--r-sm);
}
.cmd-orphan strong { color: var(--text-2); font-weight: 400; }

.cmd-field { padding-top: var(--sp-6); margin-top: var(--sp-6); border-top: 1px solid var(--outline-soft); }
/* An unset override is still readable — greyed rather than hidden, because a
   field that vanishes when you untick it takes the inherited value with it and
   the placeholder is the whole point. */
.cmd-field.unset .cmd-field-label { color: var(--text-4); }
.cmd-field-head { display: flex; align-items: center; gap: var(--sp-4); margin-bottom: var(--sp-3); }
.cmd-field-label { font-size: var(--fs-sm); color: var(--text-2); }
.cmd-field-from {
    font-size: var(--fs-xs);
    color: var(--text-4);
    padding: 1px var(--sp-3);
    background: var(--s3);
    border-radius: var(--pill);
}
.cmd-field-note { margin: var(--sp-2) 0 0; font-size: var(--fs-xs); line-height: var(--lh-prose); color: var(--text-4); }
.cmd-field-bad { margin: var(--sp-2) 0 0; font: 400 var(--fs-xs) var(--mono); line-height: var(--lh-prose); color: var(--red); }
.cmd-field .settings-text,
.cmd-field .cmd-area { width: 100%; }
.cmd-mono { font-family: var(--mono); }
.cmd-set { flex: none; }

/* A textarea rather than an input, and not for length: `validate()` refuses
   only a NUL byte, so a newline is legal in a command — and a single-line input
   drops one silently, which eats half of somebody's command on the first save. */
.cmd-area {
    display: block;
    min-height: 26px;
    padding: var(--sp-3) var(--sp-5);
    font: 400 var(--fs-sm)/var(--lh-prose) var(--mono);
    color: var(--text);
    background: var(--s3);
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    resize: none;
    overflow: hidden;
}
.cmd-area:focus { outline: 0; box-shadow: var(--ring-inset); }
.cmd-area:disabled { color: var(--text-4); }

.cmd-port { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }
.cmd-port .settings-num { width: 88px; }
.cmd-port-dash { color: var(--text-4); }
.cmd-port-env { width: 160px; flex: none; }

.cmd-env-row { display: flex; align-items: center; gap: var(--sp-4); margin-bottom: var(--sp-3); }
.cmd-env-name { width: 170px; flex: none; }
.cmd-env-value { flex: 1; min-width: 0; }

/* What the template comes to in this directory. Only drawn when expanding
   actually changed something, so a command with no placeholders does not carry
   a line repeating itself. */
.cmd-preview {
    display: flex;
    gap: var(--sp-4);
    align-items: baseline;
    flex-wrap: wrap;
    margin: var(--sp-6) 0 0;
    padding-top: var(--sp-5);
    border-top: 1px dashed var(--outline-soft);
    font-size: var(--fs-xs);
    color: var(--text-4);
}
.cmd-preview-lede { flex: none; }
.cmd-preview code { font: 400 var(--fs-xs) var(--mono); color: var(--text-3); word-break: break-all; }

.cmd-foot {
    display: flex;
    align-items: center;
    gap: var(--sp-6);
    padding: var(--sp-6) 0 var(--sp-2);
    margin-top: var(--sp-6);
    border-top: 1px solid var(--outline-soft);
}
.cmd-foot-note { font-size: var(--fs-sm); color: var(--text-4); }
.cmd-foot-note.bad { color: var(--red); }

/* A file the form cannot show, and the way through to the one thing that can
   repair it. */
.cmd-broken { font-size: var(--fs-sm); line-height: var(--lh-prose); color: var(--text-3); }
.cmd-broken strong { color: var(--text-2); font-weight: 400; }
.cmd-broken .btn { margin-top: var(--sp-5); }

/* ── the snippet editor, in Settings ───────────────────────────────────── */

.snip-settings-acts { display: flex; gap: var(--sp-4); margin: var(--sp-2) 0 var(--sp-6); }

.snip-set-group {
    --snip-accent: var(--text-3);
    background: color-mix(in srgb, var(--snip-accent) 8%, var(--s1));
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--snip-accent) 38%, var(--s1));
    border-radius: var(--r);
    padding: var(--sp-4) var(--sp-5) var(--sp-2);
    margin-bottom: var(--sp-5);
}
/* Ungrouped is not a group, and must not look like one — but it keeps the
   padding, because it is still a place a drag has to be able to land. */
.snip-set-group.is-loose { background: none; box-shadow: none; padding-left: 0; padding-right: 0; }

.snip-set-head { display: flex; align-items: center; gap: var(--sp-4); margin-bottom: var(--sp-3); }
.snip-set-name {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    padding: var(--sp-2) var(--sp-3);
    color: color-mix(in srgb, var(--snip-accent) 70%, var(--text));
    font: 600 var(--fs-base)/var(--lh-tight) var(--sans);
}
.snip-set-name:hover { border-color: var(--outline-soft); }
.snip-set-name:focus { border-color: var(--outline); background: var(--s1); }
.snip-set-accent {
    flex: none;
    width: 28px;
    height: 24px;
    padding: 0;
    background: none;
    border: 1px solid var(--outline-soft);
    border-radius: var(--r-xs);
    cursor: pointer;
}
.snip-set-loose {
    flex: 1;
    font: 600 var(--fs-sm)/var(--lh-tight) var(--sans);
    color: var(--text-4);
}

/* A minimum height so an empty group is still somewhere a drag can be dropped. */
.snip-set-list { min-height: 12px; }

.snip-set-row {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    padding: var(--sp-3) var(--sp-2);
    border-radius: var(--r-sm);
}
.snip-set-row:hover { background: var(--s2); }
.snip-set-text { flex: 1; min-width: 0; }
.snip-set-title {
    font: 400 var(--fs-md)/var(--lh-snug) var(--sans);
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.snip-set-preview {
    font: 400 var(--fs-sm)/var(--lh-snug) var(--sans);
    color: var(--text-3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.snip-set-badges { display: flex; gap: var(--sp-2); flex: none; }
.snip-badge {
    font: 500 var(--fs-xs)/var(--lh-prose) var(--sans);
    letter-spacing: 0.03em;
    color: var(--text-3);
    background: var(--s3);
    border-radius: var(--pill);
    padding: 0 var(--sp-4);
    white-space: nowrap;
}
.snip-set-foot { padding: var(--sp-1) var(--sp-2) var(--sp-3); }

.snip-grip { flex: none; color: var(--text-4); cursor: grab; display: grid; place-items: center; }
.snip-set-row[draggable="true"]:active .snip-grip { cursor: grabbing; }

.snip-move {
    flex: none;
    width: 22px;
    height: 22px;
    color: var(--text-3);
    background: transparent;
    border-radius: var(--r-xs);
    font-size: var(--fs-sm);
    line-height: 1;
}
.snip-move:hover { background: var(--s4); color: var(--text); }

.snip-del {
    flex: none;
    display: grid;
    place-items: center;
    min-width: 24px;
    height: 24px;
    padding: 0 var(--sp-3);
    color: var(--text-3);
    background: transparent;
    border-radius: var(--r-xs);
    font: 500 var(--fs-xs)/var(--lh-none) var(--sans);
}
.snip-del:hover { background: var(--s4); color: var(--red); }
/* Armed, which is the confirmation — see snipDeleteButton. */
.snip-del.armed { color: var(--red); background: var(--red-cont); }

/* ── the snippet dialogs ───────────────────────────────────────────────── */

.snip-fill-form .field:last-child { margin-bottom: var(--sp-3); }

.snip-check { position: relative; display: flex; align-items: center; gap: var(--sp-4); cursor: pointer; }
/* `.field > label` sets `display: block` at a higher specificity than a bare
   class, so a checkbox label inside a field has to out-specify it rather than
   merely come after it — and take its own type back, since that rule also styles
   these as the small grey caption above a control rather than a line to read. */
.field > label.snip-check {
    display: flex;
    margin-bottom: 0;
    font: 400 var(--fs-base)/var(--lh-snug) var(--sans);
    color: var(--text);
}
.snip-check input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
/* The box is a flex child here, unlike in the settings rows where it is not, and
   without this it is squeezed to a sliver by the label beside it. */
.snip-check .settings-box { flex: none; }
.snip-check input:checked + .settings-box { background: var(--blue); border-color: var(--blue); }
.snip-check input:checked + .settings-box::after { transform: rotate(40deg) scale(1); opacity: 1; }
.snip-check input:focus-visible + .settings-box { outline: var(--focus-w) solid var(--focus-colour); outline-offset: var(--focus-offset); }

.snip-sub { margin: var(--sp-5) 0 0 var(--sp-9); display: flex; align-items: center; gap: var(--sp-5); }
/* An author `display` beats the UA rule for `hidden`, so every class in this file
   that sets one carries its own — see .quota-menu[hidden] and its neighbours. */
.snip-sub[hidden] { display: none; }
.snip-sub label { font: 400 var(--fs-md)/var(--lh-none) var(--sans); color: var(--text-3); }

/* The three plain pickers in this dialog — Group, Where it goes, Permissions.
   Styled for the same reason every other select in this file is, which is not
   only appearance: the reset at the top sets `background: none`, and Chromium
   draws the popup list from the element's own background, so a select left
   transparent gets a white popup with unreadable options inside a dark dialog.
   The closed control looks right anyway — transparent over a dark modal, with
   `color: inherit` — which is what makes this easy to miss until somebody opens
   one. `.opts select`, `.when-args select` and `.settings-select` all carry a
   background for the same reason.

   The child combinator is load-bearing: it keeps this off the type pickers in
   the parameter rows, which sit deeper and have their own rule below. Without it
   this selector's id would out-specify that one and repaint them. */
#snip-edit-scrim .field > select,
#snip-edit-scrim .snip-sub select {
    background: var(--bg);
    border: 1px solid var(--outline-soft);
    border-radius: var(--r-sm);
    padding: var(--sp-4) var(--sp-5);
    color: var(--text);
    font: 400 var(--fs-md)/var(--lh-tight) var(--sans);
    cursor: pointer;
}

.snip-params { display: flex; flex-direction: column; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.snip-param { display: flex; align-items: center; gap: var(--sp-3); }
.snip-param input[type="text"], .snip-param select {
    background: var(--s1);
    border: 1px solid var(--outline-soft);
    border-radius: var(--r-sm);
    padding: var(--sp-3) var(--sp-4);
    color: var(--text);
    font: 400 var(--fs-md)/var(--lh-tight) var(--sans);
    min-width: 0;
}
.snip-param-name { flex: 0 1 130px; font-family: var(--mono) !important; }
.snip-param-label { flex: 1 1 130px; }
.snip-param-type { flex: 0 1 110px; }
.snip-param-default { flex: 1 1 110px; }
.snip-param-req { font: 400 var(--fs-sm)/var(--lh-none) var(--sans); color: var(--text-3); }

.snip-projects { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.snip-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-3);
    background: var(--s3);
    border-radius: var(--pill);
    padding: var(--sp-2) var(--sp-3) var(--sp-2) var(--sp-5);
    font: 400 var(--fs-sm)/var(--lh-snug) var(--mono);
    color: var(--text-2);
}
.snip-chip-x { color: var(--text-4); background: none; font-size: var(--fs-xs); padding: 0 var(--sp-2); }
.snip-chip-x:hover { color: var(--red); }
.snip-project-add { display: flex; gap: var(--sp-3); }
.snip-project-add input {
    flex: 1;
    background: var(--s1);
    border: 1px solid var(--outline-soft);
    border-radius: var(--r-sm);
    padding: var(--sp-4) var(--sp-4);
    color: var(--text);
    font: 400 var(--fs-sm)/var(--lh-tight) var(--mono);
}


/* Agent brief — web/settings/brief.js. Each section is a switch row with its
   text folded under it; the preview is the composed brief, with what a
   condition left out struck through. */
.brief-sec + .brief-sec, .brief-sec { border-top: 1px solid var(--outline-soft); }
.brief-sec .settings-row { padding-bottom: var(--sp-2); }
.brief-id { font: 400 var(--fs-xs) var(--mono); color: var(--text-4); }
.brief-tag { font-size: var(--fs-xs); color: var(--yellow); }
.brief-edit { padding: 0 0 var(--sp-6); }
.brief-edit > summary { cursor: pointer; font-size: var(--fs-sm); color: var(--text-3); }
.brief-edit[open] > summary { margin-bottom: var(--sp-4); }
.brief-text { padding: var(--sp-4) 0 var(--sp-6); }
.brief-preview-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-6); margin: var(--sp-5) 0; }
.brief-struck { display: inline-flex; align-items: center; gap: var(--sp-3); font-size: var(--fs-sm); color: var(--text-3); }
.brief-features { display: inline-flex; flex-wrap: wrap; gap: var(--sp-3); }
.brief-feature {
    padding: 1px var(--sp-4);
    border: 1px solid var(--outline-soft);
    border-radius: var(--pill);
    font: 400 var(--fs-xs) var(--mono);
    color: var(--text-4);
    text-decoration: line-through;
}
.brief-feature.on { color: var(--green); border-color: currentColor; text-decoration: none; }
.brief-problems { margin: 0 0 var(--sp-5); padding-left: var(--sp-9); font-size: var(--fs-sm); color: var(--yellow); }
.brief-preview {
    margin: 0;
    padding: var(--sp-6);
    max-height: 520px;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    background: var(--s1);
    border: 1px solid var(--outline-soft);
    border-radius: var(--r-sm);
    font: 400 var(--fs-sm)/var(--lh-base) var(--mono);
    color: var(--text-2);
}
.brief-preview del { color: var(--text-4); text-decoration-color: var(--red-soft); background: transparent; }

/* `type: 'origins'` — preview.agentOrigins, one site per line with Remove. */
.settings-origins { list-style: none; margin: 0; padding: 0; }
.settings-origins li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-6);
    padding: var(--sp-2) 0;
    border-bottom: 1px solid var(--outline-soft);
}
.settings-origins li:last-child { border-bottom: 0; }
.settings-origins code { font-size: var(--fs-sm); }
.settings-origins-empty { margin: 0; color: var(--text-3); font-size: var(--fs-sm); }

/* Settings → Updates (web/settings/updates.js). */
.upd-actions { flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-3); }
.upd-progress { display: block; width: 100%; max-width: 340px; height: 6px; margin-top: var(--sp-3); accent-color: var(--blue); }
.upd-log {
    margin: var(--sp-3) 0 0;
    padding: var(--sp-4);
    max-height: 200px;
    overflow: auto;
    white-space: pre-wrap;
    background: var(--s2);
    border-radius: var(--r-sm);
    font: 400 var(--fs-sm)/var(--lh-base) var(--mono);
    color: var(--text-3);
}

/* ── Secrets ─────────────────────────────────────────────────────────────── */
/* web/settings/secrets.js. A row per name, its buttons on the right; a revealed
   value under the name, wrapping rather than widening the row, because a key is
   often one long unbroken token. */
.secret-actions { flex: none; display: flex; align-items: center; gap: var(--sp-3); }
.secret-value {
    display: block;
    margin-top: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--r-sm, 4px);
    background: var(--s2);
    font: 400 var(--fs-sm) var(--mono);
    color: var(--text);
    word-break: break-all;
    user-select: all;
}
.secret-form { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); margin-top: var(--sp-3); }
.secret-form .settings-text { width: 260px; }
.secret-form .secret-name { width: 180px; }

/* The CLAUDE.md | AGENTS.md tabs, above the scope tabs they belong to. */
.cfg-md-kinds + .cfg-tabs { margin-top: var(--sp-3); }

/* What notifies: the muted projects, one line each with its Unmute. */
.muted-projects { list-style: none; margin: var(--sp-2, 6px) 0 0; padding: 0; }
.muted-projects li { display: flex; gap: 10px; align-items: baseline; font-size: var(--fs-sm, 12px); }
.muted-projects li span { color: var(--text-2); }
