/* Yulius web UI components — dark, dense, terminal-first (SPEC-001 UI-014). Every colour, size,
   radius and timing comes from tokens.css; this file names roles and scales only. */

* { box-sizing: border-box; }
::selection { background: var(--selection); }
/* Icons (dom.js): one optical stroke at every size; filled parts are unaffected. */
.icon { stroke-width: var(--icon-stroke); flex: none; }
.icon * { vector-effect: non-scaling-stroke; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--fs)/var(--lh) var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  /* A word longer than its box (a URL, a path) breaks inside it. break-word, not anywhere: no box
     gets narrower than its words, so short labels never break; a flex item holding free text
     opts into anywhere (SPEC-449, ADR-0290). */
  overflow-wrap: break-word;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-fg); text-decoration: none; } /* link text: the text-safe accent (4.5:1) */
a:hover { text-decoration: underline; }
/* Links inside running text are underlined, not told apart by colour alone (WCAG 1.4.1). */
p a, li a, .banner-text a, .checks-access-text a, .toast-msg a, .step-note a, .item-meta a { text-decoration: underline; text-underline-offset: 2px; }
/* Focus: a ring with a gap; the transparent outline is what forced-colors (high contrast) modes draw. */
:focus-visible { outline: 2px solid transparent; outline-offset: 2px; box-shadow: var(--focus); }
[hidden] { display: none !important; }
code, pre, .mono { font-family: var(--font-mono); font-size: var(--fs-sm); line-height: var(--lh-sm); }
pre { margin: 0; white-space: pre-wrap; word-break: break-word; }
h1, h2, h3 { margin: 0; font-weight: 600; }
b, strong { font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: var(--fs-sm); line-height: var(--lh-sm); }
.xs { font-size: var(--fs-xs); line-height: var(--lh-xs); }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.row-wrap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: var(--z-toast); padding: 8px 12px; border-radius: var(--radius); background: var(--surface-2); color: var(--text); transform: translateY(-200%); }
.skip-link:focus { transform: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

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

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--control-md); padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface-2); color: var(--text);
  cursor: pointer; white-space: nowrap; font-size: var(--fs); line-height: var(--lh);
}
.btn:hover:not(:disabled) { background: var(--surface-hover); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-danger { background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger-fg); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.btn-sm { height: var(--control-sm); padding: 0 8px; font-size: var(--fs-sm); line-height: var(--lh-sm); }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after {
  content: ""; position: absolute; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--text-2); border-right-color: transparent; animation: spin var(--duration-spin) linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--control-md); height: var(--control-md); padding: 0; border: 0; border-radius: var(--radius);
  background: transparent; color: var(--text-2); cursor: pointer; flex: none;
}
.btn-icon:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.btn-icon:disabled { opacity: 0.4; cursor: not-allowed; }
.icon { display: block; flex: none; }

.input, .select, .textarea {
  width: 100%; min-width: 0; height: var(--control-md); padding: 0 8px;
  border: 1px solid var(--border-control); border-radius: var(--radius);
  background: var(--bg); color: var(--text);
}
.textarea { height: auto; padding: 8px 8px; resize: vertical; line-height: var(--lh); }
/* Fields: an accent edge, plus a transparent outline that high-contrast modes draw. */
.input:focus, .select:focus, .textarea:focus { outline: 2px solid transparent; outline-offset: 1px; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input.mono, .textarea.mono { font-family: var(--font-mono); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.input[aria-invalid="true"] { border-color: var(--danger); }
/* Lists to choose from: where the browser can style the whole <select> (customizable select),
   the button and its list match the app's menus (surface, border, radius, shadow, accent check);
   elsewhere the native control stays, with the same field look. */
@supports (appearance: base-select) {
  .select, .select::picker(select) { appearance: base-select; }
  .select { display: inline-flex; align-items: center; gap: 8px; padding: 0 8px 0 12px; background: var(--surface); font: inherit; cursor: pointer; transition: background var(--duration-fast) var(--ease), border-color var(--duration-fast) var(--ease); }
  .select:hover:not(:disabled) { background: var(--surface-2); border-color: var(--border-strong); }
  .select:disabled { opacity: 0.6; cursor: not-allowed; }
  .select::picker-icon { content: ""; flex: none; width: 6px; height: 6px; margin: 0 4px 2px auto; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); rotate: 45deg; transition: rotate var(--duration-fast) var(--ease), margin var(--duration-fast) var(--ease); }
  .select:open::picker-icon { rotate: 225deg; margin-bottom: -2px; }
  .select:open { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
  .select::picker(select) { min-width: anchor-size(width); max-height: min(360px, 60vh); margin: 4px 0; padding: 4px; border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--surface-2); color: var(--text); box-shadow: var(--shadow); }
  .select option { display: flex; align-items: center; gap: 8px; min-height: var(--control-md); padding: 0 12px; border-radius: var(--radius-sm); cursor: pointer; }
  .select option:hover, .select option:focus-visible { background: var(--surface-hover); outline: 2px solid transparent; }
  .select option:checked { font-weight: 500; }
  .select option::checkmark { order: 1; margin-left: auto; color: var(--accent); }
  .select option:disabled { color: var(--muted); cursor: not-allowed; }
  .select-sm { padding: 0 4px 0 8px; }
  /* A select that gives its button, `<select><button><selectedcontent></selectedcontent></button>…`,
     shows a long picked label on one line ending in an ellipsis; without it the label wraps and
     spills over the fixed-height control. */
  .select > button { display: flex; flex: 1 1 auto; align-items: center; align-self: stretch; min-width: 0; margin-block: -1px; overflow: hidden; }
  .select selectedcontent { display: block; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-label { font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--text-2); font-weight: 500; }
.field-hint { font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--muted); }
.field-error { font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--danger-fg); }
.field-advice { font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--warn-fg); }
.field-advice:empty { display: none; }
.modal-error { margin: 0 16px 12px; padding: 8px 12px; border-radius: var(--radius); background: var(--danger-soft); color: var(--danger-fg); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.field-note { font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--ok-fg); }
.check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; line-height: var(--lh); }
.check input { margin: 2px 0 0; accent-color: var(--accent); width: 15px; height: 15px; flex: none; }
/* What a destructive choice of a dialog does, said before it happens (SPEC-171). */
.remove-files { margin: 0; padding: 0; border: 0; min-width: 0; }
.remove-files > legend { padding: 0; margin-bottom: 6px; }
.remove-choice { display: flex; flex-direction: column; gap: 4px; }
.remove-choice > p { margin: 0 0 0 24px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }

.switch { position: relative; display: inline-flex; width: 30px; height: 17px; flex: none; }
.switch-input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: var(--z-raised); }
.switch-input:disabled { cursor: not-allowed; }
.switch-track { position: absolute; inset: 0; border-radius: var(--radius-full); background: var(--surface-3); border: 1px solid var(--border-control); transition: background var(--duration-fast) var(--ease); }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 11px; height: 11px; border-radius: 50%; background: var(--text-2); transition: transform var(--duration-fast) var(--ease); }
.switch-input:checked + .switch-track { background: var(--accent-strong); border-color: var(--accent-strong); }
.switch-input:checked + .switch-track::after { transform: translateX(13px); background: var(--on-solid); }
.switch-input:focus-visible + .switch-track { box-shadow: var(--focus); }
.switch-input:disabled + .switch-track { opacity: 0.5; }

.seg { display: inline-flex; border: 1px solid var(--border-control); border-radius: var(--radius); overflow: hidden; }
.seg label { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; height: var(--control-md); cursor: pointer; color: var(--text-2); }
.seg-fit { align-self: flex-start; max-width: 100%; }
.seg label + label { border-left: 1px solid var(--border-strong); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--accent-soft); color: var(--text); }
.seg label:has(input:focus-visible) { box-shadow: var(--focus-inset); }

.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 18px; padding: 0 6px;
  border-radius: var(--radius-full); background: var(--surface-3); color: var(--text-2);
  font-size: var(--fs-xs); font-weight: 500; white-space: nowrap; line-height: 1;
}
.badge-accent { background: var(--accent-soft); color: var(--accent-fg); }
.badge-ok { background: var(--ok-soft); color: var(--ok-fg); }
.badge-warn { background: var(--warn-soft); color: var(--warn-fg); }
.badge-danger { background: var(--danger-soft); color: var(--danger-fg); }
.badge-violet { background: var(--violet-soft); color: var(--violet-fg); }
.kbd { display: inline-block; padding: 0 6px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--text-2); }

.placeholder { padding: 32px 16px; text-align: center; color: var(--muted); }
.placeholder-error { color: var(--danger); }

.banner { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface-2); }
.banner-warn { border-color: var(--warn-border); background: var(--warn-soft); color: var(--warn-fg-strong); }
.banner-danger { border-color: var(--danger-border); background: var(--danger-soft); color: var(--danger-fg-strong); }
.banner-info { border-color: var(--accent-border); background: var(--accent-soft); color: var(--accent-fg-strong); }
.banner .icon { flex: none; }
.banner-text { flex: 1; min-width: 0; }
/* What GitHub checks the App can't read (#111): one quiet line for administrators, not a warning. */
.checks-access { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); }
.checks-access-text { flex: 1; min-width: 0; }

.meter { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.meter-row { display: flex; justify-content: space-between; gap: 8px; font-size: var(--fs-sm); line-height: var(--lh-sm); }
.meter-label { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter-value { color: var(--text); font-variant-numeric: tabular-nums; }
.meter-track { height: 6px; border-radius: var(--radius-full); background: var(--accent-track); overflow: hidden; }
.meter-fill { height: 100%; border-radius: var(--radius-full); background: var(--series-1); }
.meter-warn .meter-track { background: var(--warn-track); }
.meter-warn .meter-fill { background: var(--warn); }
.meter-danger .meter-track { background: var(--danger-track); }
.meter-danger .meter-fill { background: var(--danger); }
.meter-unknown .meter-track { background: repeating-linear-gradient(135deg, var(--surface-3) 0 4px, transparent 4px 8px); }
.meter-unknown .meter-value { color: var(--muted); }
.meter-detail { font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--muted); }

/* ---------------------------------------------------------------- menus, modals, toasts */

.menu {
  position: fixed; z-index: var(--z-menu); display: flex; flex-direction: column;
  min-width: 180px; max-width: min(320px, 100vw - 16px); max-height: calc(100vh - 16px); padding: 4px;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
/* The items scroll inside the panel when the window is too short for them (SPEC-038). */
.menu-list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
/* No usable room beside an anchor taller than the window: the menu covers it from the top. */
.menu-from-top { top: 8px; }
.menu-filter { flex: none; margin-bottom: 4px; }
.menu-empty { padding: 4px 12px 6px; color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); }
/* Rendered while empty, so screen readers announce "No matches" when it is written. */
.menu-empty:empty { padding: 0; }
.menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%; height: var(--control-md); padding: 0 12px;
  border: 0; border-radius: var(--radius-sm); background: transparent; text-align: left; cursor: pointer;
}
.menu-item:hover:not([aria-disabled="true"]) { background: var(--surface-hover); }
.menu-item:focus-visible { background: var(--surface-hover); box-shadow: var(--focus-inset); outline: 2px solid transparent; outline-offset: -2px; }
.menu-item[aria-disabled="true"] { color: var(--muted); cursor: not-allowed; }
.menu-item[aria-disabled="true"] .menu-icon { opacity: 0.6; }
.menu-item.danger { color: var(--danger-fg); }
.menu-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-hint { color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); }
.menu-item.rich { height: auto; min-height: var(--control-md); padding: 4px 12px; align-items: flex-start; }
.menu-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
/* As many lines as it needs, never cut (SPEC-094); the menu keeps its width, so a short one is one line. */
.menu-desc { color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); overflow-wrap: anywhere; }
.menu-check { display: inline-flex; width: 14px; flex: none; color: var(--accent); }
.menu-icon { display: inline-flex; width: 16px; flex: none; color: var(--muted); }
.menu-item:hover .menu-icon, .menu-item:focus-visible .menu-icon { color: var(--text-2); }
.menu-item.rich .menu-check { margin-top: 2px; }
.menu-sep { height: 1px; margin: 4px 2px; background: var(--border); }
.menu-header { padding: 6px 12px 4px; color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); text-transform: uppercase; letter-spacing: 0.04em; }
/*
 * A long group (the "Run after" tasks) shows five rows and scrolls the rest (SPEC-102): the edge it
 * continues past fades, a thin scrollbar stays where the platform draws one, and a line under it
 * counts the rows below. A row focused by the keyboard stops clear of the fade.
 */
.menu-scroll.capped {
  /* No overscroll containment: at its end the wheel goes on to the menu's list (SPEC-038 MNU-001). */
  overflow-y: auto; scrollbar-width: thin; scrollbar-gutter: stable;
  scroll-padding-block: var(--menu-fade);
}
.menu-scroll { --menu-fade: 20px; }
.menu-scroll.more-below { mask-image: linear-gradient(to bottom, var(--mask-solid) calc(100% - var(--menu-fade)), var(--mask-faint)); }
.menu-scroll.more-above { mask-image: linear-gradient(to top, var(--mask-solid) calc(100% - var(--menu-fade)), var(--mask-faint)); }
.menu-scroll.more-above.more-below {
  mask-image: linear-gradient(to bottom, var(--mask-faint), var(--mask-solid) var(--menu-fade), var(--mask-solid) calc(100% - var(--menu-fade)), var(--mask-faint));
}
.menu-more {
  display: flex; align-items: center; gap: 6px; height: 24px; padding: 0 12px; border-radius: var(--radius-sm);
  color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); cursor: pointer;
}
.menu-more:empty { cursor: default; }
.menu-more:not(:empty):hover { background: var(--surface-hover); color: var(--text-2); }

.modal {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0;
  border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--surface); color: var(--text);
  box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.modal:not([open]) { display: none; }
.modal::backdrop { background: var(--backdrop); }
.modal-wide { width: min(860px, calc(100vw - 32px)); }
.modal-full { width: min(1100px, calc(100vw - 32px)); height: calc(100vh - 48px); }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--border); }
.modal-title { flex: 1; font-family: var(--font-display); font-size: var(--fs-lg); line-height: var(--lh-lg); }
.modal-body { padding: 16px 16px; overflow: auto; flex: 1 1 auto; min-height: 0; }
.modal-full .modal-body { display: flex; flex-direction: column; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }

.toasts { position: fixed; right: 12px; bottom: 12px; z-index: var(--z-toast); display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 24px)); pointer-events: none; }
/* When toasts would cover the focused control or a dialog's Close they move to the other edge, if it
   covers less (WCAG 2.4.11, `keepClear` in dom.js). */
.toasts.flipped { top: calc(var(--tabrow-h) + 8px); bottom: auto; }
.toast {
  display: flex; align-items: flex-start; gap: 8px; padding: 8px 6px 8px 12px; pointer-events: auto;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-left: 3px solid var(--accent);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.toast-ok { border-left-color: var(--ok); }
.toast-warn { border-left-color: var(--warn); }
.toast-error { border-left-color: var(--danger); }
.toast-body { flex: 1; min-width: 0; padding-top: 4px; }
.toast-msg { word-break: break-word; }
.toast-detail { color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); margin-top: 2px; }
.toast-x { width: var(--control-sm); height: var(--control-sm); }

/* ---------------------------------------------------------------- app grid */

.app {
  display: grid; height: 100vh; height: 100dvh;
  /* The panel's column may shrink (minmax(0, auto)): a panel wider than the room left never pushes
     the rail off the window (F 2026-10-09); panels.js also re-fits it when the window changes. */
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) minmax(0, auto) var(--rail-w);
  grid-template-rows: var(--tabrow-h) minmax(0, 1fr);
  grid-template-areas: "tabs tabs tabs tabs" "side main panel rail";
}
/* The home screen (UI-045) and the other pages outside a sandbox have one tool, the Global
   Superagent (SPEC-427 GSA-006): the rail shows only its button. */
.app.no-sandbox .rail-btn:not([data-kind="agent"]) { display: none; }
/* The sidebar stays while a tool panel is open (developers keep their tasks in view): the panel
   takes its width from the centre (panels.js applyWidth). */

/* sandbox tab row: thin (≤ 36 px), overflow scrolls (UI-008) */
.tabrow {
  grid-area: tabs; display: flex; align-items: stretch; gap: 4px; min-width: 0;
  height: var(--tabrow-h); padding: 0 6px 0 8px; background: var(--bg); border-bottom: 1px solid var(--border);
}
.tabrow-tabs { display: flex; align-items: stretch; min-width: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabrow-tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px;
  color: var(--text-2); white-space: nowrap; border-bottom: 2px solid transparent; font-size: var(--fs-md); line-height: var(--lh-md);
  max-width: 220px; user-select: none;
}
.tab:hover { color: var(--text); text-decoration: none; background: var(--surface); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); background: var(--surface); }
/* Dragging a sandbox tab (SPEC-336), as the Notes tabs: it follows the pointer, the others slide aside. */
.tabrow-tabs.reordering { cursor: grabbing; user-select: none; }
.tabrow-tabs.reordering .tab { transition: transform var(--duration-fast) var(--ease); }
.tabrow-tabs .tab.dragging { z-index: var(--z-raised); transition: none; color: var(--text); background: var(--surface-2); box-shadow: var(--shadow); cursor: grabbing; }
.tabrow-tabs .tab.settling { z-index: var(--z-raised); transition: transform var(--duration-fast) var(--ease); }
/* The grip says a tab drags (SPEC-136, SPEC-167, SPEC-434: every strip that drags): faint at rest,
   the tab's colour when it is hovered, chosen or dragged; 8 px from the tab's edge and 4 px from
   its name. Only a mouse or pen drags (touch scrolls the strip), so a device with neither does not
   see it, whatever its primary pointer. */
.tab-grip { display: inline-flex; flex: none; color: var(--text-faint); cursor: grab; }
.tab .tab-grip { margin: 0 -2px 0 -4px; }
:is(.tab, .term-tab, .ed-tab, .bp-tab):is(:hover, .active, .dragging) .tab-grip { color: currentColor; }
.reordering .tab-grip { cursor: grabbing; }
@media not (any-pointer: fine) {
  .tab-grip { display: none; }
}
.tab-name { overflow: hidden; text-overflow: ellipsis; }
.tab-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); flex: none; }
.tab-running { color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); font-variant-numeric: tabular-nums; }
.tab-add { align-self: center; width: var(--control-md); height: var(--control-md); }
/* All sandboxes (UI-045): the first tab, an icon. */
.tab-home { flex: none; justify-content: center; padding: 0 12px; }
.tab-home .icon { color: var(--muted); }
.tab-home:hover .icon, .tab-home.active .icon { color: var(--text); }
.tab-select { display: none; }
.tabrow-right { display: flex; align-items: center; gap: 8px; margin-left: auto; padding-right: 6px; flex: none; }
.tabrow-right .btn-icon { width: var(--control-lg); height: var(--control-lg); }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--radius-full); font-size: var(--fs-xs); line-height: var(--lh-xs); font-weight: 500; }
.chip-warn { background: var(--warn-soft); color: var(--warn-fg); border: 1px solid var(--warn-border); }
.chip-guest { background: var(--info-soft); color: var(--info-fg); border: 1px solid var(--border); }
.btn-status { height: var(--control-md); padding: 0 8px; gap: 4px; font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--text-2); background: transparent; border-color: transparent; }
.btn-status[aria-expanded="true"] { background: var(--surface-3); color: var(--text); }
.btn-status .ev-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.btn-status .ev-dot.off { background: var(--warn); }
.hamburger { display: none; }

/* sidebar */
.sidebar {
  grid-area: side; position: relative; z-index: var(--z-raised); display: flex; flex-direction: column; min-height: 0; min-width: 0;
  background: var(--surface); border-right: 1px solid var(--border);
}
/* The sidebar lines up like a chat list: rows are cards 6 px from the edge with 12 px inside; every
   leading mark (logo, plus, nav icon, group icon, state tile, avatar) sits in a 36 px slot, so all
   text starts on one line. */
.sidebar-top { padding: 16px 6px 8px; container: sidebar-top / inline-size; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 12px 16px; color: var(--text); }
.sidebar-brand:hover { text-decoration: none; }
.brand-logo {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex: none;
  color: var(--brand-mark); /* the mark stands on its own, as in the lockup: no tile */
}
.brand-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
/* The wordmark is set like the composer's quote (ADR-0100; tokens: --wordmark-case, --wordmark-tracking). */
.brand-name { font-family: var(--font-display); font-size: var(--fs-xl); line-height: var(--lh-xl); font-weight: 400; text-transform: var(--wordmark-case); letter-spacing: var(--wordmark-tracking); }
/* The tagline stays a quiet caption under the name, never its rival. */
.brand-by { color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); letter-spacing: 0.01em; }
.btn-newtask {
  width: 100%; height: var(--control-xl); justify-content: flex-start; gap: 12px; padding: 0 12px;
  border-color: var(--border); border-radius: var(--radius-lg); background: var(--surface-2); color: var(--text);
  font-size: var(--fs-md); line-height: var(--lh-md); font-weight: 600;
}
.btn-newtask:hover { background: var(--surface-3); border-color: var(--border-strong); text-decoration: none; }
.newtask-key { margin-left: auto; color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); font-weight: 400; letter-spacing: 0.04em; }
@media (pointer: coarse) { .newtask-key { display: none; } }
/* A narrow sidebar (200 px below 1024 px, or dragged so) has no room for the hint (SPEC-449); the
   button's tooltip still names the shortcut. */
@container sidebar-top (width < 240px) { .newtask-key { display: none; } }
.newtask-plus {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; margin: 0 4px; flex: none;
  border-radius: 50%; background: var(--accent); color: var(--accent-ink);
}
.nav { display: flex; flex-direction: column; padding: 4px 6px; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 12px; height: var(--control-xl); padding: 0 12px; border-radius: var(--radius-lg); color: var(--text-2); font-size: var(--fs-md); line-height: var(--lh-md); font-weight: 500; }
.nav-slot { display: inline-flex; align-items: center; justify-content: center; width: 36px; flex: none; }
.nav-item .icon { color: var(--muted); }
/* Without a sandbox the sandbox pages have nowhere to go: the nav hides (UX2-17). */
.app.no-sandbox .nav { display: none; }
.nav-item:hover .icon, .nav-item.active .icon { color: var(--text-2); }
.nav-item:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--text); }
/* "More" (SPEC-029): a disclosure button styled as a link, its pages below it in the same column. */
.nav-toggle { width: 100%; border: 0; background: transparent; font-family: inherit; text-align: left; cursor: pointer; }
.nav-more-chevron { display: inline-flex; margin-left: auto; }
.nav-more { display: flex; flex-direction: column; gap: 4px; }
.task-list { flex: 1 0 auto; padding: 8px 6px 12px; border-top: 1px solid var(--border); margin-top: 8px; container: tasks / inline-size; }
/* Active tasks (UI-005): groups — Needs you, Working, Stopped — of two-line rows. */
/* Task list rows read like a chat list (WhatsApp, cmux): a state tile, a 16 px title with the age
   on the right, then what is happening or what to do. */
.task-group, .skeleton-task-group { display: flex; flex-direction: column; gap: 2px; padding-top: 16px; }
/* A group's head is a band of its own (its background and edge set it apart from the tasks below). */
.task-group-head {
  position: sticky; top: 0; z-index: var(--z-raised);
  display: flex; align-items: center; gap: 12px; height: var(--control-md); padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); color: var(--text-2); font: inherit; font-size: var(--fs-sm); line-height: var(--lh-sm); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; text-align: left;
}
.task-group-head.group-needs .nav-slot, .task-group-head.group-needs .task-group-count { color: var(--warn-fg); }
.task-group-head.group-done .nav-slot { color: var(--ok-fg); }
button.task-group-head { cursor: pointer; border-radius: var(--radius); }
button.task-group-head:hover { color: var(--text); }
.task-group-count { margin-left: auto; font-weight: 500; font-variant-numeric: tabular-nums; }
.task-group-head.group-ended .task-group-count { margin-left: auto; }
.task-group-head.group-ended .task-group-count + .icon { margin-left: 4px; }
/* Done's "Archive all" (SPEC-062) sits after the count; it reads as a button, not a heading. */
.task-group-action { margin-right: -8px; text-transform: none; letter-spacing: normal; font-weight: 500; }
.task-group-action[aria-disabled="true"] { opacity: 0.4; cursor: progress; }
/* A narrow list (a 200 px sidebar) keeps Archive all's icon; its name stays for screen readers
   (SPEC-449). The head needs about 241 px with the label and a one-digit count, 7 px per digit more. */
@container tasks (width < 270px) { .task-group-action-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } }
/* Working's "Show as a graph" (SPEC-164): an icon after the count. */
.task-group-graph { width: 24px; height: 24px; margin-left: 4px; color: var(--muted); }
/* Sidebar task rows: one compact line — state icon on the nav icons' axis, pull request, title on
   the nav labels' axis, age (the kebab takes the age's place on hover). */
.task-row { position: relative; border-radius: var(--radius); }
.task-row:hover, .task-row:focus-within { background: var(--surface-3); }
.task-row.active { background: var(--accent-soft); }
/* Long lists: rows off screen skip layout and paint (PERF-03). That contains each row's painting,
   so the focus ring is drawn inside the row, not around it. */
.task-row, .tl-row { content-visibility: auto; }
.task-row { contain-intrinsic-size: auto 36px; }
.tl-row { contain-intrinsic-size: auto 52px; }
.task-link, .skeleton-task-row { display: flex; align-items: center; gap: 12px; height: 36px; padding: 0 12px; color: var(--text-2); text-decoration: none; }
.task-link:hover { text-decoration: none; }
.task-link:focus-visible { border-radius: var(--radius); box-shadow: var(--focus-inset); }
.task-row:hover .task-link, .task-row.active .task-link, .task-row:focus-within .task-link { color: var(--text); }
/* One Needs you card for a problem several tasks share (SPEC-494): it names them, each a link;
   their own rows follow it. */
.task-shared { display: flex; align-items: center; gap: 12px; min-height: 36px; padding: 4px 12px; border-radius: var(--radius); background: var(--surface-3); color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.task-shared .task-shared-text { min-width: 0; overflow-wrap: anywhere; }
.task-shared a:focus-visible { border-radius: var(--radius); box-shadow: var(--focus-inset); }
.task-mark { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 36px; color: var(--muted); }
.task-num { flex: none; min-width: 4ch; margin-right: -4px; color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); font-variant-numeric: tabular-nums; white-space: nowrap; }
.task-chips { display: inline-flex; flex: none; gap: 4px; }
.task-chips:empty { display: none; }
.task-chips .tl-pr-chip { padding: 0 6px; }
.task-title { flex: 1; min-width: 3em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-md); line-height: var(--lh-md); }
.task-group.group-ended .task-row:not(:hover):not(.active) .task-link { color: var(--muted); }
.task-owner { display: inline-flex; flex: none; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 4px; border-radius: var(--radius-full); background: var(--surface-3); color: var(--text); font-size: var(--fs-xs); line-height: 1; font-weight: 600; letter-spacing: 0.02em; }
.task-owner[hidden] { display: none; }
.task-age { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); font-variant-numeric: tabular-nums; }
.task-kebab { position: absolute; right: 6px; top: 4px; width: var(--control-sm); height: var(--control-sm); visibility: hidden; background: var(--surface-3); }
/* The menu's button stays visible while its menu is open, so Escape can return focus to it. */
.task-row:hover .task-kebab, .task-row:focus-within .task-kebab, .task-kebab[aria-expanded="true"] { visibility: visible; }
.task-row:hover .task-age, .task-row:focus-within .task-age { visibility: hidden; }
/* A narrow sidebar keeps each row's number and a few letters of its title (SPEC-122 TID-4): the
   time gives way first on rows with a pull request, then on every row, and the chip goes last.
   The row's tooltip still says both. The time's ellipsis is the last resort. */
@container tasks (width < 360px) { .task-link:has(.tl-pr-chip) .task-age { display: none; } }
@container tasks (width < 280px) { .task-age { display: none; } }
@container tasks (width < 250px) { .task-chips { display: none; } }
/* A phone's row keeps 48 px on its right for the menu button: the same order, 36 px sooner. */
@media (max-width: 767px) {
  @container tasks (width < 396px) { .task-link:has(.tl-pr-chip) .task-age { display: none; } }
  @container tasks (width < 316px) { .task-age { display: none; } }
  @container tasks (width < 286px) { .task-chips { display: none; } }
}
/* Quick Archive (SPEC-062): left of the menu's button, shown with it. */
.task-quick-archive { position: absolute; right: calc(8px + var(--control-sm)); top: 4px; width: var(--control-sm); height: var(--control-sm); visibility: hidden; background: var(--surface-3); }
.task-quick-archive[hidden] { display: none; }
.task-row:hover .task-quick-archive, .task-row:focus-within .task-quick-archive { visibility: visible; }
/* With the menu's button shown (and Archive beside it), the title ends before them; the age gives
   way entirely and the title may shrink below its 3 em (SPEC-122). */
@media (min-width: 768px) {
  .task-row:is(:hover, :focus-within) .task-link { padding-right: calc(12px + var(--control-sm)); }
  .task-row:is(:hover, :focus-within) .task-title { min-width: 0; }
  .task-row.can-archive:is(:hover, :focus-within) .task-link { padding-right: calc(12px + 2 * var(--control-sm)); }
  .task-row.can-archive:is(:hover, :focus-within) .task-age { display: none; }
}
.sidebar-foot { display: flex; align-items: center; gap: 4px; padding: 6px; border-top: 1px solid var(--border); }
.sidebar-foot .user-btn { flex: 1 1 auto; }
/* The superadmin's Update button (SPEC-133): accent while main moved on, quiet otherwise. */
.update-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: none;
  min-width: var(--control-md); height: var(--control-md); padding: 0 8px;
  border: 1px solid transparent; border-radius: var(--radius-full); background: transparent; color: var(--text-2);
  font: inherit; font-size: var(--fs-sm); line-height: var(--lh-sm); white-space: nowrap; cursor: pointer;
}
.update-btn[hidden] { display: none; }
.update-btn:hover, .update-btn:focus-visible { background: var(--surface-3); color: var(--text); }
.update-btn-offer { padding: 0 12px 0 8px; border-color: var(--accent-border); background: var(--accent-soft); color: var(--accent-fg); font-weight: 600; }
.update-btn-offer:hover, .update-btn-offer:focus-visible { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-fg-strong); }
.update-btn-running { padding: 0 12px 0 8px; border-color: var(--border-strong); }
.update-btn .spinner { display: inline-block; width: 12px; height: 12px; flex: none; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin var(--duration-spin) linear infinite; color: var(--accent-fg); }
.sidebar-foot .user-btn { gap: 12px; padding: 0 12px; border-radius: var(--radius-lg); font-size: var(--fs-md); line-height: var(--lh-md); font-weight: 500; }
.sidebar-foot .avatar { width: 32px; height: 32px; margin: 0 2px; font-size: var(--fs-sm); line-height: var(--lh-sm); }
.user-btn {
  display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; height: var(--control-xl); padding: 0 6px;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-2);
  font: inherit; text-align: left; cursor: pointer;
}
.user-btn:hover, .user-btn:focus-visible { background: var(--surface-3); color: var(--text); }
.avatar {
  display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; flex: none;
  border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface-3); color: var(--text);
  font-size: var(--fs-xs); line-height: var(--lh-xs); font-weight: 600; text-transform: uppercase;
}
.user-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* status glyph tones */
.glyph { display: inline-flex; align-items: center; justify-content: center; width: 14px; font-size: var(--fs-sm); font-weight: 600; line-height: 1; }
.tone-working, .tone-running { color: var(--ok); }
.tone-running { opacity: 0.75; }
.tone-done { color: var(--ok); } /* finished with a tested pull request (#35) */
.tone-waiting { color: var(--info); } /* "your turn": the info hue, apart from brand, warning and error */
.tone-attention { color: var(--warn); }
.tone-switching { color: var(--violet); }
.tone-queued { color: var(--muted); }
.tone-stopping, .tone-stopped, .tone-closed { color: var(--muted); }
.tone-stopped-abnormal { color: var(--warn); }
.tone-failed { color: var(--danger); }
/* Working turns like a spinner (motion is easier to spot than a pulse); switching turns slower.
   The icon itself rotates, around its own centre. */
.glyph.tone-working .icon, .glyph.tone-running .icon { animation: spin var(--duration-spin) linear infinite; }
.glyph.tone-switching .icon { animation: spin var(--duration-spin-slow) linear infinite; }
@keyframes pulse { 50% { opacity: 0.6; } }
/* Windows high-contrast (forced colours): switches, segments and status dots keep their state and
   focus visible with system colours (WCAG 1.4.11, 2.4.7). */
@media (forced-colors: active) {
  .switch-track { border: 1px solid CanvasText; }
  .switch-track::after { forced-color-adjust: none; background: CanvasText; }
  .switch-input:checked + .switch-track { forced-color-adjust: none; background: Highlight; border-color: Highlight; }
  .switch-input:checked + .switch-track::after { background: HighlightText; }
  .switch-input:focus-visible + .switch-track, .seg label:has(input:focus-visible) { outline: 2px solid Highlight; outline-offset: 2px; }
  .seg label:has(input:checked) { outline: 2px solid CanvasText; outline-offset: -2px; }
  .tab-dot, .rail-dot, .ev-dot, .dl-dot, .rail-btn.active::before { forced-color-adjust: none; background: Highlight; color: HighlightText; }
}
/* Reduced motion: no animation or transition anywhere (WCAG 2.3.3). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: var(--duration-instant) !important; animation-iteration-count: 1 !important; transition-duration: var(--duration-instant) !important; scroll-behavior: auto !important; }
}

/* center */
.center { grid-area: main; position: relative; isolation: isolate; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--term-bg); }
.center.paper { background: var(--bg); }

/* right rail + panel (UI-002, UI-015) */
/* Tools rail hidden by default; a maximized panel covers the center. */
.app.rail-hidden { --rail-w: 0px; }
.app.rail-hidden .rail { display: none; }
.app.panel-max { grid-template-columns: var(--sidebar-w) 0 minmax(0, 1fr) var(--rail-w); }
.app.panel-max .center { visibility: hidden; overflow: hidden; }
.app.panel-max .panel { width: auto !important; }
.app.panel-max .panel-resize { display: none; }
.tools-toggle.active { background: var(--accent-soft); color: var(--text); }
/* The rail's items stay inside it (F 2026-10-09): each pill is the rail's width less 6 px on either
   side of the edge line, its label gives way (ellipsis) before the count leaves the pill, and the
   4 px between pills leaves room for the focus ring. Hover is a quiet fill; the open tool (one at a
   time, aria-pressed) adds the accent fill, an accent bar on its edge and a heavier label. */
.rail { grid-area: rail; display: flex; flex-direction: column; align-items: stretch; gap: 4px; min-width: 0; padding: 6px; background: var(--surface); border-left: 1px solid var(--border); }
.rail-btn { position: relative; width: auto; min-width: 0; height: var(--control-xl); justify-content: flex-start; gap: 8px; padding: 0 8px; border-radius: var(--radius-lg); }
.rail-btn:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.rail-btn.active, .rail-btn.active:hover:not(:disabled) { background: var(--accent-soft); color: var(--text); }
.rail-btn.active::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: var(--radius-full); background: var(--accent); }
.rail-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: var(--fs-md); line-height: var(--lh-md); font-weight: 500; white-space: nowrap; }
.rail-btn.active .rail-label { font-weight: 600; }
/* The attention dot sits on its icon (tools toggle); in the named rail it ends the row. */
.rail-dot { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 2px var(--bg); }
.rail .rail-dot { position: static; margin-left: auto; flex: none; box-shadow: none; }
.panel { grid-area: panel; position: relative; display: flex; flex-direction: column; min-height: 0; min-width: 0; max-width: 100%; background: var(--surface); border-left: 1px solid var(--border); }
.panel[hidden] { display: none; }
/* Column splitters (splitter.js, UI-044): an 8 px hit area across the column's edge, a quiet grip
   at rest; the edge turns accent on hover, focus and drag. The columns they overlap are isolated
   (.center, .panel-body, .ed-main), so terminal and editor layers never cover the grip. */
.splitter { position: absolute; top: 0; bottom: 0; z-index: var(--z-float); width: 8px; cursor: col-resize; touch-action: none; }
.splitter::before { content: ""; position: absolute; top: 0; bottom: 0; left: 3px; width: 2px; background: transparent; transition: background var(--duration-fast) var(--ease); }
.splitter::after { content: ""; position: absolute; top: 50%; left: 2px; width: 4px; height: 28px; border-radius: var(--radius-full); background: var(--border-control); transform: translateY(-50%); transition: background var(--duration-fast) var(--ease); }
.splitter:hover::before, .splitter:focus-visible::before, .splitter.dragging::before,
.splitter:hover::after, .splitter:focus-visible::after, .splitter.dragging::after { background: var(--accent); }
.splitter-side, .splitter-explorer { right: -4px; }
.panel-resize { left: -4px; }
.panel-head { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 6px 0 12px; border-bottom: 1px solid var(--border); flex: none; }
.panel-title { font-weight: 600; flex: 1 0 auto; white-space: nowrap; }
/* A panel at its narrowest (300 px) keeps one line: the title stays, its pickers and notes give way. */
.panel-head .row { flex: 0 1 auto; min-width: 0; }
.panel-head .row > .muted { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-head .select { min-width: 0; max-width: 168px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-body { position: relative; isolation: isolate; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.panel-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.panel-view[hidden] { display: none; }
.panel-msg { padding: 24px 16px; color: var(--muted); text-align: center; }
/* The Agent (SPEC-035): its quick-work notice, then the user's plain Claude Code session filling
   the panel like a terminal. */
.agent { flex: 1; min-height: 0; display: flex; flex-direction: column; }
/* SPEC-428: This sandbox and All sandboxes as tabs, as the Notes tabs. */
.superagent { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.superagent-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.superagent-pane[hidden] { display: none; }
.superagent-tabs .term-tab { padding: 0 12px; border-top: 0; border-bottom: 0; border-left: 0; background: none; font: inherit; }
.superagent-tabs .term-tab.active { background: var(--term-bg); }
.superagent-tabs .term-tab[aria-disabled="true"] { cursor: not-allowed; opacity: 0.55; }
.superagent-tab-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); flex: none; }
.superagent-tab-dot[hidden] { display: none; }
.agent-note .agent-note-tab { color: inherit; font-weight: 600; text-decoration: underline; }
.agent-note { flex: none; align-items: flex-start; margin: 8px; overflow-wrap: anywhere; }
.agent-note .icon { margin-top: 2px; }
.agent-note a { color: inherit; font-weight: 600; text-decoration: underline; }
.agent-term { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--term-bg); }
.agent-msg { flex: 1; padding: 24px 16px; background: var(--surface); }
/* SPEC-355: the Superagent's lost link to Yulius, with its restart, above its session. */
.agent-link { flex: none; margin: 0 8px 8px; }
.agent-link-banner { align-items: flex-start; flex-wrap: wrap; gap: 8px; overflow-wrap: anywhere; }
.agent-link-banner .icon { margin-top: 2px; }
.agent-link-banner .banner-text { flex: 1 1 16em; }
/* SPEC-335: what the Superagent asks its person to approve, above its session. */
/* The list scrolls within part of the panel: the session below keeps room to be read. */
.agent-requests { flex: none; display: flex; flex-direction: column; gap: 8px; margin: 0 8px 8px; max-height: 60%; overflow-y: auto; }
.agent-request { flex-direction: column; align-items: stretch; gap: 6px; overflow-wrap: anywhere; }
.agent-request-head { display: flex; align-items: flex-start; gap: 6px; flex-wrap: wrap; }
.agent-request-head .icon { margin-top: 2px; }
.agent-request-title { font-weight: 600; }
.agent-request-prompt { margin: 0; max-height: 12em; overflow: auto; white-space: pre-wrap; padding: 6px 8px; border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; }
/* A secret's value (SPEC-487 SEC-002): masked as it is typed, line breaks kept. */
.agent-request-secret { -webkit-text-security: disc; width: 100%; resize: vertical; font: inherit; }
.agent-request-options { margin: 0; padding-left: 20px; }
.agent-request-end { display: block; height: 1px; }
.agent-request-hint { font-weight: 600; }
.agent-request-actions { display: flex; gap: 8px; flex-wrap: wrap; }
body.resizing { cursor: col-resize; user-select: none; }
/* While a splitter is dragged, frames and canvases under the pointer never take its moves. */
body.resizing iframe, body.resizing canvas { pointer-events: none; }

/* status panel (UI-007) */
.status-pop {
  position: fixed; top: calc(var(--tabrow-h) + 4px); right: 8px; z-index: var(--z-popover);
  width: min(440px, calc(100vw - 16px)); max-height: calc(100vh - var(--tabrow-h) - 16px); overflow: auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.status-section { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.status-section:last-child { border-bottom: 0; }
.status-section h2 { font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
/* Status panel, readable in seconds: health line, machine tiles, collapsible lists. */
.status-health { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 600; }
.health-ok { color: var(--ok-fg); }
.health-warn { color: var(--warn-fg); background: var(--warn-soft); }
.stat-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat-tile { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 12px 12px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-2); }
.stat-head { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.stat-warn .stat-head .icon { color: var(--warn); }
.stat-danger .stat-head .icon { color: var(--danger); }
.tile-value { font-size: var(--fs-xl); font-weight: 600; line-height: var(--lh-lg); font-variant-numeric: tabular-nums; }
.tile-over { margin-left: 6px; color: var(--danger); font-size: var(--fs); font-weight: 600; }
.stat-unknown .tile-value { color: var(--muted); font-size: var(--fs); line-height: var(--lh); font-weight: 500; }
.stat-detail { color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-facts { display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.status-fact { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.status-fact .icon { color: var(--muted); }
.status-fact.fact-warn, .status-fact.fact-warn .icon { color: var(--warn-fg); }
.status-fold { gap: 0; }
.status-fold > summary { display: flex; align-items: center; gap: 6px; cursor: pointer; list-style: none; color: var(--text-2); }
.status-fold > summary::-webkit-details-marker { display: none; }
.status-fold > summary > .icon:first-child { color: var(--muted); transition: transform var(--duration-fast) var(--ease); }
.status-fold[open] > summary > .icon:first-child { transform: rotate(90deg); }
.status-fold > summary h2 { flex: none; }
/* A summary longer than the room beside its title wraps between its parts, right-aligned (#549). */
.status-summary-text { margin-left: auto; min-width: 0; text-align: right; color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); }
/* A lone summary (no parts) may still wrap between its words rather than spill past its box. */
.status-summary-part:not(:only-child) { white-space: nowrap; }
.status-fold-body { padding-top: 12px; }
.status-rows { display: flex; flex-direction: column; }
.status-row { display: flex; align-items: center; gap: 8px; height: var(--control-lg); padding: 0 2px; border-top: 1px solid var(--border); }
.status-row:first-child { border-top: 0; }
.status-row .icon { color: var(--muted); flex: none; }
.status-row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-count { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); font-variant-numeric: tabular-nums; white-space: nowrap; }
.status-count.live { color: var(--text); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.account-list { display: flex; flex-direction: column; gap: 8px; container: accounts / inline-size; }
/* One account: avatar, who, plan and state; usage windows as horizontal rows (ROT-009). */
.account-card, .account-fold { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-2); }
/* Off or paused things dim their graphics, never their text below 4.5:1 (WCAG 1.4.3). */
.account-card.disabled .meter { opacity: 0.5; }
.account-card.disabled .account-avatar, .account-fold.disabled .account-avatar { color: var(--muted); }
.account-card.disabled, .account-fold.disabled { color: var(--text-2); }
.account-head { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 12px 12px; }
.account-fold > summary { list-style: none; cursor: pointer; border-radius: var(--radius-lg); }
.account-fold > summary::-webkit-details-marker { display: none; }
.account-fold > summary:hover { background: var(--surface-3); }
.account-fold[open] > summary { border-bottom: 1px solid var(--border); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.account-fold > summary > .icon:last-child { color: var(--muted); flex: none; transition: transform var(--duration-fast) var(--ease); }
.account-fold[open] > summary > .icon:last-child { transform: rotate(180deg); }
.account-fold[open] .account-glance { display: none; }
.account-avatar { width: 32px; height: 32px; font-size: var(--fs-xs); line-height: var(--lh-xs); }
.account-who { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.account-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.account-sub { color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-email-unknown { font-style: italic; }
/* A subscription's name edited in place on the Subscriptions page (SPEC-244 SUB-001). */
.account-name-edit { display: flex; align-items: center; gap: 2px; min-width: 0; flex: 1; flex-wrap: wrap; }
.account-name-text { min-width: 0; cursor: text; }
.account-name-text:hover { text-decoration: underline dotted; }
.account-rename { width: var(--control-sm); height: var(--control-sm); }
.account-rename-input { height: var(--control-sm); max-width: 260px; }
/* The email under the name is typed in place the same way (SPEC-463). A long address is cut
   short of its pencil, which stays on the line (the field's refusal wraps under the field). */
.account-email-edit { display: flex; align-items: center; gap: 2px; min-width: 0; flex-wrap: wrap; }
.account-email-text { min-width: 0; max-width: calc(100% - var(--control-sm) - 2px); cursor: text; }
.account-email-text:hover { text-decoration: underline dotted; }
/* The agent a subscription belongs to (SPEC-513), before the email under the name. Nothing here
   clips, so the email's pencil and field keep their focus ring; the email ends in an ellipsis and
   goes to its own line only when not even its start fits beside the badge. The badge is outlined,
   not filled, so it reads on a folded row's own fill and under the pointer, and the plan badge
   keeps the accent. */
.account-subline { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; row-gap: 2px; min-width: 0; }
.account-subline > .account-sub:not(.agent-badge), .account-subline > .account-email-edit { flex: 1 1 4em; min-width: 0; }
/* Open, the email field and its refusal take the whole line, under the badge. */
.account-subline > .account-email-edit:has(> .account-email-input) { flex-basis: 100%; }
.agent-badge { display: inline-flex; align-items: center; box-sizing: border-box; height: 16px; max-width: 100%; padding: 0 4px; border: 1px solid var(--border-strong); border-radius: var(--radius-full); color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none; }
.plan-badge { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: var(--radius-full); background: var(--accent-soft); color: var(--accent-fg); font-size: var(--fs-xs); line-height: var(--lh-xs); font-weight: 600; letter-spacing: 0.02em; white-space: nowrap; flex: none; }
.account-state { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: var(--radius-full); font-size: var(--fs-xs); line-height: var(--lh-xs); font-weight: 600; white-space: nowrap; flex: none; }
.state-ok { background: var(--ok-soft); color: var(--ok-fg); }
.state-warn { background: var(--warn-soft); color: var(--warn-fg); }
.state-danger { background: var(--danger-soft); color: var(--danger-fg); }
.state-muted { background: var(--surface-3); color: var(--muted); }
/* Folded, both windows at a glance (SPEC-172): one grid, so the two bars line up. */
.account-glance { display: grid; grid-template-columns: auto 64px minmax(4ch, auto); align-items: center; column-gap: 8px; row-gap: 2px; flex: none; }
.glance-line { display: contents; }
.glance-name { color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); white-space: nowrap; }
.account-glance .usage-pct { font-size: var(--fs-xs); line-height: var(--lh-xs); }
/* Beside the glance, a folded row's state shows as its icon where the list is narrow; its name still reads it. */
@container accounts (width < 480px) {
  .account-fold .account-state { padding: 0 6px; }
  .account-fold .account-state-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
/* A narrow list (the Status panel on a phone) keeps the names and percents and gives the bars' room to the name. */
@container accounts (width < 360px) { .account-glance { grid-template-columns: auto minmax(4ch, auto); } .account-glance .meter { display: none; } }
.account-body { display: flex; flex-direction: column; gap: 12px; padding: 12px; }
.account-card .account-body { padding-top: 0; }
/* On the Accounts page the block already sits in a card. */
.card .account-card { border: 0; background: transparent; }
.card .account-card .account-head, .card .account-card .account-body { padding-left: 0; padding-right: 0; }
.account-error { display: flex; align-items: flex-start; gap: 6px; color: var(--danger-fg); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.account-error .icon { flex: none; margin-top: 2px; }
.account-note { display: flex; align-items: flex-start; gap: 6px; color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.account-note .icon { flex: none; margin-top: 2px; }
.usage-row { display: grid; grid-template-columns: minmax(132px, 1fr) minmax(64px, 1.3fr) 72px; align-items: center; gap: 12px; }
.usage-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--text); }
.usage-reset { color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); }
/* :nth-child(n) outweighs the skeleton's own line widths, defined below. */
.usage-reset .skeleton-line:nth-child(n) { width: 6em; height: 8px; margin-top: 4px; }
.usage-pct { color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.usage-pct.tone-ok { color: var(--ok-fg); }
.usage-pct.tone-warn { color: var(--warn-fg); }
.usage-pct.tone-danger { color: var(--danger-fg); }
.usage-pct.tone-unknown { color: var(--muted); }
.account-foot { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); }
/* What the clock draws again in a card (SPEC-473): wrappers that take no box of their own. */
.account-live { display: contents; }
/* How old the reading is, first in the body, with Refresh at its end; then one line per used-up window. */
.account-reading { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: var(--control-sm); color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); }
.account-age { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.account-reading[data-stale="true"] .account-age { color: var(--warn-fg); }
.account-refresh { flex: none; }
.account-refresh[aria-disabled="true"] { opacity: 0.6; cursor: default; }
.account-limit { display: flex; align-items: flex-start; gap: 6px; color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.account-limit .icon { flex: none; margin-top: 2px; color: var(--muted); }
/* Folded, a reading that may be out of date: an icon beside the glance; open, the body says it. */
.account-stale { display: inline-flex; align-items: center; flex: none; color: var(--warn-fg); }
.account-fold[open] .account-stale { display: none; }

/* live-updates outage notice (PERF-08): floats under the tab row, above the page */
.conn-banner { position: fixed; z-index: var(--z-popover); top: calc(var(--tabrow-h) + 8px); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 16px); padding: 6px 6px 6px 12px; border: 1px solid var(--warn-border); border-radius: var(--radius-lg); background: var(--surface-2); color: var(--text); box-shadow: var(--shadow); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.conn-banner .icon { color: var(--warn); flex: none; }

/* brand lab (lab.js, ?lab in the URL): a development aid floating over the app */
.lab { position: fixed; z-index: var(--z-toast); right: 16px; bottom: 16px; display: flex; flex-direction: column; width: min(340px, calc(100vw - 16px)); max-height: calc(100dvh - 64px); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--surface-2); color: var(--text); box-shadow: var(--shadow); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.lab.lab-left { right: auto; left: 16px; }
.lab-head { display: flex; align-items: center; gap: 4px; padding: 4px 4px 4px 8px; border-bottom: 1px solid var(--border); }
.lab-title { display: inline-flex; align-items: center; gap: 6px; height: var(--control-md); padding: 0 6px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text); font-family: var(--font-display); font-size: var(--fs); line-height: var(--lh); font-weight: 600; cursor: pointer; }
.lab-body { display: flex; flex-direction: column; gap: 8px; padding: 12px; overflow: auto; }
.lab-section { margin-top: 8px; color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.lab-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lab-field { display: flex; flex-direction: column; gap: 2px; }
.lab-label { display: flex; justify-content: space-between; gap: 8px; color: var(--text-2); }
.lab-value { color: var(--muted); font-variant-numeric: tabular-nums; }
.lab-field input[type="range"] { width: 100%; accent-color: var(--accent); }
.lab-directions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.lab-list { display: flex; flex-direction: column; gap: 6px; }
.lab-list .lab-direction { width: 100%; }
.lab-choice { position: relative; }
.lab-choice .lab-direction { padding-right: 32px; }
.lab-remove { position: absolute; top: 4px; right: 4px; }
.lab-sliders { display: flex; flex-direction: column; gap: 8px; }
.lab-sliders[open] > summary { margin-bottom: 8px; }
.lab-sliders > * + * { margin-top: 8px; }
.lab-direction { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); text-align: left; font-family: inherit; cursor: pointer; }
.lab-direction:hover { border-color: var(--border-strong); }
.lab-direction.on { border-color: var(--accent); box-shadow: var(--focus-inset); }
.lab-direction-name { display: flex; align-items: center; justify-content: space-between; gap: 6px; width: 100%; font-weight: 600; }
.lab-direction-note { color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); }
.lab-swatches { display: inline-flex; gap: 2px; }
.lab-swatch { width: 8px; height: 8px; border-radius: var(--radius-full); background: var(--lab-swatch); box-shadow: 0 0 0 1px var(--border-strong); }
.lab-fails { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; color: var(--danger-fg); }
.lab-fails li, .lab-ok { display: flex; gap: 6px; align-items: flex-start; }
.lab-fails .icon, .lab-ok .icon { flex: none; margin-top: 2px; }
.lab-ok { color: var(--ok-fg); }
.lab-note { color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); }
.lab-perceptual > summary { color: var(--warn-fg); }
.lab-misses { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 0; padding-left: 16px; color: var(--text-2); font-size: var(--fs-xs); line-height: var(--lh-xs); }
.lab-actions { display: flex; gap: 8px; margin-top: 4px; }

/* Git → a task's changes (UI-031): header, tabs, file tree and diff */
.gt-inner { max-width: none; }
.gt-head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.gt-back { display: inline-flex; align-items: center; gap: 4px; width: max-content; color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.gt-back:hover { color: var(--text); text-decoration: none; }
.gt-title-row { display: flex; align-items: center; gap: 12px; }
.gt-title { flex: 1; min-width: 0; overflow-wrap: break-word; }
.gt-go { flex: none; }
/* Phones: the title takes its own line above the buttons instead of breaking inside words. */
@media (max-width: 767px) { .gt-title-row { flex-wrap: wrap; } .gt-title { flex-basis: 100%; } }
.gt-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.gt-state { display: inline-flex; align-items: flex-start; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
/* A state that wraps (a Needs you link) keeps its icon beside its first line (SPEC-449). */
.gt-state > .glyph { flex: none; height: var(--lh-sm); }
.gt-branch { display: inline-flex; align-items: center; gap: 4px; height: var(--control-sm); padding: 0 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-full); color: var(--text); font-size: var(--fs-xs); line-height: var(--lh-xs); }
.gt-stat { font-family: var(--font-mono); font-size: var(--fs-sm); line-height: var(--lh-sm); font-variant-numeric: tabular-nums; white-space: nowrap; }
.gt-add { color: var(--ok-fg); }
.gt-del { color: var(--danger-fg); }
.gt-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.gt-tab { display: inline-flex; align-items: center; gap: 6px; height: var(--control-xl); padding: 0 12px; border: 0; background: transparent; color: var(--text-2); font: inherit; font-weight: 500; cursor: pointer; }
.gt-tab:hover { color: var(--text); }
.gt-tab.active { color: var(--text); box-shadow: inset 0 -2px 0 var(--text); }
.gt-tab:focus-visible { box-shadow: var(--focus-inset); }
.gt-tab-count { color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); font-variant-numeric: tabular-nums; }
.gt-tab-count:empty { display: none; }
.gt-toolbar { display: flex; align-items: center; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.gt-summary { color: var(--text-2); }
.gt-uncommitted { color: var(--warn-fg); }
.gt-wrap[aria-pressed="true"], .ed-wrap[aria-pressed="true"] { background: var(--accent-soft); color: var(--text); }
.gt-changes { display: grid; grid-template-columns: minmax(200px, 280px) minmax(0, 1fr); gap: 16px; align-items: start; padding-top: 12px; }
.gt-tree { position: sticky; top: 8px; max-height: calc(100dvh - 160px); overflow: auto; }
.gt-tree-list { margin: 0; padding: 0; list-style: none; }
.gt-tree-row { display: flex; align-items: center; gap: 6px; width: 100%; height: var(--control-md); padding: 0 8px 0 calc(8px + var(--gt-depth) * 12px); border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-2); font: inherit; font-size: var(--fs-sm); line-height: var(--lh-sm); text-align: left; cursor: pointer; }
.gt-tree-row:hover { background: var(--surface-3); color: var(--text); }
summary.gt-tree-row { list-style: none; }
summary.gt-tree-row::-webkit-details-marker { display: none; }
.gt-tree-row .icon { flex: none; color: var(--muted); }
.gt-tree-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gt-tree-row .gt-add { font-family: var(--font-mono); font-size: var(--fs-xs); line-height: var(--lh-xs); }
.gt-deleted { color: var(--muted); text-decoration: line-through; }
.gt-files { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.gt-files-summary { margin: 0; color: var(--text-2); }
.gt-file { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--term-bg); overflow: hidden; content-visibility: auto; contain-intrinsic-size: auto 400px; }
.gt-file-head { display: flex; align-items: center; gap: 8px; width: 100%; height: var(--control-xl); padding: 0 12px; border: 0; border-bottom: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.gt-file-head[aria-expanded="false"] { border-bottom: 0; }
.gt-file-head:focus-visible { box-shadow: var(--focus-inset); }
.gt-file-path { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); line-height: var(--lh-sm); }
.gt-diff-scroll { overflow-x: auto; }
.gt-diff { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: var(--fs-sm); line-height: var(--lh); }
.gt-diff td { padding: 0 8px; vertical-align: top; }
.gt-ln { width: 1%; min-width: 40px; color: var(--muted); text-align: right; white-space: nowrap; user-select: none; }
.gt-row-add .gt-ln, .gt-row-del .gt-ln { color: var(--text-2); }
.gt-diff-scroll:focus-visible { box-shadow: var(--focus-inset); }
.gt-sign { width: 1%; padding: 0 4px; color: var(--muted); user-select: none; }
.gt-code { color: var(--term-fg); white-space: pre; }
.gt-wrapped .gt-code { white-space: pre-wrap; overflow-wrap: anywhere; }
.gt-row-add td { background: var(--ok-soft); }
.gt-row-del td { background: var(--danger-soft); }
.gt-row-add .gt-sign { color: var(--ok-fg); }
.gt-row-del .gt-sign { color: var(--danger-fg); }
/* Split: two fixed halves; code wraps inside its half. */
.gt-split { table-layout: fixed; }
.gt-split .gt-col-ln { width: 56px; }
.gt-split .gt-col-sign { width: 24px; }
.gt-split .gt-code { white-space: pre-wrap; overflow-wrap: anywhere; }
.gt-split .gt-k-add, .gt-split .gt-k-add ~ td { background: var(--ok-soft); }
.gt-split .gt-k-del { background: var(--danger-soft); }
.gt-split .gt-empty { background: var(--surface-2); }
.gt-hunk td { padding: 4px 8px; background: var(--surface-2); color: var(--muted); }
.gt-more { margin: 8px 12px; }
.gt-note, .gt-empty-note { margin: 0; padding: 12px; color: var(--muted); }
.gt-commits { display: flex; flex-direction: column; margin: 12px 0 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); list-style: none; overflow: hidden; }
.gt-commit { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; align-items: center; gap: 12px; padding: 8px 12px; border-top: 1px solid var(--border); background: var(--surface); }
.gt-commit:first-child { border-top: 0; }
.gt-sha { font-size: var(--fs-sm); line-height: var(--lh-sm); }
.gt-commit-subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gt-branch-card { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; max-width: 640px; margin-top: 12px; }
@media (max-width: 900px) {
  .gt-changes { grid-template-columns: minmax(0, 1fr); }
  .gt-tree { position: static; max-height: 240px; }
  .gt-commit { grid-template-columns: auto minmax(0, 1fr); }
  .gt-commit > :nth-child(n + 3) { grid-column: 2; }
}

/* Tasks → a task's overview (UI-032) */
.ti-inner { max-width: 1280px; }
.ti-body { display: flex; flex-direction: column; gap: 12px; }
.ti-what { color: var(--text-2); }
.ti-what.ti-needs { color: var(--warn-fg); font-weight: 500; }
/* Six facts: three by two, one row of six when there is room, two by three on phones. */
.ti-body { container-type: inline-size; }
.ti-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@container (min-width: 1100px) { .ti-facts { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@container (max-width: 520px) { .ti-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ti-value { font-size: var(--fs-xl); line-height: var(--lh-xl); }
.ti-progress { display: block; height: 4px; margin-top: 4px; border-radius: var(--radius-full); background: var(--accent-track); overflow: hidden; }
.ti-progress-fill { display: block; height: 100%; background: var(--series-1); }
.ti-columns { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.ti-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.ti-steps { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.ti-step { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: start; gap: 8px; padding: 8px 0; border-top: 1px solid var(--border); }
.ti-step:first-child { border-top: 0; padding-top: 0; }
.ti-step-text { display: flex; flex-direction: column; gap: 2px; }
.ti-step.st-done .ti-step-text > :first-child { color: var(--text-2); }
.ti-step.st-in_progress .ti-step-text > :first-child { font-weight: 600; }
.ti-kv { grid-template-columns: max-content minmax(0, 1fr); row-gap: 8px; }
.ti-kv dd { overflow-wrap: anywhere; }
.ti-person { display: inline-flex; align-items: center; gap: 6px; }
.ti-avatar.avatar { width: 20px; height: 20px; font-size: var(--fs-xs); }
.ti-sessions { width: 100%; }
/* A narrow overview (a phone, or a tool panel beside it) stacks each session: its cells one per line,
   each named by its column, so nothing scrolls sideways (#147). */
@container (max-width: 640px) {
  .ti-sessions thead { display: none; }
  .ti-sessions, .ti-sessions tbody, .ti-sessions tr { display: block; }
  .ti-sessions tr { padding: 8px 0; border-bottom: 1px solid var(--border); }
  .ti-sessions tr:last-child { border-bottom: 0; }
  .ti-sessions td { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 8px; padding: 2px 0; border-bottom: 0; overflow-wrap: anywhere; }
  .ti-sessions td::before { content: attr(data-label); color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh); font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }
}
@media (max-width: 900px) { .ti-columns { grid-template-columns: minmax(0, 1fr); } }

/* Spotlight-style search (UI-036): a floating panel near the top, results under the field. */
.spot { width: min(640px, calc(100vw - 32px)); max-height: min(560px, calc(100vh - 96px)); margin: 14vh auto auto; padding: 0; display: flex; flex-direction: column; border: 1px solid var(--border-strong); border-radius: var(--radius-xl); background: var(--surface); color: var(--text); box-shadow: var(--shadow); overflow: hidden; }
.spot:not([open]) { display: none; }
.spot::backdrop { background: var(--backdrop); backdrop-filter: blur(4px); }
.spot-field { display: flex; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--border); color: var(--muted); }
.spot-input { flex: 1; min-width: 0; height: 56px; padding: 0; border: 0; background: transparent; color: var(--text); font: inherit; font-size: var(--fs-lg); line-height: var(--lh-lg); }
.spot-input:focus { outline: 2px solid transparent; }
.spot-input::placeholder { color: var(--text-faint); }
.spot-list { flex: 1 1 auto; min-height: 0; margin: 0; padding: 8px; overflow-y: auto; list-style: none; }
.spot-item { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 8px 12px; border-radius: var(--radius); cursor: pointer; }
.spot-item[aria-selected="true"] { background: var(--accent-soft); }
.spot-mark { display: inline-flex; color: var(--muted); }
.spot-text { display: flex; flex-direction: column; min-width: 0; }
.spot-title, .spot-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spot-sub { color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.spot-meta { color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); font-variant-numeric: tabular-nums; }
.spot-more { margin-top: 4px; border-top: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); color: var(--text-2); }
.spot-empty { padding: 24px 12px; color: var(--muted); text-align: center; }
.spot-foot { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 8px 16px; border-top: 1px solid var(--border); background: var(--surface-2); color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); }
.spot-foot > span { display: inline-flex; align-items: center; gap: 4px; }
@media (hover: none) { .spot-foot { display: none; } }
@media (max-width: 767px) { .spot { margin-top: 16px; } }

/* Workflows → a workflow builder (UI-034): templates, steps to click or drag, gates as switches. */
.wf-inner { max-width: 1180px; }
.wf-head .gt-title-row { align-items: flex-start; flex-wrap: wrap; }
.wf-titles { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 240px; }
.wf-name, .wf-desc { width: 100%; margin: 0 0 0 -8px; padding: 2px 8px; border: 1px solid transparent; border-radius: var(--radius); background: transparent; color: var(--text); font: inherit; }
.wf-name { font-family: var(--font-display); font-size: var(--fs-xl); line-height: var(--lh-xl); font-weight: 600; }
.wf-desc { color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.wf-name:hover:not(:read-only), .wf-desc:hover:not(:read-only) { border-color: var(--border); }
.wf-name:focus, .wf-desc:focus { outline: 2px solid transparent; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.wf-name::placeholder, .wf-desc::placeholder { color: var(--text-faint); }
.wf-body { container-type: inline-size; }
.wf-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.wf-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.wf-section { display: flex; flex-direction: column; gap: 12px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.wf-section-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; margin: 0; font-size: var(--fs-md); line-height: var(--lh-md); font-weight: 600; }
.wf-section-title .muted { font-weight: 400; }
.wf-templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.wf-template { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface-2); color: var(--text); text-align: left; font: inherit; cursor: pointer; }
.wf-template:hover { border-color: var(--accent-border); }
.wf-template.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.wf-template-icon { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; margin-bottom: 4px; border-radius: var(--radius); background: var(--surface-3); color: var(--text-2); }
.wf-template.on .wf-template-icon { background: var(--accent-strong); color: var(--on-solid); }
.wf-template-name { font-weight: 600; }
.wf-steps { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.wf-step { display: grid; grid-template-columns: 14px 22px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 42px; padding: 0 6px 0 8px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface-2); }
.wf-step[draggable="true"] { cursor: grab; }
.wf-step:hover { border-color: var(--border-control); }
.wf-step.dragging { opacity: 0.4; }
.wf-handle { display: inline-flex; color: var(--text-faint); }
.wf-step:hover .wf-handle { color: var(--text-2); }
.wf-num { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: var(--radius-full); background: var(--surface-3); color: var(--text-2); font-size: var(--fs-xs); line-height: var(--lh-xs); font-variant-numeric: tabular-nums; }
.wf-step-text { min-width: 0; padding: 4px 0; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: text; overflow-wrap: anywhere; }
.wf-step-text:disabled { cursor: default; }
.wf-step-input { height: var(--control-sm); }
.wf-step-actions { display: inline-flex; gap: 2px; opacity: 0; transition: opacity var(--duration-fast) var(--ease); }
.wf-step:hover .wf-step-actions, .wf-step:focus-within .wf-step-actions { opacity: 1; }
@media (hover: none) { .wf-step-actions { opacity: 1; } }
.wf-drop-line { height: 2px; margin: -4px 0; border-radius: var(--radius-full); background: var(--accent); list-style: none; }
.wf-empty { padding: 16px; border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--muted); text-align: center; }
.wf-library { display: flex; flex-direction: column; gap: 8px; }
.wf-label { color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.wf-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.wf-chip { display: inline-flex; align-items: center; gap: 4px; height: var(--control-sm); padding: 0 12px; border: 1px dashed var(--border-control); border-radius: var(--radius-full); background: transparent; color: var(--text-2); font: inherit; font-size: var(--fs-sm); line-height: var(--lh-sm); cursor: pointer; }
.wf-chip[draggable="true"] { cursor: grab; }
.wf-chip:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.wf-chip.on { border-style: solid; border-color: var(--accent-border); background: var(--accent-soft); color: var(--text); }
.wf-chip:disabled { cursor: default; opacity: 0.6; }
.wf-custom { width: 180px; height: var(--control-sm); border-radius: var(--radius-full); padding: 0 12px; }
.wf-gates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.wf-gate { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface-2); cursor: pointer; }
.wf-gate.on { border-color: var(--accent-border); background: var(--accent-soft); }
.wf-gate-icon { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 32px; height: 32px; border-radius: var(--radius); background: var(--surface-3); color: var(--text-2); }
.wf-gate.on .wf-gate-icon { color: var(--accent-fg); }
.wf-gate-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.wf-instr { display: flex; flex-direction: column; gap: 8px; }
.wf-scope { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.wf-summary { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 8px; padding: 16px; }
.wf-summary p { margin: 0; }
.wf-summary-steps { margin: 0; padding-left: 20px; color: var(--text); }
.wf-summary-steps li + li { margin-top: 2px; }
.wf-summary-quote { padding-left: 8px; border-left: 2px solid var(--border-strong); color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
@container (max-width: 820px) { .wf-grid { grid-template-columns: minmax(0, 1fr); } .wf-summary { position: static; } }
@container (max-width: 560px) { .wf-gates { grid-template-columns: minmax(0, 1fr); } .wf-custom { width: 100%; } }

/* MCP → a server (UI-038): known servers to pick, a paste box that fills the form, write-only secrets. */
.mc-inner { max-width: 900px; }
.mc-catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.mc-pick:disabled { opacity: 0.6; cursor: default; border-color: var(--border); }
.mc-logo img { display: block; width: 18px; height: 18px; }
.mc-logo:has(.logo-on-dark) { background: var(--logo-tile-dark); }
.mc-mono { font-weight: 600; color: var(--text); }
.mc-added { display: inline-flex; align-items: center; gap: 2px; margin-left: 8px; color: var(--ok-fg); font-size: var(--fs-xs); line-height: var(--lh-xs); font-weight: 500; }
.mc-paste-wrap { display: flex; flex-direction: column; gap: 6px; }
.mc-paste-field { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border: 1px dashed var(--border-control); border-radius: var(--radius-lg); background: var(--surface); color: var(--muted); }
.mc-paste-field:focus-within { border-style: solid; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.mc-paste-field .icon { margin-top: 2px; }
.mc-paste { min-height: 0; height: auto; padding: 0; border: 0; background: transparent; resize: none; field-sizing: content; max-height: 160px; }
.mc-paste:focus { border: 0; box-shadow: none; }
.mc-conn { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.mc-conn .input { width: 100%; height: var(--control-lg); }
.mc-secret .input { height: var(--control-lg); }
.mc-stored { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--text-2); }
.mc-key { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: var(--radius-full); background: var(--surface-3); color: var(--text-2); font-size: var(--fs-xs); line-height: var(--lh-xs); }
.mc-more summary { cursor: pointer; color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.mc-more[open] summary { margin-bottom: 8px; }
.mc-test-result:empty { display: none; }
.mc-ok, .mc-fail { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; }
.mc-ok { color: var(--ok-fg); }
.mc-fail { color: var(--danger-fg); }

/* Automations → an automation (UI-039): the schedule is clicked — days, a time, every hour. */
.au-when { color: var(--text-2); }
/* The start chip sits in the action bar (SPEC-093): as tall as its buttons. */
.chip-btn.au-start { height: var(--control-md); }
.chip-btn.au-start:disabled { opacity: 0.5; cursor: not-allowed; background: transparent; color: var(--text-2); }
/* On a phone the name takes the row and the start chip, Run now and Save stay together below Delete. */
.au-break { display: none; }
@media (max-width: 767px) {
  .au-page .wf-head .gt-title-row { row-gap: 6px; }
  .au-page .wf-titles { flex-basis: 100%; margin-bottom: 6px; }
  .au-break { display: block; flex-basis: 100%; height: 0; }
}
.au-when-rows { display: flex; flex-direction: column; gap: 12px; }
.au-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.au-row > .wf-label { width: 80px; flex: none; }
.au-days { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.au-chip { border-style: solid; }
.au-chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--text); font-weight: 500; }
.au-day { min-width: 48px; justify-content: center; }
.au-quick { display: inline-flex; gap: 12px; }
.au-time { width: 120px; height: var(--control-sm); }
.au-zone { width: auto; height: var(--control-sm); }
.au-cron { max-width: 280px; }
@media (max-width: 767px) { .au-row > .wf-label { width: 100%; } }

/* Skills → a skill (UI-033) and the Markdown block editor (mdeditor.js), Notion-like */
/* New skill (UI-035) borrows the builder's in-place title (.wf-name, .wf-desc) and chips. */
.sn-setup { display: flex; flex-direction: column; gap: 12px; padding: 12px 0 4px; border-bottom: 1px solid var(--border); }
.sn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.sn-row > .wf-label { width: 80px; flex: none; }
.sn-templates { display: flex; flex-wrap: wrap; gap: 6px; }
.sn-template { border-style: solid; }
.seg label .icon, .seg label svg { flex: none; }
.se-inner { max-width: 960px; }
.se-head .gt-title-row { flex-wrap: wrap; }
.se-badges { display: inline-flex; gap: 6px; }
.se-status { color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.se-status.se-dirty { color: var(--warn-fg); }
.se-status.se-error { color: var(--danger-fg); }
.se-source[aria-pressed="true"] { background: var(--accent-soft); color: var(--text); }
.se-body { padding: 8px 0 32px; }
.md-editor { position: relative; max-width: 760px; margin: 0 auto; color: var(--text); }
.md-props { margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.md-props:empty { display: none; }
.md-prop-list { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 4px 12px; align-items: start; margin: 0; }
.md-prop-list dt { padding: 4px 0; color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.md-prop-list dd { margin: 0; }
.md-prop { width: 100%; padding: 2px 8px; border: 1px solid transparent; border-radius: var(--radius); background: transparent; color: var(--text); font: inherit; font-size: var(--fs-md); line-height: var(--lh-md); resize: vertical; }
.md-prop:hover { background: var(--surface-hover); }
.md-prop:focus { border-color: var(--border-control); background: var(--surface); }
.md-prop-raw { display: flex; flex-direction: column; gap: 4px; }
.md-blocks { display: flex; flex-direction: column; gap: 2px; min-height: 240px; padding-bottom: 48px; cursor: text; counter-reset: md-ol; }
.md-readonly .md-blocks { cursor: default; }
.md-block { position: relative; display: flex; align-items: flex-start; gap: 8px; border-radius: var(--radius-sm); }
.md-text { flex: 1; min-width: 0; padding: 2px 4px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--fs-lg); line-height: var(--lh-lg); outline: 2px solid transparent; }
.md-text:focus-visible { box-shadow: none; }
.md-block[data-type="p"] .md-text:empty:focus::before,
.md-block:not([data-type="p"]) .md-text:empty::before { content: attr(data-placeholder); color: var(--text-faint); pointer-events: none; }
.md-block[data-type="h1"] { margin-top: 16px; }
.md-block[data-type="h2"] { margin-top: 12px; }
.md-block[data-type="h3"] { margin-top: 8px; }
.md-block[data-type="h1"] .md-text { font-family: var(--font-display); font-size: var(--fs-2xl); line-height: var(--lh-2xl); font-weight: 600; }
.md-block[data-type="h2"] .md-text { font-family: var(--font-display); font-size: var(--fs-xl); line-height: var(--lh-xl); font-weight: 600; }
.md-block[data-type="h3"] .md-text { font-size: var(--fs-lg); line-height: var(--lh-lg); font-weight: 600; }
.md-block[data-type="ul"]::before, .md-block[data-type="ol"]::before { flex: none; width: 20px; padding-top: 2px; color: var(--text-2); font-size: var(--fs-lg); line-height: var(--lh-lg); text-align: right; }
.md-block[data-type="ul"]::before { content: "•"; }
.md-block[data-type="ol"] { counter-increment: md-ol; }
.md-block[data-type="ol"]::before { content: counter(md-ol) "."; font-variant-numeric: tabular-nums; }
.md-block:not([data-type="ol"]) { counter-reset: md-ol; }
.md-block[data-level] { margin-left: calc(24px * var(--md-depth, 0)); }
.md-block[data-level="1"] { --md-depth: 1; }
.md-block[data-level="2"] { --md-depth: 2; }
.md-block[data-level="3"] { --md-depth: 3; }
.md-block[data-level="4"] { --md-depth: 4; }
.md-check { flex: none; width: 16px; height: 16px; margin: 4px 2px 0; accent-color: var(--accent); }
.md-done .md-text { color: var(--muted); text-decoration: line-through; }
.md-block[data-type="quote"] .md-text { padding-left: 12px; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.md-block[data-type="code"], .md-block[data-type="raw"] { flex-direction: column; gap: 0; margin: 4px 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.md-code { width: 100%; margin: 0; padding: 4px 12px 12px; font-family: var(--font-mono); font-size: var(--fs-sm); line-height: var(--lh); white-space: pre-wrap; tab-size: 2; }
.md-lang { align-self: flex-end; width: 120px; margin: 4px 8px 0 0; padding: 0 4px; border: 0; background: transparent; color: var(--muted); font-family: var(--font-mono); font-size: var(--fs-xs); line-height: var(--lh-xs); text-align: right; }
.md-raw-label { color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); letter-spacing: 0.04em; text-transform: uppercase; }
.md-block[data-type="hr"] { padding: 8px 0; }
.md-block[data-type="hr"] hr { flex: 1; margin: 0; border: 0; border-top: 1px solid var(--border-strong); }
.md-block[data-type="hr"]:focus-visible { box-shadow: var(--focus-inset); }
.md-text code { padding: 0 4px; border-radius: var(--radius-sm); background: var(--surface-3); font-family: var(--font-mono); font-size: inherit; }
.md-text a { color: var(--accent-fg); text-decoration: underline; text-underline-offset: 2px; }
.md-source { display: block; width: 100%; min-height: 60vh; padding: 12px; border: 1px solid var(--border-control); border-radius: var(--radius); background: var(--surface); color: var(--text); font-family: var(--font-mono); font-size: var(--fs-sm); line-height: var(--lh); resize: vertical; }
.md-frontmatter { min-height: 0; }
.md-toolbar { position: absolute; z-index: var(--z-menu); display: flex; gap: 2px; padding: 4px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface-2); box-shadow: var(--shadow); }
.md-tool { min-width: 28px; height: var(--control-sm); padding: 0 6px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text); font: inherit; font-size: var(--fs-sm); line-height: var(--lh-sm); cursor: pointer; }
.md-tool:hover { background: var(--surface-hover); }
.md-tool-bold { font-weight: 600; }
.md-tool-italic { font-style: italic; }
.md-tool-strike { text-decoration: line-through; }
.md-tool-code { font-family: var(--font-mono); }

/* keyboard shortcut sheet (UI-029) */
.shortcuts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 24px 32px; }
.shortcuts-title { margin-bottom: 8px; font-size: var(--fs-sm); line-height: var(--lh-sm); font-weight: 600; color: var(--text); }
.shortcuts-list { display: grid; grid-template-columns: 144px 1fr; gap: 6px 12px; align-items: baseline; font-size: var(--fs-sm); line-height: var(--lh-sm); }
.shortcuts-list dt { white-space: nowrap; }
.shortcuts-list dd { margin: 0; color: var(--text-2); }

/* notification center (UI-020) */
/* The badge sits inside the button's box, so the window edge never cuts it (the bell is the last
   control on pages without tools, #147). */
.notif-btn { position: relative; }
.notif-badge {
  position: absolute; top: 1px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--radius-full);
  background: var(--accent); color: var(--accent-ink); font-size: var(--fs-xs); font-weight: 600; line-height: var(--lh-xs); text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
}
.notif-pop { width: min(400px, calc(100vw - 16px)); scroll-padding-top: 56px; } /* rows never hide under the sticky head (2.4.11) */
.notif-head { position: sticky; top: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 12px 12px 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.notif-filter { flex-basis: 100%; }
.notif-filter label { flex: 1; justify-content: center; }
.notif-head h2 { font-size: var(--fs-lg); line-height: var(--lh-lg); font-weight: 600; }
.notif-list { display: flex; flex-direction: column; padding: 4px; }
.notif-row { display: flex; align-items: flex-start; gap: 2px; border-radius: var(--radius-sm); color: var(--text-2); }
.notif-row:hover { background: var(--surface-3); }
.notif-open {
  display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; align-items: start; gap: 8px; flex: 1; min-width: 0;
  padding: 8px 4px 8px 12px; border: 0; border-radius: var(--radius-sm); background: transparent; color: inherit;
  font: inherit; text-align: left;
}
button.notif-open { cursor: pointer; }
button.notif-open:hover, button.notif-open:focus-visible { color: var(--text); }
.notif-read, .notif-read-space { flex: none; margin: 4px 4px 0 0; }
.notif-read-space { width: var(--control-md); }
.notif-row.unread { color: var(--text); }
.notif-mark { width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: transparent; }
.notif-row.unread .notif-mark { background: var(--accent); }
.notif-row.unread.notif-warn .notif-mark { background: var(--warn); }
.notif-row.unread.notif-error .notif-mark { background: var(--danger); }
.notif-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-title { overflow-wrap: anywhere; }
.notif-row.unread .notif-title { font-weight: 600; }
.notif-detail { color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); overflow-wrap: anywhere; }
.notif-time { color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); white-space: nowrap; font-variant-numeric: tabular-nums; margin-top: 2px; }
.notif-empty { padding: 32px 20px; color: var(--muted); text-align: center; font-size: var(--fs-sm); line-height: var(--lh-sm); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: var(--fs-sm); line-height: var(--lh-sm); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- task view */

.taskview { display: flex; flex-direction: column; flex: 1; min-height: 0; }
/* The terminal and what floats over it: the attention bar never resizes the terminal (each resize
   makes the agent's TUI redraw, F 2026-10-09). */
.taskview-term { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.attention-bar { position: absolute; top: calc(var(--term-banner-h, 0px) + 8px); right: 16px; z-index: var(--z-float); display: flex; align-items: center; gap: 12px; max-width: min(560px, calc(100% - 32px)); padding: 8px 8px 8px 12px; border: 1px solid var(--border-strong); border-left: 3px solid var(--warn); border-radius: var(--radius); background: var(--warn-soft-solid); color: var(--warn-fg-strong); font-size: var(--fs-sm); line-height: var(--lh-sm); box-shadow: var(--shadow); }
.attention-bar[hidden] { display: none; }
/* Below the attention bar, the terminal's own notices. */
.taskview-term:has(.attention-bar:not([hidden])) .term-corner { top: calc(var(--term-banner-h, 0px) + var(--attention-h, 48px) + 16px); }
.attention-bar.waiting { border-left-color: var(--info); background: var(--info-soft-solid); color: var(--info-fg-strong); }
.attention-bar .icon { flex: none; }
.attention-text { flex: 1; min-width: 0; }
/* A request for control (SPEC-070) above what else the task needs. */
.attention-bar.stacked { flex-direction: column; align-items: stretch; gap: 8px; }
/* A waiting task's bar (SPEC-126): its words on one row, its start chip and buttons below. */
.attention-bar.wrap { flex-wrap: wrap; row-gap: 8px; }
/* The icon (16px) and the gap (12px) share the first row with the words. */
.attention-bar.wrap .attention-text { flex-basis: calc(100% - 28px); }
.attention-row { display: flex; align-items: center; gap: 12px; }
/* A request to a person (SPEC-327): a heading over What happened, Problem and To do; a label sits
   beside its text, or above it when the bar is too narrow for both. The to-do is the strongest. */
.attention-bar.needs-you { flex-wrap: wrap; align-items: flex-start; row-gap: 8px; }
.attention-bar.needs-you .needs-you-text { flex: 1 1 18em; }
/* The bar's own colour (warn, or info while the agent waits) reaches the held to-do. */
.attention-row:has(> .needs-you-text), .needs-you-text, .needs-you-parts { background: inherit; }
:is(.attention-bar, .attention-row):has(> .needs-you-text) { align-items: flex-start; }
:is(.attention-bar, .attention-row):has(> .needs-you-text) > .icon { margin-top: 2px; }
.needs-you-title { display: flex; flex-wrap: wrap; align-items: baseline; margin-bottom: 4px; }
/* Long context scrolls inside the list; the to-do stays at its foot, in view. */
.needs-you-parts { display: flex; flex-direction: column; gap: 4px; margin: 0; max-height: min(20em, 45vh); overflow-y: auto; overscroll-behavior: contain; border-radius: var(--radius-sm); }
.needs-you-parts:focus-visible { box-shadow: var(--focus); outline: none; }
.needs-you-parts > div { display: flex; flex-wrap: wrap; column-gap: 12px; }
.needs-you-parts dt { flex: 0 0 7.5em; color: var(--text-2); }
.needs-you-parts dd { flex: 1 1 14em; min-width: 0; margin: 0; overflow-wrap: anywhere; }
.needs-you-todo { position: sticky; bottom: 0; margin-top: auto; padding-top: 4px; border-top: 1px solid var(--border-strong); background: inherit; }
.needs-you-todo dt, .needs-you-todo dd { font-weight: 600; color: inherit; }
/* A reply being written (SPEC-156): the words on the first row, the field and its buttons below. */
.attention-bar.replying { flex-wrap: wrap; row-gap: 8px; }
.attention-bar.replying .attention-text { flex-basis: calc(100% - 28px); }
.attention-reply { display: flex; flex: 1 1 100%; gap: 8px; }
/* Whom a request asks besides its owner, and the owner's Withdraw for each (SPEC-512 ANS-005). */
.needs-you-who { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.attention-reply[hidden] { display: none; }
/* The bar holds the keyboard after a reply field closed under typing: it shows it has it. */
.attention-bar:focus-visible { box-shadow: var(--focus), var(--shadow); }
.attention-reply .input { flex: 1; min-width: 0; height: var(--control-sm); }
/* Queued messages (SPEC-052): at the bottom of a waiting task's empty terminal. */
.queue-slot { position: absolute; left: 50%; bottom: 16px; z-index: var(--z-float); width: min(640px, calc(100% - 32px)); transform: translateX(-50%); }
.queue-slot[hidden] { display: none; }
.queue-card { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); font-size: var(--fs-sm); line-height: var(--lh-sm); box-shadow: var(--shadow); }
.queue-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.queue-request { margin: 0; padding: 8px 12px; max-height: 140px; overflow: auto; border-left: 2px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.queue-compose { position: relative; display: flex; align-items: flex-end; gap: 8px; }
/* A file of the request (SPEC-168): the composer's placeholder, a button that opens it. */
.queue-request .queue-file { font: inherit; font-size: var(--fs-sm); cursor: pointer; user-select: none; }
.queue-request .queue-file:focus-visible { outline: 2px solid var(--accent-border-strong); outline-offset: 1px; }
/* The message box: the composer's prompt input (SPEC-168), drawn as the card's field. */
.queue-card .queue-input {
  flex: 1; min-width: 0; min-height: var(--control-xl); max-height: 160px; padding: 6px 8px;
  border: 1px solid var(--border-control); border-radius: var(--radius); background: var(--bg);
  font-size: inherit; line-height: inherit;
}
.queue-card .queue-input:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); outline: 2px solid transparent; outline-offset: 1px; }
.queue-compose .upload-status-float { top: auto; bottom: calc(100% + 8px); left: 0; }
.queue-card .field-error:empty { display: none; }
/* A waiting task has no session to send keys to: the phone's quick input gives way to the card. */
.taskview:has(.queue-slot:not([hidden])) .quickbar { display: none; }
/* A prompt held by the scope check (TSK-013): its choices float over the terminal like the
   attention bar, so the terminal keeps its size. */
.held-slot { position: absolute; top: 8px; right: 16px; z-index: var(--z-float); width: min(560px, calc(100% - 32px)); }
.held-slot[hidden] { display: none; }
.held-card { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--border-strong); border-left: 3px solid var(--warn); border-radius: var(--radius); background: var(--surface); color: var(--text); font-size: var(--fs-sm); line-height: var(--lh-sm); box-shadow: var(--shadow); }
.held-card.held-redirect { border-left-color: var(--danger); }
.held-card.busy { opacity: 0.7; pointer-events: none; }
.held-head { display: flex; align-items: center; gap: 8px; }
.held-head strong { flex: 1; min-width: 0; }
.held-head .icon { flex: none; color: var(--warn-fg); }
.held-prompt { margin: 0; padding: 8px 12px; max-height: 96px; overflow: auto; border-left: 2px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.held-text { margin: 0; }
.held-steps { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.held-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.taskview-term:has(.held-slot:not([hidden])) .term-notice { top: 64px; }
/* The chain on both tasks (TSK-012). */
.chain-chip { border: 1px solid var(--border); color: var(--text-2); text-decoration: none; }
a.chain-chip:hover { background: var(--surface-3); color: var(--text); }
/* The subscription a task runs on; a button opens "Run on…" (SPEC-447). */
.account-chip { border: 1px solid var(--border); background: transparent; color: var(--text-2); font-family: inherit; }
button.account-chip { cursor: pointer; }
button.account-chip:hover { background: var(--surface-3); color: var(--text); }
/* The composer's split proposal (TSK-011; F 2026-10-10 layout): below the prompt box, compact rows
   with an editable title, a one-line preview and the prompt collapsed; one primary action. */
/* The start-rule editor (SPEC-022): one row per condition, a task and its state. */
.rule-editor .seg { align-self: flex-start; }
.rule-conditions { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.rule-condition { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rule-condition .rule-task { flex: 1 1 auto; min-width: 0; }
.rule-condition .rule-state { flex: none; }
.rule-add { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rule-preview { margin: 0; font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--text-2); overflow-wrap: anywhere; }
@media (max-width: 480px) { .rule-condition { flex-wrap: wrap; } .rule-condition .rule-task { flex-basis: 100%; } }

.split-card {
  display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow-raised); font-size: var(--fs-sm); line-height: var(--lh-sm);
  animation: rise-in var(--duration) var(--ease);
}
.split-head { display: flex; align-items: flex-start; gap: 12px; }
.split-head > .icon { flex: none; margin-top: 4px; color: var(--text-2); }
.split-heading { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.split-heading strong { color: var(--text); font-size: var(--fs-md); line-height: var(--lh-md); font-weight: 600; }
.split-head .split-x { flex: none; margin-left: auto; }
.split-list { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; border: 1px solid var(--border); border-radius: var(--radius); }
.split-item { display: flex; gap: 12px; padding: 8px 12px; animation: fade-in var(--duration) var(--ease); }
.split-item + .split-item { border-top: 1px solid var(--border); }
.split-num {
  display: inline-flex; flex: none; align-items: center; justify-content: center; width: 20px; height: 20px; margin-top: 4px;
  border-radius: 50%; background: var(--surface-3); color: var(--text-2); font-size: var(--fs-xs); line-height: var(--lh-xs); font-weight: 600;
}
.split-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.split-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
/* The title reads as text and edits in place. */
.split-title {
  flex: 1; min-width: 0; height: var(--control-md); margin-left: -8px; padding: 0 8px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--text); font: inherit; font-size: var(--fs); line-height: var(--lh); font-weight: 500;
}
.split-title:hover { border-color: var(--border); }
.split-title:focus { border-color: var(--border-control); background: var(--surface-2); }
/* The whole row is the disclosure's target, at least 24 px tall (WCAG 2.2 2.5.8). */
.split-prompt summary { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: var(--control-sm); color: var(--muted); cursor: pointer; list-style: none; }
.split-prompt summary::-webkit-details-marker { display: none; }
.split-preview { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.split-more { flex: none; color: var(--text-2); font-size: var(--fs-xs); line-height: var(--lh-xs); }
.split-prompt summary:hover .split-more { color: var(--text); text-decoration: underline; }
.split-prompt[open] .split-more-closed, .split-prompt:not([open]) .split-more-open { display: none; }
.split-prompt[open] .split-preview { visibility: hidden; }
.split-prompt-text {
  margin-top: 4px; padding: 8px 12px; max-height: 160px; overflow: auto; border-radius: var(--radius-sm); background: var(--surface-2);
  color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere;
}
.split-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.split-spacer { flex: 1; }

/* Calm loading (F 2026-10-10): shimmering bars where content will appear (dom.js skeleton), the
   composer's working line, and a sheen along the prompt box while intake decides. */
.skeleton { display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
/* In place of a page's, a panel's or a dialog's content (SPEC-092): room around it, and bars no
   longer than a line of text. */
.skeleton-block { gap: 12px; width: 100%; max-width: 640px; padding: 16px; }
.skeleton-line {
  display: block; height: 12px; border-radius: var(--radius-full);
  background: var(--surface-3) linear-gradient(90deg, transparent, var(--overlay-active), transparent) no-repeat; background-size: 50% 100%;
  animation: shimmer var(--duration-pulse) linear infinite;
}
.skeleton-line:nth-child(1) { width: 72%; }
.skeleton-line:nth-child(2) { width: 54%; }
.skeleton-line:nth-child(3) { width: 36%; }
/* Loading shapes (SPEC-120): the final layout's own boxes; a bar is one line of the text it
   replaces (1lh tall, the pill centred in it), a tile an icon's square. */
.skeleton-shaped { display: block; padding: 0; }
.skeleton-bar { display: flex; align-items: center; max-width: 100%; height: 1lh; }
.skeleton-bar::before, .skeleton-shape .skeleton-tile, .skeleton-field, .skeleton-chart, .skeleton-spark, .skeleton-button, .skeleton-chip {
  background: var(--surface-3) linear-gradient(90deg, transparent, var(--overlay-active), transparent) no-repeat; background-size: 50% 100%;
  animation: shimmer var(--duration-pulse) linear infinite;
}
.skeleton-bar::before { content: ""; flex: 1; height: min(12px, 0.7lh); border-radius: var(--radius-full); }
.skeleton-shape .skeleton-tile { border-color: transparent; }
/* Fixed bar lengths (bar('xs' … 'xl')): a count, an age, a heading. */
.skeleton-bar-xs { width: 1em; }
.skeleton-bar-sm { width: 2em; }
.skeleton-bar-md { width: 5em; }
.skeleton-bar-lg { width: 8em; }
.skeleton-bar-xl { width: 10em; }
.skeleton-card { display: flex; flex-direction: column; gap: 8px; padding: 16px; }
.skeleton-field { height: var(--control-xl); border-radius: var(--radius-lg); }
.skeleton-chart { height: 160px; border-radius: var(--radius); }
.skeleton-spark { border-radius: var(--radius-sm); }
.skeleton-button { flex: none; width: 72px; height: var(--control-md); border-radius: var(--radius); }
.skeleton-button-sm { height: var(--control-sm); }
.skeleton-dot { display: block; flex: none; width: 16px; height: 16px; border-radius: 50%; }
.tl-chips-loading { display: flex; gap: 8px; }
.tl-chips-loading[hidden] { display: none; }
/* A radio in a choice row (SHAPES.rows): about the room Chrome's radio takes with its margins. */
.skeleton-radio { flex: none; width: 12px; height: 12px; margin: 4px; border-radius: 50%; }
.skeleton-chip { width: 88px; height: var(--control-lg); border-radius: var(--radius-full); }
.tl-tabs[aria-busy="true"] .tl-tab { cursor: default; }
.tl-tabs[aria-busy="true"] .tl-tab:hover { background: transparent; color: var(--text-2); }
.skeleton-shape .ss-row-link:hover { background: var(--surface); border-color: var(--border); }
.skeleton .task-group-head, .skeleton .tl-group-head { cursor: default; }
/* The Tasks band is surface-3 itself: its bar is a step brighter. */
.skeleton .tl-group-head .skeleton-bar::before { background-color: var(--border-strong); }
/* Task rows while a list loads (layout.js, pages/tasks.js): the rows' own grid and height. */
.skeleton-tl-row { border-top: 1px solid var(--border); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.tl-group-head + .skeleton-tl-row { border-top: 0; }
.skeleton-tl-link { font-size: var(--fs-md); line-height: var(--lh-md); }
.intake-slot { display: flex; flex-direction: column; }
.intake-status {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface) linear-gradient(100deg, transparent 30%, var(--overlay-hover) 50%, transparent 70%) no-repeat; background-size: 60% 100%;
  color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm);
  animation: rise-in var(--duration) var(--ease), shimmer var(--duration-pulse) linear infinite;
}
.intake-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: breathe var(--duration-pulse) var(--ease) infinite; }
.intake-label-in { animation: fade-in var(--duration) var(--ease); }
.composer-box { position: relative; }
.composer-box.thinking::after {
  content: ""; position: absolute; left: 20px; right: 20px; bottom: -1px; height: 2px; border-radius: var(--radius-full); pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--accent), transparent) no-repeat; background-size: 40% 100%;
  animation: shimmer var(--duration-pulse) var(--ease) infinite;
}
.composer-box.thinking .composer-prompt { color: var(--text-2); }
@keyframes shimmer { from { background-position: -150% 0; } to { background-position: 250% 0; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(4px); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes breathe { 50% { opacity: 0.45; transform: scale(0.7); } }
.stepstrip { flex: none; background: var(--surface); border-bottom: 1px solid var(--border); container: strip / inline-size; }
/* A narrow centre (a tool panel open beside it): the step name, then the state and count give way,
   so the strip's parts never overlap (UI-046). */
@container strip (max-width: 560px) {
  /* `.stepstrip` outranks the base rules that come later (they kept the bar at 120 px and the
     chips' box shown, #348). */
  .stepstrip .step-progress { width: 60px; }
  .step-current, .stepstrip .strip-extras { display: none; }
}
@container strip (max-width: 420px) {
  .strip-state, .step-count { display: none; }
  /* No count, no floor; `.stepstrip` outranks the base rule that comes later. */
  .stepstrip .stepstrip-toggle { min-width: 0; }
}
.stepstrip-main { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 4px 0 8px; }
/* The label takes the room the rest leaves, and never less than its step count needs while that
   shows; the state takes at most 40% of the strip and gives its words up first (down to its icon),
   so neither a long state nor a narrow strip beside a tool panel pushes "Step N/M" under the bar
   (#341). The label is clipped in its button, never painted over the bar. */
.stepstrip-toggle { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 8rem; overflow: hidden; height: var(--control-md); padding: 0 6px; border: 0; border-radius: var(--radius-sm); background: transparent; cursor: pointer; text-align: left; color: var(--text-2); }
.stepstrip-toggle:hover { background: var(--surface-3); color: var(--text); }
.stepstrip-toggle .icon { transition: transform var(--duration-fast) var(--ease); }
.stepstrip.open .stepstrip-toggle .icon { transform: rotate(90deg); }
.step-label { display: flex; gap: 6px; min-width: 0; align-items: baseline; }
.step-count { flex: none; color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
/* What a plan that grew had at first (SPEC-484): quieter than the count it follows. */
.step-first { color: var(--muted); font-weight: 400; }
/* The task title leads and keeps its room; the step name truncates first. */
.step-current { flex: 0 100 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-task { flex: 0 1 auto; min-width: 0; color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step-task-num { margin-right: 6px; color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.step-progress { display: flex; width: 120px; height: 4px; border-radius: var(--radius-full); background: var(--accent-track); overflow: hidden; flex: none; }
.step-progress-fill { flex: none; width: 0; height: 100%; background: var(--series-1); border-radius: var(--radius-full); transition: width var(--duration-slow) var(--ease); }
/* The step in progress, in the working colour (the "Working" mark beside the bar), right after
   the finished share; the two meet square (#150, SPEC-159). */
.step-progress-active { flex: none; width: 0; height: 100%; background: var(--ok); border-radius: 0 var(--radius-full) var(--radius-full) 0; transition: width var(--duration-slow) var(--ease); }
.step-progress-fill:has(+ .step-progress-active:not([hidden])) { border-radius: var(--radius-full) 0 0 var(--radius-full); }
.strip-delivery { display: inline-flex; align-items: center; gap: 8px; }
.strip-delivery:empty { display: none; }
button.strip-pr { background: transparent; font-family: inherit; cursor: pointer; }
.strip-extras { flex: none; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
:is(button, a).strip-extra { height: var(--control-sm); }
.strip-extras:empty { display: none; }
/* Parts that gave way so the strip keeps within its edge (#348, fitStrip in taskview.js); while
   the chips decide, the state keeps its words, so chips go first. */
.stepstrip-main .strip-gone { display: none; }
.strip-fitting .strip-status { flex-shrink: 0; }
.strip-status { display: inline-flex; align-items: center; gap: 4px; min-width: 30px; max-width: 40%; height: var(--control-sm); padding: 0 8px; border-radius: var(--radius-full); font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--text-2); white-space: nowrap; }
.strip-status .glyph { flex: none; }
.strip-state { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* The session's state at a glance: waiting for you, needs you, done, failed (F 2026-10-09). */
.strip-status[data-tone="waiting"] { background: var(--info-soft); color: var(--info-fg); }
.strip-status[data-tone="attention"], .strip-status[data-tone="stopped-abnormal"] { background: var(--warn-soft); color: var(--warn-fg); }
.strip-status[data-tone="done"] { background: var(--ok-soft); color: var(--ok-fg); }
.strip-status[data-tone="failed"] { background: var(--danger-soft); color: var(--danger-fg); }
.strip-status:is([data-tone="waiting"], [data-tone="attention"], [data-tone="stopped-abnormal"], [data-tone="done"], [data-tone="failed"]) .glyph { color: inherit; }
.steplist { max-height: 40vh; overflow: auto; padding: 4px 12px 12px 32px; border-top: 1px solid var(--border); }
.step-item { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 8px; padding: 4px 0; align-items: baseline; }
.step-item + .step-item { border-top: 1px solid var(--border); }
.step-mark { font-family: var(--font-mono); font-size: var(--fs-sm); line-height: var(--lh-sm); text-align: center; }
.step-item.st-done .step-mark { color: var(--ok); }
.step-item.st-done .step-title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--text-disabled); }
.step-item.st-in_progress .step-mark { color: var(--accent); }
.step-item.st-in_progress .step-title { color: var(--text); font-weight: 600; }
.step-item.st-blocked .step-mark { color: var(--danger); }
.step-item.st-skipped .step-mark, .step-item.st-pending .step-mark { color: var(--muted); }
.step-note { grid-column: 2 / 4; color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.step-audit { color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); white-space: nowrap; }

.term-lazy { display: contents; } /* terminal.js: the view loads into it on demand */
.term-load-error { display: flex; align-items: center; gap: 12px; margin: auto; color: var(--text-2); }
.term { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--term-bg); }
.term-host { flex: 1; min-height: 0; padding: 4px 0 0 6px; overflow: hidden; }
.term-fit { width: 100%; height: 100%; } /* xterm's box, without padding: the fit measures exactly this */
.term-host .xterm { height: 100%; }
/* Another viewer sets the size: its grid, scaled to fill this box, centred across the width left. */
.term-host.term-mirror .xterm-screen { margin-inline: auto; }
.term-host .xterm-viewport { background-color: var(--term-bg) !important; }
/* Dim terminal text (ANSI faint) keeps 4.5:1: xterm's contrast floor does not apply to it. */
.term-host .xterm-dim { color: var(--muted) !important; }
.term-banner { flex: none; display: flex; flex-direction: column; }
.term-banner-row { display: flex; align-items: center; gap: 8px; padding: 4px 12px; font-size: var(--fs-sm); line-height: var(--lh-sm); border-bottom: 1px solid var(--border); }
.term-banner-row > .icon { flex: none; }
.term-banner-text { flex: 1; min-width: 0; }
.term-banner-info { background: var(--surface-2); color: var(--text-2); }
.term-banner-warn { background: var(--warn-soft); color: var(--warn-fg-strong); }
.term-banner-error { background: var(--danger-soft); color: var(--danger-fg-strong); }
.term-banner-readonly { background: var(--surface-2); color: var(--text-2); }
/* The terminal appears once, at its final size and font (F 2026-10-09): until its first screen is
   drawn the grid is laid out but hidden, under a calm placeholder of the terminal's colour. */
.term-host.term-pending { visibility: hidden; }
.term-skeleton { position: absolute; inset: 0; z-index: var(--z-float); display: flex; flex-direction: column; gap: 12px; padding: 16px 12px; background: var(--term-bg); pointer-events: none; opacity: 1; transition: opacity var(--duration) var(--ease); }
.term-skeleton > span {
  display: block; height: var(--lh-sm); border-radius: var(--radius-sm); opacity: 0;
  background: var(--surface-2) linear-gradient(90deg, transparent, var(--overlay-active), transparent) no-repeat; background-size: 50% 100%;
  animation: term-skeleton-in var(--duration-slow) var(--ease) var(--duration-slow) forwards, shimmer var(--duration-pulse) linear infinite;
}
.term-skeleton > span:nth-child(1) { width: 38%; }
.term-skeleton > span:nth-child(2) { width: 62%; }
.term-skeleton > span:nth-child(3) { width: 24%; }
.term-skeleton.term-skeleton-done { opacity: 0; }
@keyframes term-skeleton-in { to { opacity: .5; } }
.term-placeholder { position: relative; }
/* A word over a blank screen (a task that has not started yet). */
.term-empty { position: absolute; inset: 0; z-index: var(--z-float); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 24px; text-align: center; pointer-events: none; }
.term-empty-title { margin: 0; color: var(--text); font-size: var(--fs-md); line-height: var(--lh-md); font-weight: 500; }
.term-empty-text { margin: 0; max-width: 48ch; color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); }
/* A transient state (queued, starting, switching) shimmers like the composer's working line. */
.term-empty-bar {
  display: block; width: 120px; height: 2px; margin-top: 12px; border-radius: var(--radius-full);
  background: var(--accent-track) linear-gradient(90deg, transparent, var(--accent), transparent) no-repeat; background-size: 40% 100%;
  animation: shimmer var(--duration-pulse) var(--ease) infinite;
}
/* Connection trouble floats over the top of the terminal: it never changes the terminal's size. */
.term-conn { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: var(--z-float); display: flex; align-items: center; gap: 8px; max-width: calc(100% - 24px); padding: 4px 4px 4px 12px; border-radius: var(--radius-full); background: var(--warn-soft); border: 1px solid var(--border-strong); color: var(--warn-fg-strong); font-size: var(--fs-sm); line-height: var(--lh-sm); box-shadow: var(--shadow-sm); }
.term-conn.term-conn-error { background: var(--danger-soft); color: var(--danger-fg-strong); }
.term-conn > .icon { flex: none; }
.term-conn .spinner { width: 12px; height: 12px; flex: none; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin var(--duration-spin) linear infinite; }
/* The terminal's corner: notices, the size chip and the mouse hand-over, floating and opaque (they
   never resize the terminal, #101/#103). Only its children take the pointer. */
.term-corner { position: absolute; top: calc(var(--term-banner-h, 0px) + 6px); right: 16px; z-index: var(--z-float); display: flex; flex-direction: column; align-items: flex-end; gap: 6px; max-width: 70%; pointer-events: none; }
.term-corner > * { pointer-events: auto; }
.term-corner > [hidden] { display: none; }
.term-size-chip { padding: 2px 8px; border-radius: var(--radius-full); background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text-2); font-size: var(--fs-xs); line-height: var(--lh-xs); box-shadow: var(--shadow-sm); white-space: nowrap; cursor: default; }
.term-notice { max-width: 100%; padding: 6px 12px; border-radius: var(--radius); background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--text); font-size: var(--fs-sm); line-height: var(--lh-sm); box-shadow: var(--shadow); }

/* phone quick input (UI-012, §6.4) */
.quickbar { display: none; flex: none; flex-direction: column; gap: 6px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); }
.quickbar-input { display: flex; gap: 6px; }
.quickbar-input .input { height: var(--control-xl); font-size: var(--fs-lg); line-height: var(--lh-lg); }
.quickbar-input .btn { height: var(--control-xl); }
.quickbar-keys { display: flex; gap: 6px; overflow-x: auto; }
.quickbar-keys .btn { height: var(--control-xl); min-width: 44px; padding: 0 12px; font-family: var(--font-mono); font-size: var(--fs-sm); line-height: var(--lh-sm); flex: 1 0 auto; }

/* composer */
.composer { flex: 1; overflow: auto; display: flex; flex-direction: column; align-items: center; padding: 14vh 16px 24px; background: var(--bg); }
/* A random line about building great things sits above the composer (quotes.js). */
.composer-quote { margin: 0 0 40px; }
.composer-quote blockquote { margin: 0; color: var(--text-2); font-size: var(--fs-xl); line-height: var(--lh-xl); font-weight: 500; letter-spacing: -0.01em; text-wrap: balance; }
.composer-quote figcaption { margin-top: 8px; color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.composer-card { width: min(760px, 100%); display: flex; flex-direction: column; gap: 12px; }
.composer-title { font-family: var(--font-display); }
/* The composer's top bar: sandbox › New task on the left, the repository and its branch on the right. */
.composer { position: relative; }
.composer-top { position: absolute; top: 16px; left: 24px; right: 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.composer-crumbs ol { display: flex; align-items: center; gap: 8px; margin: 0; padding: 0; list-style: none; }
.composer-crumbs li { display: inline-flex; align-items: center; gap: 8px; min-width: 0; color: var(--muted); }
.composer-crumbs a { color: var(--text-2); font-size: var(--fs-lg); line-height: var(--lh-lg); text-decoration: none; }
.composer-crumbs a:hover { color: var(--text); text-decoration: none; }
.composer-crumbs .composer-title { margin: 0; color: var(--text); font-size: var(--fs-lg); line-height: var(--lh-lg); font-weight: 500; }
.composer-repo-bar { display: flex; align-items: center; gap: 12px; min-width: 0; }
.composer-repo-link { display: inline-flex; align-items: center; gap: 8px; min-width: 0; color: var(--text-2); font-size: var(--fs-lg); line-height: var(--lh-lg); text-decoration: none; }
.composer-repo-link:hover { color: var(--text); text-decoration: none; }
.composer-repo-link .icon, .composer-branch .icon { flex: none; }
.composer-repo-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer-branch { display: inline-flex; flex: none; align-items: center; gap: 6px; height: var(--control-lg); padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); color: var(--text-2); font-family: var(--font-mono); font-size: var(--fs-md); line-height: var(--lh-md); }
@media (max-width: 767px) { .composer-top { position: static; align-self: stretch; flex-wrap: wrap; margin-bottom: 16px; } }
/* Onboarding comes first (SPEC-096): only its message and button, centred in the page. */
/* Symmetric, clear of the top bar (16px from the top, one large control high). */
.composer.gated { padding: calc(var(--control-lg) + 32px) 16px; }
.onboarding-gate { width: min(560px, 100%); margin-block: auto; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.onboarding-gate-title { margin: 0; color: var(--text); font-family: var(--font-display); font-size: var(--fs-xl); line-height: var(--lh-xl); font-weight: 500; text-wrap: balance; }
.onboarding-gate p { margin: 0; color: var(--text-2); }
.onboarding-gate-steps { display: flex; flex-direction: column; gap: 6px; margin: 0; padding-left: 20px; color: var(--text-2); text-align: left; }
.onboarding-gate .btn { margin-top: 8px; }
.onboarding-gate-loading { align-self: stretch; margin-top: 8px; }
@media (max-width: 767px) { .composer.gated { padding: 16px; } }
/* The prompt box (UI-021): a rounded chat box with the task's choices along its bottom edge. */
.composer-box {
  display: flex; flex-direction: column; border: 1px solid var(--border-control); border-radius: var(--radius-xl);
  background: var(--surface); box-shadow: var(--shadow-raised); container: composer / inline-size;
}
.composer-box:focus-within { border-color: var(--accent-border-strong); outline: 2px solid transparent; outline-offset: 1px; }
.composer-prompt {
  min-height: 112px; max-height: 50vh; padding: 16px 20px 8px; border: 0; background: transparent; color: var(--text);
  font: inherit; font-size: var(--fs-md); line-height: var(--lh-md); resize: none; outline: none;
}
/* The prompt with its files inside the text (SPEC-124): plain text, wrapped as typed. */
.prompt-input { overflow-x: hidden; overflow-y: auto; white-space: pre-wrap; overflow-wrap: anywhere; cursor: text; }
.prompt-input.pi-empty::before { content: attr(data-placeholder); float: left; height: 0; color: var(--text-faint); pointer-events: none; }
.prompt-input[aria-disabled="true"] { cursor: not-allowed; }
/* The tray (SPEC-150): every uploaded file above the text; a thumbnail opens large, × removes it,
   + puts a file not in the text yet at the caret, and a tile drags into the text. */
.composer-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 12px 16px 0; list-style: none; }
.composer-box.previewing .composer-attachments { display: none; }
.composer-attachment {
  position: relative; display: flex; align-items: center; justify-content: center; width: 72px; height: 72px;
  border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface-2, var(--surface)); color: var(--text-2); overflow: hidden;
}
.composer-attachment[draggable="true"] { cursor: grab; }
.composer-attachment.unplaced { border-style: dashed; }
.composer-attachment-open {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; padding: 0; border: 0;
  background: transparent; color: inherit; cursor: pointer;
}
button.composer-attachment-open:has(img) { cursor: zoom-in; }
span.composer-attachment-open { cursor: default; }
.composer-attachment-open:focus-visible { outline: 2px solid var(--accent-border-strong); outline-offset: -2px; }
.composer-attachment img { width: 100%; height: 100%; object-fit: cover; }
.composer-attachment-name { position: absolute; inset: auto 0 0; padding: 0 4px; overflow: hidden; background: var(--surface-2); color: var(--text); font-size: var(--fs-xs); text-overflow: ellipsis; white-space: nowrap; }
.composer-attachment-number {
  position: absolute; top: 2px; left: 2px; min-width: 18px; padding: 0 4px; border-radius: var(--radius); background: var(--surface);
  color: var(--text); font-size: var(--fs-xs); font-weight: 600; line-height: var(--lh-sm); text-align: center;
}
.composer-attachment .btn-icon { position: absolute; width: var(--control-sm); height: var(--control-sm); min-width: 0; padding: 0; background: var(--surface); }
.composer-attachment-remove { top: 2px; right: 2px; }
.composer-attachment-place { right: 2px; bottom: 18px; }
/* A file in the text: one character, a placeholder one line high, never wider than the box. */
.pi-atom {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%; margin: 0 2px; vertical-align: bottom;
  border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface-2, var(--surface));
  color: var(--text-2); white-space: nowrap; cursor: grab; user-select: all;
}
.pi-atom:hover { border-color: var(--accent-border-strong); }
.pi-file, .pi-image, .pi-pending { height: 1.6em; padding: 0 6px; font-size: var(--fs-sm); line-height: var(--lh-sm); }
.pi-image { color: var(--text); }
.pi-file-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.pi-pending { border-style: dashed; cursor: progress; }
.pi-spinner { flex: none; width: 10px; height: 10px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin var(--duration-spin) linear infinite; }
.pi-dragging { opacity: 0.4; }
/* A file in the selection is chosen as a whole (#535): its label is never painted as selected text,
   the placeholder takes the selection's colour instead. */
.pi-atom::selection, .pi-atom ::selection { background: transparent; }
.pi-atom.pi-selected { border-color: var(--accent); background: var(--selection); color: var(--text); }
@media (forced-colors: active) {
  .pi-atom.pi-selected { outline: 2px solid Highlight; }
}
.pi-preview-image { display: block; max-width: 100%; max-height: 160px; border-radius: var(--radius); }
.pi-preview-file { display: inline-flex; max-width: min(240px, 100%); margin: 2px; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; vertical-align: middle; cursor: zoom-in; }
.pi-preview-after { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.pi-preview-file.pi-file { padding: 0 6px; border: 1px solid var(--border-strong); cursor: pointer; }
/* Files dragged over the prompt land at the caret: the overlay keeps the text in sight, and the
   upload's progress shows above the box, not over the words being typed. */
.composer-box .drop-overlay { align-items: flex-end; background: transparent; }
.composer-box .upload-status-float { top: auto; bottom: calc(100% + 8px); }
.attachment-modal .modal-body { display: flex; justify-content: safe center; overflow: auto; }
.attachment-zoom { flex: none; max-width: 100%; padding: 0; border: 0; background: transparent; cursor: zoom-in; }
.attachment-zoom:focus-visible { outline: 2px solid var(--accent-border-strong); outline-offset: 2px; }
.attachment-zoom[aria-pressed="true"] { max-width: none; margin: auto; cursor: zoom-out; }
.attachment-zoom[aria-pressed="true"] .attachment-preview { max-width: none; max-height: none; }
/* The prompt a task started with (SPEC-043): the text as written, then its attached files. */
.prompt-text { max-height: 60vh; overflow: auto; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2, var(--surface)); }
.prompt-text .md-blocks { min-height: 0; padding-bottom: 0; cursor: auto; }
.prompt-files { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.prompt-file { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--text-2); }
.prompt-file.image { flex-direction: column; align-items: stretch; width: 96px; }
.prompt-file-name { overflow: hidden; font-size: var(--fs-sm); text-overflow: ellipsis; white-space: nowrap; }
.prompt-file.image .prompt-file-name { font-size: var(--fs-xs); }
.prompt-thumb { position: relative; width: 96px; height: 72px; padding: 0; overflow: hidden; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface-2, var(--surface)); cursor: zoom-in; }
.prompt-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* An image still being read (SPEC-420): the skeleton's shimmer and a turning ring, never the
   browser's broken-image icon. */
.prompt-thumb.loading {
  display: grid; place-items: center; cursor: progress;
  background: var(--surface-3) linear-gradient(90deg, transparent, var(--overlay-active), transparent) no-repeat; background-size: 50% 100%;
  animation: shimmer var(--duration-pulse) linear infinite;
}
.prompt-thumb-spinner { width: 20px; height: 20px; border: 2px solid var(--text-2); border-right-color: transparent; border-radius: 50%; animation: spin var(--duration-spin) linear infinite; }
.prompt-file.gone { opacity: 0.8; }
/* A file inside the text (SPEC-124) sits in the line, where it was put. */
.prompt-file.inline { display: inline-flex; max-width: 100%; margin: 2px; vertical-align: middle; }
/* An image inside the text is the composer's one-line placeholder (SPEC-180), opened by a click. */
.prompt-text .prompt-atom { font: inherit; font-size: var(--fs-sm); cursor: pointer; user-select: none; }
.prompt-text .prompt-atom .pi-spinner { width: 14px; height: 14px; }
.prompt-text .prompt-atom[aria-busy="true"] { cursor: progress; }
.prompt-text .prompt-atom:focus-visible { outline: 2px solid var(--accent-border-strong); outline-offset: 1px; }
.attachment-preview { display: block; max-width: 100%; max-height: 75vh; object-fit: contain; }
/* The box shows focus; the prompt itself draws no ring (the global :focus-visible would). */
.composer-prompt:focus-visible { box-shadow: none; }
.composer-tools { display: flex; align-items: center; gap: 4px; padding: 6px 8px 8px 12px; }
/* One row while the box has room for it: a long label truncates rather than wrapping the row. */
.composer-tools > .chip-btn { flex: 0 1 auto; min-width: 0; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 6px; height: var(--control-lg); padding: 0 12px; max-width: 240px;
  border: 1px solid var(--border-control); border-radius: var(--radius-full); background: transparent; color: var(--text-2);
  font: inherit; font-size: var(--fs-sm); cursor: pointer; white-space: nowrap;
}
.chip-btn:hover, .chip-btn:focus-visible, .chip-btn[aria-expanded="true"] { background: var(--surface-3); color: var(--text); }
.chip-btn:focus-visible { border-radius: var(--radius-full); }
.chip-btn .chip-label { overflow: hidden; text-overflow: ellipsis; }
.chip-btn .icon { flex: none; }
.chip-btn.plain { border-color: transparent; }
.chip-btn.plain.muted-chip { color: var(--muted); }
.composer-right { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.composer-send { width: var(--control-lg); height: var(--control-lg); margin-left: 4px; padding: 0; border-radius: 50%; }
.composer-send:focus-visible { border-radius: 50%; }
/* Squeezed (a narrow window or a tool panel, SPEC-119): the choices wrap from the left and
   Preview, model, effort and Start take the last row, from the left edge to Start at the right. */
@container composer (max-width: 739px) {
  .composer-tools { flex-wrap: wrap; }
  .composer-right { flex: 1 1 100%; min-width: 0; margin-left: 0; }
  .composer-right .chip-btn { flex: 0 1 auto; min-width: 0; }
  .composer-send { flex: none; margin-left: auto; }
}
.composer-hint { padding: 0 6px; }
.composer-kbd .kbd { margin-right: 4px; }
/* The keyboard way to start is for keyboards: not on touch screens. */
@media (pointer: coarse) { .composer-kbd, .composer-hint-sep { display: none; } }
/* Preview: the prompt formatted (mdeditor.js, read-only) in the text box's place. */
.composer-preview { max-height: 50vh; overflow: auto; padding: 16px 20px 8px; cursor: text; }
.composer-preview .md-editor { max-width: none; margin: 0; }
.composer-preview-toggle { width: var(--control-lg); height: var(--control-lg); border-radius: 50%; color: var(--muted); }
.composer-preview-toggle[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }
.auto-chip .icon { flex: none; }

/* ---------------------------------------------------------------- pages */

/* A page is a size container: its lists and cards adapt to the width the page has (a tool panel
   open beside it counts), not only to the window (UI-046). */
.page { flex: 1; overflow: auto; background: var(--bg); container: page / inline-size; }
/* Material: a brand's soft light and texture (tokens --light, --texture; none by default). */
.composer, .page, .auth { background-image: var(--light), var(--texture); }
.sidebar, .rail { background-image: var(--texture); }
/* Centred up to its maximum width, with equal margins: never an empty band on one side (UI-047). */
.page-inner { padding: 24px 32px 40px; max-width: 1280px; margin-inline: auto; display: flex; flex-direction: column; gap: 16px; }
.page-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 30px; }
.page-title { font-family: var(--font-display); font-size: var(--fs-xl); line-height: var(--lh-xl); font-weight: 600; margin-right: 6px; min-width: 0; overflow-wrap: anywhere; }
.page-sub { color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.page-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.toolbar .input, .toolbar .select { width: auto; min-width: 140px; height: var(--control-md); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); min-width: 0; }
/* The one card title (#147): Settings sections, the task overview, Git, the Dashboard, CI, admin. */
.card-title { display: flex; align-items: center; gap: 8px; margin: 0; min-width: 0; color: var(--text); font-size: var(--fs-md); line-height: var(--lh-md); font-weight: 600; }
.card-title > .icon { flex: none; color: var(--muted); }
.card-pad { padding: 16px 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; }
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-top: 1px solid var(--border); min-width: 0; }
.list-item:first-child { border-top: 0; }
.list-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list-title { font-weight: 500; display: flex; align-items: center; gap: 8px; min-width: 0; }
.list-sub { color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Settings page (ACC-010): sections of icon rows, admin tiles. */
.settings-section { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.settings-head { display: flex; align-items: center; gap: 8px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.settings-head .icon { color: var(--muted); }
.settings-body { display: flex; flex-direction: column; }
.settings-identity { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.settings-avatar { width: 40px; height: 40px; font-size: var(--fs); line-height: var(--lh); }
.settings-name { font-size: var(--fs-lg); line-height: var(--lh-lg); font-weight: 600; }
.settings-row { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--border); }
.settings-identity + .settings-row, .settings-body > .settings-row:first-child { border-top: 0; }
.settings-row-icon { display: inline-flex; color: var(--muted); }
/* Connect your local agent (SPEC-247): API tokens and the commands that use them. */
.agent-connect { display: grid; gap: 12px; padding: 12px 20px 16px; min-width: 0; container-type: inline-size; }
/* Rows of labels, controls, hints and field messages (`invalid()`): each field spans them (subgrid)
   and the button takes the control row, so a long scope hint moves nothing beside it (SPEC-270). */
.agent-token-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 240px) auto; grid-template-rows: repeat(4, auto); gap: 4px 12px; }
.agent-token-form > .field { display: grid; grid-row: span 4; grid-template-rows: subgrid; }
.agent-token-submit { grid-area: 2 / 3; display: flex; }
/* Stacked once the name would be too narrow for its placeholder beside the scope and the button. */
@container (max-width: 600px) {
  .agent-token-form { display: flex; flex-direction: column; gap: 12px; }
  .agent-token-form > .field { display: flex; }
}
.agent-created-box { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); }
.agent-command .secret-value { overflow-x: auto; white-space: nowrap; }
.agent-token-list { list-style: none; margin: 0; padding: 0; display: grid; }
.agent-token { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); min-width: 0; }
.agent-token-text { min-width: 0; overflow-wrap: anywhere; }
.agent-token-label { font-weight: 500; }
.settings-row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.settings-row-control { display: flex; align-items: center; gap: 8px; }
/* The personal Telegram channel (SPEC-498): its link, code and choices span the row's text column. */
.telegram-row { grid-template-columns: 20px minmax(0, 1fr); align-items: start; }
.telegram-link { display: grid; gap: 8px; margin-top: 8px; }
.telegram-link .row { flex-wrap: wrap; }
.telegram-code { padding: 2px 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); overflow-wrap: anywhere; }
.telegram-choices { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.telegram-choice { display: flex; align-items: baseline; gap: 8px; }
.settings-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; padding: 16px 20px; }
.settings-tile { display: flex; align-items: flex-start; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-2); color: var(--text); }
.settings-tile .icon { color: var(--accent); flex: none; margin-top: 1px; }
a.settings-tile:hover { background: var(--surface-3); border-color: var(--border-strong); text-decoration: none; }
.settings-tile.disabled { cursor: not-allowed; color: var(--text-2); }
.settings-tile.disabled .icon { color: var(--muted); }
.settings-tile-title { font-weight: 600; }

/* Helpers the scripts use instead of inline styles (scripts keep only computed values inline). */
summary { cursor: pointer; }
.advanced[open] > summary { margin-bottom: 8px; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.space-top { margin-top: 8px; }
.list-plain { margin: 0; padding-left: 16px; }
.wrap-text { white-space: normal; }
.scroll-box { max-height: 320px; overflow: auto; }
.fill-column { flex: 1; min-height: 0; }
.choice { cursor: pointer; }
.choice.disabled { cursor: not-allowed; opacity: 0.55; }
.select-sm { width: auto; height: var(--control-sm); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.code-input { max-width: 220px; text-transform: uppercase; }
.overlay-message { align-items: center; max-width: 420px; text-align: center; }
/* Brand, nav and tasks scroll as one, so on a short screen the task list can take the full height. */
.sidebar-full { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.login-terminal { display: flex; flex-direction: column; flex: 1; min-height: 320px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.steplist-note { padding: 6px 0; }
.steplist-spec { padding-top: 6px; }
.env-row { display: grid; grid-template-columns: 1fr 1fr 2fr 1fr auto; gap: 6px; align-items: center; }

/* Tasks page (pages/tasks.js): toolbar, then a grouped list of two-line rows */
.tl-toolbar { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; }
.tl-tabs { display: flex; flex-wrap: wrap; gap: 2px; min-width: 0; }
.tl-tab { display: inline-flex; align-items: center; gap: 6px; height: var(--control-lg); padding: 0 12px; border: 0; border-radius: var(--radius-full); background: transparent; color: var(--text-2); font: inherit; font-size: var(--fs-md); line-height: var(--lh-md); font-weight: 500; cursor: pointer; white-space: nowrap; }
.tl-tab:hover { background: var(--surface-3); color: var(--text); }
.tl-tab.active { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.tl-tab-count { color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); font-weight: 400; font-variant-numeric: tabular-nums; }
.tl-tab.urgent .tl-tab-count { color: var(--warn-fg); font-weight: 600; }
.tl-tab-icon { display: inline-flex; color: var(--muted); }
.tl-tab.urgent .tab-needs { color: var(--warn); }
/* The sidebar's group colours: Done is the green one, Working stays neutral. */
.tab-done { color: var(--ok); }
.tl-tab:hover .tl-tab-icon, .tl-tab.active .tl-tab-icon:not(.tab-done):not(.tab-needs) { color: var(--text-2); }
.tl-chips { display: flex; gap: 8px; }
.tl-chip { height: var(--control-lg); }
.tl-chip.active { border-color: var(--accent-border); background: var(--accent-soft); color: var(--text); }
.tl-chip-group { display: inline-flex; align-items: center; gap: 2px; }
.tl-chip-clear { width: var(--control-sm); height: var(--control-sm); }
.tl-summary { color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); font-variant-numeric: tabular-nums; }
.link-btn { padding: 0; border: 0; background: none; color: var(--accent-fg); font: inherit; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.tl { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); overflow: clip; }
.tl-group + .tl-group { border-top: 1px solid var(--border); }
.tl-group-title { margin: 0; font: inherit; position: sticky; top: 0; z-index: var(--z-sticky); }
.tl-group-head { display: flex; align-items: center; gap: 8px; width: 100%; height: var(--control-xl); padding: 0 20px; border: 0; border-bottom: 1px solid var(--border); background: var(--surface-3); color: var(--text-2); font: inherit; font-size: var(--fs-sm); line-height: var(--lh-sm); letter-spacing: 0.04em; text-transform: uppercase; font-weight: 600; cursor: pointer; text-align: left; }
.tl-group-head:hover { color: var(--text); }
.tl-group-head[aria-expanded="false"] { border-bottom: 0; }
.tl-group-count { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.group-needs .tl-group-head > .icon:nth-child(2), .group-needs .tl-group-head .tl-group-count { color: var(--warn-fg); }
.tl-rows { margin: 0; padding: 0; list-style: none; }
/* Tasks as a table: one line per task, the same columns under every group; fewer columns as the list
   narrows (container queries on .tl). */
.tl { container-type: inline-size; }
.tl-row, .tl-columns, .skeleton-tl-row {
  display: grid; align-items: center; gap: 20px; padding: 0 16px 0 0;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1.6fr) minmax(0, 1.1fr) 96px 104px 28px 48px 112px 64px;
}
.tl-row { position: relative; border-top: 1px solid var(--border); }
.tl-row:first-child { border-top: 0; }
.tl-row:hover, .tl-row:focus-within { background: var(--surface-hover); }
.tl-columns { height: var(--control-xl); border-bottom: 1px solid var(--border); color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.tl-columns > :first-child { padding-left: 20px; }
/* A column's name stays one word: "Created" is wider than its 48 px column (SPEC-449). */
.tl-columns > span { white-space: nowrap; }
.tl-columns > :nth-child(5), .tl-columns > :nth-child(7), .tl-columns > :nth-child(8) { text-align: right; }
.tl-link, .skeleton-tl-link { display: flex; align-items: center; gap: 12px; min-width: 0; height: 52px; padding: 0 0 0 16px; color: var(--text); text-decoration: none; }
.tl-link:hover { text-decoration: none; }
.tl-link::after { content: ""; position: absolute; inset: 0; }
.tl-link:focus-visible { box-shadow: none; }
.tl-row:has(.tl-link:focus-visible) { box-shadow: var(--focus-inset); outline: 2px solid transparent; outline-offset: -2px; }
.tl-mark { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 24px; }
.tl-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-md); line-height: var(--lh-md); font-weight: 500; }
/* The title cell keeps its contents inside it (UI-046): the title gives way (ellipsis) and the origin
   chip stays whole, never cut to one letter (#147). The row's stretched link (::after) belongs to the
   row, so it is not clipped. */
.tl-link { overflow: hidden; }
.group-stopped .tl-title, .group-closed .tl-title { color: var(--text-2); font-weight: 400; }
.tl-origin { flex: none; white-space: nowrap; padding: 0 6px; border: 1px solid var(--border-strong); border-radius: var(--radius-full); color: var(--text-2); font-size: var(--fs-xs); line-height: var(--lh-xs); }
.tl-cell { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.tl-row.group-needs .tl-status { color: var(--text); }
.tl-branch { font-family: var(--font-mono); }
.tl-diff { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.tl-started { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
@container (max-width: 1060px) {
  .tl-row, .tl-columns, .skeleton-tl-row { grid-template-columns: minmax(0, 2fr) minmax(0, 1.6fr) 96px 104px 28px 112px 64px; }
  .tl-branch, .tl-started, :is(.tl-columns, .skeleton-tl-row) > :is(:nth-child(3), :nth-child(7)) { display: none; }
}
@container (max-width: 760px) {
  .tl-row, .tl-columns, .skeleton-tl-row { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 104px 112px 64px; }
  .tl-diff, .tl-avatar, :is(.tl-columns, .skeleton-tl-row) > :is(:nth-child(4), :nth-child(6)) { display: none; }
}
/* A narrow list (a phone, or a tool panel open beside it): the title takes the line, the status in
   words goes under it, the time and the actions stay on the right; no column headers (UI-046). */
@container (max-width: 600px) {
  .tl-columns, .tl-row > .tl-branch, .tl-row > .tl-diff, .tl-row > .tl-pr, .tl-row > .tl-avatar, .tl-row > .tl-started { display: none; }
  /* Loading rows (pages/tasks.js) take the same two lines: their cells follow the columns' order. */
  .skeleton-tl-row > :is(:nth-child(3), :nth-child(4), :nth-child(5), :nth-child(6), :nth-child(7)) { display: none; }
  .tl-row, .skeleton-tl-row { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "link time actions" "status status status"; gap: 0 12px; padding-right: 8px; }
  .tl-row { contain-intrinsic-size: auto 72px; }
  .tl-link, .skeleton-tl-link { grid-area: link; height: auto; padding: 12px 0 2px 16px; }
  .tl-status, .skeleton-tl-row > :nth-child(2) { grid-area: status; padding: 0 0 12px calc(16px + 24px + 12px); }
  .tl-time, .skeleton-tl-row > :nth-child(8) { grid-area: time; }
  .tl-actions, .skeleton-tl-row > :nth-child(9) { grid-area: actions; }
  .skeleton-tl-row > :nth-child(8) { width: 64px; }
}
.tl-pr, .tl-avatar, .tl-time, .tl-actions { position: relative; z-index: var(--z-raised); }
.tl-avatar, .tl-time { pointer-events: none; }
.tl-pr { display: flex; justify-content: flex-end; }
/* One line at its fixed height: squeezed in a crowded strip, "PR #523" broke over its pill (#542). */
.tl-pr-chip { display: inline-flex; align-items: center; gap: 4px; height: var(--control-sm); padding: 0 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-full); color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); font-variant-numeric: tabular-nums; text-decoration: none; white-space: nowrap; }
.tl-pr-chip:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.tl-pr-chip.merged { border-color: var(--violet-border); color: var(--violet-fg); }
.tl-pr-chip.closed { color: var(--muted); }
.tone-ok { color: var(--ok); }
.tone-danger { color: var(--danger); }
.tone-warn { color: var(--warn); }
.tl-avatar.avatar { width: 20px; height: 20px; font-size: var(--fs-xs); }
.tl-time { color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tl-row.group-needs .tl-time { color: var(--warn-fg); }
.tl-actions { display: flex; justify-content: flex-end; gap: 4px; visibility: hidden; }
.tl-row:hover .tl-actions, .tl-row:focus-within .tl-actions, .tl-actions:has([aria-expanded="true"]) { visibility: visible; }
@media (hover: none) { .tl-actions { visibility: visible; } }
.tl-action { width: var(--control-sm); height: var(--control-sm); }
.tl-more { display: block; width: 100%; height: var(--control-lg); padding: 0 16px 0 48px; border: 0; border-top: 1px solid var(--border); background: transparent; color: var(--accent-fg); font: inherit; font-size: var(--fs-sm); text-align: left; cursor: pointer; }
.tl-more:hover { background: var(--surface-hover); }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 48px 16px; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); text-align: center; }
.empty-state p { margin: 0; max-width: 480px; }
.empty-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; margin-bottom: 4px; border-radius: 50%; background: var(--surface-3); color: var(--text-2); }
.empty-title { font-size: var(--fs-md); line-height: var(--lh-md); font-weight: 600; }
.empty-text { color: var(--muted); }
.tl-footer a { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.tl-footer a:hover { color: var(--text); }
/* "/" opens the search (UI-036): the header only says so; on touch screens it is a search button. */
.tl-find { display: inline-flex; align-items: center; gap: 8px; height: var(--control-lg); padding: 0 8px; border: 0; border-radius: var(--radius); background: transparent; color: var(--muted); font: inherit; font-size: var(--fs-sm); line-height: var(--lh-sm); cursor: pointer; }
.tl-find:hover { background: var(--surface-2); color: var(--text); }
.tl-find-text { display: inline-flex; align-items: center; gap: 4px; }
/* The Tasks page's Graph (SPEC-164): sections of open tasks; the linked ones drawn as cards over
   an SVG of arrows, in a frame that scrolls by itself so the page never scrolls sideways. */
.tl-view label { height: var(--control-lg); }
.tg { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.tg-section { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); padding: 12px 16px 16px; min-width: 0; }
.tg-head { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.tg-count { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.tg-sub { margin: 4px 0 12px; color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.tg-list { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.tg-queue-item { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tg-pos { flex: none; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--surface-3); color: var(--text-2); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.tg-item { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; height: var(--control-lg); padding: 0 8px; border-radius: var(--radius); color: var(--text); text-decoration: none; }
.tg-item:hover { background: var(--surface-2); }
.tg-item:focus-visible, .tg-node:focus-visible, .tg-frame:focus-visible { outline: none; box-shadow: var(--focus); }
.tg-mark { flex: none; display: inline-flex; }
.tg-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-item .tg-title { flex: 0 1 auto; }
.tg-words { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.tg-item .tg-words { margin-left: auto; padding-left: 12px; flex: 0 1 auto; }
.tg-frame { overflow: auto; max-height: 70vh; padding: 4px; border-radius: var(--radius); }
.tg-canvas { position: relative; }
.tg-edges { position: absolute; inset: 0; overflow: visible; pointer-events: none; }
.tg-edge { fill: none; stroke: var(--muted); stroke-width: 1.5; }
.tg-edge-rule { stroke-dasharray: 6 4; }
.tg-edge-hold { stroke-dasharray: 1.5 3.5; stroke-linecap: round; }
.tg-arrowhead { fill: var(--muted); }
.tg-node { position: absolute; box-sizing: border-box; display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface-2); color: var(--text); text-decoration: none; }
a.tg-node:hover { border-color: var(--accent); }
.tg-node-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tg-node[data-tone="attention"] { border-color: var(--warn-fg); }
.tg-supertask { border-width: 2px; }
.tg-context { opacity: 0.6; }
.tg-ghost { border-style: dashed; background: transparent; color: var(--muted); }
.tg-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 12px 0 0; color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.tg-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.tg-legend-line { overflow: visible; }
@container (max-width: 520px) {
  .tg-item { flex-wrap: wrap; height: auto; min-height: var(--control-lg); padding: 6px 8px; row-gap: 2px; }
  .tg-item .tg-words { flex-basis: 100%; margin-left: 0; padding-left: 0; }
}
.tg-section { container-type: inline-size; }
.kbd-on-accent { margin-left: 4px; border-color: transparent; background: var(--accent-strong); color: var(--accent-ink); }
@media (max-width: 767px) {
  /* The Tasks toolbar's order on phones; filter tabs elsewhere (Secrets, MCP, Sessions) stay where they are. */
  .tl-toolbar > .tl-tabs { order: 1; width: 100%; }
  .tl-find { width: var(--control-xl); height: var(--control-xl); justify-content: center; padding: 0; }
  .tl-find-text { display: none; }
  .tl-chips { order: 3; }
  .tl-summary { order: 4; width: 100%; }
  .tl-tab { height: var(--control-lg); }
  .tl-actions .tl-action:not(:last-child) { display: none; }
  .page-actions .kbd-on-accent { display: none; }
  .tl-action { width: var(--control-xl); height: var(--control-xl); }
}

/* Git page (pages/git.js): delivery at a glance */
.dl-intro { display: flex; flex-direction: column; gap: 4px; max-width: 880px; }
.dl-sentence { margin: 0; color: var(--text-2); font-size: var(--fs-md); line-height: var(--lh-md); }
.dl-how summary { width: max-content; color: var(--accent-fg); font-size: var(--fs-sm); line-height: var(--lh-sm); cursor: pointer; }
.dl-flow { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 8px 0 0; padding: 0; list-style: none; font-size: var(--fs-sm); line-height: var(--lh-sm); }
.dl-flow li { display: inline-flex; align-items: center; gap: 6px; }
.dl-strip { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dl-card { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.dl-card p { margin: 0; }
.dl-big { font-size: var(--fs-lg); line-height: var(--lh-lg); font-weight: 600; }
.dl-big .muted { font-size: var(--fs); font-weight: 400; }
.dl-env { display: flex; align-items: center; gap: 8px; min-height: var(--control-md); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.dl-env-text { flex: 1; min-width: 0; }
.dl-release { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.dl-section { display: flex; flex-direction: column; gap: 8px; }
.dl-section-title { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); font-weight: 600; }
/* A titled group on a list page (Workflows: Defaults and Custom; Skills: Included and Custom). */
.page-section-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; margin: 8px 0 0; color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); font-weight: 600; }
.page-section-title .muted { font-weight: 400; }
.page-section-note { margin: 0; color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.dl-head-link { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; font-weight: 400; }
.dl-needs, .dl-activity { margin: 0; padding: 0; list-style: none; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.dl-need { display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 16px; }
.dl-need + .dl-need, .dl-event + .dl-event { border-top: 1px solid var(--border); }
.dl-need-text { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; flex: 1; min-width: 0; }
.dl-need-why { color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.dl-task { color: var(--text); text-decoration: none; }
.dl-task.strong { font-weight: 500; }
a.dl-task:hover { text-decoration: underline; }
.dl-empty { display: flex; align-items: center; gap: 8px; margin: 0; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--muted); }
.tone-accent { color: var(--accent); }
.tone-muted { color: var(--muted); }
.dl-board { display: grid; grid-template-columns: repeat(var(--dl-cols), minmax(0, 1fr)); gap: 12px; align-items: start; }
.dl-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 12px; border-radius: var(--radius-lg); background: var(--surface-2); }
.dl-col-head { display: flex; flex-direction: column; gap: 2px; padding: 0 4px 4px; }
.dl-col-name { font-weight: 600; }
.dl-col-empty { margin: 0; padding: 8px 4px; color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.dl-card-task { display: flex; flex-direction: column; gap: 4px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
/* A card opens the task's changes: the title link covers the card; its chips and Deliver stay clickable above it. */
.dl-card-task.clickable { position: relative; }
.dl-card-task.clickable:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.dl-card-link { color: var(--text); text-decoration: none; }
.dl-card-link:hover { text-decoration: none; }
.dl-card-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.dl-card-link:focus-visible { box-shadow: none; }
.dl-card-task.clickable:has(.dl-card-link:focus-visible) { box-shadow: var(--focus); }
.dl-card-task .tl-pr-chip, .dl-card-task .dl-deliver { position: relative; z-index: var(--z-raised); }
.dl-diffstat { font-family: var(--font-mono); font-size: var(--fs-xs); line-height: var(--lh-xs); font-variant-numeric: tabular-nums; }
.dl-card-task.attention { border-color: var(--border-strong); }
.dl-card-title { display: flex; align-items: flex-start; gap: 8px; font-weight: 500; }
.dl-card-title .dl-task { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.dl-dot { flex: none; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--warn); }
.dl-card-line { display: flex; align-items: flex-start; gap: 2px; overflow-wrap: anywhere; color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); }
/* A label that wraps keeps its icon beside its first line (SPEC-449). */
.dl-card-line > .glyph { flex: none; height: var(--lh-sm); }
.dl-card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dl-deliver { margin-left: auto; }
.dl-event { display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 16px; font-size: var(--fs-sm); line-height: var(--lh-sm); }
.dl-event-time { flex: none; width: 40px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dl-event-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The board and the cards give way to the page's width, so a tool panel beside it counts (SPEC-115). */
@container page (max-width: 900px) {
  .dl-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container page (max-width: 560px) {
  .dl-strip, .dl-board { grid-template-columns: minmax(0, 1fr); }
  .dl-need, .dl-env { flex-wrap: wrap; }
  .dl-need-text, .dl-env-text { flex: 1 1 calc(100% - 32px); }
  .dl-need .btn, .dl-env .btn { flex: 1 1 0; justify-content: center; }
  .dl-release .btn { width: 100%; }
}
/* Touch-sized buttons on a phone. */
@media (max-width: 767px) {
  .dl-need .btn, .dl-env .btn, .dl-release .btn { height: var(--control-xl); }
}

/* Design system page (/design) */
.ds .ds-section { display: flex; flex-direction: column; gap: 12px; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.ds-sub { margin: 4px 0 0; color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.ds-sample { padding: 12px 16px; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); }
.ds-missing { border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); }
.ds-missing .page-inner { padding: 16px; }
.ds-head p { margin: 4px 0 0; }
.ds-group h3 { margin: 4px 0 8px; color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.ds-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.ds-swatch { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ds-chip { width: 40px; height: 40px; flex: none; border: 1px solid var(--border-strong); border-radius: var(--radius); }
.ds-swatch-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ds-swatch-text code { font-size: var(--fs-sm); line-height: var(--lh-sm); }
.ds-pass { color: var(--ok-fg); }
.ds-fail { color: var(--danger-fg); font-weight: 600; }
.ds-type { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-top: 1px solid var(--border); }
.ds-spacing { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.ds-space { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ds-space-bar { display: block; height: 24px; background: var(--accent-soft); border: 1px solid var(--accent-border); }
.ds-radius { display: flex; align-items: center; justify-content: center; width: 120px; height: 64px; border: 1px solid var(--border-control); background: var(--surface-2); }
.ds-controls { align-items: flex-end; }
.ds-elev { display: flex; flex-direction: column; gap: 4px; width: 220px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-2); }
.ds-icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.ds-icon { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; border-radius: var(--radius); color: var(--text-2); text-align: center; overflow-wrap: anywhere; }
.ds-icon:hover { background: var(--surface-3); color: var(--text); }
.ds-states { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px 16px; }
.ds-brand { gap: 24px; }
.ds-input { max-width: 260px; }
.ds-select { max-width: 200px; }

/* Item cards (dom.js itemCard): workflows, skills… — the whole card opens the item. */
.item-list { display: flex; flex-direction: column; gap: 12px; }
.item-card {
  position: relative; display: flex; align-items: center; gap: 16px; min-width: 0; padding: 16px 20px;
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface);
  transition: background var(--duration-fast) var(--ease), border-color var(--duration-fast) var(--ease);
}
.item-card.clickable:hover { background: var(--surface-2); border-color: var(--border-strong); }
.item-card:has(.item-open:focus-visible) { box-shadow: var(--focus); }
.item-card.off .item-icon { opacity: 0.5; }
.item-card.off .item-name { color: var(--text-2); }
.item-card.off .item-desc, .item-card.off .item-meta { color: var(--muted); }
.item-icon { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex: none; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-2); color: var(--accent-fg); }
.item-icon:has(.logo-on-dark) { background: var(--logo-tile-dark); border-color: var(--logo-tile-dark); }
.item-main { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.item-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
.item-name { color: var(--text); font-size: var(--fs-md); line-height: var(--lh-md); font-weight: 600; }
.item-open { padding: 0; border: 0; background: none; font: inherit; font-size: var(--fs-md); line-height: var(--lh-md); font-weight: 600; text-align: left; cursor: pointer; }
.item-open:focus-visible { box-shadow: none; }
.item-open::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.item-desc { color: var(--text-2); min-width: 0; overflow-wrap: anywhere; }
.item-meta { color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-controls { position: relative; z-index: var(--z-raised); display: flex; align-items: center; gap: 8px; flex: none; }
.item-chevron { display: inline-flex; color: var(--muted); }
.item-card.clickable:hover .item-chevron { color: var(--text-2); }
/* A narrow page (a phone, or a tool panel open beside it): the text takes the full width and the
   controls move to their own row (UX2-05, UI-046). */
@container page (max-width: 560px) {
  .item-card { flex-wrap: wrap; align-items: flex-start; }
  .item-main { flex: 1 1 calc(100% - 52px); }
  .item-controls { flex: 1 1 100%; justify-content: flex-end; padding-top: 8px; border-top: 1px solid var(--border); }
  .item-card .item-meta { white-space: normal; }
}
@media (max-width: 767px) {
  .term-banner-row { flex-wrap: wrap; padding: 8px 12px; }
  .term-banner-text { flex: 1 1 100%; }
}
.btn-quiet-danger { color: var(--muted); }
.btn-quiet-danger:hover:not(:disabled) { color: var(--danger-fg); background: var(--danger-soft); }
/* A workflow's steps as a readable sequence: ① Write spec → ② Implement → ③ Test */
.steps-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 4px; margin: 0; padding: 0; list-style: none; }
.steps-line li { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.steps-line li + li::before { content: "→"; color: var(--text-faint); margin-right: 4px; }
.step-num { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 4px; border-radius: var(--radius-full); background: var(--surface-3); color: var(--text-2); font-size: var(--fs-xs); line-height: var(--lh-xs); font-weight: 600; }

/* MCP servers: one card each, with room between logo, details and actions. */

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs); line-height: var(--lh); }
.table th { position: sticky; top: 0; text-align: left; font-weight: 500; color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); text-transform: uppercase; letter-spacing: 0.04em; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .title-cell { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-view { background: var(--term-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; max-height: 60vh; overflow: auto; font-size: var(--fs-sm); line-height: var(--lh-sm); }
.run-output { min-height: 160px; max-height: 50vh; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
/* A host wider than the card wraps inside its chip, whole (SPEC-344): a person reads it to allow it. */
.chips > .badge { max-width: 100%; height: auto; align-items: flex-start; border-radius: var(--radius-lg); white-space: normal; overflow-wrap: anywhere; line-height: var(--lh-sm); }
/* On more lines it is a rounded box (one 18 px line clamps the radius to the same pill) with the
   icon on the first line. */
.chips > .badge > .icon { margin-top: 4px; }
.kv-rows { display: flex; flex-direction: column; gap: 6px; }
.kv-row { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 6px; }

.stage-track { display: flex; gap: 4px; flex-wrap: wrap; }
.stage { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--radius-full); font-size: var(--fs-xs); line-height: var(--lh-xs); background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.stage.done { color: var(--text-2); border-color: var(--ok-border); }
.stage.current { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }

/* dashboard */
.db-harness-table th[scope="row"] { top: auto; left: 0; color: var(--text); font-size: inherit; letter-spacing: normal; text-transform: none; }
.db-harness-table tr:last-child th[scope="row"] { border-bottom: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.stat { padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; gap: 4px; }
.stat-label { color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.stat-value { font-size: var(--fs-2xl); line-height: var(--lh-2xl); font-weight: 600; color: var(--text); }
.stat-sub { color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); }
/* Dashboard (UI-040): a strip of key numbers with changes, the daily chart as the hero, the
   outcomes as one split bar, breakdowns as bar lists. Container queries keep it readable at any width. */
.db { display: flex; flex-direction: column; gap: 12px; container-type: inline-size; }
.db-range { color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); font-variant-numeric: tabular-nums; }
.db-seg label { height: var(--control-sm); font-size: var(--fs-sm); line-height: var(--lh-sm); }
/* Dividers are each cell's left and top hairline; the card clips those on its outer edges. */
.db-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); overflow: hidden; }
.db-kpi { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 16px 20px; box-shadow: -1px 0 0 var(--border), 0 -1px 0 var(--border); }
.db-kpi-label { color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-kpi-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.db-kpi-value { font-family: var(--font-display); font-size: var(--fs-2xl); line-height: var(--lh-2xl); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; white-space: nowrap; }
.db-kpi-sub { color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); }
.db-kpi-note { color: var(--text-faint); font-size: var(--fs-xs); line-height: var(--lh-xs); }
.db-delta { display: inline-flex; align-items: center; gap: 2px; height: 20px; padding: 0 6px; border-radius: var(--radius-full); background: var(--surface-3); color: var(--text-2); font-size: var(--fs-xs); line-height: var(--lh-xs); font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.db-delta-good { background: var(--ok-soft); color: var(--ok-fg); }
.db-delta-bad { background: var(--danger-soft); color: var(--danger-fg); }
.spark, .skeleton-spark { display: block; width: 100%; height: 28px; }
.spark-line { fill: none; stroke: var(--series-1); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.spark-area { fill: var(--accent-soft); }
.db-ratio { display: flex; gap: 2px; height: 6px; overflow: hidden; border-radius: var(--radius-full); }
.db-ratio-ok { background: var(--ok); }
.db-ratio-bad { background: var(--danger); }
.db-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 12px; align-items: stretch; }
.db-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.db-card { display: flex; flex-direction: column; gap: 16px; min-width: 0; padding: 16px 20px 20px; }
.db-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.db-card-titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.db-card-sub { color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.db-table-toggle[aria-pressed="true"] { background: var(--accent-soft); color: var(--text); }
.db-chart { min-height: 220px; }
.db-weekend { fill: var(--surface-2); }
.db-grid { stroke-dasharray: 2 4; }
.db-bar-col { fill: var(--series-1); }
.db-bar-col.db-partial { opacity: 0.5; }
.db-hover-band { fill: var(--accent-soft); }
.db-avg { stroke: var(--text-faint); stroke-width: 1; stroke-dasharray: 4 4; }
.db-avg-label { fill: var(--text-2); }
.db-tip { transform: translate(-50%, calc(-100% - 8px)); }
.db-tip-date { display: block; color: var(--text-2); font-size: var(--fs-xs); line-height: var(--lh-xs); }
.db-bars { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.db-bar { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 32px; padding: 0 8px; border-radius: var(--radius-sm); }
.db-bar-fill { position: absolute; inset: 0 auto 0 0; border-radius: var(--radius-sm); background: var(--accent-soft); }
.db-bar:hover .db-bar-fill { background: var(--accent-track); }
.db-bar-label, .db-bar-value { position: relative; }
.db-bar-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); line-height: var(--lh-sm); }
.db-bar-value { display: inline-flex; flex: none; gap: 8px; font-size: var(--fs-sm); line-height: var(--lh-sm); font-weight: 500; font-variant-numeric: tabular-nums; }
.db-bar-share { min-width: 32px; color: var(--muted); font-weight: 400; text-align: right; }
.db-more, .db-empty { margin: 8px 0 0; color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.db-outcomes { display: flex; flex-direction: column; gap: 16px; }
.db-split { display: flex; gap: 2px; height: 12px; overflow: hidden; border-radius: var(--radius-full); }
.db-split-part { min-width: 4px; }
.db-legend { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 40px; align-items: center; gap: 8px 12px; margin: 0; padding: 0; list-style: none; }
.db-legend li { display: contents; }
.db-side .db-legend { max-width: 560px; }
.db-dot { width: 12px; height: 12px; border-radius: var(--radius-sm); }
.db-legend-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.db-legend-value { font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; }
.db-legend-share { color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); font-variant-numeric: tabular-nums; text-align: right; }
.db-t-done { background: var(--ok); }
.db-t-stopped { background: var(--text-faint); }
.db-t-problem { background: var(--warn); }
.db-t-failed { background: var(--danger); }
.db-t-live { background: var(--accent); }
@container (max-width: 1180px) { .db-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@container (max-width: 980px) { .db-row { grid-template-columns: minmax(0, 1fr); } .db-row-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (max-width: 620px) { .db-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .db-row-3 { grid-template-columns: minmax(0, 1fr); } .db-kpi { padding: 12px 16px; } }

.chart { position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart-axis { fill: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); font-family: var(--font); }
.chart-bar { fill: var(--series-1); }
.chart-grid { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart-baseline { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart-hit { fill: transparent; cursor: default; }
/* A chart's hover tip wraps past 360 px or its plot's width, and placeTip() keeps it inside the plot (#986). */
.chart-tip { position: absolute; z-index: var(--z-float); pointer-events: none; padding: 6px 8px; border-radius: var(--radius-sm); background: var(--surface-3); border: 1px solid var(--border-strong); box-shadow: var(--shadow); font-size: var(--fs-sm); line-height: var(--lh-sm); width: max-content; max-width: min(360px, 100%); overflow-wrap: anywhere; transform: translate(-50%, -100%); }
.chart-tip strong { display: block; color: var(--text); font-size: var(--fs); line-height: var(--lh); }
.chart-tip span { color: var(--text-2); }

/* ---------------------------------------------------------------- browser panel */

.bp { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.bp-tabs { display: flex; align-items: stretch; height: var(--control-lg); overflow-x: auto; background: var(--bg); border-bottom: 1px solid var(--border); scrollbar-width: thin; flex: none; }
.bp-tab { display: inline-flex; align-items: center; gap: 6px; max-width: 200px; padding: 0 4px 0 12px; border-right: 1px solid var(--border); color: var(--text-2); cursor: pointer; font-size: var(--fs-sm); line-height: var(--lh-sm); background: transparent; border-top: 0; border-left: 0; border-bottom: 2px solid transparent; }
.bp-tab.active { background: var(--surface); color: var(--text); border-bottom-color: var(--accent); }
.bp-tab.attention { background: var(--warn-soft); color: var(--warn-fg-strong); animation: pulse var(--duration-pulse) ease-in-out infinite; }
.bp-tab.attention.active { animation: none; border-bottom-color: var(--warn); }
.bp-tab-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bp-tablist { display: flex; align-items: stretch; flex: none; }
.bp-tab:focus-visible { box-shadow: var(--focus-inset); }
.bp-tab-close { display: inline-flex; align-items: center; justify-content: center; width: var(--control-sm); height: var(--control-sm); border-radius: var(--radius); color: var(--text-2); flex: none; }
.bp-tab-close:hover { background: var(--surface-3); color: var(--text); }
.bp-bar { display: flex; align-items: center; gap: 4px; padding: 4px 6px; border-bottom: 1px solid var(--border); flex: none; }
.bp-bar .input { height: var(--control-md); font-family: var(--font-mono); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.bp-attn { margin: 6px; }
.bp-view { position: relative; flex: 1; min-height: 0; background: var(--canvas); overflow: hidden; }
/* The streamed sandbox Chrome (ADR-15): the canvas at the page's size, scaled to fit; the user's
   own pointer is the local cursor. */
.bp-surface { position: absolute; top: 0; left: 0; cursor: default; touch-action: none; }
.bp-canvas { display: block; width: 100%; height: 100%; background: var(--mirror-bg); }
/* The keyboard's focus target (IME, dead keys, phone keyboards): present, never seen. */
.bp-keys { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; resize: none; overflow: hidden; pointer-events: none; }
.bp-stream:focus-within { box-shadow: var(--focus-inset); }
.bp-shared { position: absolute; z-index: var(--z-float); right: 8px; top: 8px; display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; border-radius: var(--radius-full); background: var(--surface-2); color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); box-shadow: var(--shadow-sm); }
.bp-shared[hidden] { display: none; }
.bp-keyboard { display: none; flex: none; }
@media (pointer: coarse) { .bp-keyboard { display: inline-flex; } }
.bp-viewchip { flex: none; cursor: help; }
/* The agent's cursor (BRW-007). */
.bp-agent { position: absolute; z-index: var(--z-float); pointer-events: none; transition: left var(--duration-slow) var(--ease), top var(--duration-slow) var(--ease); }
.bp-agent[hidden] { display: none; }
.bp-agent-arrow { position: absolute; left: -2px; top: -2px; width: 0; height: 0; border-left: 9px solid var(--agent); border-top: 6px solid transparent; border-bottom: 6px solid transparent; transform: rotate(45deg); transform-origin: 0 50%; filter: drop-shadow(0 1px 2px var(--shadow-color)); }
.bp-agent-label { position: absolute; left: 12px; top: 10px; white-space: nowrap; padding: 2px 8px; border-radius: var(--radius-full); background: var(--agent); color: var(--agent-ink); font: 600 var(--fs-xs)/var(--lh-xs) var(--font); box-shadow: var(--shadow-sm); }
.bp-agent-ripple { position: absolute; left: -14px; top: -14px; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--agent); animation: bp-ripple var(--duration-ripple) ease-out forwards; }
@keyframes bp-ripple { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.bp-agent-pill { position: absolute; z-index: var(--z-float); top: 8px; left: 50%; transform: translateX(-50%); padding: 4px 12px; border-radius: var(--radius-full); background: var(--agent); color: var(--agent-ink); font: 600 var(--fs-sm)/var(--lh-sm) var(--font); pointer-events: none; box-shadow: var(--shadow-sm); }
.bp-agent-pill[hidden] { display: none; }
.bp-copied { position: absolute; z-index: var(--z-float); right: 10px; bottom: 10px; padding: 4px 12px; border-radius: var(--radius-full); background: var(--surface-2); color: var(--text); font-size: var(--fs-sm); line-height: var(--lh-sm); pointer-events: none; }
.bp-copied[hidden] { display: none; }
.bp-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); background: var(--surface); text-align: center; padding: 16px; }
.bp-overlay:has(> .skeleton) { align-items: flex-start; justify-content: flex-start; padding: 0; }
/* Shown instead of the app when it is framed (BRW-008). */
.framed-notice { max-width: 560px; margin: 0 auto; padding: 48px 24px; color: var(--text); }
.framed-notice h1 { font: 600 var(--fs-lg)/var(--lh-lg) var(--font); }
.bp-stages { position: relative; display: flex; flex-direction: column; flex: 1; min-height: 0; }
.bp-view[hidden] { display: none; }
.bp-notice { position: absolute; z-index: var(--z-float); top: 8px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; max-width: calc(100% - 16px); padding: 4px 4px 4px 12px; border-radius: var(--radius-full); background: var(--agent); color: var(--agent-ink); font: 600 var(--fs-sm)/var(--lh-sm) var(--font); box-shadow: var(--shadow-sm); }
.bp-notice[hidden] { display: none; }
.bp-agent-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--agent-ink); flex: none; }
.bp-tab.agent:not(.active) { border-bottom-color: var(--agent); }


/* ---------------------------------------------------------------- auth pages */

.auth { height: 100vh; height: 100dvh; overflow: auto; display: flex; align-items: flex-start; justify-content: center; padding: 10vh 16px 32px; background: var(--bg); }
.auth-card { width: min(460px, 100%); display: flex; flex-direction: column; gap: 12px; padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); }
.auth-logo { display: flex; align-items: center; gap: 12px; font-family: var(--font-display); font-size: var(--fs-xl); line-height: var(--lh-xl); font-weight: 400; color: var(--text); text-transform: var(--wordmark-case); letter-spacing: var(--wordmark-tracking); }
.auth-title { font-family: var(--font-display); font-size: var(--fs-xl); line-height: var(--lh-xl); }
.warning-box { display: flex; gap: 8px; padding: 12px; border-radius: var(--radius); border: 1px solid var(--danger-border); background: var(--danger-soft); color: var(--danger-fg-strong); }
.warning-box strong { color: var(--text); }
.warning-box .icon { color: var(--danger); margin-top: 2px; }
.divider { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.btn-github { height: var(--control-xl); font-weight: 600; }
/* The quiet "another GitHub account" link under the sign-in button (ACC-004). */
.auth-alt { align-self: center; }
/* GitHub refuses this address after a move (SPEC-466 MVC-012). */
.auth-moved { align-items: flex-start; }
.drawer-backdrop { display: none; }

/* ---------------------------------------------------------------- home (pages/home.js, UI-045) */

.home { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 12px; }
.home-card {
  display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 16px 20px; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface);
  transition: background var(--duration-fast) var(--ease), border-color var(--duration-fast) var(--ease);
}
.home-card:hover, .home-card:focus-within { background: var(--surface-2); border-color: var(--border-strong); }
.home-card-head { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.home-card-titles { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.home-card-name { font-size: var(--fs-lg); line-height: var(--lh-lg); font-weight: 600; overflow-wrap: anywhere; }
.home-card-name a { color: var(--text); }
.home-card-repo { display: flex; align-items: center; gap: 4px; min-width: 0; color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.home-card-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.home-counts { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 0; list-style: none; color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.home-count { display: inline-flex; align-items: center; gap: 6px; }
.home-count .icon { color: var(--muted); }
.home-count strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.home-count-attention .icon, .home-count-attention strong { color: var(--warn-fg); }
.home-count-running .icon { color: var(--ok); }
.home-activity { color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.home-activity .skeleton-line { width: 10em; max-width: 100%; height: 10px; }
.home-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }

/* ---------------------------------------------------------------- phone (< 768 px, §6.4) */

@media (max-width: 1023px) {
  :root { --sidebar-w: 200px; }
}

@media (max-width: 767px) {
  :root { --tabrow-h: 44px; }
  .app, .app.no-sandbox {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: var(--tabrow-h) minmax(0, 1fr);
    grid-template-areas: "tabs rail" "main main";
  }
  .hamburger { display: inline-flex; align-self: center; width: var(--control-xl); height: var(--control-xl); margin-left: 4px; }
  .tabrow { padding-right: 2px; gap: 2px; border-bottom: 1px solid var(--border); }
  .tabrow-right { gap: 4px; padding-right: 0; }
  .tabrow-tabs, .tab-add { display: none; }
  /* The sandbox list gives way to the tools rail when it shows in this row (it never overlaps it). */
  .tab-select { display: flex; align-self: center; flex: 1; min-width: 0; max-width: 200px; height: var(--control-xl); gap: 4px; padding: 0 4px 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .btn-status .status-text, .chip-warn .chip-text { display: none; }
  .rail { flex-direction: row; align-items: center; gap: 0; padding: 0 2px; border-left: 0; border-bottom: 1px solid var(--border); background: var(--bg); }
  .rail-btn { width: var(--control-lg); height: var(--control-lg); justify-content: center; padding: 0; }
  .rail-btn.active::before { top: auto; bottom: 2px; left: 8px; right: 8px; width: auto; height: 3px; }
  .rail-label { display: none; }
  .rail .rail-dot { position: absolute; top: 4px; right: 4px; margin: 0; box-shadow: 0 0 0 2px var(--bg); }

  .sidebar {
    position: fixed; z-index: var(--z-drawer); top: 0; bottom: 0; left: 0; width: min(300px, 86vw);
    transform: translateX(-102%); transition: transform var(--duration) var(--ease); box-shadow: var(--shadow);
  }
  body.drawer-open .sidebar { transform: none; }
  .drawer-backdrop { position: fixed; inset: 0; z-index: var(--z-drawer-scrim); background: var(--scrim); }
  body.drawer-open .drawer-backdrop { display: block; }
  /* Touch: the row's actions and the notification buttons are full-size targets. */
  .task-link { height: var(--control-xl); padding: 0 48px 0 12px; }
  .task-kebab { visibility: visible; top: 0; right: 2px; width: var(--control-xl); height: var(--control-xl); background: transparent; }
  /* One row action on a phone: Archive is in the menu (SPEC-062 QAR-004). */
  .task-quick-archive { display: none; }
  .task-group-head.group-done { height: var(--control-xl); }
  .task-group-action { height: var(--control-xl); padding: 0 12px; }
  .task-group-head.group-working { height: var(--control-xl); }
  .task-group-graph { width: var(--control-xl); padding: 0; }
  .notif-head .btn-sm { height: var(--control-xl); padding: 0 12px; }
  .nav-item { height: var(--control-xl); }

  .panel { position: fixed; z-index: var(--z-panel); inset: 0; width: auto !important; border-left: 0; }
  /* Phones keep the drawer and full-screen panels: no column splitters (UI-044). */
  .splitter { display: none; }
  .ed .ed-root { grid-template-columns: minmax(120px, max(160px, 22%)) minmax(0, 1fr); }
  .panel-head { height: 44px; }

  .quickbar { display: flex; }
  .step-progress { width: 60px; }
  /* Phones: the task title keeps the strip; state shows as its icon, the step as the bar (UX2-06). */
  .strip-state, .strip-extras, .step-count { display: none; }
  .step-current { display: none; }
  .stepstrip-toggle { min-width: 0; }
  .composer { padding-top: 16px; }
  .composer-kbd, .composer-hint-sep { display: none; }
  .page-inner { padding: 12px 12px 32px; }
  .status-pop { top: calc(var(--tabrow-h) + 2px); right: 8px; left: 8px; width: auto; }
  .modal, .modal-wide, .modal-full { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .modal-full { height: calc(100dvh - 16px); }
  .toasts { top: calc(var(--tabrow-h) + 6px); bottom: auto; right: 8px; }
  .toasts.flipped { top: auto; bottom: 8px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .table .hide-phone { display: none; }
}

/* Harness change waiting for approval (ROT-012). */

/* Built-in editor (EDT-001): explorer, tabs, Monaco. */
.ed { min-height: 0; }
/* The explorer's width: dragged (--ed-side-w, UI-044) or 22 % (at least 160 px), always leaving
   the open file 240 px. */
.ed-root { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(120px, min(var(--ed-side-w, max(160px, 22%)), calc(100% - 240px))) minmax(0, 1fr); }
.ed-side { position: relative; z-index: var(--z-raised); display: flex; flex-direction: column; min-height: 0; min-width: 0; border-right: 1px solid var(--border); background: var(--surface); }
.ed-tree-head { display: flex; align-items: center; gap: 2px; padding: 4px 4px 4px 12px; font-size: var(--fs-xs); line-height: var(--lh-xs); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom: 1px solid var(--border); }
/* The label gives way at the Explorer's narrowest (EDT-013): it shortens, the buttons never leave. */
.ed-tree-head > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-tree-head > button { flex: none; }
.ed-tree { flex: 1; min-height: 0; overflow: auto; padding: 4px 0; font-size: var(--fs); line-height: var(--lh); }
.ed-row { display: flex; align-items: center; gap: 4px; height: var(--control-sm); padding-right: 8px; white-space: nowrap; cursor: pointer; user-select: none; }
.ed-row:hover { background: var(--overlay-hover); }
.ed-row-loading { cursor: default; }
.ed-row-loading:hover { background: none; }
.ed-row-loading .skeleton { flex: 1; }
.ed-row-loading .skeleton-line { width: 8em; max-width: 100%; height: 10px; }
.ed-row.active { background: var(--accent-soft); color: var(--text); }
.ed-row:focus-visible { outline: 1px solid var(--accent); outline-offset: -1px; }
.ed-twisty { width: 12px; flex: none; color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); }
.ed-name { overflow: hidden; text-overflow: ellipsis; }
.ed-main { isolation: isolate; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--term-bg); }
.ed-tabs, .term-tabs { display: flex; overflow-x: auto; flex: none; background: var(--surface); border-bottom: 1px solid var(--border); min-height: var(--control-lg); }
.ed-tab, .term-tab { display: flex; align-items: center; gap: 6px; padding: 0 4px 0 12px; height: var(--control-lg); border-right: 1px solid var(--border); font-size: var(--fs); line-height: var(--lh); cursor: pointer; color: var(--muted); white-space: nowrap; }
.ed-tab.active, .term-tab.active { background: var(--term-bg); color: var(--text); box-shadow: inset 0 1px 0 var(--accent); }
.ed-tab:focus-visible, .term-tab:focus-visible { box-shadow: var(--focus-inset); }
.ed-tab-close, .term-tab-close { display: inline-flex; align-items: center; justify-content: center; color: inherit; width: var(--control-sm); height: var(--control-sm); border-radius: var(--radius-sm); cursor: pointer; font-size: var(--fs); line-height: 1; }
.ed-tab-close:hover, .term-tab-close:hover { background: var(--overlay-active); }
/* Sandbox terminals (UI-016): one tab per terminal; double-click or F2 renames. */
.term-tab-name { max-width: 16ch; overflow: hidden; text-overflow: ellipsis; }
.term-tab-rename { width: 14ch; height: var(--control-sm); padding: 0 6px; border: 1px solid var(--accent); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); font: inherit; }
.term-tab-ended .term-tab-name { text-decoration: line-through; }
.term-views { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--term-bg); }
.term-views > [hidden] { display: none; }
.term-slot { flex: 1; min-height: 0; display: flex; flex-direction: column; }
/* Notes (SPEC-041): a notepad per sandbox and one for the team, saved while typing. */
.notes-tabs .term-tab { padding: 0 12px; border-top: 0; border-bottom: 0; border-left: 0; background: none; font: inherit; }
.notes-tabs .term-tab.active { background: var(--term-bg); }
/* Tabs in any order (SPEC-112, SPEC-434): the dragged tab rides above, the others slide aside, it
   settles. The grip (.tab-grip) is styled with the top bar's. */
:is(.term-tabs, .ed-tabs, .bp-tablist).reordering { cursor: grabbing; user-select: none; }
:is(.term-tabs, .ed-tabs, .bp-tablist).reordering :is(.term-tab, .ed-tab, .bp-tab) { transition: transform var(--duration-fast) var(--ease); }
:is(.term-tabs, .ed-tabs, .bp-tablist) :is(.term-tab, .ed-tab, .bp-tab).dragging { position: relative; z-index: var(--z-raised); transition: none; background: var(--surface-2); box-shadow: var(--shadow); cursor: grabbing; }
:is(.term-tabs, .ed-tabs, .bp-tablist) :is(.term-tab, .ed-tab, .bp-tab).settling { position: relative; z-index: var(--z-raised); transition: transform var(--duration-fast) var(--ease); }
/* A tab with a grip: 8 px before it and 4 px to the name (its other parts keep their gap); after
   the strips' own paddings. */
:is(.term-tab, .ed-tab, .bp-tab):has(> .tab-grip) { padding-left: 8px; }
:is(.term-tab, .ed-tab, .bp-tab) > .tab-grip { margin-right: -2px; }
@media not (any-pointer: fine) {
  :is(.term-tab, .ed-tab, .bp-tab):has(> .tab-grip) { padding-left: 12px; }
}
.notes-panes { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--term-bg); }
.notes-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.notes-pane[hidden] { display: none; }
.notes-box { flex: 1; min-height: 0; display: flex; position: relative; }
/* Before the first read (SPEC-092): fields over the box instead of its placeholder. */
.notes-box > .skeleton { position: absolute; inset: 0 0 auto; pointer-events: none; }
.notes-loading .notes-text::placeholder { color: transparent; }
.notes-text { flex: 1; min-height: 0; width: 100%; resize: none; padding: 12px 16px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: var(--fs); line-height: var(--lh); }
.notes-text:focus-visible { outline: none; box-shadow: inset 2px 0 0 var(--accent); }
/* Drawn selection (SPEC-112): the text box is see-through above a layer of rounded shapes that
   glide from one selection to the next; the browser's own square highlight is not painted. */
.notes-text.drawn-selection { position: relative; }
.notes-text.drawn-selection::selection { background: transparent; }
.text-layer { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.tl-content { position: absolute; inset: 0; }
.tl-mirror { position: absolute; top: 0; left: 0; visibility: hidden; box-sizing: content-box; border: 0; white-space: pre-wrap; overflow-wrap: break-word; word-break: normal; }
.tl-group { --tl-colour: var(--accent); }
.tl-shape { position: absolute; top: 0; left: 0; border-radius: var(--radius-xs); background: color-mix(in srgb, var(--tl-colour) 35%, transparent);
  transition: transform var(--duration-fast) var(--ease), width var(--duration-fast) var(--ease), height var(--duration-fast) var(--ease), opacity var(--duration-fast) var(--ease), background-color var(--duration-fast) var(--ease); }
.tl-blurred .tl-shape { background: color-mix(in srgb, var(--tl-colour) 16%, transparent); }
.tl-shape.tl-gone { opacity: 0; }
.tl-shape.tl-still, .tl-jump .tl-shape, .tl-jump .tl-caret { transition: none; }
/* Teammates: a caret in their colour with their name on a tag above it (below it on the first
   line), their selection in their colour; they glide like one's own and fade in and out. */
.tl-peer { transition: opacity var(--duration-slow) var(--ease); }
.tl-peer.tl-leaving { opacity: 0; }
.tl-caret { position: absolute; top: 0; left: 0; width: 2px; border-radius: 0; background: var(--tl-colour);
  transition: transform var(--duration-fast) var(--ease), height var(--duration-fast) var(--ease); }
.tl-caret.tl-still { transition: none; }
.tl-name { position: absolute; left: 0; bottom: 100%; max-width: 16ch; overflow: hidden; text-overflow: ellipsis; padding: 0 4px;
  border-radius: var(--radius-xs) var(--radius-xs) var(--radius-xs) 0; background: var(--tl-colour); color: var(--peer-ink); font-size: var(--fs-xs); font-weight: 600; line-height: var(--lh-xs); white-space: nowrap; }
.tl-caret.tl-below .tl-name { bottom: auto; top: 100%; border-radius: 0 var(--radius-xs) var(--radius-xs) var(--radius-xs); }
.tl-caret.tl-off { opacity: 0; }
/* The Editor (SPEC-127): Monaco's selection boxes and teammates' decorations are see-through and
   copied into the same shapes, in a layer that scrolls with Monaco's text, behind it. */
.ed-layer { position: absolute; top: 0; left: 0; width: 0; height: 0; overflow: visible; pointer-events: none; }
.ed-host .monaco-editor .view-overlays .selected-text,
.ed-host .monaco-editor .view-overlays .ed-peer-range { background: transparent; }
/* Forced colours paint author backgrounds away: the browser's own selection comes back. */
@media (forced-colors: active) {
  .notes-text.drawn-selection::selection { background: Highlight; color: HighlightText; }
  .text-layer { display: none; }
  .ed-layer { display: none; }
  .ed-host .monaco-editor .view-overlays .selected-text { background: Highlight; }
}
.notes-text[readonly] { color: var(--text-2); }
.notes-meta { flex: none; margin: 0; padding: 4px 16px; min-height: calc(var(--lh-sm) + 8px); border-top: 1px solid var(--border); color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.notes-readonly { flex: none; margin: 0; padding: 6px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.notes-banner { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 8px 16px; border-bottom: 1px solid var(--warn-border); background: var(--warn-soft); color: var(--warn-fg-strong); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.notes-banner[hidden] { display: none; }
.notes-banner p { margin: 0; }
.notes-status { color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); white-space: nowrap; }
.notes-status[data-tone="warn"] { color: var(--warn-fg); }
.ed-stage { position: relative; flex: 1; min-height: 0; }
.ed-host { position: absolute; inset: 0; }
.ed-host[hidden] { display: none; }
.ed-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); text-align: center; padding: 16px; }
.ed-empty[hidden] { display: none; }
.ed-status { display: flex; gap: 12px; align-items: center; height: 22px; padding: 0 12px; font-size: var(--fs-sm); line-height: var(--lh-sm); border-top: 1px solid var(--border); background: var(--surface); flex: none; overflow: hidden; white-space: nowrap; }
.ed-status > span:first-child { overflow: hidden; text-overflow: ellipsis; }
.ed-status > .ed-disk-changed { color: var(--warn-fg); }
/* The choice for a file that changed on disk under unsaved text (SPEC-411 EDT-020): links in the bar. */
.ed-status > .link-btn { flex: none; }
/* Dropped files (EDT-006, UI-048): the drop overlay says where files go (or why they cannot),
   the explorer marks the folder under the pointer, and a batch shows its progress and errors —
   at the foot of the explorer, or floating over a terminal. */
/* A playground's project folder (SPEC-099): drop it or choose it; progress and errors in place. */
.playground-drop { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 24px 16px; border: 2px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--surface-2); text-align: center; }
.playground-drop.drop-over { border-color: var(--accent); background: var(--accent-soft); }
.playground-drop.busy { border-style: solid; }
.playground-drop-icon { display: inline-flex; color: var(--accent); }
.playground-drop-title { margin: 0; font-weight: 600; }
.playground-drop p { margin: 0; max-width: 56ch; }
.playground-drop-actions { justify-content: center; }
.playground-drop-status { display: flex; align-items: center; gap: 8px; width: min(420px, 100%); min-height: 20px; }
.playground-drop-status:empty { display: none; }
.home-github { padding-top: 12px; border-top: 1px solid var(--border); }
.home-github-title { margin: 0; font-size: var(--fs); font-weight: 600; }
.drop-overlay { position: absolute; inset: 0; z-index: var(--z-float); display: flex; align-items: center; justify-content: center; padding: 16px; border: 2px dashed var(--accent); border-radius: var(--radius); background: var(--accent-soft); pointer-events: none; }
.drop-overlay-label { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 8px 16px; border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--surface-2); color: var(--text); font-size: var(--fs); line-height: var(--lh); font-weight: 500; box-shadow: var(--shadow-sm); }
.drop-overlay-label > span { min-width: 0; overflow-wrap: anywhere; }
.drop-overlay-label .icon { flex: none; }
.drop-overlay-refused { border-color: var(--border-strong); background: var(--scrim); }
.drop-overlay-refused .drop-overlay-label { color: var(--text-2); }
.ed-row.ed-drop-target { background: var(--accent-soft); box-shadow: var(--focus-inset); }
.upload-status { flex: none; display: flex; flex-direction: column; gap: 6px; padding: 8px 4px 8px 12px; border-top: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.upload-status[hidden] { display: none; }
.upload-head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.upload-head > .icon { flex: none; color: var(--muted); }
.upload-text { flex: 1; min-width: 0; color: var(--text); overflow-wrap: anywhere; }
.upload-close[hidden] { display: none; }
.upload-bar { height: 4px; margin-right: 8px; border-radius: var(--radius-full); background: var(--accent-track); overflow: hidden; }
.upload-bar[hidden] { display: none; }
.upload-bar-fill { width: 0; height: 100%; border-radius: var(--radius-full); background: var(--series-1); transition: width var(--duration-fast) var(--ease); }
.upload-errors { display: flex; flex-direction: column; gap: 4px; max-height: 120px; margin: 0; padding: 0 8px 0 0; overflow: auto; list-style: none; }
.upload-errors:empty { display: none; }
.upload-error { display: flex; align-items: baseline; gap: 6px; color: var(--danger-fg); overflow-wrap: anywhere; }
.upload-error .icon { flex: none; }
/* Over a terminal: top left, clear of its input line, the connection notice (centre) and the
   attention bar and notices (right). */
.upload-status-float { position: absolute; top: 8px; left: 12px; z-index: var(--z-float); width: min(420px, calc(100% - 24px)); border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface-2); box-shadow: var(--shadow); }
.upload-conflicts { margin: 8px 0 0; padding-left: 20px; color: var(--text-2); font-family: var(--font-mono); font-size: var(--fs-sm); line-height: var(--lh-sm); overflow-wrap: anywhere; }

/* Recovery code (ACC-011). */
.recovery-code { font: 600 var(--fs-2xl)/var(--lh-2xl) var(--font-mono); letter-spacing: .18em; text-align: center; padding: 16px 8px; border: 1px dashed var(--border); border-radius: var(--radius-lg); user-select: all; }
.recovery-gap { display: inline-block; width: .6em; }
.recovery-input { font-size: var(--fs-xl); line-height: var(--lh-xl); letter-spacing: .3em; max-width: 12ch; }
.btn-link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-align: left; }
.btn-link:hover { text-decoration: underline; }
.card-warn { border-color: var(--warn); }
/* In the administration page's modal only: the setup page keeps the auth card's frame (SPEC-283). */
.modal .recovery-card { box-shadow: none; border: 0; padding: 0; max-width: none; }
.modal .recovery-card .auth-logo { display: none; }
.token-totals { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 4px; }
.kv-line { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; font-size: var(--fs-sm); line-height: var(--lh-sm); }

/* ---------------------------------------------------------------- Brand details
   The brand's shapes beyond tokens (Roma, smoke and chalk): the mark in an arched niche over the
   composer with smoke rising in it (brandfx.js), a symmetric composer, quotes set like inscriptions,
   group heads as softly rounded bands of spaced capitals. A brand-lab proposal may add its own,
   keyed on data-brand (set by the lab). */
.composer-card { align-items: stretch; }
.brand-niche {
  display: flex; align-items: center; justify-content: center; align-self: center; width: 104px; height: 136px; margin-bottom: 24px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-full) var(--radius-full) var(--radius-sm) var(--radius-sm);
  background: radial-gradient(90% 70% at 50% 28%, var(--overlay-active), transparent 72%), var(--surface); color: var(--brand-mark);
  position: relative; overflow: hidden;
  /* A second, inner arch: the niche's moulding. */
  box-shadow: inset 0 0 0 8px var(--surface), inset 0 0 0 9px var(--border), var(--shadow-sm);
}
/* The smoke (brandfx.js) fills the inner arch, behind the mark. */
.brand-niche-fx { position: absolute; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); border-radius: var(--radius-full) var(--radius-full) 0 0; }
.brand-niche .icon { position: relative; z-index: var(--z-raised); }
.composer-quote { margin-bottom: 40px; text-align: center; }
.composer-quote blockquote { color: var(--text); font-family: var(--font-display); font-weight: 400; letter-spacing: 0; }
.composer-quote figcaption { margin-top: 12px; color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); letter-spacing: 0.24em; text-transform: uppercase; }
.composer-hint { text-align: center; }
.task-group-head {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2);
  color: var(--muted); font-weight: 500; letter-spacing: 0.18em;
}
button.task-group-head:hover { color: var(--text); }


/* Sessions (SES-002, SES-003, UI-049): the list with search and filters, and a session's
   read-only transcript (messages, tool calls with their results, edits as diffs). */
.ss-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px; }
.ss-search-wrap { position: relative; display: flex; align-items: center; flex: 1 1 280px; min-width: 0; max-width: 520px; color: var(--muted); }
.ss-search-wrap .icon { position: absolute; left: 12px; pointer-events: none; }
.ss-search { padding-left: 32px; }
.ss-people { max-width: 220px; }
.ss-summary { margin-left: auto; }
.ss-list { position: relative; }
/* Busy while a search or filter loads: a thin shimmering line above the list. The rows keep
   full contrast (dimming them failed the contrast check mid-load). */
.ss-list.ss-busy::before { content: ""; position: absolute; top: -6px; left: 0; right: 0; height: 2px; border-radius: var(--radius-full);
  background: linear-gradient(90deg, transparent, var(--accent), transparent) 0 0 / 50% 100% no-repeat var(--surface-3);
  animation: shimmer var(--duration-pulse) linear infinite; }
@media (prefers-reduced-motion: reduce) { .ss-list.ss-busy::before { animation: none; } }
.ss-rows { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.ss-row-link { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); text-decoration: none; transition: background var(--duration-fast) var(--ease), border-color var(--duration-fast) var(--ease); }
.ss-row-link:hover { background: var(--surface-hover); border-color: var(--border-strong); text-decoration: none; }
.ss-row-link:focus-visible { box-shadow: var(--focus); }
.ss-row-link > .icon { flex: none; margin-top: 4px; color: var(--muted); }
.ss-kind { display: inline-flex; flex: none; align-items: center; justify-content: center; width: var(--control-md); height: var(--control-md); border-radius: var(--radius); background: var(--surface-3); color: var(--text-2); }
.ss-kind-imported { background: var(--violet-soft); color: var(--violet-fg); }
.ss-row-main { display: flex; flex: 1; flex-direction: column; gap: 4px; min-width: 0; }
.ss-row-title { font-weight: 500; overflow-wrap: anywhere; }
.ss-row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.ss-branch { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-mono); font-size: var(--fs-xs); line-height: var(--lh-xs); }
.ss-hit { display: flex; gap: 8px; color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.ss-hit-role { flex: none; color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-sm); text-transform: uppercase; letter-spacing: 0.04em; }
.ss-snippet { min-width: 0; overflow-wrap: anywhere; }
.ss-snippet mark { padding: 0 2px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--text); }
.ss-command { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--term-bg); }
.ss-command code { flex: 1; min-width: 0; color: var(--term-fg); font-family: var(--font-mono); font-size: var(--fs-sm); line-height: var(--lh-sm); overflow-wrap: anywhere; }
/* A session fills the content area edge to edge, as Claude Code's terminal fills its window
   (SPEC-086): no maximum width, no side margin; the header and what stands in for the transcript
   keep the page's padding, the transcript well spans the width and reaches the page's bottom. */
.page-inner.ss-inner { max-width: none; min-height: 100%; padding: 0; gap: 0; }
.ss-inner > .gt-head { margin: 0; padding: 24px 32px 16px; }
.ss-inner > .ss-body { flex: 1; gap: 0; }
.ss-inner > .ss-body > :not(.ss-tui) { margin: 0 32px 16px; }
.ss-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ss-notice { display: inline-flex; align-items: center; gap: 4px; margin: 0; }
.ss-body { display: flex; flex-direction: column; gap: 16px; }
/* A session printed as Claude Code's TUI printed it (SPEC-075), in its own faded palette (--session-*). */
.ss-tui { position: relative; display: flow-root; flex: 1; padding: 16px 32px 24px; border-top: 1px solid var(--session-border); border-radius: 0; background: var(--session-bg); color: var(--session-fg); font-family: var(--font-mono); font-size: var(--fs-term); line-height: var(--lh); }
.ss-tui ::selection { background: var(--term-selection); }
.ss-dim { color: var(--session-dim); }
/* Block flow, so the lines beside the corner's web (a float) make room for it. */
.ss-entries { margin: 0; padding: 0; list-style: none; }
.ss-entry + .ss-entry { margin-top: 12px; }
.ss-tui > .ss-more, .ss-tui > .ss-locked { position: relative; margin-top: 16px; }
/* The web floats in the well's corner and sticks there while the page scrolls (SPEC-101): the first
   lines wrap beside it, later ones paint over it (everything after it is positioned). It keeps its
   colours when stuck (SPEC-109). */
.ss-web { position: sticky; top: 0; float: right; width: 84px; height: 102px; margin: -16px -32px 8px 16px; pointer-events: none; } /* 3 px pixels, in the well's corner */
.ss-web-thread, .ss-web-silk { fill: var(--session-web); }
.ss-web-spider { fill: var(--session-dim); }
/* Every 8 s the spider climbs 6 pixels up its thread, one pixel a step, hangs there and drops back,
   its legs switching frames on each step (SPEC-101); the thread shortens with it, from its top. */
.ss-web-spider { animation: ss-spider-climb var(--duration-spider) steps(6, end) infinite; }
.ss-web-silk { transform-box: fill-box; transform-origin: top; animation: ss-spider-silk var(--duration-spider) steps(6, end) infinite; }
.ss-web-legs-a { animation: ss-spider-legs-a var(--duration-spider) steps(1, end) infinite; }
.ss-web-legs-b { visibility: hidden; animation: ss-spider-legs-b var(--duration-spider) steps(1, end) infinite; }
@keyframes ss-spider-climb { 0%, 50% { transform: none; } 62%, 80% { transform: translateY(-6px); } 92%, 100% { transform: none; } }
@keyframes ss-spider-silk { 0%, 50% { transform: none; } 62%, 80% { transform: scaleY(var(--ss-silk-top)); } 92%, 100% { transform: none; } }
@keyframes ss-spider-legs-a {
  0%, 54%, 58%, 62%, 84%, 88%, 92%, 100% { visibility: visible; }
  52%, 56%, 60%, 82%, 86%, 90% { visibility: hidden; }
}
@keyframes ss-spider-legs-b {
  0%, 54%, 58%, 62%, 84%, 88%, 92%, 100% { visibility: hidden; }
  52%, 56%, 60%, 82%, 86%, 90% { visibility: visible; }
}
/* Now and then a cockroach runs across the well (SPEC-101; pages/sessions.js runCockroach moves it).
   The well clips it at its sides: clip, not hidden, so the web's sticky position keeps the page's scroll. */
.ss-tui { overflow-x: clip; }
.ss-roach { position: absolute; top: 0; left: 0; width: 48px; height: 21px; pointer-events: none; fill: var(--session-roach); } /* 3 px pixels */
.ss-roach-legs-a { animation: ss-roach-legs-a var(--duration-scurry) steps(1, end) infinite; }
.ss-roach-legs-b { visibility: hidden; animation: ss-roach-legs-b var(--duration-scurry) steps(1, end) infinite; }
@keyframes ss-roach-legs-a { 0%, 100% { visibility: visible; } 50% { visibility: hidden; } }
@keyframes ss-roach-legs-b { 0%, 100% { visibility: hidden; } 50% { visibility: visible; } }
@media (prefers-reduced-motion: reduce) { .ss-web-spider, .ss-web-silk, .ss-web-legs, .ss-roach-legs { animation: none; } }
.ss-locked { display: flex; align-items: center; gap: 1ch; padding: 6px 1ch; border: 1px solid var(--session-border); border-radius: var(--radius); color: var(--session-dim); cursor: not-allowed; }
.ss-locked > .icon { flex: none; }
/* content-visibility clips paint at the entry's edge: what highlights it (focus, the search target,
   the prompt's background) is drawn inside, in its 1ch side padding. */
.ss-entry { position: relative; display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 2px 1ch; border-radius: var(--radius-sm); content-visibility: auto; contain-intrinsic-size: auto 48px; }
.ss-entry.ss-sidechain { margin-left: 2ch; padding-left: 2ch; border-left: 1px solid var(--session-border); border-radius: 0; }
.ss-entry.ss-target { box-shadow: inset 0 0 0 1px var(--session-dim); }
.ss-when { position: absolute; top: 2px; right: 0; padding: 2px 1ch 0 8px; }
.ss-block { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ss-line { display: flex; gap: 1ch; min-width: 0; }
.ss-line-body { flex: 1; min-width: 0; }
.ss-mark { flex: none; width: 1ch; color: var(--session-fg); user-select: none; }
.ss-mark-prompt, .ss-mark-shell, .ss-mark-dim, .ss-mark-out, .ss-mark-think, .ss-mark-call { color: var(--session-dim); }
.ss-mark-ok { color: var(--session-ok); }
.ss-mark-err { color: var(--session-err); }
.ss-prompt { padding: 2px 1ch; margin: 0 -1ch; border-radius: var(--radius-sm); background: var(--session-prompt-bg); } /* into the entry's padding */
.ss-has-when .ss-prompt { padding-right: 16ch; }
.ss-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.ss-code { margin: 0; padding: 4px 0 4px 1ch; border-left: 1px solid var(--session-border); color: var(--session-fg); font: inherit; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 480px; overflow: auto; }
.ss-text .ss-code { margin: 4px 0; }
.ss-input { margin-left: 3ch; color: var(--session-dim); }
.ss-fold > summary { display: flex; flex-direction: column; gap: 2px; margin: 0 -1ch; padding: 0 1ch; border-radius: var(--radius-sm); cursor: pointer; list-style: none; }
.ss-fold > summary::-webkit-details-marker { display: none; }
.ss-fold > summary:hover .ss-call, :is(.ss-thinking, .ss-note, .ss-wake) > summary:hover .ss-line-body { text-decoration: underline; text-decoration-color: var(--session-dim); text-underline-offset: 3px; }
.ss-fold > summary:focus-visible { outline: none; box-shadow: var(--focus-inset); }
.ss-fold > :not(summary) { margin: 4px 0 0 2ch; }
.ss-thinking > summary .ss-line-body { color: var(--session-dim); font-style: italic; }
.ss-call { min-width: 0; overflow-wrap: anywhere; }
.ss-tool-name { font-weight: 600; }
.ss-tool-flag { color: var(--session-err); }
.ss-out { margin-left: 2ch; color: var(--session-dim); }
.ss-out-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.ss-out-err, .ss-out-err .ss-mark { color: var(--session-err); }
.ss-result, .ss-note-text { max-height: 480px; overflow: auto; }
.ss-tool[open] .ss-preview-folded { display: none; }
.ss-diff { margin-left: 4ch; }
.ss-tui :is(.ss-code, .ss-result, .ss-diff-hunk, .ss-note-text):focus-visible { outline: none; box-shadow: var(--focus-inset); }
.ss-diff-hunk { margin: 0; font: inherit; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 480px; overflow: auto; }
.ss-diff-hunk > span { display: block; padding: 0 1ch; }
.ss-ctx { color: var(--session-dim); }
.ss-add { background: var(--session-add-bg); color: var(--session-fg); }
.ss-del { background: var(--session-del-bg); color: var(--session-fg); }
.ss-meta { padding-left: 2ch; white-space: pre-wrap; overflow-wrap: anywhere; }
.ss-more { display: flex; justify-content: center; }
.ss-more:empty { display: none; }
.ss-tui .ss-more { justify-content: flex-start; font-family: var(--font); }
@container page (max-width: 640px) {
  .ss-row-link { padding: 12px; }
  .ss-inner > .gt-head { padding: 12px; }
  .ss-inner > .ss-body > :not(.ss-tui) { margin: 0 12px 12px; }
  .ss-tui { padding: 12px 12px 24px; font-size: var(--fs-sm); line-height: var(--lh-sm); }
  .ss-web { width: 56px; height: 68px; margin: -12px -12px 8px 12px; } /* 2 px pixels */
  .ss-roach { width: 32px; height: 14px; } /* 2 px pixels */
  .ss-has-when .ss-prompt { padding-right: 1ch; }
  .ss-when { position: static; align-self: flex-end; padding: 0; }
  .ss-summary { margin-left: 0; }
}

/* Someone else's task, watched as its live transcript (watchview.js, SPEC-179): the session well of
   the Sessions view in the terminal's place, scrolling on its own, the newest lines at the bottom. */
/* The terminal's own colours, not a past session's faded ones (WAT-004). */
.ss-live { --session-bg: var(--term-bg); --session-fg: var(--term-fg); --session-dim: var(--ansi-bright-black); --session-ok: var(--ansi-green); --session-err: var(--ansi-red); --session-border: var(--border); --session-prompt-bg: var(--live-prompt-bg); --session-add-bg: var(--live-add-bg); --session-del-bg: var(--live-del-bg); }
/* Watching, the control card sits above the transcript, in the flow: it covers no line (WAT-005). */
.taskview-term.watching > .attention-bar { position: relative; top: auto; right: auto; order: -1; flex: none; align-self: stretch; max-width: none; margin: 8px 16px; box-shadow: none; }
/* A size container named as a page is, so the session well's narrow layout applies here too. */
.watch { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; container: page / inline-size; }
.watch-scroll { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; }
.watch-scroll:focus-visible { outline: none; box-shadow: var(--focus-inset); }
.watch .ss-tui { flex: 1 0 auto; border-top: 0; padding-inline: 16px; } /* inset as the control card above it */
@container page (max-width: 640px) { .watch .ss-tui { padding-inline: 12px; } }
.watch-earlier { position: relative; margin: 0 0 12px; font-family: var(--font); }
.watch-earlier[hidden], .watch-empty[hidden], .watch-working[hidden], .watch-jump[hidden] { display: none; }
.watch-empty { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 48px 24px; text-align: center; font-family: var(--font); }
.watch-working { position: relative; margin-top: 12px; padding: 0 1ch; }
/* Claude Code's spinner (SPEC-190): one line of a strip of 12 frames, stepped through. */
.watch-spinner { height: 1lh; overflow: hidden; color: var(--session-fg); }
.watch-spinner-frames { display: flex; flex-direction: column; animation: working-turn var(--duration-turn) steps(12) infinite; }
.watch-spinner-frames > span { height: 1lh; text-align: center; }
@keyframes working-turn { to { transform: translateY(-100%); } }
/* The light runs through the words' own box, from just left of them to just right (WRK-002). */
.watch-working-text { display: inline-block; color: transparent; background: linear-gradient(90deg, var(--session-dim) 40%, var(--session-fg) 50%, var(--session-dim) 60%); background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; animation: working-sweep var(--duration-sweep) linear infinite; }
.watch-working-time { color: var(--session-dim); }
@keyframes working-sweep { from { background-position: 100% 0; } to { background-position: 0 0; } }
.watch-jump { position: absolute; bottom: 16px; left: 50%; z-index: var(--z-float); transform: translateX(-50%); box-shadow: var(--shadow); }
/* The whole session (SPEC-326): offered over the top of the terminal when a wheel turn reached it,
   left by the button where the prompt box was. */
.term-history-offer { position: absolute; top: max(calc(var(--term-banner-h, 0px) + 12px), calc(var(--term-overlay-bottom, 0px) + 8px)); left: 50%; z-index: var(--z-float); transform: translateX(-50%); max-width: calc(100% - 32px); box-shadow: var(--shadow); }
/* Below the connection notice too; the task view measures the attention bar and held card above
   it (--term-overlay-bottom, taskview.js). */
.term:has(> .term-conn:not([hidden])) > .term-history-offer { top: max(calc(var(--term-banner-h, 0px) + 52px), calc(var(--term-overlay-bottom, 0px) + 8px)); }
.watch.history .ss-locked { cursor: default; }
.watch.history .ss-locked > .ss-line-body { flex: 1; min-width: 0; }
.watch-back { flex: none; font-family: var(--font); }
@media (prefers-reduced-motion: reduce) {
  .watch-working-text { animation: none; color: var(--session-dim); background: none; }
  .watch-spinner-frames { animation: none; transform: translateY(calc(-100% * 4 / 12)); } /* ✻ */
}

/* instance updates (updates.js, pages/instance.js; SPEC-002 ADR-18) and the Jev key (jevkey.js) */
.update-banner { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: min(460px, 36vw); height: var(--control-md); padding: 0 6px 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-full); background: var(--surface-2); color: var(--text); font-size: var(--fs-xs); line-height: var(--lh-xs); }
.update-banner[hidden] { display: none; }
.update-banner.update-info { border-color: var(--accent-border); }
.update-banner.update-info > .icon { color: var(--accent-fg); }
.update-banner.update-warn { border-color: var(--warn-border); }
.update-banner.update-warn > .icon { color: var(--warn); }
.update-banner .icon { flex: none; }
.update-banner.disk-critical { border-color: var(--danger-border); }
.update-banner.disk-critical > .icon { color: var(--danger); }
.update-text { display: block; min-width: 0; padding: 4px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; text-decoration: none; }
a.update-text:hover { text-decoration: underline; text-underline-offset: 2px; }
.update-close, .update-action { flex: none; display: inline-flex; align-items: center; justify-content: center; height: var(--control-sm); padding: 0 6px; border: 0; border-radius: var(--radius-full); background: transparent; color: var(--muted); cursor: pointer; font: inherit; }
.update-close:hover, .update-action:hover { background: var(--surface-3); color: var(--text); }
.update-action { color: var(--accent-fg); font-weight: 600; }
.update-banner .spinner, .update-step-mark .spinner, .jev-test .spinner { display: inline-block; width: 12px; height: 12px; flex: none; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin var(--duration-spin) linear infinite; }
.update-banner .spinner { color: var(--accent-fg); }
.instance-body { gap: 12px; padding: 16px 20px; }
.instance-version { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.update-offer, .update-run { display: flex; flex-direction: column; gap: 12px; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-2); }
.update-commits { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; font-size: var(--fs-sm); line-height: var(--lh-sm); }
.update-commits li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: var(--control-sm); }
.update-commits a { display: inline-flex; align-items: center; min-height: var(--control-sm); }
.update-steps { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; list-style: none; }
.update-step { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 12px; align-items: start; }
.update-step-mark { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border-strong); color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); }
.update-step-done .update-step-mark { border-color: var(--ok); background: var(--ok-soft); color: var(--ok-fg); }
.update-step-current .update-step-mark { border-color: var(--accent); color: var(--accent-fg); }
.update-step-next .update-step-title { color: var(--text-2); }
.update-step-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.update-step-title { font-weight: 600; }
.update-progress { display: flex; align-items: center; gap: 8px; }
.update-track { position: relative; flex: 1; height: 6px; border-radius: var(--radius-full); background: var(--surface-3); overflow: hidden; }
.update-fill { height: 100%; border-radius: var(--radius-full); background: var(--accent); transition: width var(--duration-slow) ease-out; }
.update-track.indeterminate .update-fill { width: 30%; animation: update-slide var(--duration-spin-slow) ease-in-out infinite; }
@keyframes update-slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
.update-count { flex: none; font-variant-numeric: tabular-nums; }
.update-outcome { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.update-outcome-ok { border-color: var(--ok-border); }
.update-outcome-ok > .row .icon { color: var(--ok); }
.update-outcome-danger { border-color: var(--danger-border); background: var(--danger-soft); color: var(--danger-fg-strong); }
.update-log { max-height: 240px; overflow: auto; margin: 0; padding: 8px 12px; border-radius: var(--radius); background: var(--surface-3); font-size: var(--fs-xs); line-height: var(--lh-xs); white-space: pre-wrap; }
/* Sandbox Docker (SPEC-203): the verdict, the rebuild, the smoke check's lines. */
.sandbox-docker-body { gap: 12px; padding: 16px 20px; }
.sandbox-docker-detail { margin: 0; overflow-wrap: anywhere; }
.sandbox-docker-recheck .icon { color: var(--ok); vertical-align: -2px; }
.sandbox-docker-recheck ul, .sandbox-docker-own ul { margin: 4px 0 0; padding-left: 16px; }
.sandbox-docker-smoke { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.sandbox-docker-smoke-passed { border-color: var(--ok-border); }
.sandbox-docker-smoke-passed > .row .icon { color: var(--ok); }
.sandbox-docker-smoke-failed { border-color: var(--danger-border); }
.sandbox-docker-checks { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.sandbox-docker-checks li { display: grid; grid-template-columns: 16px minmax(0, 1fr); column-gap: 8px; align-items: baseline; font-size: var(--fs-sm); }
.sandbox-docker-checks li .icon { align-self: center; }
.sandbox-docker-checks li.ok .icon { color: var(--ok); }
.sandbox-docker-checks li.failed .icon { color: var(--danger); }
.sandbox-docker-checks li .mono { grid-column: 2; overflow-wrap: anywhere; }
/* Leftovers (Settings → Instance, SPEC-215). */
.leftovers-body { gap: 12px; padding: 16px 20px; }
.leftovers-disk { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.leftovers-actions { flex-wrap: wrap; }
.leftovers-kept h3 { margin: 0; }
.leftovers-kept-list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.leftovers-kept-row { flex-wrap: wrap; gap: 8px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.leftovers-kept-name { min-width: 0; overflow-wrap: anywhere; }
.leftovers-result ul { margin: 4px 0 0; padding-left: 16px; overflow-wrap: anywhere; }
.leftovers-table .leftovers-check { width: 32px; }
.leftovers-what { min-width: 0; }
.leftovers-owner { white-space: nowrap; }
.leftovers-what > div + div { margin-top: 2px; }
.leftovers-path { overflow-wrap: anywhere; color: var(--muted); }
.update-confirm-steps { display: flex; flex-direction: column; gap: 8px; margin: 0; padding-left: 20px; }
/* The instance page's Resource limits card (SPEC-459 HSL-008). */
.limits-intro { margin: 0; max-width: 72ch; }
.limits-notice { align-items: flex-start; }
.limits-notice .banner-text { display: flex; flex-direction: column; gap: 8px; }
.limits-stale { margin: 0; padding-left: 16px; }
.limits-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.limit { display: flex; flex-direction: column; gap: 6px; padding: 12px 0; border-top: 1px solid var(--border); }
.limit-head { gap: 8px; flex-wrap: wrap; }
.limit-name { font-size: var(--fs); line-height: var(--lh); }
.limit-value { font-variant-numeric: tabular-nums; font-weight: 600; }
.limit-note { margin: 0; max-width: 88ch; }
.limit-form { flex-wrap: wrap; }
.limit-input { width: 112px; }
/* The instance page's Address card (SPEC-466 MVC-011). */
.address-ok { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.address-ok .icon { flex: none; color: var(--ok); }
.address-moved { margin: 0; max-width: 88ch; }
/* The instance page's "Move to another host" card (SPEC-470). */
.move-intro, .move-arrived-head, .move-recorded { margin: 0; max-width: 88ch; }
.move-recorded { display: flex; align-items: flex-start; gap: 8px; }
.move-recorded .icon { flex: none; margin-top: 2px; color: var(--muted); }
.move-form { display: flex; flex-direction: column; gap: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.move-fields { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 12px 16px; }
.move-waiting { color: var(--text-2); }
.move-waiting .spinner, .move-frozen .spinner { display: inline-block; width: 12px; height: 12px; flex: none; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin var(--duration-spin) linear infinite; }
.move-key, .move-attention, .move-frozen { align-items: flex-start; }
.move-key .banner-text, .move-attention .banner-text, .move-frozen .banner-text { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.move-key p, .move-frozen p, .move-outcome p { margin: 0; max-width: 88ch; }
.move-key-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.move-key-line code { overflow-wrap: anywhere; user-select: all; }
.move-attention-list { display: flex; flex-direction: column; gap: 4px; margin: 0; padding-left: 20px; overflow-wrap: anywhere; }
.move-checklist > summary { cursor: pointer; color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.move-lines { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }
.move-line { display: grid; grid-template-columns: 96px minmax(0, 1fr); column-gap: 8px; align-items: baseline; font-size: var(--fs-sm); line-height: var(--lh-sm); }
.move-line-mark { display: inline-flex; align-items: center; gap: 6px; }
.move-line-mark .icon { flex: none; color: var(--muted); }
.move-line-ok .move-line-mark .icon, .move-line-changed .move-line-mark .icon { color: var(--ok); }
.move-line-manual .move-line-mark .icon { color: var(--warn-fg); }
.move-line-failed .move-line-mark .icon { color: var(--danger); }
.move-line-text { min-width: 0; overflow-wrap: anywhere; }
.move-line-detail { color: var(--text-2); }
.move-arrived { display: flex; flex-direction: column; gap: 8px; }
.move-error { overflow-wrap: anywhere; }
@media (max-width: 767px) {
  .move-fields { grid-template-columns: minmax(0, 1fr); }
  .move-line { grid-template-columns: minmax(0, 1fr); }
}
.address-missing { align-items: flex-start; }
.address-missing .banner-text { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.address-missing p { margin: 0; max-width: 80ch; }
.address-values { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.address-value dt { font-weight: 600; }
.address-value dd { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.address-value code { overflow-wrap: anywhere; }
.jev-status { display: flex; align-items: center; gap: 8px; }
.jev-status.jev-on .icon { color: var(--ok); }
.jev-form { display: flex; flex-direction: column; gap: 8px; max-width: 520px; }
/* The Claude Code card (SPEC-461): the check's line, the channel choice, tasks on an older version. */
.claude-check { margin: 0; }
.claude-check .spinner { display: inline-block; width: 12px; height: 12px; vertical-align: -2px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin var(--duration-spin) linear infinite; }
.claude-unmanaged { margin: 0; overflow-wrap: anywhere; }
.claude-notes { margin: 0; padding-left: 16px; }
.claude-channel { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--border); padding-top: 12px; }
.claude-channel .select { flex: none; width: 220px; max-width: 100%; }
.claude-channel p { margin: 0; }
.claude-behind { border-top: 1px solid var(--border); padding-top: 12px; }
.claude-behind h3, .claude-behind p { margin: 0; }
.claude-behind-list { margin: 0; padding-left: 16px; }
/* The Vidoc card's projects, each with its switch (SPEC-338 VOF-005). */
.vidoc-instance { display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--border); padding-top: 12px; max-width: 520px; }
.vidoc-instance p { margin: 0; }
.vidoc-projects { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--border); padding-top: 12px; }
.vidoc-projects h3 { margin: 0; }
.vidoc-project-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-width: 520px; }
.vidoc-project { justify-content: space-between; gap: 12px; min-height: 32px; }
.vidoc-project-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.vidoc-card p { margin: 0; max-width: 72ch; }
.vidoc-warn { color: var(--warn-fg); display: flex; gap: 6px; align-items: flex-start; }
.jev-test { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); line-height: var(--lh-sm); }
.jev-test-ok .icon { color: var(--ok); }
.jev-test-warn .icon { color: var(--warn); }
.jev-test-danger { color: var(--danger-fg); }
.auth-step { color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
@media (prefers-reduced-motion: reduce) {
  .update-track.indeterminate .update-fill { animation: none; }
}
@media (max-width: 767px) {
  .update-banner { max-width: 44vw; }
}
/* Secrets page (VLT-001..009): revealed values wrap, keep their line breaks (#592) and stay
   selectable; the activity trail is a quiet list. */
.secret-value { word-break: break-all; user-select: all; white-space: pre-wrap; }
/* A shown value (SPEC-114) sits in a box with its eye and copy buttons, always visible (SPEC-207);
   masked, it is a fixed run of dots that cannot be selected. */
.secret-box {
  display: flex; align-items: center; gap: 2px; min-width: 0;
  min-height: var(--control-md); padding: 2px 4px 2px 8px;
  border: 1px solid var(--border-control); border-radius: var(--radius); background: var(--bg);
}
.secret-box .secret-value { flex: 1; min-width: 0; }
.secret-box .btn-icon { width: var(--control-sm); height: var(--control-sm); }
.secret-masked { user-select: none; letter-spacing: 0.1em; }
/* Notes wrap in their box and scroll past 240 px, their copy at the top. */
.secret-box-notes { align-items: flex-start; }
.secret-notes { flex: 1; min-width: 0; max-height: 240px; overflow: auto; margin: 0; padding: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.section-title { margin: 16px 0 0; font-size: var(--fs-md); line-height: var(--lh-md); font-weight: 600; }
.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.stack-tight { display: flex; flex-direction: column; gap: 4px; }

/* ---- CI page (pages/ci.js) */
.ci-heading { font-weight: 600; font-size: var(--fs); line-height: var(--lh); margin: 8px 0 0; }
.ci-config { margin: 0; }
.ci-jobs, .ci-hygiene { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ci-jobs li { display: flex; gap: 12px; align-items: baseline; min-width: 0; }
.ci-job-name { flex: none; min-width: 96px; font-weight: 500; }
.ci-job-command { min-width: 0; overflow-wrap: anywhere; color: var(--text-2); }
.ci-hygiene li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; }
.ci-hygiene code { overflow-wrap: anywhere; }
.ci-hygiene-part { display: contents; }
.ci-hygiene-status { margin: 0; color: var(--text-2); }
.ci-hygiene-status:has(> span:not(:empty)) { margin-top: 6px; }
.ci-hygiene-status.ci-hygiene-problem { color: var(--danger-fg); }
.ci-state { display: inline-flex; color: var(--muted); }
.ci-passed { color: var(--ok-fg); }
.ci-failed, .ci-error { color: var(--danger-fg); }
.ci-running, .ci-skipped { color: var(--warn-fg); }
.ci-running .icon { animation: spin var(--duration-spin-slow) linear infinite; }
.ci-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.ci-tab { display: inline-flex; align-items: center; gap: 6px; height: var(--control-sm); padding: 0 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); cursor: pointer; }
.ci-tab:hover { background: var(--surface-2); }
.ci-tab.active { border-color: var(--border-strong); background: var(--surface-2); color: var(--text); }
.ci-tab:focus-visible { box-shadow: var(--focus); outline: none; }

/* ---- CD page (pages/cd.js) */
/* Two columns at most (SPEC-417): a column is never narrower than half the row, nor than 320 px. */
.cd-envs { --cd-gap: 12px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, max(320px, (100% - var(--cd-gap)) / 2)), 1fr)); gap: var(--cd-gap); }
.cd-env { min-width: 0; }
.cd-env-head { display: flex; align-items: flex-start; gap: 8px; }
.cd-env-name { flex: 1; min-width: 0; min-height: var(--control-md); }
.cd-env-head > .btn { flex: none; }
.cd-facts, .cd-rollback-facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; }
.cd-facts dt, .cd-rollback-facts dt { color: var(--muted); }
.cd-facts dd, .cd-rollback-facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.cd-secrets { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cd-secrets li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cd-steps { margin: 8px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; overflow-wrap: anywhere; }
.cd-setup { width: 100%; font-family: var(--font-mono); font-size: var(--fs-sm); }
/* Rollback (SPEC-415): the kept releases of each part, the current one marked. */
.cd-rollback { border-top: 1px solid var(--border); padding-top: 8px; }
.cd-rollback-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cd-rollback-head h3 { margin: 0; font-size: var(--fs); line-height: var(--lh); font-weight: 600; }
.cd-part-name { margin: 0; font-size: var(--fs-sm); line-height: var(--lh-sm); font-weight: 600; }
.cd-releases { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.cd-releases li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 8px; min-height: var(--control-sm); }
/* A long release id stays on one line, cut with an ellipsis; its tooltip holds all of it (SPEC-419). */
.cd-release-id { min-width: 0; display: flex; flex-direction: column; overflow-wrap: anywhere; }
.cd-release-id code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-wrap { overflow-wrap: anywhere; }
.cd-older > summary { cursor: pointer; color: var(--text-2); width: fit-content; }
.cd-older > .cd-releases { margin-top: 4px; }
/* A deploy before its run exists (SPEC-189): what the server does now, with the time so far. */
.cd-starting-row { display: flex; align-items: flex-start; gap: 12px; padding: 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); }
.cd-starting { flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 12px; overflow-wrap: anywhere; }
.cd-starting p { margin: 0; }
.cd-starting-spinner { flex: none; width: 16px; height: 16px; margin-top: 2px; border-radius: 50%; border: 2px solid var(--text-2); border-right-color: transparent; animation: spin var(--duration-spin) linear infinite; }
.cd-starting-elapsed { flex: none; font-variant-numeric: tabular-nums; }


/* Stages (SPEC-137): the waterfall of one run, task or deployment, and the Pipeline page. */
.st-waterfall { display: flex; flex-direction: column; gap: 8px; min-width: 0; container-type: inline-size; }
.st-head { display: flex; align-items: center; gap: 8px; }
.st-title { margin: 0; font-size: var(--fs); line-height: var(--lh); font-weight: 600; }
.st-plot { position: relative; }
.st-rows { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.st-row, .st-axis { display: grid; grid-template-columns: minmax(96px, 30%) minmax(0, 1fr) 100px; align-items: center; gap: 8px; }
.st-row { min-height: 26px; border-radius: var(--radius-sm); }
.st-row:hover { background: var(--surface-2); }
.st-group { margin-top: 8px; padding-bottom: 2px; color: var(--text-2); font-size: var(--fs-xs); line-height: var(--lh-xs); font-weight: 600; }
.st-name { display: flex; align-items: center; gap: 4px; min-width: 0; color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.st-name > .icon { flex: none; color: var(--muted); }
.st-fold { width: 100%; margin: 0; border: 0; border-radius: var(--radius-sm); background: none; font: inherit; text-align: left; cursor: pointer; }
.st-fold:hover .st-name-text { color: var(--text); }
.st-fold:focus-visible { box-shadow: var(--focus-inset); outline: 2px solid transparent; outline-offset: -2px; }
.st-fold-space { flex: none; width: 12px; }
.st-mark { display: inline-flex; flex: none; color: var(--muted); }
.st-mark-passed { color: var(--ok); }
.st-mark-running { color: var(--accent); }
.st-mark-failed, .st-mark-error { color: var(--danger-fg); }
.st-mark-skipped { color: var(--warn-fg); }
.st-name-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-count { flex: none; color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); white-space: nowrap; }
/* Each track carries the axis's gridlines, one every tick (SPEC-165 STR-005). */
.st-track { position: relative; align-self: stretch; min-height: 26px; background: repeating-linear-gradient(to right, var(--grid) 0 1px, transparent 1px var(--st-step, 100%)); }
.st-bar { position: absolute; top: 50%; height: 12px; min-width: 2px; transform: translateY(-50%); border-radius: var(--radius-sm); background: var(--series-1); }
.st-bar-wait { background: repeating-linear-gradient(135deg, var(--text-faint) 0 2px, transparent 2px 5px); box-shadow: inset 0 0 0 1px var(--text-faint); }
.st-bar-lead { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.st-bar-tail { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.st-bar-failed { background: var(--danger); }
.st-bar-running { background: var(--accent); opacity: 0.7; }
/* A wait still running keeps the wait's look, which the legend names "Waiting". */
.st-bar-wait.st-bar-running { background: repeating-linear-gradient(135deg, var(--text-faint) 0 2px, transparent 2px 5px); opacity: 1; }
.st-bar-skipped { background: transparent; box-shadow: inset 0 0 0 1px var(--text-faint); }
.st-bar-backfilled { opacity: 0.6; }
.st-took { display: flex; flex-direction: column; color: var(--text-2); font-size: var(--fs-xs); line-height: var(--lh-xs); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.st-took-failed { color: var(--danger-fg); }
.st-waited { color: var(--muted); }
.st-axis-ticks { position: relative; height: 16px; }
.st-tick { position: absolute; top: 0; transform: translateX(-50%); color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-xs); font-variant-numeric: tabular-nums; white-space: nowrap; }
.st-tick:first-child { transform: none; }
.st-tick-now { transform: translateX(-100%); color: var(--accent); }
.st-swatch { display: inline-block; width: 16px; height: 10px; border-radius: var(--radius-sm); background: var(--series-1); }
.st-swatch.st-bar-wait { background: repeating-linear-gradient(135deg, var(--text-faint) 0 2px, transparent 2px 5px); }
.st-swatch.st-bar-failed { background: var(--danger); }
.st-swatch.st-bar-running { background: var(--accent); opacity: 0.7; }
.st-swatch.st-bar-skipped { background: transparent; box-shadow: inset 0 0 0 1px var(--text-faint); }
.st-tip { transform: translate(-50%, calc(-100% - 8px)); }
.st-tip span { display: block; }
.st-tip .st-tip-figure { display: inline-block; max-width: 100%; }
.st-chart { min-height: 220px; }
.st-line-p50 { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.st-line-p90 { fill: none; stroke: var(--text-faint); stroke-width: 2; stroke-dasharray: 4 4; stroke-linecap: round; }
.st-dot-p50 { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
.st-dot-p90 { fill: var(--text-faint); stroke: var(--surface); stroke-width: 2; }
.st-cross { stroke: var(--axis); stroke-width: 1; }
.st-end-label { fill: var(--text-2); }
.st-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0; padding: 0; list-style: none; color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.st-legend li { display: inline-flex; align-items: center; gap: 6px; }
.st-key { display: inline-block; width: 16px; height: 0; border-top: 2px solid var(--series-1); }
.st-key-p90 { border-top: 2px dashed var(--text-faint); }
.pl-filters { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.pl-filter { display: inline-flex; align-items: center; gap: 8px; }
.pl-filter-label { color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.pl-env { display: flex; flex-direction: column; gap: 8px; }
.pl-env-title { margin: 0; color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); font-weight: 600; }
.pl-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1px var(--border); }
.pl-dissolved { margin-top: 8px; font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--text-2); }
.pl-dissolved summary { cursor: pointer; }
.pl-dissolved ul { margin: 6px 0 0; padding-left: 16px; display: grid; gap: 4px; overflow-wrap: anywhere; }
.pl-chosen td { background: var(--accent-soft); }
.pl-failed { color: var(--danger-fg); }
.run-stages { padding-bottom: 8px; border-bottom: 1px solid var(--border); }
/* A run's view in the CI/CD page (SPEC-238): "All runs" at the start, the run under it. */
.run-view { min-width: 0; }
.run-back { align-self: flex-start; }
/* Focused by script only, so the keyboard goes with the run: no ring around the whole view (the
   global :focus-visible draws it as a box-shadow), while the controls in it keep theirs (#777). */
.run-view:focus { outline: none; box-shadow: none; }
/* Focus scrolled into view lands below the sticky summary, never under it (WCAG 2.4.11). */
.page:has(.run-summary) { scroll-padding-top: 96px; }
/* On a phone its head and facts wrap onto more lines. */
@media (max-width: 600px) { .page:has(.run-summary) { scroll-padding-top: 160px; } }
/* Its summary stays at the top of the page while the stages and the log scroll under it: a card
   like the Now line, its content off its edges (SPEC-259). */
.run-summary { position: sticky; top: 0; z-index: var(--z-sticky); display: flex; flex-direction: column; gap: 4px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.run-facts { display: flex; flex-wrap: wrap; gap: 4px 16px; font-variant-numeric: tabular-nums; }
.run-facts:empty { display: none; }
.run-now { color: var(--text-2); }
/* The CI/CD page's Now summary (SPEC-238): what runs, above the tabs. */
/* One line of the same height loading, idle or with one run, so the tabs under it stay put. */
.ci-now { padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.ci-now-list { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.ci-now-row, .ci-now-idle { min-height: 24px; }
.ci-now-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; min-width: 0; font-variant-numeric: tabular-nums; }
.ci-now-idle { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.ci-now-kind { font-weight: 600; }
.ci-now-time { margin-left: auto; }
.ci-now-idle { margin: 0; }
@container (max-width: 820px) { .pl-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Narrow (a phone): the name and its figures on one line, the bar under them at full width. */
@container (max-width: 520px) {
  .st-row, .st-axis { grid-template-columns: minmax(0, 1fr) auto; row-gap: 0; }
  .st-row { padding-top: 4px; }
  .st-row > .st-took { grid-row: 1; grid-column: 2; flex-direction: row; gap: 6px; }
  .st-row > .st-track { grid-row: 2; grid-column: 1 / -1; min-height: 18px; }
  .st-axis > :first-child, .st-axis > :last-child { display: none; }
  .st-axis-ticks { grid-column: 1 / -1; }
}

/* Onboarding says what comes next (SPEC-283): the GitHub page's waiting and next steps. */
.steps-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.next-steps { margin: 0; padding: 0; list-style: none; counter-reset: next-step; display: flex; flex-direction: column; gap: 12px; }
.next-step { counter-increment: next-step; display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 8px 12px; }
.next-step::before { content: counter(next-step); grid-row: span 2; width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border-strong); color: var(--text-2); font-size: var(--fs-xs); line-height: 1; }
.next-step > .row-wrap { grid-column: 2; }
.next-step a.btn { text-decoration: none; }
/* Home's getting-started steps (SPEC-283). */
.getting-started { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; padding-bottom: 12px; }
.gs-heading { margin: 0; font-size: var(--fs); font-weight: 600; }
.gs-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.gs-step { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: start; gap: 12px; }
.gs-mark { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border-strong); color: var(--text-2); font-size: var(--fs-xs); line-height: 1; }
.gs-done .gs-mark { background: var(--accent-soft); color: var(--text); }
.gs-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.gs-text { color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.gs-done .gs-title { color: var(--text-2); }
.gs-state { font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--muted); white-space: nowrap; }
.gs-next .gs-state { color: var(--text); font-weight: 600; }
.gs-next .gs-mark { border-color: var(--text-2); color: var(--text); }

/* A playground's guest links (SPEC-410): the admin's dialog. */
.guest-new { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.guest-invite-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.guest-invite { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.guest-invite > .grow { flex: 1; min-width: 0; }

/* The end-of-day digest page (SPEC-512 DIG-005): one task per row, links big enough to tap. */
.digest-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.digest-item a { display: inline-flex; align-items: center; min-height: 24px; }
.digest-detail { overflow-wrap: anywhere; }

/* A task's handoffs (SPEC-512 HOF-004, HOF-005): floating over the terminal, never resizing it;
   a long prompt scrolls inside its card and the answer stays in view. */
.handoffs { position: absolute; bottom: 8px; right: 16px; z-index: var(--z-float); display: flex; flex-direction: column; gap: 8px; width: min(560px, calc(100% - 32px)); max-height: 60%; overflow: auto; }
.handoffs[hidden] { display: none; }
.handoffs > * { padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); font-size: var(--fs-sm); line-height: var(--lh-sm); box-shadow: var(--shadow); }
.handoff-request { display: flex; flex-direction: column; gap: 8px; border-left: 3px solid var(--warn); }
.handoff-prompt { margin: 0; max-height: 30vh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--font-mono); font-size: var(--fs-xs); }
.handoff-from { display: flex; align-items: center; gap: 6px; }

/* Actionable Needs You reason beside status and wait-episode history (SPEC-578). */
.strip-needs-reason { color: var(--warn-fg); font-weight: 500; }
.steplist-history { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.steplist-history-title { margin-bottom: 4px; font-weight: 600; }
.steplist-history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.steplist-history-item { display: flex; flex-direction: column; gap: 2px; }
.steplist-history-item.resolved { opacity: 0.78; }
.ti-wait-history { display: flex; flex-direction: column; gap: 12px; }
.ti-wait-item { display: flex; flex-direction: column; gap: 4px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.ti-wait-item:last-child { padding-bottom: 0; border-bottom: 0; }
.ti-wait-item.resolved { opacity: 0.82; }
.ti-wait-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ti-wait-link { margin-left: auto; }
