/* viewer.css -- MevView: the niwa live-session guest */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html {
  /* iOS Safari inflates text on pages that don't pin this. */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
/* Native fonts keep private sessions independent of font services. */
body {
  background: var(--ground);
  color: var(--ink);
  font: 14px/1.6 var(--font-ui);
  overflow-x: clip;
}
.prose, .own-entry .own-text { font: 1rem/1.7 var(--font-ui); }
code, pre { font-family: var(--font-mono); }

.activity-group { min-width: 0; }
.activity-group > summary {
  display: flex;
  align-items: baseline;
  gap: .5em;
  cursor: pointer;
  min-width: 0;
}
.activity-group > summary::before { content: '▸'; flex: none; }
.activity-group[open] > summary::before { content: '▾'; }
.activity-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-failed { flex: none; color: var(--failed); white-space: nowrap; }
.activity-counts { max-width: 65%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-group > .turn { padding-inline: 0; }

/* ── Header ─────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem 1rem;
  padding: .8rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.wordmark {
  font-family: var(--font-mono);
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
}
.wordmark small {
  display: block;
  font-weight: 400;
  letter-spacing: .04em;
  text-transform: none;
  color: var(--muted);
  font-size: .8rem;
}
/* The filter is its own full-width row under the topbar line: it is
   also the send scope, so it must not hide until a discussion exists or
   fight the wordmark for space on a phone. */
.filter {
  flex-basis: 100%;
  display: flex;
  gap: .3rem;
  font-size: .8rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: .1rem;
}
.filter[hidden] { display: none; }
.filter button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font: inherit;
  padding: .25rem .75rem;
  border-radius: var(--control-radius);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.filter button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--accent);
  box-shadow: var(--shadow);
  font-weight: 600;
}
.filter button.dir { color: var(--accent); }
/* All is the overview, kept apart at the strip's far end. */
.filter button.all { margin-left: auto; }
.filter button .cnt {
  font-size: .68rem;
  line-height: 1;
  padding: .12rem .38rem;
  border-radius: var(--control-radius);
  background: color-mix(in srgb, var(--line) 60%, transparent);
  color: var(--muted);
}
.filter button.unseen::after {
  content: "";
  position: absolute;
  top: -.1rem;
  right: -.1rem;
  width: .5rem;
  height: .5rem;
  border-radius: var(--control-radius);
  background: var(--ok);
  box-shadow: 0 0 0 2px var(--surface);
}
/* The strip earns its own row on a phone; on a wide screen a lone
   "Main chat" control under the wordmark looks orphaned, so it joins the line. */
@media (min-width: 60rem) {
  .topbar { flex-wrap: nowrap; }
  .filter {
    order: 1;
    flex: 1 1 auto;
    flex-basis: auto;
    min-width: 0;
    padding-bottom: 0;
    margin-left: .5rem;
  }
}
/* Connection state stays compact in the modeline. */
.conn {
  margin: 0;
  display: flex;
  align-items: center;
  gap: .4rem;
  line-height: 1;
  color: var(--muted);
  white-space: nowrap;
}
.conn.connected { color: var(--ok); }
.conn::before {
  content: "";
  width: .45rem;
  height: .45rem;
  border-radius: var(--control-radius);
  background: var(--muted);
  flex-shrink: 0;
}
.conn.connected::before { background: var(--ok); }
.conn.ended::before { background: var(--failed); }
.conn.ended { color: var(--failed); }

/* ── Ledger ─────────────────────────────────────────────────────────── */
.ledger {
  max-width: 54rem;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}
/* A stable reading measure also aligns the composer and session menu. */
.requests, .own-queue, .dock-strip, .dock-disclosure, .composer,
.disclosure, .modeline { max-width: 51rem; }


.turn {
  display: grid;
  grid-template-columns: .25rem minmax(0, 1fr);
  gap: .95rem;
  min-width: 0;
}
.turn[hidden] { display: none; }
.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
}
/* A node on the spine, not an avatar: the transcript is one run, and
   the speaker is a mark on it. */
.glyph {
  width: .25rem;
  height: .75rem;
  border-radius: .15rem;
  margin-top: .45rem;
  font-size: 0;
  color: transparent;
  flex-shrink: 0;
  background: var(--line);
}
/* The rail carries the speaker's colour down the turn, so identity
   survives past the header line on a long answer. */
.rail::after {
  content: "";
  flex: 1;
  width: 2px;
  border-radius: 2px;
  background: var(--line);
}
.turn.you   .rail::after {
  background: color-mix(in srgb, var(--accent) 35%, transparent);
}
.turn.guest .rail::after {
  background: color-mix(in srgb, var(--guest) 45%, transparent);
}
.turn.cont { margin-top: -.7rem; }
.turn.cont .glyph { visibility: hidden; }
.turn.cont .who { display: none; }
.turn.you   .glyph { background: var(--ink); }
.turn.guest .glyph { background: var(--guest); }
.turn.ai    .glyph { background: var(--accent); }
.content { min-width: 0; }

.who {
  display: flex;
  align-items: baseline;
  gap: .6rem;
  margin-bottom: .25rem;
  font-size: .8125rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
  flex-wrap: wrap;
}
.turn.guest .who .name { color: var(--guest); }
.turn.you   .who .name { color: var(--accent); }
.badge {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: none;
  padding: .08rem .5rem;
  border-radius: var(--control-radius);
  background: var(--guest-soft);
  color: var(--guest);
}
.dirchip {
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  padding: .08rem .5rem;
  border-radius: var(--control-radius);
  background: var(--accent-soft);
  color: var(--accent);
  border: 0;
  font-family: inherit;
  cursor: pointer;
}
.dirchip:hover { text-decoration: underline; }
/* The host rechecks history authority; read/full links offer only Copy. */
body:not([data-owner-link]) .owner-message-action { display: none; }

/* ── Prose / markdown ───────────────────────────────────────────────── */
/* Prose and tool output share the bounded conversation column. */
.prose { overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p { margin: .5rem 0; }
.prose h1, .prose h2, .prose h3, .prose h4 {
  margin: 1rem 0 .3rem;
  font-size: 1rem;
  text-wrap: balance;
}
.prose h1 { font-size: 1.15rem; }
.prose h2 { font-size: 1.07rem; }
.prose ul, .prose ol { margin: .4rem 0; padding-left: 1.25rem; }
.prose li { margin: .18rem 0; }
.prose li::marker { color: var(--muted); }
.prose strong { font-weight: 650; }
.prose blockquote {
  margin: .5rem 0;
  padding: .1rem .9rem;
  border-left: 3px solid var(--line);
  color: var(--muted);
}
.prose code {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: .3rem;
  padding: .06rem .32rem;
  font-size: .84em;
}
.prompt { font-size: 1rem; }
.turn.you .content, .turn.guest .content {
  background: var(--surface-2); padding: .8rem 1rem; border-radius: var(--panel-radius);
}
.turn.you .glyph, .turn.guest .glyph { margin-top: 1rem; }

.codeblock {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: .6rem;
  margin: .6rem 0;
  overflow: hidden;
}
.codeblock-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .25rem .8rem;
  border-bottom: 1px solid var(--line);
}
.codeblock .lang {
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
  font-size: .7rem;
  color: var(--muted);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.codeblock-header .codeblock-copy {
  flex-shrink: 0;
  margin-left: auto;
  padding: .25rem .5rem;
  font-size: .72rem;
  font-weight: 500;
}
.codeblock pre {
  margin: 0;
  padding: .7rem .9rem;
  overflow-x: auto;
  font-size: .82rem;
  line-height: 1.55;
}
.tok-kw  { color: var(--kw); }
.tok-str { color: var(--str); }
.tok-fn  { color: var(--fn); font-weight: 600; }
.tok-com { color: var(--com); font-style: italic; }

/* ── Tool rows ──────────────────────────────────────────────────────── */
/* One line per call. No border, no card: the box is reserved for the
   things that are waiting on the reader. */
.tool {
  border: 0;
  background: none;
  margin: 0;
}
.tool > summary {
  list-style: none;
  display: flex;
  align-items: baseline;
  gap: .55rem;
  padding: .12rem 0;
  cursor: pointer;
  font-size: .86rem;
}
.tool > summary::-webkit-details-marker { display: none; }
.tool > summary .st {
  width: .7rem;
  flex-shrink: 0;
  font-size: .78rem;
}
.tool > summary .st.completed { color: var(--ok); }
.execution-breadcrumb { display: flex; align-items: baseline; flex-wrap: wrap; gap: .3rem; font-size: .9rem; color: var(--muted); }
/* Reasoning stays separate from tool activity, with a quiet collapsed label. */
.thinking > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: .8125rem;
  font-weight: 500;
}
.thinking:not([open]) > summary { font-weight: 400; }
.thinking[open] > summary { margin-bottom: .35rem; }
.thinking > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* A request's closing rule: the host label, then a line to the edge. */
.turn.summary > .content { grid-column: 2; }
.request-summary { font-size: .8125rem; color: var(--muted); }
div.request-summary, .request-summary > summary {
  display: flex;
  align-items: center;
  gap: .35em;
  min-width: 0;
  overflow-wrap: anywhere;
}
div.request-summary::after, .request-summary > summary::after {
  content: "";
  flex: 1 0 1.5rem;
  border-top: 1px solid var(--line);
}
.request-summary > summary { list-style: none; cursor: pointer; }
.request-summary > summary::-webkit-details-marker { display: none; }
.request-summary > summary:hover { color: var(--ink); }
.request-summary > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.request-summary-details {
  margin: .35rem 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: .8rem/1.5 var(--font-mono);
}
/* The compaction row reads as a rule with a label; its body is the summary. */
.compaction-body { margin: .5rem 0 0; color: var(--ink); font-size: .9375rem; }
.execution-status.failed { color: var(--failed); }
.execution-result-link { border: 0; padding: 0; background: none; color: var(--accent); cursor: pointer; text-decoration: underline; font: inherit; }
.execution-result-dialog { width: min(850px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; background: var(--surface); color: var(--ink); border: 1px solid var(--rule-strong); border-radius: 6px; }
.execution-result-dialog::backdrop { background: #0006; }
.execution-result-dialog pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.tool > summary .st.failed { color: var(--failed); }
.tool > summary .st.running { color: var(--running); }
.tool > summary:hover .tname { text-decoration: underline; }
.tool .tname { font-weight: 600; white-space: nowrap; color: var(--fn); }
.tool-approval { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.tool .targ {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.tool .result {
  border-left: 2px solid var(--line);
  background: var(--code-bg);
  margin: .2rem 0 .45rem;
  padding: .45rem .7rem;
  overflow: auto;
  font-size: .78rem;
  line-height: 1.55;
  max-height: 24rem;
}
.tool.failed .result { color: var(--failed); }
/* Structure inside a tool result: line-number gutters and the
   path:line prefix grep puts in front of every match. These are
   scaffolding, so they recede and let the source carry the colour. */
/* Pipe tables: the viewer renders them, so they need the same
   restraint as the rest -- hairlines, a tinted head, and their own
   scroll container so a wide table never scrolls the page. */
.tablewrap { overflow-x: auto; margin: .1rem 0 .6rem; }
.mdtable {
  border-collapse: collapse;
  font-size: .86rem;
  min-width: 100%;
}
.mdtable th, .mdtable td {
  border: 1px solid var(--line);
  padding: .3rem .6rem;
  vertical-align: top;
}
.mdtable th {
  background: var(--surface-2);
  font-weight: 700;
  white-space: nowrap;
}
.mdtable td { font-variant-numeric: tabular-nums; }
.mdtable tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }

.result .gutter { color: var(--com); user-select: none; }
.result .gpath { color: var(--muted); }
.result .gline { color: var(--fn); }
.result .gsep { color: var(--com); }
.tool .result.diff { padding: .4rem 0; }

/* ── Diff ───────────────────────────────────────────────────────────── */
.diff {
  font-family: var(--font-mono);
  font-size: .8rem;
  line-height: 1.5;
  overflow-x: auto;
}
.diff .line { display: block; padding: 0 .9rem; white-space: pre; }
.diff .hunk { color: var(--fn); background: var(--surface-2); }
.diff .file { color: var(--muted); font-weight: 700; }
.diff .add  { background: var(--diff-add); color: var(--diff-add-ink); }
.diff .del  { background: var(--diff-del); color: var(--diff-del-ink); }

/* ── Live affordance ────────────────────────────────────────────────── */
/* Float above the dock without reserving space or intercepting the chat. */
.live-controls {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.live-controls:not(:has(.live-button:not([hidden]))) { display: none; }
.live-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: transparent;
  color: var(--on-accent);
  cursor: pointer;
  font: 22px/1 var(--font-ui);
  pointer-events: auto;
}
.live-button::before {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: var(--shadow);
}
.live-button > span { position: relative; }
.live-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.live-button[hidden] { display: none; }

/* ── Dock: interactions, notice, composer ───────────────────────────── */
/* In flow after the transcript, sticky at the viewport bottom: a short
   session shows the composer right under its last turn instead of
   across a void, while a long one keeps it pinned during scroll. */
.dock {
  position: sticky;
  bottom: 0;
  z-index: 20;
  background: linear-gradient(transparent,
    color-mix(in srgb, var(--ground) 96%, transparent) 14%,
    var(--ground) 40%);
  padding: 1.6rem 1rem calc(.6rem + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .55rem;
}
/* Historical/session detail collapses to one summary line in the dock. */
.dock-disclosure {
  width: 100%;
  max-width: 51rem;
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: .7rem;
  box-shadow: none;
}
.dock-disclosure[hidden] { display: none; }
.dock-disclosure summary {
  cursor: pointer;
  padding: .6rem .9rem;
  font-size: .8125rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dock-disclosure summary[data-warning="true"] { color: var(--failed); }
.dock-disclosure-list {
  list-style: none;
  margin: 0;
  display: flex;
  flex-direction: column;
}
/* Live agents, settled agents and tasks all report through one
   disclosure, so the scroll cap belongs to the body they share rather
   than to each list, and a rule separates the sections that are
   otherwise two kinds of plain row. */
.dock-disclosure-body {
  max-height: 15rem;
  overflow-y: auto;
}
.dock-disclosure-body > .dock-strip { padding: .1rem .5rem .45rem; }
.dock-disclosure-body > .dock-actions { padding: .4rem .5rem .45rem; }
/* Long lists fold into a submenu: the same summary styling as the menu,
   closed until asked, so the menu stays a menu at 50 commands. */
.dock-submenu[hidden] { display: none; }
.dock-submenu > .dock-strip { padding: .1rem .5rem .45rem; }
.dock-submenu > .skill-chips { margin: 0; flex-wrap: wrap; }
#editing-box .btn {
  min-height: 40px;
  border-radius: .5rem;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
}
.editing-create {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  padding: .25rem .7rem .6rem;
}
.editing-create:not(:has(button:not([hidden]))) { display: none; }
#editing-items {
  display: grid;
  gap: .3rem;
  padding: 0 .7rem .6rem;
}
#editing-items:empty { display: none; }
/* One hairline per populated section, so the summary, the live chips,
   the settled rows and the task rows read as parts rather than as one
   undifferentiated run of rows. Specific enough to add padding the
   sections' own shorthands would otherwise reset. */
.dock-disclosure .dock-disclosure-body > *:not([hidden]):not(:empty) {
  border-top: 1px solid var(--line);
  padding-top: .4rem;
}
.requests {
  width: 100%;
  max-width: 51rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  max-height: 45vh;
  overflow-y: auto;
}
.request-card {
  background: var(--surface);
  border: 1px solid var(--accent);
  border-left-width: 4px;
  border-radius: .7rem;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.request-card .rhead {
  display: block;
  padding: .4rem .9rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
  border-bottom: 1px solid var(--line);
}
.request-card .request-body {
  margin: 0;
  padding: .55rem .9rem;
  font-size: .78rem;
  line-height: 1.5;
  max-height: 11rem;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.request-card .diff {
  max-height: 14rem;
  overflow: auto;
  padding: .4rem 0;
}
.request-card .diff .line { white-space: pre-wrap; }
.request-card .request-body.prose { white-space: normal; }
.request-option-label { display: grid; gap: .25rem; width: 100%; font-size: .8rem; }
.request-option-input { min-width: 0; width: 100%; box-sizing: border-box; }
.request-controls {
  display: flex;
  gap: .5rem;
  align-items: center;
  padding: .5rem .9rem;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.request-feedback {
  flex: 1;
  min-width: 9rem;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: var(--ground);
  color: inherit;
  font: inherit;
  font-size: .82rem;
  padding: .38rem .8rem;
}

.btn {
  display: inline-block;
  text-decoration: none;
  text-align: center;
  border: 0;
  border-radius: var(--control-radius);
  padding: .42rem 1rem;
  font: inherit;
  font-size: .82rem;
  font-weight: 650;
  cursor: pointer;
  background: var(--accent);
  color: var(--on-accent);
}
.btn.quiet {
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn.danger { background: var(--failed); color: var(--on-danger); }
.btn:hover { filter: brightness(.94); }
.btn:disabled { opacity: .5; cursor: default; }
.btn:focus-visible, .filter button:focus-visible,
.tool > summary:focus-visible, .request-feedback:focus-visible,
.composer textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.notice {
  margin: 0;
  font-size: .76rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  padding: .3rem .9rem;
  box-shadow: var(--shadow);
}
.notice[hidden] { display: none; }

.composer {
  width: 100%;
  max-width: 51rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--panel-radius);
  box-shadow: var(--shadow);
  padding: .8rem 1rem .7rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.composer[hidden] { display: none; }
/* The message starts at one line and grows with its text up to a cap,
   then scrolls. */
.composer textarea {
  box-sizing: border-box;
  border: 0;
  background: transparent;
  resize: none;
  color: inherit;
  font: inherit;
  font-size: 1rem;
  field-sizing: content;
  max-height: min(40dvh, 18rem);
  overflow-y: auto;
  outline: none;
}
.composer-row {
  display: flex;
  align-items: flex-end;
  gap: .5rem;
  flex-wrap: wrap;
}
.composer-row > .btn { min-height: 2.5rem; }
.composer-spacer { flex: 1; }

.disclosure {
  width: 100%;
  max-width: 51rem;
  margin: 0;
  font-size: .68rem;
  line-height: 1.5;
  color: var(--muted);
}
.disclosure summary { cursor: pointer; }
.disclosure p { margin: .3rem 0 0; }

/* ── Small screens ──────────────────────────────────────────────────── */
@media (max-width: 520px) {
  .topbar { padding: .5rem .7rem; gap: .6rem; }
  .ledger { padding: 1rem .6rem 1.2rem; gap: .9rem; }
  .turn { gap: .7rem; }
  .prose { font-size: .9375rem; }
  .btn, .filter button { min-height: 40px; }
  .dock { padding-left: .6rem; padding-right: .6rem; }
}

.questionnaire { margin: 0 18px 12px; }
.question { position: relative; min-width: 0; }
.question-heading, .question-panel {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
  padding: .65rem 0;
}
.question-heading {
  display: flex;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: .82rem;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
}
.question-heading[hidden] { display: none; }
.question-summary-title, .question-summary-answer { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.question-summary-title { flex: 1; }
.question-summary-answer { flex: 0 1 50%; }
.question-summary-answer[hidden] { display: none; }
.question-heading:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.question-panel[inert] { position: absolute; top: 0; visibility: hidden; pointer-events: none; }
.question-option { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .3rem .5rem; margin-bottom: .6rem; }
.question-option .option { text-align: left; overflow-wrap: anywhere; }
.question-description { grid-row: 2; grid-column: 1 / -1; font-size: .82rem; overflow-wrap: anywhere; }
.question-preview { grid-row: 1; grid-column: 2; }
.question-panel > .request-feedback { width: 100%; min-width: 0; }
.question-samples { display: grid; margin-top: .5rem; background: var(--ground); }
.question-sample-option { grid-area: 1 / 1; min-width: 0; }
.question-sample-option[inert] { visibility: hidden; pointer-events: none; }
.question-sample-label { padding: .35rem .5rem; font-size: .75rem; color: var(--muted); }
.request-card .question-panel .question-sample {
  padding: .4rem .5rem;
  font: .8rem/1.5 var(--font-mono);
  max-height: 12lh;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.question-text {
  margin: 0 0 .35rem;
  font-size: .82rem;
  font-weight: 650;
}
.btn.option[aria-pressed="true"] {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}


/* One strip for session state, the way a mode line reports it. */
.modeline {
  width: 100%;
  max-width: 51rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: .3rem .1rem 0;
  font-size: .72rem;
  color: var(--muted);
  flex-wrap: wrap;
}
.modeline .ml { white-space: nowrap; }
.modeline .tail { margin-left: auto; }
/* Plan changes what the session will do with what you send, so it is
   the one status word that carries colour. */
.modeline .plan {
  color: var(--accent);
  font-weight: 600;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 4px;
  padding: 0 .35rem;
}

.queue-state {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--muted);
}

.queue-state.paused {
  color: var(--running);
}

.own-queue {
  width: 100%;
  max-width: 51rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.own-queue[hidden] { display: none; }
.own-entry {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: .7rem;
  padding: .1rem 0 .4rem;
}
.own-entry .rhead {
  display: block;
  padding: .6rem .9rem;
  font-size: .8125rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
}
.own-entry .own-text {
  margin: 0;
  padding: 0 .9rem .3rem;
  font-size: .8rem;
  line-height: 1.45;
  max-height: 4.6rem;
  overflow: hidden;
  overflow-wrap: break-word;
}
.own-entry .request-controls { padding: 0 .9rem; }

.skill-chips {
  display: flex;
  gap: .35rem;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 0 6px;
}
.skill-chips[hidden] { display: none; }
.skill-chip {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: .74rem;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  padding: .25rem .7rem;
  cursor: pointer;
}
.skill-chip:hover, .skill-chip.armed { border-color: var(--accent); }
.skill-chip.armed { color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }

.composer-scope {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  margin: 0 0 6px;
  align-self: flex-start;
  font-size: 12px;
  color: var(--accent);
}
.composer-scope:not(.armed), .scope-selection {
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-radius: var(--control-radius);
  padding: .15rem .6rem;
}
.scope-selection { display: inline-flex; align-items: center; gap: .5rem; max-width: 100%; overflow-wrap: anywhere; }
.composer-scope[hidden] { display: none; }
.scope-clear {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: var(--control-radius);
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: 1;
  cursor: pointer;
}
.scope-clear:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.scope-clear:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tool > .tool, .tool-dependencies, .tool-parallel {
  margin-left: 1rem;
  padding-left: .75rem;
  border-left: 2px solid var(--line, #ddd);
}
.tool .tool-markdown { font-size: .95rem; white-space: normal; }
.tool-group-label, .tool-truncated {
  font: .8rem var(--mono, monospace);
  opacity: .75;
  margin: .5rem 0;
}
.st.warning { color: #a66b00; }
.st.denied, .st.cancelled { color: var(--failed); }

.shared-context { margin-top: 10px; font: 13px system-ui; }
.shared-context > summary { cursor: pointer; color: var(--muted); }
.shared-context-body { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 400px; overflow: auto; font: 12px ui-monospace, monospace; }

.assistant-working::before { content: ''; display: inline-block; width: .75em; height: .75em; margin-right: .5em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; vertical-align: -.1em; animation: assistant-spin 1s linear infinite; }
@keyframes assistant-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .assistant-working::before { animation: none; } }

.skip-link { position: fixed; top: .5rem; left: .5rem; z-index: 40;
  transform: translateY(-200%); padding: .6rem 1rem;
  color: var(--on-accent); background: var(--accent); }
.skip-link:focus { transform: none; }
.composer-label { color: var(--muted); font-size: .75rem; font-weight: 600; }
.composer:focus-within { border-color: var(--accent); }

/* On wide screens, session navigation has its own column. The same
   disclosure stays in the dock on phones and at increased browser zoom. */
@media (min-width: 80rem) {
  body[data-session-menu] { padding-right: 20rem; }
  body[data-session-menu] > .topbar { width: calc(100% + 20rem); }
  #session-box {
    position: fixed; top: 6.5rem; right: 1.5rem; width: 17.5rem;
    max-height: calc(100dvh - 8rem); border-radius: var(--panel-radius);
  }
  #session-box > summary { white-space: normal; }
  #session-box .dock-disclosure-body { max-height: calc(100dvh - 14rem); }
  #session-box .dock-strip { width: auto; }
  #session-box .dock-actions { flex-wrap: wrap; }
}

.empty-state { max-width: 51rem; margin: 0 auto; padding: 3rem 1rem 2rem; }
.empty-state[hidden] { display: none; }
.empty-state h1 { font-size: 1.5rem; letter-spacing: -.025em; margin: 0 0 .5rem; }
.empty-state p { max-width: 48ch; color: var(--muted); margin: 0; }
.ledger:empty { padding-block: 0; }

/* Operational issues stay outside the editable composer. */
#recovery-issues { padding: .6rem 1rem; border-top: 1px solid var(--border); }
#recovery-issues p { margin: .4rem 0; }
