/* WorkBuddy Harness — the whole surface, one stylesheet, no build step. */

:root {
  color-scheme: light dark;

  --bg: #f6f7f9;
  --bg-panel: #ffffff;
  --bg-sunken: #eef0f4;
  --bg-hover: #e8ebf0;
  --border: #dce0e8;
  --border-strong: #c3c9d6;
  --text: #171a20;
  --text-dim: #5b6474;
  --text-faint: #8b93a3;
  --accent: #2f6df6;
  --accent-text: #ffffff;
  --accent-soft: #e6eeff;
  --danger: #c8332c;
  --danger-soft: #fdecea;
  --ok: #1c8a4c;
  --warn: #a36a00;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --radius: 10px;
  --sidebar-w: 268px;
}

/* The dark palette is defined twice on purpose: once for the system default,
   guarded so an explicit Light choice survives it, and once for an explicit
   Dark choice, which must win over a light system. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0d10;
    --bg-panel: #121317;
    --bg-sunken: #191b20;
    --bg-hover: #22242b;
    --border: #23252c;
    --border-strong: #33363f;
    --text: #e8eaef;
    --text-dim: #a3abba;
    --text-faint: #767e8d;
    --accent: #5b8dff;
    --accent-text: #0d1017;
    --accent-soft: #1e2a44;
    --danger: #ff6b61;
    --danger-soft: #3a1f1d;
    --ok: #4ad07f;
    --warn: #e0a03a;
  }
}

:root[data-theme="dark"] {
    --bg: #0c0d10;
    --bg-panel: #121317;
    --bg-sunken: #191b20;
    --bg-hover: #22242b;
    --border: #23252c;
    --border-strong: #33363f;
    --text: #e8eaef;
    --text-dim: #a3abba;
    --text-faint: #767e8d;
    --accent: #5b8dff;
    --accent-text: #0d1017;
    --accent-soft: #1e2a44;
    --danger: #ff6b61;
    --danger-soft: #3a1f1d;
    --ok: #4ad07f;
    --warn: #e0a03a;
}

* { box-sizing: border-box; }

/* A component that sets its own `display` would otherwise out-specify the
   `hidden` attribute, which is how the session view kept painting under the
   start screen. */
[hidden] { display: none !important; }

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

body {
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

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

/* ── shell ────────────────────────────────────────────────────────────── */

.app {
  display: grid;
  /* Four columns, two of which are usually zero. Written as variables rather
     than as a rule per combination: with a sidebar that collapses and two
     panes that open independently there are eight of those, and the eighth is
     always the one that gets forgotten. */
  --col-sidebar: var(--sidebar-w);
  --col-browser: 0px;
  --col-files: 0px;
  /* Keep room for chat; pane widths are preferred sizes and shrink when the
     viewport cannot fit them. They must never squeeze the conversation to zero. */
  grid-template-columns: var(--col-sidebar) minmax(min(360px, 100%), 1fr) minmax(0, var(--col-browser)) minmax(0, var(--col-files));
  /* `minmax(0, 1fr)` pins the single row to the viewport. A bare `auto` row
     would size to `.main`'s content, `height: 100%` inside it would resolve
     against that, and the page would grow instead of scrolling internally. */
  grid-template-rows: minmax(0, 1fr);
  height: 100%;
}

.app > * { min-height: 0; }

/* Each pane is pinned to its own column rather than left to auto-placement.
   A hidden pane is `display: none`, so it stops being a grid item — and the
   ones after it slide one column left into somebody else's width. With the
   browser closed that put the file pane in the browser's zero-width column,
   1px wide, with its own 400px column standing empty beside it. */
.app > .sidebar { grid-column: 1; }
.app > main { grid-column: 2; }
.app > .browser-pane { grid-column: 3; }
.app > .files-pane { grid-column: 4; }

.app.sidebar-collapsed { --col-sidebar: 0px; }

/* The browser and the files are columns of the shell, not sheets laid over it:
   opening one narrows the conversation rather than covering what you were
   reading, and all of them stay usable at once — which is the point. */
.app.browser-open { --col-browser: var(--browser-w, 560px); }
.app.files-open { --col-files: var(--files-w, 400px); }
.app.sidebar-collapsed .sidebar { display: none; }

.sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
}

.sidebar-head {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  border-radius: 7px;
  background: var(--accent);
  color: var(--accent-text);
  font: 600 11px/1 var(--sans);
  letter-spacing: 0.02em;
  flex: none;
}

.brand-name {
  font-weight: 600;
  font-size: 14px;
  min-width: 0;
  flex: 0 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-list {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 8px;
  display: grid;
  /* `minmax(0, 1fr)` is what stops a long session title from widening the
     track: without the 0 floor, the column takes its content's minimum size
     and the sidebar grows a horizontal scrollbar. */
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
  align-content: start;
}

.session-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  /* A grid item defaults to `min-width: auto`, meaning it refuses to shrink
     below its own content — so a long title made the row wider than the
     sidebar instead of being ellipsized. */
  min-width: 0;
  padding: 0 8px 0 10px;
  border-radius: 8px;
  background: transparent;
  color: inherit;
}

/* The row's own control: everything except the delete affordance. */
.session-open {
  flex: 1;
  min-width: 0;
  display: grid;
  /* Same floor as the list: an auto track sizes to the title's full length, so
     a long title would push the row wider than the sidebar. */
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

/* Revealed on hover, and whenever anything inside the row has focus, so the
   keyboard reaches it too. */
.row-x {
  flex: none;
  width: 22px; height: 22px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-faint);
  font-size: 11px;
  cursor: pointer;
  opacity: 0;
}

.session-row:hover .row-x,
.session-row:focus-within .row-x { opacity: 1; }
.row-x:hover { background: var(--danger-soft); color: var(--danger); }
.row-x:focus-visible { opacity: 1; }

.session-row.arming { background: var(--danger-soft); }
.session-row.arming .session-open { opacity: 0.6; }
.row-confirm { font-size: 11.5px; color: var(--danger); white-space: nowrap; }

.row-btn {
  flex: none;
  padding: 3px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg-panel);
  color: var(--text);
  font: 500 11.5px/1.4 var(--sans);
  cursor: pointer;
}

.row-btn.danger { border-color: var(--danger); background: var(--danger); color: var(--accent-text); }
.row-btn:hover { filter: brightness(1.1); }

.session-row:hover { background: var(--bg-hover); }
.session-row[aria-current="true"] { background: var(--accent-soft); }

.session-row-title {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13.5px;
}

.session-row-meta {
  font-size: 11px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.session-row .spinner { width: 11px; height: 11px; flex: none; }
.session-row-meta { flex: none; }

.list-empty {
  padding: 14px 10px;
  color: var(--text-faint);
  font-size: 13px;
}

.sidebar-foot {
  border-top: 1px solid var(--border);
  padding: 10px 14px;
  display: grid;
  gap: 5px;
  font-size: 11.5px;
  color: var(--text-dim);
}


.conn-line { display: flex; align-items: center; gap: 7px; }

.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--warn);
  flex: none;
}

.app[data-connection="ready"] .dot { background: var(--ok); }
.app[data-connection="lost"] .dot { background: var(--danger); }

/* ── main column ──────────────────────────────────────────────────────── */

/* Flex column, not a grid with named rows: `.strips` and `.interactions` take
   themselves out of flow with `:empty { display: none }`, and grid
   auto-placement would then shift every region up a track — handing the
   flexible row to whatever landed in it. Flex only cares which children are
   present, not how many. */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
}

/* `.main` holds two mutually exclusive screens: the start screen, and the
   session view. The flex rules that shape a session belong to the latter. */
.main > .start,
.main > .session-view { flex: 1; min-height: 0; }

.session-view {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.session-view > * { flex: none; min-height: 0; }

/* The conversation is the one region that absorbs the leftover height; its
   `min-height: 0` above is what stops a long log from pushing the composer
   off the bottom of the page. */
.session-view > .conversation { flex: 1; }

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
}

.topbar-title { flex: 1 1 160px; min-width: 0; }

.topbar-title h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-title p {
  margin: 1px 0 0;
  font-size: 11.5px;
  color: var(--text-faint);
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; max-width: 100%; }
.topbar-actions > * { max-width: 100%; }

#model-select {
  max-width: 230px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-sunken);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
}

#model-select:disabled { opacity: 0.5; }

/* ── conversation ─────────────────────────────────────────────────────── */

.conversation {
  overflow-y: auto;
  padding: 22px 18px 8px;
  display: grid;
  gap: 14px;
  align-content: start;
  justify-items: stretch;
}

.conversation > * {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
}

.empty-state {
  text-align: center;
  color: var(--text-dim);
  padding: 56px 20px;
}

.empty-state h2 { margin: 0 0 6px; font-size: 19px; color: var(--text); }
.empty-state p { margin: 0; font-size: 14px; }

.msg { display: grid; gap: 6px; }

.msg-role {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.msg-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg-user .msg-body {
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 13px;
}

.msg-assistant .msg-body { padding: 0 2px; }

.msg-notice .msg-body {
  border-left: 2px solid var(--border-strong);
  padding: 2px 0 2px 10px;
  color: var(--text-dim);
  font-size: 13.5px;
}

.msg-error .msg-body {
  background: var(--danger-soft);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 10px 13px;
  color: var(--danger);
  font-size: 13.5px;
}

.streaming .msg-body::after {
  content: "▍";
  color: var(--accent);
  animation: blink 1s steps(2, start) infinite;
}

@keyframes blink { to { visibility: hidden; } }

/* reasoning + tools share the disclosure shape */

/* No `overflow: hidden` here: paired with the flex `summary` below it makes
   Chrome collapse a closed `details` to a few pixels, clipping the summary.
   The body rounds its own bottom corners instead. */
details.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-panel);
}

details.card > summary {
  cursor: pointer;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-dim);
  list-style: none;
}

details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::before { content: "▸"; color: var(--text-faint); }
details.card[open] > summary::before { content: "▾"; }

details.card .card-body {
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 10px 12px;
  background: var(--bg-sunken);
}

.tool-name { font-family: var(--mono); color: var(--text); }
.tool-status { margin-left: auto; font-size: 11px; }
.tool-status.pending { color: var(--warn); }
.tool-status.ok { color: var(--ok); }
.tool-status.failed { color: var(--danger); }

pre.code {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 340px;
  overflow: auto;
}

pre.code + .code-label { margin-top: 10px; }

.code-label {
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 4px;
}

.todo-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.todo-list li { font-size: 13.5px; display: flex; gap: 8px; }
.todo-list li[data-status="completed"] { color: var(--text-faint); text-decoration: line-through; }
.todo-list li[data-status="in_progress"] { color: var(--accent); }

/* ── interaction dock (approvals + questions) ─────────────────────────── */

.interactions {
  display: grid;
  gap: 10px;
  padding: 0 18px 12px;
  max-height: 46vh;
  overflow-y: auto;
}

.interactions:empty { display: none; padding: 0; }

.interactions > * {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
}

.prompt-card {
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--bg-panel);
  padding: 13px 15px;
  display: grid;
  gap: 10px;
}

.prompt-card h3 { margin: 0; font-size: 13.5px; }
.prompt-card p { margin: 0; font-size: 13px; color: var(--text-dim); }
.prompt-card .row { display: flex; gap: 8px; flex-wrap: wrap; }

.prompt-card fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.prompt-card label.option {
  display: flex;
  gap: 8px;
  align-items: start;
  font-size: 13.5px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

.prompt-card label.option:hover { background: var(--bg-hover); }
.prompt-card .option-desc { display: block; font-size: 12px; color: var(--text-faint); }

.prompt-card input[type="text"] {
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-sunken);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
}

/* ── composer ─────────────────────────────────────────────────────────── */

/* ── jump to the latest ────────────────────────────────────────────────────
   A round button floating in the gap above the composer. The dock holds no
   height of its own, so nothing moves when the button comes and goes. */
.scroll-dock {
  position: relative;
  height: 0;
  overflow: visible;
  z-index: 3;
}

.scroll-bottom {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--bg-panel);
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 6px 18px rgb(0 0 0 / 0.18);
}

.scroll-bottom[hidden] { display: none; }
.scroll-bottom:hover { background: var(--bg-hover); }
.scroll-bottom:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.composer {
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
  padding: 12px 18px 16px;
}

.queue-strip {
  max-width: 820px;
  margin: 0 auto 8px;
  display: grid;
  gap: 4px;
  font-size: 12.5px;
  color: var(--text-dim);
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 9px;
}

.queue-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-item .btn { margin-left: auto; }

.composer-form {
  width: 100%;
  min-width: 0;
  max-width: 820px;
  margin: 0 auto;
  display: grid;
  /* An auto track would grow to the running hint's intrinsic width and push
     the input and Send button underneath the adjacent browser column. */
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

#composer-input {
  width: 100%;
  resize: none;
  min-height: 46px;
  max-height: 220px;
  padding: 12px 14px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font: inherit;
  line-height: 1.5;
}

#composer-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

#composer-input:disabled { opacity: 0.55; }

.composer-actions {
  display: flex;
  flex-wrap: wrap;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.composer-hint {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  font-size: 11.5px;
  color: var(--text-faint);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-hint[data-state="running"] { font-size: 13px; color: var(--text); }
.composer-hint .spinner { border: 1.5px dotted currentColor; border-right-color: transparent; }

/* ── buttons ──────────────────────────────────────────────────────────── */

.btn {
  border: 1px solid var(--border-strong);
  background: var(--bg-sunken);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 13px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.btn:hover:not(:disabled) { background: var(--bg-hover); }
.btn:disabled { opacity: 0.5; cursor: default; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) { filter: brightness(1.07); background: var(--accent); }

.btn-danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}

.btn-ghost { background: transparent; border-color: transparent; }
.btn-icon { padding: 6px 9px; font-size: 15px; line-height: 1; }
.btn-sm { padding: 3px 8px; font-size: 11.5px; }

.spinner {
  display: inline-block;
  width: 13px; height: 13px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex: none;
}

@keyframes spin { to { transform: rotate(360deg); } }

.banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-radius: var(--radius);
  padding: 9px 13px;
  font-size: 13px;
}

/* Red is for something that went wrong. It was being used for everything —
   "Saved the archive" arrived looking exactly like "that address cannot be
   opened" — and a strip that cries wolf is one nobody reads when it matters. */
.banner-error {
  background: var(--danger-soft);
  border: 1px solid var(--danger);
  color: var(--danger);
}

.banner-info {
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.banner .grow { flex: 1; min-width: 0; }

/* Quiet until reached for: the message is the thing to read, and a second
   red control beside red text is two things shouting. */
.banner-close {
  flex: none;
  padding: 0 2px;
  border: 0;
  background: none;
  color: inherit;
  opacity: 0.6;
  font: inherit;
  line-height: 1.35;
  cursor: pointer;
}

.banner-close:hover { opacity: 1; }
/* The ring takes the strip's own colour, so it is visible on both tones. */
.banner-close:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; border-radius: 4px; }


/* ── the file pane ───────────────────────────────────────────────────────────
   The rightmost column: an explorer over the workspace with a preview under
   it. Stacked rather than side by side, because the pane is a sidebar and two
   columns inside 400px leaves neither of them readable. */
.files-pane {
  position: relative;
  min-width: 0;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: repeat(5, auto) auto auto minmax(0, 1fr);
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
}

.files-pane[hidden] { display: none; }

/* Full height and wide enough to grab, but visually only a hairline. */
.files-resizer {
  position: absolute;
  inset: 0 auto 0 -4px;
  width: 9px;
  cursor: ew-resize;
  touch-action: none;
  user-select: none;
  z-index: 2;
}

.files-resizer::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 4px;
  width: 1px;
  background: transparent;
}

.files-resizer:hover::after { background: var(--accent); }

.files-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px 9px 14px;
  border-bottom: 1px solid var(--border);
}

.files-title { font-size: 12.5px; letter-spacing: 0.02em; }

/* The workspace's own name, so it is obvious which folder is on screen when
   two sessions in different projects are open. */
.files-where {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  color: var(--text-faint);
}

.files-tree {
  height: 300px;
  max-height: 40vh;
  overflow: auto;
  padding: 6px 0;
  scrollbar-gutter: stable;
}

.files-toolbar { display: flex; flex-wrap: wrap; gap: 5px; padding: 8px 10px; }
.files-selection { border-top: 1px solid var(--border); }
.files-destination { display: flex; align-items: center; gap: 6px; padding: 0 10px 6px; font-size: 11px; }
.files-destination .mono { overflow-wrap: anywhere; min-width: 0; }
.files-status { margin: 0; padding: 3px 12px 8px; font-size: 11px; color: var(--text-faint); overflow-wrap: anywhere; }
.files-pane.is-drop-target { outline: 2px solid var(--accent); outline-offset: -2px; }
.files-check { flex: none; margin: 0; accent-color: var(--accent); }
.files-toolbar .btn:disabled { opacity: 0.45; cursor: default; }
.files-operation-list { max-height: 180px; overflow: auto; padding-left: 20px; overflow-wrap: anywhere; }

.files-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 3px 12px 3px 0;
  font-size: 12.5px;
  line-height: 1.5;
  cursor: default;
  user-select: none;
}

.files-row:hover { background: var(--bg-hover); }
.files-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.files-row.is-selected {
  background: var(--accent-soft);
  color: var(--accent);
}

.files-glyph {
  flex: none;
  width: 15px;
  text-align: center;
  font-size: 11px;
  color: var(--text-faint);
}

/* The folder arrow turns rather than being swapped for another character, so
   opening one reads as the same thing moving. */
.files-glyph.is-open { transform: rotate(90deg); }
.files-folder-toggle { border: 0; background: transparent; padding: 0; cursor: pointer; }
.files-folder-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.files-row.is-selected .files-glyph { color: inherit; }

.files-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.files-row.is-folder .files-name { font-weight: 550; }

.files-size {
  flex: none;
  font-size: 11px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.files-empty {
  margin: 0;
  padding: 8px 14px;
  font-size: 12px;
  color: var(--text-faint);
}

/* The divider between the tree and the preview. */
.files-split {
  height: 7px;
  cursor: ns-resize;
  touch-action: none;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg-sunken);
}

.files-split:hover { background: var(--accent-soft); }

.files-view {
  overflow: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.files-view-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
  position: sticky;
  top: 0;
  z-index: 1;
}

.files-view-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 600;
}

.files-view-meta {
  flex: none;
  font-size: 11px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

/* ── what a preview looks like ─────────────────────────────────────────────── */

.files-text {
  margin: 0;
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre;
  overflow-x: auto;
}

/* Images and media sit on a checkered-neutral ground so a transparent PNG is
   visible as one rather than as whatever the panel happens to be. */
.files-media {
  padding: 14px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.files-media img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  background:
    linear-gradient(45deg, var(--bg-sunken) 25%, transparent 25%, transparent 75%, var(--bg-sunken) 75%) 0 0 / 16px 16px,
    linear-gradient(45deg, var(--bg-sunken) 25%, transparent 25%, transparent 75%, var(--bg-sunken) 75%) 8px 8px / 16px 16px;
}

.files-image-toolbar { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-bottom: 1px solid var(--border); }
.files-image-info { min-width: 0; font-size: 11.5px; color: var(--text-faint); overflow-wrap: anywhere; }
.files-image-stage { padding: 14px; max-height: 56vh; overflow: auto; }
.files-image-stage img {
  display: block; margin: 0 auto; width: auto; height: auto;
  max-width: 100%; max-height: 50vh; border-radius: 4px;
  background:
    linear-gradient(45deg, var(--bg-sunken) 25%, transparent 25%, transparent 75%, var(--bg-sunken) 75%) 0 0 / 16px 16px,
    linear-gradient(45deg, var(--bg-sunken) 25%, transparent 25%, transparent 75%, var(--bg-sunken) 75%) 8px 8px / 16px 16px;
}
.files-image-stage img[hidden] { display: none; }
.files-image-stage.is-actual-size img { max-width: none; max-height: none; }

.files-media audio, .files-media video { width: 100%; max-width: 100%; border-radius: 6px; }

/* PDFs and HTML get the browser's own renderer, at the full height of the
   preview half — a viewer 200px tall is not a viewer. */
.files-frame {
  flex: 1;
  min-height: 320px;
  width: 100%;
  border: 0;
  background: #fff;
}

.files-doc {
  padding: 14px 16px 24px;
  font-size: 13px;
  line-height: 1.6;
}

.files-doc h1 { font-size: 19px; margin: 18px 0 8px; }
.files-doc h2 { font-size: 16.5px; margin: 16px 0 7px; }
.files-doc h3 { font-size: 14.5px; margin: 14px 0 6px; }
.files-doc h4, .files-doc h5, .files-doc h6 { font-size: 13px; margin: 12px 0 5px; }
.files-doc p { margin: 0 0 9px; }
.files-doc ul { margin: 0 0 9px; padding-left: 22px; }
.files-doc li { margin: 0 0 3px; }

/* An empty paragraph in the original is a gap the author put there. */
.files-doc p.files-gap { height: 9px; margin: 0; }

.files-sheet { display: flex; flex-direction: column; min-height: 0; }
.files-sheet-body { min-height: 0; }

.files-tabs {
  display: flex;
  gap: 2px;
  padding: 6px 10px 0;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
}

.files-tab {
  flex: none;
  padding: 5px 10px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  background: none;
  color: var(--text-dim);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.files-tab:hover { background: var(--bg-hover); }

.files-tab.is-current {
  background: var(--bg-panel);
  border-color: var(--border);
  color: var(--text);
  font-weight: 600;
}

.files-table-scroll { overflow-x: auto; }

.files-table {
  border-collapse: collapse;
  font-size: 12px;
  /* Not `width: 100%`: a sheet is as wide as its columns need, and stretching
     six columns across the pane makes a spreadsheet look like a form. */
  width: max-content;
  max-width: none;
}

.files-table th, .files-table td {
  border: 1px solid var(--border);
  padding: 4px 8px;
  text-align: left;
  vertical-align: top;
  /* Long cells are clipped rather than allowed to set the column width; the
     whole value is in the tooltip-free `white-space: pre-wrap` of a click. */
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: pre;
}

.files-table th {
  background: var(--bg-sunken);
  font-weight: 600;
  position: sticky;
  top: 0;
}

/* The row numbers down the left, as a spreadsheet has. */
.files-rownum {
  background: var(--bg-sunken);
  color: var(--text-faint);
  text-align: right !important;
  font-variant-numeric: tabular-nums;
  position: sticky;
  left: 0;
}

.files-slides { padding: 12px; display: flex; flex-direction: column; gap: 10px; }

.files-slide {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px 12px 38px;
  background: var(--bg);
}

.files-slide h4 { margin: 0 0 6px; font-size: 13.5px; }
.files-slide p { margin: 0 0 4px; font-size: 12.5px; color: var(--text-dim); }

.files-slide-no {
  position: absolute;
  left: 12px;
  top: 12px;
  font-size: 11px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.files-archive { padding: 4px 0 12px; }

.files-archive-row {
  display: flex;
  gap: 8px;
  padding: 3px 14px;
  font-size: 12px;
  font-family: var(--mono);
}

.files-archive-row .grow {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── narrow viewports ─────────────────────────────────────────────────── */

@media (max-width: 1000px) {
  .app, .app.sidebar-collapsed { grid-template-columns: var(--col-sidebar) minmax(0, 1fr); }
  .app > .sidebar { grid-row: 1 / -1; position: sticky; top: 0; height: 100vh; }
  .app > main { grid-column: 2; grid-row: 1; }
  .app > .browser-pane { grid-column: 2; grid-row: 2; }
  .app > .files-pane { grid-column: 2; grid-row: 2; }
  /* When there is no room beside chat, previews follow it vertically.
     Minimum row heights keep each pane usable; the shell can scroll. */
  .app.browser-open, .app.files-open {
    grid-template-rows: minmax(420px, 1fr) minmax(360px, 1fr);
    overflow-y: auto;
  }
  .app.files-open:not(.browser-open) { grid-template-rows: minmax(420px, 1fr) minmax(640px, 1fr); }
  .app.browser-open.files-open { grid-template-rows: minmax(420px, 1fr) minmax(360px, 1fr) minmax(640px, 1fr); }
  .app.browser-open.files-open > .files-pane { grid-row: 3; }
  .app .browser-resizer, .app .files-resizer { display: none; }
}

@media (max-width: 720px) {
  .app, .app.sidebar-collapsed { grid-template-columns: minmax(0, 1fr); }
  .app > main, .app > .browser-pane, .app > .files-pane { grid-column: 1; }
  .app > .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(84vw, var(--sidebar-w));
    z-index: 10;
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.35);
  }
  .app.sidebar-collapsed .sidebar { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .spinner, .streaming .msg-body::after { animation: none; }
}

/* ── sidebar search ───────────────────────────────────────────────────── */

.search {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-sunken);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.search:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.list-section {
  padding: 10px 10px 4px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.session-row-snippet {
  grid-column: 1 / -1;
  font-size: 11.5px;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── strips: goal bar, jobs, subagents ────────────────────────────────── */

.strips {
  display: grid;
  gap: 8px;
  padding: 0 18px;
}

.strips:empty { display: none; }
.strips > * { width: 100%; max-width: 820px; margin: 10px auto 0; }

.strip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-panel);
  font-size: 12.5px;
}

.strip-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  flex: none;
}

.strip-body { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strip .btn { flex: none; }

.context-strip { flex-wrap: wrap; min-width: 0; }
.context-meter { flex: none; width: 72px; height: 6px; overflow: hidden; border-radius: 999px; background: var(--bg-sunken); }
.context-meter-fill { display: block; height: 100%; background: var(--text-faint); border-radius: inherit; }
.context-near-limit .context-meter-fill { background: var(--accent); }
.context-usage { flex: 1 1 160px; min-width: 0; overflow-wrap: anywhere; }
.context-threshold { margin-left: auto; text-transform: uppercase; white-space: nowrap; }
.context-notice { flex: 1 0 100%; min-width: 0; display: flex; align-items: center; gap: 7px; color: var(--text-dim); overflow-wrap: anywhere; }
.context-notice .spinner { flex: none; }
.context-failed { color: var(--danger); }
@media (prefers-reduced-motion: reduce) { .context-notice .spinner { animation: none; } }

.strip-list { display: grid; gap: 5px; }
.strip-row { display: flex; align-items: center; gap: 9px; font-size: 12.5px; }
.strip-row .mono { font-family: var(--mono); font-size: 11.5px; }

/* ── badges ───────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-dim);
  white-space: nowrap;
}

.badge-ok { border-color: var(--ok); color: var(--ok); }
.badge-warn { border-color: var(--warn); color: var(--warn); }
.badge-bad { border-color: var(--danger); color: var(--danger); }
.badge-accent { border-color: var(--accent); color: var(--accent); }

/* ── modal ────────────────────────────────────────────────────────────── */

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 10, 14, 0.55);
}

.modal-root[hidden] { display: none; }

.modal {
  display: flex;
  flex-direction: column;
  width: min(940px, 100%);
  max-height: min(760px, 100%);
  min-height: 0;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.modal-sm { width: min(520px, 100%); }

.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
  flex: none;
}

.modal-head h2 { margin: 0; font-size: 15px; font-weight: 600; flex: 1; }

.modal-tabs {
  display: flex;
  gap: 2px;
  padding: 8px 12px 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
  overflow-x: auto;
  flex: none;
}

.modal-tab {
  padding: 7px 13px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.modal-tab:hover { color: var(--text); }
.modal-tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* Flex column with `flex: none` children, not a grid: this box has a definite
   height (it is the modal's scroll area), and auto grid rows holding
   `overflow: hidden` panels get compressed below their content instead of
   overflowing — which silently clips a long settings card in half. */
.modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-body > * { flex: none; }

.modal-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
  flex: none;
}

.modal-foot .spacer { flex: 1; }

.modal-note {
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.5;
}

.modal-note code {
  font-family: var(--mono);
  font-size: 11.5px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 4px;
}

/* ── cards + rows inside the modal ────────────────────────────────────── */

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-panel);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 13px;
  border-bottom: 1px solid var(--border);
}

.panel-head h3 { margin: 0; font-size: 13.5px; font-weight: 600; flex: 1; min-width: 0; }
.panel-head .mono { font-family: var(--mono); font-size: 11.5px; color: var(--text-faint); }
.panel-body { padding: 12px 13px; display: grid; gap: 11px; }
.panel-body.tight { padding: 0; }

.row-list { display: grid; }

.row-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.row-item:last-child { border-bottom: 0; }
.row-item .grow { flex: 1; min-width: 0; }
.row-item .mono { font-family: var(--mono); font-size: 11.5px; color: var(--text-faint); overflow-wrap: anywhere; }
.row-item .sub { font-size: 11.5px; color: var(--text-faint); }
.row-title { font-weight: 500; overflow-wrap: anywhere; }

.empty-note {
  padding: 18px 13px;
  color: var(--text-faint);
  font-size: 13px;
  text-align: center;
}

/* ── forms ────────────────────────────────────────────────────────────── */

.field { display: grid; gap: 4px; }

.field > label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 7px;
}

.field .hint { font-size: 11.5px; color: var(--text-faint); font-weight: 400; }

.field input[type="text"],
.field input[type="password"],
.field input[type="number"],
.field select,
.field textarea {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-sunken);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.field textarea {
  font-family: var(--mono);
  font-size: 12px;
  min-height: 92px;
  resize: vertical;
}

.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.field-check { display: flex; align-items: center; gap: 8px; }
.field-check label { font-size: 13px; font-weight: 400; color: var(--text); }

.field-overridden > label::after {
  content: "overridden";
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}

.form-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.form-actions .spacer { flex: 1; }

.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { flex: 1; }

.error-text { color: var(--danger); font-size: 12.5px; overflow-wrap: anywhere; }
.ok-text { color: var(--ok); font-size: 12.5px; }

/* ── directory browser ────────────────────────────────────────────────── */

.crumbs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 12px; }

.crumb {
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 5px;
}

.crumb:hover { background: var(--bg-hover); }
.crumb-sep { color: var(--text-faint); }

.dir-list {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.dir-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 11px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.dir-row:last-child { border-bottom: 0; }
.dir-row:hover { background: var(--bg-hover); }
.dir-row.hidden-entry { color: var(--text-faint); }

/* ── narrow viewports ─────────────────────────────────────────────────── */

@media (max-width: 720px) {
  .modal-root { padding: 0; }
  .modal { max-height: 100%; height: 100%; border-radius: 0; border: 0; }
}

/* ── the new shell: sidebar rail, start screen, popover menus ──────────── */

.brand-badge {
  font-size: 10.5px;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  color: var(--text-faint);
  flex: none;
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand .icon-btn { margin-left: auto; }

/* One icon button, used across the rail and the topbar. */
.icon-btn {
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}

.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn:disabled { opacity: 0.4; cursor: default; }
.icon-btn:disabled:hover { background: transparent; color: var(--text-faint); }

.new-session {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-sunken);
  color: var(--text);
  font: 600 14px/1 var(--sans);
  cursor: pointer;
}

.new-session:hover { background: var(--bg-hover); }
.new-session:disabled { opacity: 0.5; cursor: default; }

.rail-head {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 2px;
}

.rail-title {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
}

.sidebar-foot {
  display: grid;
  gap: 6px;
  padding: 10px 12px 12px;
}

.settings-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-dim);
  font: 500 13.5px/1 var(--sans);
  cursor: pointer;
}

.settings-link:hover { background: var(--bg-hover); color: var(--text); }


/* ── start screen ─────────────────────────────────────────────────────── */

.start {
  position: relative;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow-y: auto;
}

/* The ambient wash behind the hero. Pointer-events off so it never eats a
   click meant for the composer sitting on top of it. */
.start-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(58% 44% at 50% 46%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 70%),
    radial-gradient(38% 30% at 50% 52%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 72%);
}

.start-inner {
  position: relative;
  width: 100%;
  max-width: 760px;
  display: grid;
  justify-items: center;
  gap: 18px;
}

.start-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.start-mark { display: grid; place-items: center; color: var(--text); }

.pill-badge {
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-family: var(--mono);
}

.start-pills { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

.pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-panel);
  color: var(--text);
  font: 500 13.5px/1 var(--sans);
  cursor: pointer;
}

.pill:hover { background: var(--bg-hover); }
.pill .chev { color: var(--text-faint); font-size: 12px; line-height: 1; }
.pill[aria-expanded="true"] { border-color: var(--border-strong); background: var(--bg-hover); }

.start-box {
  width: 100%;
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px dashed var(--border-strong);
  border-radius: 20px;
  background: color-mix(in srgb, var(--bg-panel) 82%, transparent);
}

.start-box:focus-within { border-style: solid; border-color: var(--accent); }

#start-input {
  width: 100%;
  resize: none;
  min-height: 62px;
  max-height: 260px;
  padding: 4px 6px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15.5px;
  line-height: 1.5;
}

#start-input:focus { outline: none; }
#start-input:disabled { opacity: 0.7; }
#start-input::placeholder { color: var(--text-faint); }

.start-box-actions { display: flex; align-items: center; gap: 10px; }
.start-box-actions .send { margin-left: auto; }

.start-note {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-faint);
  text-align: center;
  min-height: 18px;
}

.start-note.error-text { color: var(--danger); }

/* One round button: the composer's send, and the start box's two controls. */
.round-btn {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  flex: none;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-sunken);
  color: var(--text-dim);
  cursor: pointer;
}

.round-btn:hover { background: var(--bg-hover); color: var(--text); }

.round-btn.send {
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-text);
}

.round-btn.send:hover { filter: brightness(1.08); }
.round-btn:disabled { opacity: 0.45; cursor: default; filter: none; }

/* ── popover menus ────────────────────────────────────────────────────── */

.menu-root {
  position: fixed;
  inset: 0;
  z-index: 40;
}

.menu {
  position: absolute;
  min-width: 260px;
  max-width: 420px;
  max-height: min(60vh, 520px);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: var(--bg-panel);
  box-shadow: 0 18px 44px rgb(0 0 0 / 0.38);
  display: grid;
  gap: 2px;
}

.menu-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.menu-item:hover { background: var(--bg-hover); }
.menu-item-title { font-size: 14px; font-weight: 500; }

.menu-item-desc {
  grid-column: 1;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-faint);
}

.menu-item-path {
  grid-column: 1;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── the plugins pane ─────────────────────────────────────────────────── */

.inv-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.inv-search {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-panel);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.inv-search:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; }

/* Two columns where there is room, one where there is not. `auto-fill` with a
   floor rather than a fixed count, so the pane survives a narrow dialog. */
.inv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
}

.inv-card {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-panel);
  min-width: 0;
}

.inv-head {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}

.inv-name {
  font-weight: 500;
  font-size: 13.5px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inv-module { font-size: 11px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-desc { font-size: 12.5px; color: var(--text); }
.inv-detail { font-size: 12px; color: var(--text-dim); }

/* The pill is the control wherever the unit can move, so it has to look
   pressable — a badge that does something and a badge that only reports must
   not be the same object on screen. */
.badge-btn {
  border: 1px solid var(--border-strong);
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
}

.badge-btn:hover { filter: brightness(1.06); border-color: var(--accent); }
.badge-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* A disabled row is dimmed but still readable: it is the half of this list
   worth reading, so it must not be decoration. */
.inv-off { background: transparent; }
.inv-off .inv-name { color: var(--text-dim); }

/* Uploaded-but-not-yet-sent files, above whichever composer is showing. */
.attach-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 5px 8px 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-soft, transparent);
  font-size: 12.5px;
}

.attach-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 260px;
}

.attach-size { color: var(--text-faint); font-variant-numeric: tabular-nums; }

.attach-x {
  border: 0;
  padding: 0 2px;
  background: transparent;
  color: var(--text-faint);
  font: inherit;
  line-height: 1;
  cursor: pointer;
}

.attach-x:hover { color: var(--text); }

/* Plan mode is the one permission state the agent cannot be talked out of, so
   the chip stops looking like a neutral setting and starts looking like a
   state you are in. */
#composer-permission[data-plan="on"] {
  border-color: var(--accent);
  color: var(--accent);
}

/* A command palette reads differently from a picker: the name is what you
   scan for and the description is there to confirm it, so the two sit on one
   line instead of stacking. */
.menu-item-inline { grid-template-columns: auto 1fr; align-items: baseline; }
.menu-item-inline .menu-item-title { grid-column: 1; grid-row: 1; }
.menu-item-inline .menu-item-desc { grid-column: 2; grid-row: 1; }
/* The slot openMenu keeps for a tick or a value, which a command never has. */
.menu-item-inline > span:empty { display: none; }

.menu-check { color: var(--text); font-size: 14px; line-height: 1.4; }
.menu-sep { height: 1px; margin: 4px 6px; background: var(--border); }

.menu-empty {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-faint);
}

/* ── composer, restyled to match the start box ────────────────────────── */

.composer-form {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--bg-sunken);
  padding: 10px 12px;
}

.composer-form:focus-within { border-color: var(--accent); }

#composer-input {
  border: 0;
  background: transparent;
  padding: 4px 4px;
  min-height: 38px;
}

#composer-input:focus { outline: none; }

.composer-actions { gap: 10px; }

@media (max-width: 720px) {
  .start-title { font-size: 26px; }
  .start-box { border-radius: 16px; }
}

/* ── settings dialog ──────────────────────────────────────────────────── */

.modal-settings {
  width: min(1020px, 100%);
  max-height: min(820px, 100%);
  border-radius: 18px;
}

.settings-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.settings-head h2 { margin: 0; font-size: 20px; font-weight: 600; }
.settings-head .spacer { flex: 1; }

.ghost-pill {
  padding: 8px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: 500 13.5px/1 var(--sans);
  cursor: pointer;
}

.ghost-pill:hover { background: var(--bg-hover); }

.settings-body {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  min-height: 0;
  flex: 1;
}

.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 12px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text-dim);
  font: 500 14px/1 var(--sans);
  text-align: left;
  cursor: pointer;
}

.settings-nav-item:hover { background: var(--bg-hover); color: var(--text); }

.settings-nav-item[aria-current="true"] {
  background: var(--bg-hover);
  color: var(--text);
}

.nav-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.45;
  flex: none;
}

.settings-nav-item[aria-current="true"] .nav-dot { opacity: 1; background: var(--accent); }

.settings-pane {
  overflow-y: auto;
  padding: 20px 24px 28px;
  display: grid;
  gap: 0;
  align-content: start;
}

/* The panes that were built for the old tabbed dialog keep their own spacing. */
.settings-pane > .panel,
.settings-pane > .modal-note,
.settings-pane > .form-actions { margin-bottom: 14px; }

.set-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.set-row:last-child { border-bottom: 0; }
.set-row-block { grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
.set-title { font-size: 15.5px; font-weight: 500; }

.set-desc {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-faint);
  max-width: 62ch;
}

.pill-select {
  appearance: none;
  padding: 9px 34px 9px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-sunken);
  color: var(--text);
  font: 500 14px/1 var(--sans);
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 16px center, right 11px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.pill-select:hover { background-color: var(--bg-hover); }
.pill-select:disabled { opacity: 0.5; cursor: default; }

.appearance {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.appearance-card {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 22px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  font: 500 14px/1 var(--sans);
  cursor: pointer;
}

.appearance-card:hover { background: var(--bg-hover); }

.appearance-card[aria-pressed="true"] {
  border-color: var(--border-strong);
  background: var(--bg-sunken);
}

.appearance-glyph { font-size: 19px; line-height: 1; }

@media (max-width: 720px) {
  .settings-body { grid-template-columns: minmax(0, 1fr); }
  .settings-nav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .set-row { grid-template-columns: minmax(0, 1fr); gap: 12px; }
}

/* ── Models pane: provider rows and the inline editor ─────────────────── */

.pane-title { margin: 0 0 6px; font-size: 22px; font-weight: 600; }
.pane-lede { margin: 0 0 20px; font-size: 14px; color: var(--text-dim); }

.provider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-panel);
}

.provider-name { font-size: 16px; font-weight: 500; }

.status-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex: none;
}

.status-dot.ok { background: var(--ok); }
.status-dot.idle { background: var(--warn); }
.status-dot.off { background: var(--text-faint); opacity: 0.6; }

.ghost-pill.sm { padding: 6px 14px; font-size: 13px; }

.solid-pill {
  padding: 8px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font: 600 13.5px/1 var(--sans);
  cursor: pointer;
}

.solid-pill:hover { filter: brightness(1.08); }
.solid-pill:disabled { opacity: 0.5; cursor: default; filter: none; }

.add-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }

.dashed-btn {
  flex: 1 1 220px;
  padding: 16px;
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  background: transparent;
  color: var(--text-dim);
  font: 500 14px/1 var(--sans);
  cursor: pointer;
}

.dashed-btn:hover { background: var(--bg-hover); color: var(--text); }

.provider-editor {
  display: grid;
  gap: 14px;
  padding: 20px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-panel);
}

.provider-editor .field { display: grid; gap: 7px; }
.provider-editor .field label { display: flex; align-items: baseline; gap: 8px; font-size: 13.5px; color: var(--text-dim); }

.provider-editor input[type="text"],
.provider-editor input[type="password"] {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-sunken);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.provider-editor input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.pill-select.wide { width: min(320px, 100%); border-radius: 10px; }

.disclosure {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border: 0;
  border-top: 1px solid var(--border);
  padding-top: 14px;
  background: transparent;
  color: var(--text);
  font: 500 14px/1 var(--sans);
  cursor: pointer;
  text-align: left;
}

.disclosure .chev { color: var(--text-faint); }

.models-head { display: flex; align-items: center; gap: 10px; }

.link-btn {
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font: 500 13.5px/1 var(--sans);
  cursor: pointer;
  padding: 4px 0;
}

.link-btn:hover { color: var(--accent); text-decoration: underline; }

.models-empty {
  padding: 16px;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  text-align: center;
  font-size: 13px;
  color: var(--text-faint);
}

.model-chips { display: flex; flex-wrap: wrap; gap: 8px; }

.model-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-sunken);
  font-family: var(--mono);
  font-size: 12px;
}

.chip-x {
  border: 0;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 11px;
  padding: 0 2px;
}

.chip-x:hover { color: var(--danger); }

.editor-foot { display: flex; align-items: center; gap: 10px; }
.editor-foot .hint.note { color: var(--text-dim); }

.ghost-pill.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.ghost-pill.danger:hover { background: var(--danger-soft); }

/* Armed: the second click is the destructive one, so it stops looking like a
   quiet secondary action. */
.ghost-pill.danger.armed {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--accent-text);
  font-weight: 600;
}

.ghost-pill.danger.armed:hover { filter: brightness(1.08); background: var(--danger); }

.badge-inline {
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-sunken);
  font-size: 11px;
  color: var(--text-dim);
}

.row-warn { font-size: 12.5px; color: var(--warn); }
.link-btn.danger { color: var(--danger); }
.link-btn.danger:hover { color: var(--danger); }

.pill.sm { padding: 6px 12px; font-size: 12.5px; border-radius: 999px; }
.pill.sm .chev { font-size: 11px; }
.start-box-actions .pill.sm { margin-left: auto; }
.start-box-actions .send { margin-left: 10px; }

/* The permission chip belongs beside the + button, not away on the right with
   the model pill. It answers "what may this do to my machine", which is part
   of the message you are about to send rather than a property of the route —
   and it is the same place the session composer keeps it. */
#start-permission { margin-left: 0; }

.menu-header {
  padding: 8px 12px 4px;
  font-size: 11.5px;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  color: var(--text-faint);
}

/* The workspace row reveals its Remove the way a session row does, and turns
   the same shade while the confirm is armed. */
.ws-row:hover .row-x,
.ws-row:focus-within .row-x { opacity: 1; }
.ws-row.arming { background: var(--danger-soft); border-radius: 8px; }
.ws-row.arming .ws-select { opacity: 0.6; }

/* One reviewable file. The whole row is the label, so the checkbox has a
   generous target rather than being a 13px square. */
.cleanup-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.cleanup-row:hover { background: var(--bg-hover); }
.cleanup-row input { margin-top: 3px; flex: none; }

/* ── @ file mentions ──────────────────────────────────────────────────── */

/* Fixed, because it is positioned against the composer's viewport box and
   must not be clipped by the conversation's own scroll container. */
.mention-root {
  position: fixed;
  z-index: 40;
}

.mention-list {
  display: grid;
  gap: 2px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-panel);
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.14);
  max-height: 300px;
  overflow-y: auto;
}

.mention-item {
  display: flex;
  align-items: baseline;
  gap: 9px;
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.mention-item:hover,
.mention-active { background: var(--bg-hover); }

.mention-icon {
  flex: none;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
}

.mention-name { font-size: 14px; }

/* The folder half is context, not the answer, so it recedes and is the part
   that gets cut when the row runs out of room. */
.mention-path {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  color: var(--text-faint);
}

.mention-note {
  position: sticky;
  bottom: -6px;
  margin: 2px -6px -6px;
  padding: 7px 10px;
  border-top: 1px solid var(--border);
  border-radius: 0 0 13px 13px;
  background: var(--bg-panel);
  font-size: 11.5px;
  color: var(--text-faint);
}

/* A sent mention, in the transcript. Tinted rather than boxed: it sits inside
   a sentence, and a border would break the line it is part of. */
.md-mention {
  font-weight: 650;
  word-break: break-all;
}

/* Converted maths. Kept in the body face rather than a serif italic: this is
   plain text standing in for a formula, and dressing it up as typesetting
   would promise a fidelity the conversion does not have. It wraps like the
   prose around it — a long display formula pinned to one line would push a
   horizontal scrollbar through the whole conversation. */
.md-math { font-variant-numeric: tabular-nums; }

/* A heading written as prose, not as an identifier, keeps its capitals. */
.menu-header-plain { text-transform: none; }

/* ── markdown ─────────────────────────────────────────────────────────── */

.md > *:first-child { margin-top: 0; }
.md > *:last-child { margin-bottom: 0; }
.md p { margin: 0 0 10px; }

.md-h {
  margin: 16px 0 8px;
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.35;
}

.md h3.md-h { font-size: 17px; }
.md h4.md-h { font-size: 15.5px; }

.md-list { margin: 0 0 10px; padding-left: 22px; display: grid; gap: 4px; }
.md-list li { padding-left: 2px; }
.md-list li::marker { color: var(--text-faint); }

.md strong { font-weight: 600; color: var(--text); }
.md em { font-style: italic; }

.md code {
  font-family: var(--mono);
  font-size: 0.88em;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
}

.md-code {
  margin: 0 0 10px;
  padding: 12px 14px;
  position: relative;
  white-space: pre;
  overflow-x: auto;
}

.md-code[data-lang]::after {
  content: attr(data-lang);
  position: absolute;
  top: 6px; right: 10px;
  font-size: 10.5px;
  color: var(--text-faint);
}

.md blockquote {
  margin: 0 0 10px;
  padding: 2px 0 2px 12px;
  border-left: 2px solid var(--border-strong);
  color: var(--text-dim);
}

.md hr { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
.md a { color: var(--accent); }
.md a:hover { text-decoration: underline; }

.pill-sub { color: var(--text-faint); font-weight: 400; }
.menu-item-value { color: var(--text-faint); font-size: 13px; }
.menu-item-nav .menu-item-value::after { content: '  ›'; }

/* ── thinking ─────────────────────────────────────────────────────────── */

.card.thinking summary { display: flex; align-items: center; gap: 10px; }
.thinking-label { color: var(--text-dim); }
.card.thinking[open] .thinking-label { color: var(--text); }

.thinking-count {
  font-size: 11px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.card.thinking .spinner { width: 11px; height: 11px; margin-left: auto; }

/* Set apart from the answer: this is the model's working, not its reply. */
.thinking-body {
  font-size: 13.5px;
  color: var(--text-dim);
  border-left: 2px solid var(--border-strong);
  padding-left: 12px;
}

.thinking-body .md-h { font-size: 13.5px; color: var(--text-dim); margin: 10px 0 4px; }
.thinking-body strong { color: var(--text-dim); }
.thinking-body > *:first-child { margin-top: 0; }

/* ── the skill behind a request ────────────────────────────────────────────
   `/mark-scripts-dashboard …` sends the whole procedure to the model. The
   conversation shows the request; this is the procedure, folded away under it
   and still there to be read. */
.skill-used {
  margin-top: 8px;
  border-top: 1px solid var(--border);
  padding-top: 6px;
}

.skill-used > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-dim);
}

.skill-used > summary::-webkit-details-marker { display: none; }
.skill-used > summary:hover { color: var(--text); }

.skill-used-mark { color: var(--accent); }

.skill-used-name {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text);
}

.skill-used-hint { color: var(--text-faint); }

.skill-used-body {
  margin-top: 8px;
  padding-left: 12px;
  border-left: 2px solid var(--border-strong);
  font-size: 13px;
  color: var(--text-dim);
  max-height: 340px;
  overflow-y: auto;
}

.skill-used-body > *:first-child { margin-top: 0; }
.skill-used-body .md-h { font-size: 13px; color: var(--text-dim); margin: 10px 0 4px; }

/* ── sidebar: one folder per project, its sessions beneath ─────────────── */

.ws-group { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; margin-bottom: 6px; min-width: 0; }

.ws-row {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 4px 10px 4px 4px;
  border-radius: 8px;
  color: var(--text-dim);
  font: 500 13px/1.4 var(--sans);
}

.ws-row:hover { background: var(--bg-hover); color: var(--text); }

.ws-caret {
  flex: none;
  width: 18px; height: 22px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-faint);
  font-size: 10px;
  cursor: pointer;
}

.ws-caret:hover { background: var(--bg-sunken); color: var(--text); }

.ws-select {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

/* The folder the next session will open in. */
.ws-selected > .ws-row { color: var(--accent); }
.ws-selected > .ws-row .ws-select { font-weight: 600; }

/* The folder holding the session on screen: marked, but not competing with
   the selection above it. */
.ws-active > .ws-row::before {
  content: '';
  width: 3px;
  height: 14px;
  margin-right: 2px;
  border-radius: 2px;
  background: var(--accent);
  flex: none;
}

.ws-icon { font-size: 12px; flex: none; }

.ws-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-count {
  flex: none;
  font-size: 11px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

/* Sessions sit under their folder, indented enough to read as children.
   Padding rather than margin: with `box-sizing: border-box` it cannot widen
   the row, whereas a margin plus a percentage width can. */
.ws-group .session-row { padding-left: 26px; }

.menu-search {
  position: sticky;
  top: 0;
  z-index: 1;
  width: 100%;
  margin-bottom: 4px;
  padding: 9px 12px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 12px 12px 0 0;
  background: var(--bg-panel);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
}

.menu-search:focus { outline: none; border-bottom-color: var(--accent); }
.menu-search::placeholder { color: var(--text-faint); }
.menu-list { display: grid; gap: 2px; }

/* A grid item refuses to shrink below its own content unless told to, so
   anything that scrolls inside its own box — a wide table, a long line of
   code — grew the whole message instead, and the conversation scrolled
   sideways. These two let the box be narrower than what it holds. */
.msg { min-width: 0; }
.msg-body { min-width: 0; }

/* Markdown tables.
   The wrapper scrolls, not the page: a wide table in a reply must not make the
   whole conversation scroll sideways. */
.md-table-wrap {
  margin: 0 0 12px;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-panel);
}

.md-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13.5px;
  line-height: 1.45;
}

.md-table th,
.md-table td {
  padding: 7px 12px;
  text-align: left;
  vertical-align: top;
  /* Only between rows. An outer border would double up with the wrapper's. */
  border-bottom: 1px solid var(--border);
  /* Every column can contain prose. Keep a readable minimum so a long
     neighbouring cell cannot squeeze labels into one character per line. */
  min-width: 8rem;
  max-width: 32rem;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}

.md-table thead th {
  background: var(--bg-sunken);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.01em;
  position: sticky;
  top: 0;
}

.md-table tbody tr:last-child th,
.md-table tbody tr:last-child td { border-bottom: 0; }

.md-table tbody tr:hover { background: var(--bg-hover); }

/* Alignment the divider row asked for: `---:` right, `:---:` centre. Numbers
   in a right-aligned column line up on their digits, which is the whole
   reason the syntax exists. */
.md-table .ta-right { text-align: right; font-variant-numeric: tabular-nums; }
.md-table .ta-center { text-align: center; }
.md-table .ta-left { text-align: left; }

/* The `/` menu can list every command plus the folder's skills, which is more
   rows than the file menu ever shows. Capped and scrollable so it cannot grow
   taller than the window it is positioned against. */
.mention-list { max-height: 44vh; overflow-y: auto; }

/* ── the browser pane ────────────────────────────────────────────────────────
   Shares the shell's width with chat and File Manager, in its own column. */
.browser-pane {
  position: relative;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
}

.browser-pane[hidden] { display: none; }

/* Full height and wide enough to grab, but visually only a hairline. */
.browser-resizer {
  position: absolute;
  inset: 0 auto 0 -4px;
  width: 9px;
  cursor: ew-resize;
  touch-action: none;
  user-select: none;
  z-index: 2;
}

.browser-resizer::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 44px;
  border-radius: 2px;
  transform: translate(-50%, -50%);
  background: var(--border-strong);
  opacity: 0.5;
  transition: opacity 0.15s ease;
}

.browser-resizer:hover::after { opacity: 1; }

.browser-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 10px 10px 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-sunken);
}

.browser-url {
  flex: 1 1 120px;
  min-width: 0;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--bg-panel);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}

.browser-url:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; }

.browser-status {
  display: flex;
  overflow-wrap: anywhere;
  /* Top, not centre: a long file name wraps to two or three lines, and a
     centred button then sits in the middle of the sentence as though it were
     a word in it. */
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 7px 14px;
  font-size: 12.5px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}

/* The line can carry an offer — "…is ready." beside a button that takes it. */
.browser-status .grow { flex: 1; min-width: 0; }
.browser-status .btn { flex: none; }

.browser-status[hidden] { display: none; }

.browser-body {
  /* Positioned, so the agent's cursor can be laid over the frame. */
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  background: var(--bg);
}

.browser-body iframe {
  flex: 1;
  width: 100%;
  border: 0;
  background: #fff;
}

/* The empty state carries the one instruction that matters, because a blank
   white panel reads as something that failed to load. */
.browser-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 24px;
  text-align: center;
  color: var(--text-dim);
}

.browser-empty strong { color: var(--text); font-weight: 600; }
.browser-empty span { font-size: 12.5px; }

/* The live view: a real browser's output, painted as it arrives.
   `contain` keeps a repaint of the frame from invalidating the whole pane. */
.browser-screen {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: top left;
  background: #fff;
  cursor: default;
  contain: strict;
}

.browser-screen:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ── the browser's tabs ────────────────────────────────────────────────────
   Real tabs in the agent's browser, above the address bar as in any browser.
   The current one takes the address bar's colour, so the two read as one. */
.browser-tabbar {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 36px;
  padding: 6px 10px 0 8px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.browser-tabs {
  flex: 0 1 auto;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.browser-tabs::-webkit-scrollbar { display: none; }

.browser-tab {
  flex: 0 1 180px;
  min-width: 96px;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  margin-bottom: -1px;
  padding: 0 4px 0 10px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.browser-tab:hover { background: var(--bg-hover); }

.browser-tab.is-current {
  background: var(--bg-sunken);
  border-color: var(--border);
  color: var(--text);
}

.browser-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.browser-tab-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.browser-tab-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 5px;
  background: none;
  color: inherit;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.55;
}

.browser-tab-close:hover { opacity: 1; background: var(--bg-hover); }

.browser-tab-new {
  flex: none;
  width: 28px;
  height: 28px;
  margin: 0 0 1px 2px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text-dim);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.browser-tab-new:hover { background: var(--bg-hover); color: var(--text); }

/* ── the tab drop-down ─────────────────────────────────────────────────────
   Shown only once the strip has run out of room. It lists every open tab,
   the ones scrolled out of sight included, and searches them by name. */
.browser-tab-menu {
  flex: none;
  width: 26px;
  height: 26px;
  margin: 0 4px 2px 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.browser-tab-menu:hover { background: var(--bg-hover); color: var(--text); }
.browser-tab-menu[hidden] { display: none; }
.browser-tab-menu[aria-expanded='true'] { background: var(--bg-hover); color: var(--text); }

.tab-search {
  position: absolute;
  z-index: 30;
  top: calc(100% - 2px);
  left: 6px;
  width: min(340px, calc(100% - 16px));
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--bg-panel);
  box-shadow: 0 18px 44px rgb(0 0 0 / 0.38);
  overflow: hidden;
}

.tab-search[hidden] { display: none; }

.tab-search-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.tab-search-icon { flex: none; color: var(--text-dim); font-size: 14px; }

.tab-search-box {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  outline: none;
}

.tab-search-label {
  padding: 9px 12px 3px;
  color: var(--text-dim);
  font-size: 11px;
}

.tab-search-rows {
  max-height: min(50vh, 360px);
  padding-bottom: 6px;
  overflow-y: auto;
}

.tab-search-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 8px 5px 12px;
  cursor: pointer;
}

.tab-search-row.is-active { background: var(--bg-hover); }

.tab-search-glyph {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--bg-sunken);
  color: var(--text-dim);
  font-size: 12px;
}

.tab-search-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.tab-search-title,
.tab-search-detail {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab-search-title { font-size: 12.5px; color: var(--text); }
.tab-search-row.is-current .tab-search-title { font-weight: 600; }
.tab-search-detail { font-size: 11px; color: var(--text-dim); }

.tab-search-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
}

.tab-search-row:hover .tab-search-close,
.tab-search-row.is-active .tab-search-close,
.tab-search-close:focus-visible { opacity: 0.7; }

.tab-search-close:hover { opacity: 1; background: var(--bg-hover); color: var(--text); }

.tab-search-empty {
  padding: 8px 12px 14px;
  color: var(--text-dim);
  font-size: 12px;
}

/* ── the agent's cursor ────────────────────────────────────────────────────
   Drawn over the frame where the agent is about to click, type, hover or
   drag, so its actions can be followed rather than inferred from the page
   changing. It never takes the person's pointer events. */
.browser-pointer {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  transform: translate(var(--px, 0px), var(--py, 0px));
  transition: transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 160ms ease;
}

.browser-pointer.is-shown { opacity: 1; }

/* Jumped rather than glided — the first appearance, before a drag's glide. */
.browser-pointer.is-placing { transition: opacity 160ms ease; }

.browser-pointer svg {
  position: absolute;
  left: -3px;
  top: -2px;
  width: 22px;
  height: 22px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
}

.browser-pointer-ripple {
  position: absolute;
  left: -16px;
  top: -16px;
  width: 32px;
  height: 32px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  opacity: 0;
}

.browser-pointer.is-click .browser-pointer-ripple { animation: browser-ripple 650ms ease-out; }

@keyframes browser-ripple {
  from { transform: scale(0.25); opacity: 0.95; }
  to { transform: scale(1.5); opacity: 0; }
}

.browser-pointer-label {
  position: absolute;
  left: 18px;
  top: 20px;
  max-width: 220px;
  padding: 2px 7px;
  overflow: hidden;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

@media (prefers-reduced-motion: reduce) {
  .browser-pointer { transition: opacity 160ms ease; }
  .browser-pointer.is-click .browser-pointer-ripple { animation: none; }
}

/* ── highlighting mentions as you type ───────────────────────────────────────
   A textarea cannot hold a styled span, so the highlight is drawn on a mirror
   behind it — the same text in the same metrics, with the mentions given a
   tinted box. The mirror's own text is invisible; the textarea on top is what
   you read and edit, so the caret, selection and undo stay where they belong.
   Every metric below has to match the textarea exactly or the boxes drift. */
.composer-field {
  position: relative;
  width: 100%;
  min-width: 0;
}

.composer-mirror {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  font: inherit;
  line-height: 1.5;
  /* Invisible, and behind. The textarea draws every glyph itself — which is
     what makes selecting text work: the browser paints the selection band on
     the textarea, so anything drawn below it would be covered by the band. */
  color: transparent;
  pointer-events: none;
}

.composer-mirror .composer-mention,
.composer-mirror .composer-command {
  /* Thickened with a shadow rather than font-weight, for two reasons. A real
     bold run is wider than the same characters in the regular face, and the
     textarea above wraps in the regular face and owns the caret — any width
     added here would put the caret in the wrong place from that character on.
     And the span itself is transparent, so the shadow needs a colour of its
     own; it draws just outside the glyph edges, thickening the letters the
     textarea paints on top. */
  text-shadow: 0.4px 0 0 var(--text), -0.4px 0 0 var(--text);
}

/* The textarea sits over the mirror and draws every glyph. Only its
   background is given up, so the thickening behind a mention shows through. */
.composer-field textarea {
  position: relative;
  z-index: 2;
  background: transparent;
}

.composer-field textarea::placeholder { color: var(--text-faint); }
.composer-field textarea::selection { background: var(--accent-soft); }

/* The two composers differ in padding, border and size; the mirror copies each
   so the text lands in the same place. */
#composer-field {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-panel);
}

#composer-field:focus-within { border-color: var(--accent); }
#composer-field textarea { border: 0; }


/* A file or folder found by search, in the sidebar. A button, because it does
   something — it puts the path in the composer as a mention. */
.file-hit {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.file-hit:hover { background: var(--bg-hover); }
.file-hit:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.file-hit-icon { flex: none; font-size: 13px; }
.file-hit .row-title { font-size: 13.5px; }
.file-hit .sub { font-size: 11.5px; color: var(--text-faint); word-break: break-all; }

/* The mention menu's own search box. Typing after the `@` cannot hold a space,
   and most names in these workspaces have one. */
.mention-search-row {
  padding: 8px 8px 6px;
  border-bottom: 1px solid var(--border);
}

.mention-search {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--bg-sunken);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.mention-search:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; }

/* The textarea rules are addressed by id, which outranks the class above — so
   the handover of the glyphs to the mirror has to be stated by id too. */
#start-input,
#composer-input {
  color: var(--text);
}

#start-input::placeholder,
#composer-input::placeholder { color: var(--text-faint); }

/* The textarea reserves a gutter for its scrollbar once the text is long
   enough to scroll; the mirror, which never scrolls, does not. That makes the
   mirror's lines 15px wider, so it wraps later than the textarea and the
   emphasis lands beside the word instead of on it. Reserving the gutter on
   both keeps their content boxes the same width whatever the length. */
.composer-field textarea,
.composer-mirror {
  scrollbar-gutter: stable;
}

/* ── learned approvals ──────────────────────────────────────────────────────
   What runs without asking, listed rather than merely counted: a standing
   permission nobody can see the terms of is the thing this could most easily
   get wrong. */
.approval-rules {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  max-width: 340px;
}

.approval-rule {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-sunken);
}

.approval-rule .grow { flex: 1; min-width: 0; }

.approval-rule-what {
  font-size: 12.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.approval-rule-where {
  font-size: 11px;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* A run that has not become a rule yet: dashed, because it is not one. */
.approval-rule-pending {
  background: none;
  border-style: dashed;
}

/* ── why an approval is being asked ─────────────────────────────────────── */

.prompt-why {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--text-dim);
}

.prompt-hard { color: var(--danger); }

/* Persistent memory in Settings › General. */
.memory-store-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 12.5px;
}
.memory-store-head:first-child { margin-top: 0; }
.memory-meter {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  overflow: hidden;
}
.memory-meter > span { display: block; height: 100%; background: var(--accent); }
.memory-meter.is-full > span { background: var(--danger, #c0392b); }
.memory-entry { white-space: pre-wrap; overflow-wrap: anywhere; }

/* File tabs: the files a turn produced, each in its own tab. The frames
   behind them sit in one box that stays in the pane, so switching tabs never
   reloads a page. */
.browser-frames { display: contents; }
.browser-tab-kind {
  flex: none;
  font-size: 12px;
  line-height: 1;
  color: var(--accent);
  margin-right: 5px;
}

/* A skill that ships with WorkBuddy is marked as such in the "/" menu. */
.mention-badge {
  flex: none;
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 10.5px;
  color: var(--text-faint);
  white-space: nowrap;
}

/* Always visible so workspace actions work with touch and keyboard too. */
.ws-more,
.session-more {
  flex: none;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  color: inherit;
  background: transparent;
  font: 600 20px/1 var(--sans);
  cursor: pointer;
}
.ws-more:hover,
.ws-more[aria-expanded="true"],
.session-more:hover,
.session-more[aria-expanded="true"] { background: var(--bg-sunken); color: var(--text); }
.ws-more:focus-visible,
.session-more:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.menu-item.workspace-remove .menu-item-title { color: var(--danger); }

.workspace-option { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.workspace-option:last-child { border-bottom: 0; }
.workspace-option .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }

.removed-workspaces { margin-top: 18px; }
.removed-workspaces summary { cursor: pointer; padding: 8px 0; }

/* Keep sidebar chat actions available to touch and keyboard users. */
.session-more { width: 28px; height: 28px; flex: none; }
.session-remove { color: var(--danger); }

/* Scheduled tasks use the same account-scoped RPC and visual controls as chat. */
.scheduled-link { margin-top: 9px; width: 100%; gap: 9px; }
.scheduled-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.scheduled-link .badge { margin-left: auto; }
.schedule-page { height: 100%; overflow-y: auto; min-width: 0; padding: clamp(18px, 4vw, 48px); background: var(--bg-panel); }
.schedule-page > * { max-width: 1050px; margin-left: auto; margin-right: auto; }
.schedule-header { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 28px; }
.schedule-header h1 { flex: 1; margin: 0; font-size: clamp(24px, 3vw, 36px); }
.schedule-tabs, .schedule-actions, .schedule-filters { display: flex; flex-wrap: wrap; gap: 9px; margin: 14px 0; align-items: center; }
.schedule-filters input { flex: 1; min-width: 120px; }
.schedule-page input, .schedule-page select, .schedule-page textarea { border: 1px solid var(--border-strong); border-radius: 7px; padding: 9px; background: var(--bg-panel); color: var(--text); font: inherit; max-width: 100%; }
.schedule-form { display: grid; gap: 16px; }
.schedule-field { display: grid; gap: 7px; min-width: 0; font-size: 13px; }
.schedule-field > span { font-weight: 600; }
.schedule-field textarea { width: 100%; resize: vertical; }
.schedule-days { display: flex; flex-wrap: wrap; gap: 7px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; }
.schedule-days legend { font-size: 13px; }
.schedule-days button { text-transform: capitalize; }
.schedule-row, .schedule-template { border: 1px solid var(--border); border-radius: 10px; padding: 18px; margin: 14px 0; overflow-wrap: anywhere; }
.schedule-row-head { display: flex; align-items: center; gap: 12px; }
.schedule-row h3, .schedule-template h3 { margin: 0; flex: 1; font-size: 16px; }
.schedule-prompt { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; }
.schedule-next { font-size: 13px; font-weight: 600; }
.schedule-confirm { border-top: 1px solid var(--border); margin-top: 12px; }
.schedule-confirm button { margin-right: 8px; }
.schedule-empty { min-height: 320px; display: grid; place-content: center; justify-items: center; gap: 16px; color: var(--text-dim); }
.schedule-clock { font-size: 86px; line-height: 1; color: var(--text); }
.schedule-template-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 16px; }
.schedule-template { margin: 0; }
.schedule-template p { font-size: 13px; color: var(--text-dim); line-height: 1.5; }

.main > .schedule-page { flex: 1; min-height: 0; }

/* Child status changes update this panel independently of streaming chunks. */
.subagent-depth { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.subagent-depth label { flex: 1; }
.subagent-row { flex-wrap: wrap; gap: 8px; }
.subagent-row .grow { min-width: 160px; overflow-wrap: anywhere; }

.subagent-panel .subagent-depth { margin: 12px 14px; }
.subagent-panel .panel-body > p { margin: 12px 14px; }
