/* The assistant task pane. Fisher & Paykel black and greys in light and dark; the accent (black, or
   near-white in dark) is reserved for the primary action and the live state. Everything is sized for a 320–420 px pane inside Office. */
:root {
  --bg: #fafafa;
  --bg-elev: #ffffff;
  --surface: #f3f3f3;
  --surface-2: #e9e9e9;
  --fg: #1a1a1a;
  --fg-2: #474747;
  --muted: #5f5f5f;
  --border: #e2e2e2;
  --border-strong: #cccccc;
  --accent: #1a1a1a;
  --accent-hover: #000000;
  --accent-soft: #e6e6e6;
  --accent-fg: #ffffff;
  --ok: #2f7d4a;
  --ok-soft: #e4f1e8;
  --warn: #8a5a00;
  --warn-soft: #f8edd3;
  --bad: #b3261e;
  --bad-soft: #f9e3e1;
  --user-bubble: #ececec;
  /* selected text: a blue that stands apart from every grey the pane uses (SWE-2894) */
  --selection: #a8c7fa;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 6px 20px -8px rgba(0, 0, 0, 0.18);
  --radius: 10px;
  --radius-sm: 7px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #181818;
  --bg-elev: #202020;
  --surface: #262626;
  --surface-2: #2e2e2e;
  --fg: #ededed;
  --fg-2: #c8c8c8;
  --muted: #a3a3a3;
  --border: #343434;
  --border-strong: #474747;
  --accent: #ededed;
  --accent-hover: #ffffff;
  --accent-soft: #3a3a3a;
  --accent-fg: #181818;
  --ok: #7cc48f;
  --ok-soft: #22302a;
  --warn: #e0b35a;
  --warn-soft: #352d1b;
  --bad: #ef8a83;
  --bad-soft: #3a2422;
  --user-bubble: #2c2c2c;
  --selection: #2f5f93;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -8px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html,
body {
  height: 100%;
  margin: 0;
}
body {
  font:
    13.5px/1.5 -apple-system,
    BlinkMacSystemFont,
    "Segoe UI Variable",
    "Segoe UI",
    ui-sans-serif,
    system-ui,
    sans-serif;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection {
  background: var(--selection);
  color: var(--fg);
}
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
button {
  font: inherit;
  color: inherit;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
svg.i {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
svg.i.sm {
  width: 14px;
  height: 14px;
}

/* viewport units are scaled by the text size's zoom too: divide it back out (--zoom, set by app.js) */
.h-screen {
  height: calc(100vh / var(--zoom, 1));
  display: flex;
  flex-direction: column;
}

/* ---- startup recovery screen (no dependencies) */
.startup {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
  z-index: 50;
}
.startup-inner {
  max-width: 280px;
  text-align: center;
  padding: 24px;
  color: var(--muted);
}
#office-startup-title {
  color: var(--fg);
  font-weight: 600;
  margin-bottom: 4px;
}
#office-startup-reload {
  margin-top: 12px;
  padding: 6px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  cursor: pointer;
}

/* ---- header */
header {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 8px 8px 12px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
  min-height: 44px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-size: 14px;
  min-width: 0;
}
.brand .mark {
  flex: 0 0 auto; /* stays square when a larger text size wraps the title */
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: var(--accent);
  display: grid;
  place-items: center;
  color: var(--accent-fg);
}
.brand .mark svg {
  width: 11px;
  height: 11px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.badge {
  font-size: 10.5px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 7px;
  white-space: nowrap;
  margin-left: 2px;
}
@media (max-width: 359px) {
  .badge {
    display: none;
  }
}
.in-office header .brand,
.in-office header .badge {
  display: none;
}
.in-office #model-select {
  order: -1; /* left, where the name was; the buttons stay right */
  max-width: 200px; /* the room the name and badge left */
}
header:has(#undo-btn:not([hidden])) .badge {
  display: none;
}
.office-mac header {
  padding-right: 44px;
}
header .spacer {
  flex: 1 1 auto;
  min-width: 4px;
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--fg-2);
  cursor: pointer;
  transition:
    background 140ms var(--ease),
    color 140ms var(--ease);
}
.icon-btn:hover {
  background: var(--surface);
  color: var(--fg);
}
.icon-btn.text-btn {
  width: auto;
  padding: 0 8px;
  font-size: 12px;
  gap: 5px;
}
#undo-btn {
  color: var(--accent);
}
#model-select {
  flex: 0 1 auto;
  min-width: 96px;
  max-width: 128px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  color: var(--fg);
  font: inherit;
  font-size: 12px;
  padding: 4px 22px 4px 8px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%237a766d' stroke-width='1.6' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
#model-select:hover {
  border-color: var(--border-strong);
}

/* ---- conversation */
main {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 14px 8px;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  main {
    scroll-behavior: auto;
  }
}
.msg {
  margin: 0 0 12px;
  max-width: 100%;
  animation: sidecar-in 220ms var(--ease) both;
}
@keyframes sidecar-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .msg,
  .card,
  .step {
    animation: none !important;
  }
}
.msg .who {
  display: none;
}
.msg.user {
  display: flex;
  justify-content: flex-end;
}
.msg.user .body {
  background: var(--user-bubble);
  border-radius: 14px 14px 4px 14px;
  padding: 8px 12px;
  max-width: 88%;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.msg.assistant .body {
  word-wrap: break-word;
  padding: 2px 28px 2px 0;
}
.msg.assistant.streaming .body > p:last-child::after,
.msg.assistant.streaming .body > ul:last-child > li:last-child::after,
.msg.assistant.streaming .body > ol:last-child > li:last-child::after,
.msg.assistant.streaming .body > .tbl:last-child::after,
.msg.assistant.streaming .body:empty::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 13px;
  margin-left: 2px;
  vertical-align: -2px;
  background: var(--accent);
  border-radius: 2px;
  animation: sidecar-caret 1s steps(2, start) infinite;
}
@keyframes sidecar-caret {
  to {
    visibility: hidden;
  }
}
.msg.assistant .body p {
  margin: 0 0 8px;
}
.msg.assistant .body p:last-child {
  margin-bottom: 0;
}
.msg.assistant .body h1,
.msg.assistant .body h2,
.msg.assistant .body h3 {
  font-size: 13.5px;
  font-weight: 600;
  margin: 10px 0 4px;
}
/* a table in a reply: readable at pane width, scrolling sideways inside itself when it is wider */
.msg.assistant .body .tbl {
  overflow-x: auto;
  margin: 6px 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.msg.assistant .body table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12.5px;
  line-height: 1.4;
}
.msg.assistant .body th,
.msg.assistant .body td {
  padding: 5px 9px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}
.msg.assistant .body th {
  background: var(--surface);
  font-weight: 600;
  white-space: nowrap;
}
.msg.assistant .body tr:last-child td {
  border-bottom: 0;
}
.msg.assistant .body .r {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.msg.assistant .body .c {
  text-align: center;
}
.msg.assistant .body ul,
.msg.assistant .body ol {
  margin: 0 0 8px;
  padding-left: 20px;
}
.msg.assistant .body li {
  margin: 2px 0;
}
.msg.assistant .body code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  background: var(--surface);
  padding: 1px 4px;
  border-radius: 4px;
}
.msg.assistant .body strong {
  font-weight: 600;
}
.sources {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 11.5px;
}
.sources .sources-title {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.sources a {
  color: var(--fg-2);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 9px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sources a:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.msg.status {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  color: var(--muted);
  font-size: 12px;
  margin: 2px 0 8px;
}
.msg.status .body {
  white-space: pre-wrap;
}
.msg.status svg.i {
  margin-top: 2px;
  width: 14px;
  height: 14px;
  opacity: 0.8;
}
.msg.usage {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  margin: -4px 0 12px;
  font-variant-numeric: tabular-nums;
}
.msg.plan {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
}
.msg.plan > summary {
  display: flex;
  gap: 7px;
  align-items: center;
  cursor: pointer;
  list-style: none;
  color: var(--muted);
}
.msg.plan > summary::-webkit-details-marker {
  display: none;
}
.msg.plan > summary .by {
  margin-left: auto;
}
.msg.plan .body {
  margin-top: 6px;
}
.msg.plan .approach {
  margin: 0 0 6px;
}
.msg.plan ul,
.msg.plan ol {
  margin: 0 0 4px;
  padding-left: 18px;
}
.msg.plan .assumptions {
  color: var(--muted);
}
.msg.plan .steps li {
  margin: 2px 0;
}
.msg.plan .steps li .tier {
  color: var(--muted);
  margin-left: 6px;
  font-size: 11px;
}
.msg.plan .steps li.done {
  color: var(--muted);
}
.msg.plan .steps li.now {
  font-weight: 600;
}
/* a sub-agent's block: who and what on one line, its brief, steps and report when opened */
.msg.subagent {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
}
.msg.subagent > summary {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 7px;
  align-items: center;
  cursor: pointer;
  list-style: none;
  color: var(--muted);
}
.msg.subagent > summary::-webkit-details-marker {
  display: none;
}
.msg.subagent > summary .agent {
  color: var(--fg);
  font-weight: 600;
}
.msg.subagent > summary .brief {
  flex: 1 1 160px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.msg.subagent > summary .now {
  margin-left: auto;
  font-size: 11px;
}
.msg.subagent.running > summary .i {
  animation: sidecar-spin 0.9s linear infinite;
}
.msg.subagent .body {
  margin-top: 6px;
}
.msg.subagent .label {
  color: var(--muted);
  font-size: 11px;
  margin-top: 6px;
}
.msg.subagent .task {
  margin: 2px 0;
  white-space: pre-wrap;
}
.msg.subagent .steps {
  margin: 2px 0;
  padding-left: 18px;
}
.msg.subagent .steps li .detail {
  color: var(--muted);
  margin-left: 6px;
  font-size: 11px;
}
.msg.subagent .steps li.failed {
  color: var(--bad);
}
.msg.subagent .report {
  margin-top: 2px;
}
.msg.error {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
  background: var(--bad-soft);
  color: var(--bad);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 12.5px;
}
.msg.error .body {
  white-space: pre-wrap;
  flex: 1 1 200px;
}
.msg-actions {
  flex-basis: 100%;
  display: flex;
  gap: 6px;
  margin-top: 2px;
}
.msg-actions button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--fg-2);
  border-radius: var(--radius-sm);
  padding: 4px 9px;
  font-size: 12px;
  cursor: pointer;
}
.msg-actions button:hover {
  color: var(--fg);
  background: var(--surface);
}
.msg.assistant {
  position: relative;
}
/* "Get help" under a reply: there on the latest one, on hover or focus for earlier ones; only
   where the server takes reports (a reopened chat can bring the row from one that did) */
.msg-help {
  display: none;
  margin-top: 4px;
  opacity: 0;
  transition: opacity 120ms var(--ease);
}
.issue-reports .msg-help {
  display: flex;
}
.msg-help.latest,
.msg.assistant:hover .msg-help,
.msg-help:focus-within {
  opacity: 1;
}
.msg-help button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: none;
  color: var(--muted);
  border-radius: var(--radius-sm);
  padding: 3px 7px 3px 0;
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
}
.msg-help button:hover {
  color: var(--fg);
}
@media (hover: none) {
  .msg-help {
    opacity: 0.7;
  }
}
.msg.assistant .msg-copy {
  position: absolute;
  right: 0;
  top: -2px;
  opacity: 0;
  transition: opacity 120ms var(--ease);
}
.msg.assistant:hover .msg-copy,
.msg.assistant .msg-copy:focus-visible {
  opacity: 0.85;
}
@media (hover: none) {
  .msg.assistant .msg-copy {
    opacity: 0.6;
  }
}

/* tool activity: one compact row per step, grouped between replies */
.steps {
  margin: 0 0 10px;
  border-left: 2px solid var(--border);
  padding-left: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.step {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 22px;
  font-size: 12px;
  color: var(--muted);
  animation: sidecar-in 180ms var(--ease) both;
}
.step .label {
  color: var(--fg-2);
}
.step .detail {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.step.running svg.i {
  color: var(--accent);
  animation: sidecar-spin 1s linear infinite;
}
.step.done svg.i {
  color: var(--ok);
}
.step.failed svg.i {
  color: var(--bad);
}
@keyframes sidecar-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---- empty state */
#welcome {
  padding: 28px 6px 10px;
}
#welcome h2 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 6px;
  text-wrap: balance;
}
#welcome p {
  margin: 0 0 16px;
  color: var(--muted);
}
#welcome .chips {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#welcome .chip {
  text-align: left;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  border-radius: var(--radius);
  padding: 9px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--fg-2);
  transition:
    border-color 140ms var(--ease),
    background 140ms var(--ease),
    transform 140ms var(--ease);
}
#welcome .chip:hover {
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--fg);
  transform: translateY(-1px);
}
#welcome .chip svg.i {
  color: var(--accent);
}

/* ---- cards (proposals, replies, scripts) */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 4px 0 12px;
  overflow: hidden;
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  animation: sidecar-in 220ms var(--ease) both;
}
.card .head {
  padding: 9px 12px;
  font-weight: 600;
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}
.card .head svg.i {
  color: var(--accent);
}
.card .head .verdict {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.card .verdict.ok {
  color: var(--ok);
}
.card .verdict.risky,
.card .verdict.reject {
  color: var(--warn);
}
.card .edits {
  border-top: 1px solid var(--border);
}
/* a decided card's edits, folded to one line */
.card details.folded {
  border-top: 1px solid var(--border);
}
.card details.folded > summary {
  padding: 7px 12px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}
.card details.folded > summary:hover {
  color: var(--fg);
}
.card .edit {
  padding: 7px 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}
.card .edit:first-child {
  border-top: none;
}
.card .edit-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.card .edit-kind {
  flex: 0 0 auto;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
  min-width: 52px;
}
.card .edit-target {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--fg);
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card .edit-values {
  margin-top: 2px;
  padding-left: 60px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
/* a row opened shows the whole change */
.card .edit.open .edit-target {
  white-space: normal;
  overflow-wrap: anywhere;
}
.card .edit-full {
  margin: 6px 0 2px 60px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--fg);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 320px;
  overflow: auto;
}
.card .edit.open .edit-values {
  display: block;
  -webkit-line-clamp: unset;
  white-space: pre-wrap;
}
.card details.review summary {
  color: var(--warn);
}
.card .review-list {
  margin: 0;
  padding: 0 12px 8px 12px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.card .review-list li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 12px;
  color: var(--fg-2);
  line-height: 1.4;
}
.card .review-list .sev {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-top: 6px;
  background: var(--muted);
}
.card .review-list .sev-medium .sev {
  background: var(--warn);
}
.card .review-list .sev-high .sev {
  background: var(--bad);
}
.card .reply-body {
  white-space: pre-wrap;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}
.card .reply-meta {
  padding: 6px 12px 8px;
  color: var(--muted);
  font-size: 11.5px;
}
/* mailbox cards (app/mailbox-cards.js): who, when and where, one labelled line each */
.card .mail-row {
  display: flex;
  gap: 8px;
  padding: 4px 12px;
  font-size: 12.5px;
  overflow-wrap: anywhere;
}
.card .mail-row .mail-label {
  flex: 0 0 52px;
  color: var(--muted);
}
.card .resolution a {
  color: inherit;
}
.card .summary-line {
  padding: 0 12px 8px;
  color: var(--fg-2);
  font-size: 12.5px;
}
.card pre.code {
  margin: 0;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 240px;
  overflow: auto;
}
.card details {
  border-top: 1px solid var(--border);
  font-size: 12px;
}
.card details summary {
  padding: 7px 12px;
  cursor: pointer;
  color: var(--muted);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.card details summary::-webkit-details-marker {
  display: none;
}
.card details summary::before {
  content: "";
  width: 5px;
  height: 5px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 140ms var(--ease);
  margin-right: 2px;
}
.card details[open] summary::before {
  transform: rotate(45deg);
}
.card .risks {
  border-top: 1px solid var(--border);
  padding: 7px 12px;
  color: var(--warn);
  font-size: 12px;
  background: var(--warn-soft);
}
.card .actions {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}
.card .actions button {
  flex: 1;
  padding: 7px 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  font-weight: 600;
  font-size: 12.5px;
  transition:
    background 140ms var(--ease),
    border-color 140ms var(--ease),
    transform 120ms var(--ease);
}
.card .actions button:active {
  transform: scale(0.985);
}
.card .actions .approve {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}
.card .actions .approve:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
/* widening permission (this file, or one sheet from now on): quieter than Apply, under the row */
.card .actions-more {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 0 12px 10px;
}
.card .actions-more .always {
  padding: 4px 0;
  min-height: 32px;
  border: 0;
  background: transparent;
  color: var(--fg);
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.card .actions-more .always:hover {
  text-decoration-thickness: 2px;
}
.card .actions-note {
  font-size: 11.5px;
  color: var(--muted);
}
.card.resolved .actions-more {
  display: none;
}
.card .actions .reject {
  background: transparent;
  color: var(--fg-2);
}
.card .actions .reject:hover {
  background: var(--surface);
  color: var(--fg);
}
.card.resolved .actions {
  display: none;
}
.card .resolution {
  padding: 7px 12px;
  font-size: 11.5px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}
.card .resolution.good {
  color: var(--ok);
}
.card .resolution.bad {
  color: var(--bad);
}
.card .resolution.warn {
  color: var(--warn);
}
/* a failed batch: the plain-language line, then the technical detail folded away */
.card .resolution.failure {
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
}
.card .resolution.failure .line {
  display: flex;
  align-items: center;
  gap: 6px;
}
.card .resolution.failure summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 11px;
  padding-left: 20px;
}
.card .resolution.failure .detail {
  color: var(--muted);
  padding: 4px 0 2px 20px;
  overflow-wrap: anywhere;
}
.card.auto {
  box-shadow: none;
  background: var(--surface);
}
.card.handoff {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}
.card.handoff .head .from {
  white-space: nowrap;
}
.card.handoff .head .verdict {
  text-transform: none;
  letter-spacing: 0;
}
.card.handoff .summary-line {
  font-weight: 600;
  color: var(--fg);
  padding-top: 2px;
}
.card.handoff .reply-meta {
  padding-top: 0;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
}
.msg.status.handoff-sent {
  color: var(--fg-2);
}
.card.auto .head {
  font-weight: 500;
  font-size: 12.5px;
  padding: 8px 12px;
}
.card.auto .head svg.i {
  color: var(--ok);
}

/* ---- todos, questions */
#todos {
  border-top: 1px solid var(--border);
  padding: 6px 14px;
  font-size: 12px;
  background: var(--bg-elev);
}
#todos summary {
  cursor: pointer;
  list-style: none;
}
#todos summary::-webkit-details-marker {
  display: none;
}
#todos summary .text {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#todos summary .count {
  flex: none;
  color: var(--muted);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
#todos summary::after {
  content: "";
  flex: none;
  width: 5px;
  height: 5px;
  margin: 0 2px 2px 4px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(-135deg);
  transition: transform 140ms var(--ease);
}
#todos details[open] summary::after {
  transform: rotate(45deg);
  margin-bottom: 4px;
}
#todos .list {
  max-height: calc(40vh / var(--zoom, 1));
  overflow-y: auto;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}
#todos .t {
  display: flex;
  gap: 7px;
  padding: 2px 0;
  color: var(--muted);
  align-items: center;
}
#todos .t.now svg.i {
  color: var(--accent);
}
#todos .t.done svg.i {
  color: var(--ok);
}
#todos .t.done {
  text-decoration: line-through;
  opacity: 0.7;
}
#todos .t.now {
  color: var(--fg);
  font-weight: 600;
}
#questions {
  border-top: 1px solid var(--border);
  padding: 10px 14px;
  background: var(--bg-elev);
}
#questions .q {
  margin-bottom: 10px;
}
#questions .q .qt {
  font-weight: 600;
  margin-bottom: 6px;
}
#questions .q .opts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}
#questions .q .opts button {
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--fg);
  border-radius: 999px;
  padding: 4px 11px;
  cursor: pointer;
  font-size: 12px;
}
#questions .q .opts button:hover {
  background: var(--surface);
}
#questions .q .opts button.picked {
  border-color: var(--accent);
  background: var(--accent-soft);
}
#questions input[type="text"] {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 6px 9px;
  background: var(--bg-elev);
  color: var(--fg);
  margin-bottom: 6px;
  font: inherit;
}
#questions button.submit {
  border: none;
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  cursor: pointer;
  font-weight: 600;
}

/* ---- working indicator */
#activity {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  background: var(--bg-elev);
}
#activity .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: sidecar-pulse 1.1s ease-in-out infinite;
}
#activity.paused .dot {
  animation: none;
  background: var(--warn);
}
#activity #activity-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#activity #activity-time {
  font-variant-numeric: tabular-nums;
}
#activity button {
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--fg-2);
  border-radius: 999px;
  padding: 2px 10px;
  cursor: pointer;
  font-size: 11.5px;
}
#activity button:hover {
  background: var(--surface);
  color: var(--fg);
}
@keyframes sidecar-pulse {
  0%,
  100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}
@media (prefers-reduced-motion: reduce) {
  #activity .dot {
    animation: none;
  }
}

/* ---- composer: a card like the assistants users compare us with. The message box on top (two lines
   to start, growing to about eight), the selection above it, and a bar of controls below */
#composer {
  padding: 8px 12px 12px;
  border-top: 1px solid var(--border);
  flex: 0 0 auto;
  background: var(--bg);
}
#composer .field {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: var(--bg-elev);
  padding: 8px 8px 6px 12px;
  transition:
    border-color 140ms var(--ease),
    box-shadow 140ms var(--ease);
}
#composer .field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
#composer .field.dropping {
  border-style: dashed;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
#composer textarea {
  resize: none;
  border: none;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
  padding: 4px 4px 6px 0;
  /* the cap is set by app.js growInput: about half the pane, allowing for the text size */
  min-height: 44px;
  outline: none;
}
#composer .bar {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: -6px;
}
#composer .bar .spacer {
  flex: 1 1 auto;
}
#composer .bar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  color: var(--fg-2);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
/* a pane at Office's narrowest: the bar keeps every label on one line by dropping Help's icon */
@media (max-width: 359px) {
  #composer .bar-btn {
    padding: 0 6px;
  }
  #composer .bar:not(:has(#files-btn:not([hidden]))) #help-btn svg {
    display: none;
  }
}
/* with the "N files" button (SWE-2916) the bar still keeps every label on one line: in a narrower
   pane the button shows the clip and the count (its words stay in aria-label and the tooltip), then
   Help shows its icon and the approvals mode its words without its icon */
@media (max-width: 439px) {
  #files-btn > span {
    display: none;
  }
  #composer #files-btn {
    padding: 0 3px;
    gap: 2px;
  }
}
@media (max-width: 399px) {
  #composer .bar:has(#files-btn:not([hidden])) #help-btn {
    padding: 0 3px;
  }
  #composer .bar:has(#files-btn:not([hidden])) :is(#help-btn > span, #mode-btn svg) {
    display: none;
  }
}
#composer .bar-btn:hover,
#composer .bar-btn[aria-expanded="true"] {
  background: var(--surface);
  color: var(--fg);
}
#composer .bar-btn.always {
  color: var(--warn);
}
#composer .mode-wrap {
  position: relative;
}
#mode-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  z-index: 20;
  width: 270px;
  padding: 4px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--bg-elev);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.18);
}
#mode-menu[hidden] {
  display: none;
}
#mode-menu button {
  display: grid;
  grid-template-columns: 1fr auto;
  width: 100%;
  text-align: left;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--fg);
  font: inherit;
  padding: 7px 9px;
  cursor: pointer;
}
#mode-menu button:hover {
  background: var(--surface);
}
#mode-menu .t {
  font-size: 13px;
}
#mode-menu .d {
  grid-column: 1;
  font-size: 11.5px;
  color: var(--muted);
}
#mode-sheets {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
#mode-sheets[hidden] {
  display: none;
}
#mode-sheets > .d {
  display: block;
  padding: 0 9px 2px;
}
#mode-menu button[aria-checked="true"]::after {
  content: "✓";
  grid-column: 2;
  grid-row: 1;
  color: var(--accent);
}
#composer textarea::placeholder {
  color: var(--muted);
}
#send {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-fg);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition:
    background 140ms var(--ease),
    transform 120ms var(--ease);
  flex: 0 0 auto;
}
#send:hover {
  background: var(--accent-hover);
}
#send:active {
  transform: scale(0.95);
}
/* ---- "What's new" (whats-new.js): the notice after an update, the dot on the cog, the list */
#whats-new-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 12px 0;
  padding: 7px 8px 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-elev);
  font-size: 12.5px;
  color: var(--fg-2);
}
#whats-new-note[hidden] {
  display: none;
}
#whats-new-note .t {
  flex: 1 1 auto;
  min-width: 0;
}
#whats-new-note b {
  color: var(--fg);
  font-weight: 600;
}
#whats-new-note button {
  flex: 0 0 auto;
  border: 0;
  background: none;
  color: var(--fg);
  font: inherit;
  cursor: pointer;
  padding: 2px;
}
#whats-new-note .link {
  font-weight: 600;
  text-decoration: underline;
}
#whats-new-note .x {
  display: inline-flex;
  color: var(--muted);
}
#config-btn {
  position: relative;
}
#config-btn.has-news::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bad);
}
#whats-new .release {
  padding: 2px 0 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
#whats-new .release .head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
#whats-new .release .when {
  font-size: 12px;
  color: var(--muted);
}
#whats-new .release .here {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-fg);
}
#whats-new .release ul {
  margin: 6px 0 0;
  padding-left: 18px;
  font-size: 12.5px;
  color: var(--fg-2);
}
#whats-new .release li {
  margin: 4px 0;
}
#whats-new .release li b {
  color: var(--fg);
}
#whats-new .earlier summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 12px;
}
/* ---- messages waiting while a request runs (message-queue.js) */
#queue {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 12px 0;
}
#queue .queued {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px 5px 10px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  font-size: 12px;
  color: var(--fg-2);
}
#queue .queued.steering {
  border-style: solid;
  border-color: var(--accent);
}
#queue .t {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#queue .s {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
}
#queue button {
  flex: 0 0 auto;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: none;
  color: var(--fg-2);
  font: inherit;
  font-size: 11.5px;
  padding: 2px 8px;
  cursor: pointer;
}
#queue button.icon {
  display: inline-flex;
  border-color: transparent;
  padding: 3px;
  color: var(--muted);
}
#queue button:hover {
  color: var(--fg);
  background: var(--surface);
}
#composer .hint {
  display: none;
}

/* ---- undo toast */
#toast {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 150px; /* above the composer card */
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  background: var(--fg);
  color: var(--bg);
  font-size: 12.5px;
  box-shadow: var(--shadow);
  animation: sidecar-in 200ms var(--ease) both;
}
#toast .t-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#toast button {
  border: none;
  background: transparent;
  color: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
#toast button:hover {
  background: rgba(255, 255, 255, 0.12);
}
[data-theme="dark"] #toast button:hover {
  background: rgba(0, 0, 0, 0.15);
}

/* ---- panels (settings, chats, audit) */
.panel {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 40;
  display: flex;
  flex-direction: column;
}
.panel .panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 10px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 14px;
}
.panel .panel-head .icon-btn {
  margin-left: auto;
}
.panel .panel-head .back-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px 5px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: none;
  color: var(--fg);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.panel .panel-head .back-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.panel .panel-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 16px 20px;
}
:is(#config, #report) .hint {
  color: var(--muted);
  font-size: 12px;
  margin: 0 0 14px;
}
:is(#config, #report) .section {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 18px 0 8px;
  font-weight: 600;
}
:is(#config, #report) label {
  display: block;
  font-size: 12px;
  color: var(--fg-2);
  margin-bottom: 10px;
}
:is(#config, #report) input,
:is(#config, #report) select {
  display: block;
  width: 100%;
  margin-top: 4px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 9px;
  background: var(--bg-elev);
  color: var(--fg);
  font: inherit;
  font-size: 13px;
}
:is(#config, #report) select {
  appearance: auto;
}
:is(#config, #report) input:focus,
:is(#config, #report) select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
:is(#config, #report) .row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
}
:is(#config, #report) .row button {
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: 12.5px;
  line-height: 18px;
  border: 1px solid transparent;
}
:is(#config, #report) .primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}
:is(#config, #report) .primary:hover {
  background: var(--accent-hover);
}
:is(#config, #report) .row button:not(.primary) {
  background: transparent;
  color: var(--fg-2);
  border: 1px solid var(--border-strong);
}
:is(#config, #report) .row button:not(.primary):hover {
  background: var(--surface);
  color: var(--fg);
}
:is(#config, #report) .err {
  color: var(--bad);
  font-size: 12px;
  flex-basis: 100%;
}
:is(#config, #report) .row.dev {
  margin-top: 0;
}
:is(#config, #report) .row.dev button {
  font-weight: 500;
  font-size: 12px;
  padding: 5px 11px;
  color: var(--muted);
}
/* Connected MCP services in Settings */
.mcp-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mcp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface);
  font-size: 12px;
}
.mcp-name {
  font-weight: 500;
  flex: 1 1 auto;
}
.mcp-state {
  color: var(--muted);
  font-size: 11.5px;
}
.mcp-btn {
  padding: 3px 9px;
  font-size: 11.5px;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--fg);
  cursor: pointer;
}
.mcp-btn:hover {
  background: var(--bg);
}

:is(#config, #report) .sub {
  display: block;
  margin-top: 5px;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--muted);
}
:is(#config, #report) label.check {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
}
/* a checkbox's explanation goes under its label, lined up with the label's text, not squeezed beside it */
:is(#config, #report) label.check .sub {
  flex-basis: 100%;
  margin: -4px 0 0 24px;
}
:is(#config, #report) label.check input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
  flex: 0 0 auto;
}
:is(#config, #report) select {
  accent-color: var(--accent);
}
/* Report an issue: the settings form's look; the ticket link reads as a link */
#report a {
  color: var(--accent);
  font-weight: 600;
}
/* Settings → Your playbooks */
#config .playbook-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--border);
  padding: 8px 0;
}
#config .playbook-row .chat-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
#config .playbook-row .name {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
}
#config .playbook-row .when {
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#config .playbook-row .link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
}
#config .playbook-row .link.danger {
  color: var(--bad);
}
#config .playbook-form textarea {
  min-height: 220px;
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 12px;
}
#config p.err,
#config #cfg-sync.err {
  color: var(--bad);
  font-size: 12px;
}
#chats .chat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding: 9px 0;
}
#chats .chat-row:first-of-type {
  border-top: none;
}
#chats .chat-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
#chats .chat-row .link {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  color: var(--fg);
  cursor: pointer;
  padding: 0;
  font: inherit;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#chats .chat-row .link:hover {
  color: var(--accent);
  text-decoration: underline;
}
#chats .chat-row.current .link {
  color: var(--accent);
  font-weight: 600;
}
#chats .chat-row .when {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#chats .chats-heading {
  margin-top: 16px;
  padding-bottom: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}
#chats .chat-row .icon-btn {
  flex: 0 0 auto;
  opacity: 0.6;
}
#chats .chat-row:hover .icon-btn {
  opacity: 1;
}
#chats .entry {
  color: var(--muted);
  font-size: 12.5px;
  padding: 6px 0;
}
#chats button.primary {
  align-self: flex-start;
  background: var(--accent);
  color: var(--accent-fg);
  border: none;
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 10px;
}
#chats .chats-actions {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  flex-wrap: wrap;
}
#chats #download-current {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  color: var(--fg);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
#chats #download-current:hover {
  background: var(--surface);
}
#chats button.danger {
  margin-top: 14px;
  background: none;
  border: 1px solid var(--bad);
  color: var(--bad);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  cursor: pointer;
  font-size: 12px;
}
#audit .entry {
  border-top: 1px solid var(--border);
  padding: 7px 0;
  font-size: 12px;
  color: var(--muted);
}
#audit .entry b {
  color: var(--fg);
  font-weight: 600;
}

/* ---- benchmark banner */
#eval-banner {
  padding: 8px 14px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--border);
}
#eval-banner button {
  margin-left: auto;
  border: 1px solid currentColor;
  background: none;
  color: inherit;
  border-radius: 999px;
  padding: 2px 10px;
  cursor: pointer;
  font-size: 11.5px;
}

/* self-test report */
.card .report-row {
  display: flex;
  gap: 8px;
  padding: 4px 12px;
  font-size: 12px;
  border-top: 1px solid var(--border);
}
.card .report-row.ok {
  color: var(--fg-2);
}
.card .report-row.fail {
  color: var(--bad);
}

/* trusted scripts (reads, and writes to the assistant's own slides): one expandable row, code behind a click */
.card.compact {
  border-color: var(--border);
}
.card.compact > summary.head {
  padding: 7px 12px;
  font-weight: 500;
  font-size: 12.5px;
  cursor: pointer;
  list-style: none;
  gap: 8px;
}
.card.compact > summary.head::-webkit-details-marker {
  display: none;
}
.card.compact > summary.head .purpose {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--fg-2);
}
.card.compact > summary.head .verdict {
  text-transform: none;
  letter-spacing: 0;
}
.card.compact > summary.head svg.i.sm {
  flex: 0 0 auto;
}
.card.compact > summary.head svg.i.spin {
  color: var(--accent);
  animation: sidecar-spin 1s linear infinite;
}
.card.compact > summary.head svg.i.good {
  color: var(--ok);
}
.card.compact > summary.head svg.i.bad {
  color: var(--bad);
}
.card.compact[open] > summary.head {
  border-bottom: 1px solid var(--border);
}
.card.compact pre.code {
  border-top: none;
}

/* attachments: chips above the composer for files waiting to go with the next message */
#attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px 0;
}
/* a reference in a reply (Excel): a chip that goes to the range, sheet, table or name */
.msg .body button.ref {
  display: inline;
  font: inherit;
  font-size: 0.95em;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-radius: 6px;
  padding: 0 5px;
  margin: 0 1px;
  cursor: pointer;
  white-space: nowrap;
}
.msg .body button.ref::after {
  content: " ↗";
  font-size: 0.85em;
}
.msg .body button.ref:hover {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}
.msg .body button.ref code {
  background: none;
  padding: 0;
  color: inherit;
}
#selection-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 4px;
  max-width: 100%;
  width: fit-content;
  padding: 3px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-elev);
  color: var(--muted);
  font-size: 12px;
}
#selection-chip[hidden] {
  display: none;
}
#selection-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#attachments .att {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 6px 4px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-elev);
  font-size: 12px;
  color: var(--fg-2);
}
#attachments .att .n {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}
#attachments .att .m {
  color: var(--muted);
  font-size: 11px;
}
#attachments .att button {
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0 2px;
  display: grid;
  place-items: center;
}
#attachments .att button:hover {
  color: var(--fg);
}
#attach-btn {
  flex: 0 0 auto;
  margin-bottom: 3px;
  position: relative;
}
#attach-file {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}
#attach-file:focus {
  outline: none;
}
/* inset: the composer card clips anything drawn outside it */
#attach-btn:has(#attach-file:focus-visible) {
  box-shadow: inset 0 0 0 2px var(--accent);
}
.msg.user .atts {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.msg.user .atts span {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--fg) 10%, transparent);
}
:is(#config, #report) textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  color: var(--fg);
  font: inherit;
  font-size: 13px;
  padding: 8px 10px;
  margin-top: 4px;
}
/* standing instructions: room to read and edit a long set (Claude's is about this size) */
#config #cfg-instructions {
  min-height: 260px;
  max-height: calc(70vh / var(--zoom, 1));
  line-height: 1.45;
}
#config .about {
  font-variant-numeric: tabular-nums;
  user-select: text;
}
#cfg-about-row:has(button:not([hidden])) {
  margin-bottom: 14px;
}
#config .text-size {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 12px;
}
#config .text-size .label {
  display: block;
  font-size: 12px;
  color: var(--fg-2);
}
#config .text-size .stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
}
#config .text-size .stepper button {
  width: 32px;
  height: 30px;
  border: none;
  background: none;
  color: var(--fg);
  font: inherit;
  font-size: 16px;
  cursor: pointer;
}
#config .text-size .stepper button:disabled {
  color: var(--muted);
  cursor: default;
}
#config .text-size output {
  min-width: 48px;
  text-align: center;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
#config .sub.count {
  font-variant-numeric: tabular-nums;
}
#config .sub.count.err {
  color: var(--bad);
}
/* instructions and skill cards: before/after text, and the playbook behind a click */
.card .diff {
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  line-height: 1.45;
}
.card .diff .old {
  color: var(--muted);
  text-decoration: line-through;
  white-space: pre-wrap;
}
.card .diff .new {
  color: var(--fg);
  white-space: pre-wrap;
}
.card .diff .lbl {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 4px 0 2px;
}
.card pre.skill {
  margin: 0;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  font: inherit;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow: auto;
}

/* step rows folded under one line once the reply has landed */
details.steps-folded {
  margin: 0 0 10px;
}
details.steps-folded > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  min-height: 22px;
}
details.steps-folded > summary::-webkit-details-marker {
  display: none;
}
details.steps-folded > summary svg.i {
  color: var(--ok);
}
details.steps-folded > summary::after {
  content: "";
  width: 5px;
  height: 5px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  margin-left: 2px;
  opacity: 0.7;
  transition: transform 140ms var(--ease);
}
details.steps-folded[open] > summary::after {
  transform: rotate(-135deg);
}
details.steps-folded > summary:hover {
  color: var(--fg-2);
}
details.steps-folded > .steps {
  margin-top: 4px;
}

/* the work trail (#1801): finished work between two pieces of reply text, folded under one line in
   the steps-folded look. The line wraps in its own column, so the icon, the Flagged chip and the
   chevron stay on its first line at any width. */
details.work-trail {
  margin: 0 0 10px;
}
details.work-trail > summary {
  list-style: none;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: start;
  column-gap: 7px;
  font-size: 12px;
  line-height: 18px;
  padding: 2px 0;
  color: var(--muted);
  cursor: pointer;
  min-height: 22px;
  border-radius: var(--radius-sm);
}
details.work-trail > summary::-webkit-details-marker {
  display: none;
}
details.work-trail > summary svg.i {
  color: var(--ok);
  margin-top: 2px;
}
details.work-trail.warn > summary svg.i {
  color: var(--warn);
}
details.work-trail > summary .trail-text {
  overflow-wrap: anywhere;
}
details.work-trail > summary .trail-flag {
  grid-column: 3;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
details.work-trail > summary::after {
  content: "";
  grid-column: 4;
  width: 5px;
  height: 5px;
  margin: 5px 2px 0;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.7;
  transition: transform 140ms var(--ease);
}
details.work-trail[open] > summary::after {
  transform: rotate(-135deg);
  margin-top: 8px;
}
details.work-trail > summary:hover {
  color: var(--fg-2);
}
details.work-trail > summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
details.work-trail > .trail-body {
  margin-top: 6px;
}

/* read by screen readers, not shown */
.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;
}
/* Settings: one section open at a time; a closed one says what it is set to */
#config .cfg-group {
  border-top: 1px solid var(--border);
}
#config .cfg-group:last-of-type {
  border-bottom: 1px solid var(--border);
}
#config .cfg-group > summary {
  list-style: none;
  cursor: pointer;
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 8px;
  align-items: center;
  padding: 11px 2px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
}
#config .cfg-group > summary::-webkit-details-marker {
  display: none;
}
#config .cfg-group > summary::after {
  content: "";
  grid-row: 1 / span 2;
  grid-column: 2;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.15s var(--ease);
}
#config .cfg-group[open] > summary::after {
  transform: rotate(45deg);
}
#config .cfg-group > summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-radius: var(--radius-sm, 6px);
}
#config .cfg-summary {
  grid-column: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  font-weight: 400;
  color: var(--muted);
}
#config .cfg-summary:empty,
#config .cfg-group[open] > summary .cfg-summary {
  display: none;
}
#config .cfg-body {
  padding: 2px 2px 8px;
}
/* Save sits below the scrolling body, so it and its error stay in view */
#config .cfg-actions {
  flex: 0 0 auto;
  margin: 0;
  padding: 10px 16px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}
/* Settings: developer tools folded away under About */
.panel details.dev-tools {
  margin-top: 12px;
  font-size: 12.5px;
}
.panel details.dev-tools summary {
  cursor: pointer;
  color: var(--muted);
}

/* the reviewer's flag reads as a sentence, not a shouted tag; so does "Not reviewed" (muted) */
.card .head .verdict.risky,
.card .head .verdict.reject,
.card .head .verdict.unreviewed {
  text-transform: none;
  letter-spacing: 0;
  font-size: 11.5px;
}
/* a change row with more to show: a chevron button opens the full text below it */
.card .edit-top.can-open {
  cursor: pointer;
}
.card .edit-more {
  flex: 0 0 auto;
  align-self: center;
  margin-left: auto;
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
}
.card .edit-more::before {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: translateY(-2px) rotate(45deg);
  transition: transform 140ms var(--ease);
}
.card .edit.open .edit-more::before {
  transform: translateY(2px) rotate(-135deg);
}
.card .edit-more:hover {
  background: var(--surface-2);
}

/* ---- attach menu and the SharePoint and OneDrive browser (OFFICE-19) */
#composer .attach-wrap {
  position: relative;
  flex: 0 0 auto;
  margin-bottom: 3px;
}
#attach-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  z-index: 20;
  width: 260px;
  padding: 4px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--bg-elev);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.18);
}
#attach-menu .item,
#attach-menu button {
  position: relative;
  display: grid;
  width: 100%;
  text-align: left;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--fg);
  font: inherit;
  padding: 7px 9px;
  cursor: pointer;
}
#attach-menu .item:hover,
#attach-menu button:hover,
#attach-menu .item:has(#attach-file:focus-visible) {
  background: var(--surface);
}
#attach-menu .t {
  font-size: 13px;
}
#attach-menu .d {
  font-size: 11.5px;
  color: var(--muted);
}
#files form {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
#files input[type="search"] {
  flex: 1 1 auto;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  color: var(--fg);
  font: inherit;
  font-size: 13px;
}
#files nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
#files .crumb {
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  padding: 2px 0;
}
#files button.crumb {
  cursor: pointer;
  text-decoration: underline;
}
#files span.crumb {
  color: var(--fg);
  font-weight: 600;
}
#files [data-files="status"] {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--muted);
}
#files [data-files="status"]:empty {
  display: none;
}
#files [data-files="status"].error {
  color: var(--bad);
}
#files .files-heading {
  margin: 12px 0 4px;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
#files .files-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 6px 8px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--fg);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
#files .files-row:hover:not(:disabled),
#files .files-row:focus-visible {
  background: var(--surface);
}
#files .files-row:disabled {
  cursor: default;
}
#files .files-row.blocked {
  opacity: 0.55;
}
#files .files-row.busy {
  background: var(--surface);
}
#files .files-text {
  display: grid;
  min-width: 0;
}
#files .files-text .n {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#files .files-text .d {
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#files .files-empty {
  margin: 4px 8px;
  font-size: 12px;
  color: var(--muted);
}

.picture-preview {
  display: block;
  max-width: 100%;
  width: 240px;
  max-height: 180px;
  object-fit: contain;
  border-radius: 6px;
  margin: 8px 0;
}

/* "/" skill list above the message box (SWE-2913) */
#skill-list {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 35; /* above the toast (30): the user is choosing from it */
  max-height: 260px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--bg-elev);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.18);
}
#skill-list[hidden] {
  display: none;
}
#skill-list .skill-option {
  display: grid;
  gap: 1px;
  padding: 6px 9px;
  border-radius: 8px;
  cursor: pointer;
}
#skill-list .skill-option[aria-selected="true"],
#skill-list .skill-option:hover {
  background: var(--surface);
}
#skill-list .t {
  font-size: 13px;
  color: var(--fg);
}
#skill-list .d {
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* "Files in this chat" (SWE-2916): the bar's "N files" button opens the list of files sent earlier,
   each with a × that removes it from the chat after a confirm */
#files-btn {
  white-space: nowrap;
}
#files-btn[hidden],
#files-panel[hidden] {
  display: none;
}
#files-panel {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 35; /* above the toast (30), like the "/" skill list */
  max-height: 280px;
  overflow-y: auto;
  padding: 4px 6px 6px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--bg-elev);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.18);
  font-size: 12px;
}
#files-panel .cf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 6px;
  font-weight: 600;
  color: var(--fg);
}
#files-panel .cf-file {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-top: 1px solid var(--border);
  color: var(--fg-2);
}
#files-panel .cf-file .n {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#files-panel .cf-file .m {
  color: var(--muted);
  font-size: 11px;
}
#files-panel .cf-x,
#files-panel .cf-close {
  min-width: 24px;
  height: 24px;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
#files-panel .cf-x:hover,
#files-panel .cf-close:hover {
  background: var(--surface);
  color: var(--fg);
}
#files-panel .cf-confirm {
  display: grid;
  gap: 4px;
  margin: 4px 0;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent);
  border-radius: 10px;
  background: var(--bad-soft);
  color: var(--fg-2);
}
#files-panel .cf-confirm b {
  color: var(--fg);
  overflow-wrap: anywhere;
}
#files-panel .cf-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}
#files-panel .cf-actions button {
  padding: 4px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--bg-elev);
  color: var(--fg);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
#files-panel .cf-actions .cf-remove {
  border-color: var(--bad);
  background: var(--bad);
  color: var(--bg-elev);
}
