/* app.css
 *
 * Chat surface for the Pasons office agent. Warm paper canvas, one clay
 * accent, chats on the left, conversation centred in a single column, an
 * optional workspace panel on the right. Light and dark from the same tokens,
 * no gradients, numbers in tabular figures.
 *
 * Radius scale: 16px for the composer and panels, 10px for inner rows,
 * full pill for buttons and chips. Followed everywhere on purpose.
 */

:root {
  --paper: #fbfaf7;
  --side: #f4f2ec;
  --surface: #ffffff;
  --sunk: #f6f4ee;
  --ink: #23211c;
  --ink-soft: #4b4841;
  --muted: #6e6b62;
  --line: #e9e6dc;
  --line-strong: #d8d4c7;
  --accent: #c4644a;
  --accent-text: #a9533b;
  --accent-soft: #f6e7e1;
  --bubble: #efede5;
  --ok: #2f7a5e;
  --warn: #a9740f;
  --danger: #a63a2a;
  --danger-soft: #fbeeeb;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(35, 33, 28, 0.05);
  --shadow-md: 0 14px 34px -24px rgba(35, 33, 28, 0.5);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  /* the reading column: answers are read, not scanned, so the measure is
     held near 70 characters, centred, with the space either side left calm.
     The conversation, the task dock and the composer all share it. */
  --chat-w: 768px;
  /* answers are set like a report, in a book face made for screens; the
     interface around them stays in the sans */
  --serif: Charter, "Bitstream Charter", "Iowan Old Style", "Source Serif 4", "Noto Serif", Georgia, Cambria, serif;
  --gutter: clamp(18px, 2.4vw, 36px);
  --side-w: 288px;
  --inspector-w: 340px;
  --top-h: 56px;
  /* the panel is meant to be read, not squinted at: half the window by
     default, then dragged by the seam between chat and preview */
  --preview-w: clamp(460px, 50vw, 1120px);
}

/* ------------------------------------------------------------- dark theme */

/* Same warm character at night: deep brown-grey paper, cream ink, the clay
   accent a step lighter so it still reads. The system setting decides unless
   the reader picked one with the moon button. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1c1b18;
    --side: #171613;
    --surface: #24221e;
    --sunk: #201f1b;
    --ink: #ece8de;
    --ink-soft: #cfcabd;
    --muted: #9b968a;
    --line: #34312b;
    --line-strong: #46423a;
    --accent: #d9785c;
    --accent-text: #e48d72;
    --accent-soft: #3a2a23;
    --bubble: #2c2a25;
    --ok: #4fae88;
    --warn: #d6a13a;
    --danger: #e0705e;
    --danger-soft: #3a2420;
    --shadow-md: 0 14px 34px -20px rgba(0, 0, 0, 0.8);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #1c1b18;
  --side: #171613;
  --surface: #24221e;
  --sunk: #201f1b;
  --ink: #ece8de;
  --ink-soft: #cfcabd;
  --muted: #9b968a;
  --line: #34312b;
  --line-strong: #46423a;
  --accent: #d9785c;
  --accent-text: #e48d72;
  --accent-soft: #3a2a23;
  --bubble: #2c2a25;
  --ok: #4fae88;
  --warn: #d6a13a;
  --danger: #e0705e;
  --danger-soft: #3a2420;
  --shadow-md: 0 14px 34px -20px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* the hidden attribute must beat any display rule below, as the HTML standard
   itself specifies. Author display rules otherwise override the UA default. */
[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
  cursor: pointer;
}

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

.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: flex;
  height: 100dvh;
  overflow: hidden;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

/* ---------------------------------------------------------------- sidebar */

.sidebar {
  display: flex;
  flex-direction: column;
  flex: none;
  width: var(--side-w);
  min-height: 0;
  background: var(--side);
  border-right: 1px solid var(--line);
}

.side-head {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--top-h);
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  flex: none;
}

.brand-name {
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.icon-btn.side-close {
  display: none;
  margin-left: auto;
}

.side-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 14px 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.side-panel {
  padding: 14px 2px;
  border-bottom: 1px solid var(--line);
}

.side-panel:last-child {
  border-bottom: none;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}

.panel-head h2 {
  margin: 0;
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: -0.005em;
  color: var(--muted);
}

.count {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.empty-line {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.45;
}

/* --------------------------------------------------------------- sidebar */

.side-foot {
  flex: none;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
}

.topbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: var(--top-h);
  padding: 0 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.icon-btn.menu-btn {
  display: none;
}

.topbar-title {
  display: none;
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 13px;
  border: 1px solid transparent;
}

.btn.ghost {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink-soft);
  transition: border-color 140ms ease, color 140ms ease, transform 120ms ease;
}

.btn.ghost:hover {
  border-color: var(--ink-soft);
  color: var(--ink);
}

.btn.ghost:active {
  transform: scale(0.98);
}

/* ------------------------------------------------------------------ chat */

.chat {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.messages {
  flex: 1;
  min-height: 0;
  width: 100%;
  padding: 36px max(var(--gutter), calc((100% - var(--chat-w)) / 2)) 40px;
  display: flex;
  flex-direction: column;
  /* more room between turns than inside one, so a question and its answer
     read as a pair */
  gap: 30px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.messages.is-dragging {
  outline: 2px dashed var(--accent);
  outline-offset: -8px;
  border-radius: var(--radius);
}

/* Empty conversation: greeting, composer and prompts sit as one centred
   group in the middle of the screen. The class drops on the first message. */

.chat.is-empty {
  justify-content: center;
}

/* Safe keyword keeps the top of a tall group reachable on short screens;
   browsers without it drop this line and keep the centred rule above. */
.chat.is-empty {
  justify-content: safe center;
}

.chat.is-empty .messages {
  flex: 0 1 auto;
  min-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  overflow: visible;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.chat.is-empty .composer {
  flex: none;
}

/* ----------------------------------------------------------------- empty */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.hero-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-text);
}

.empty h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 640;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.empty p {
  margin: 0;
  max-width: 46ch;
  color: var(--ink-soft);
  font-size: 15px;
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: min(var(--chat-w), calc(100% - 2 * var(--gutter)));
  margin: 0 auto;
  padding: 4px 0 6px;
}

.chip {
  padding: 8px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
  color: var(--ink-soft);
  transition: border-color 140ms ease, color 140ms ease, transform 120ms ease;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent-text);
}

.chip:active {
  transform: scale(0.98);
}

/* --------------------------------------------------------------- messages */

.msg {
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: rise 180ms ease-out both;
}

.msg.user {
  align-items: flex-end;
}

.msg.user .bubble {
  max-width: 85%;
  padding: 11px 16px;
  border-radius: 20px 20px 6px 20px;
  font-size: 15px;
  line-height: 1.55;
  background: var(--bubble);
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg.assistant .bubble {
  width: 100%;
  color: var(--ink);
}

.msg.system .bubble {
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13.5px;
}

.msg-meta {
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.attachment-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  margin-bottom: 6px;
}

.attach-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  font-size: 11.5px;
  color: var(--ink-soft);
}

/* ------------------------------------------------------------------ prose */

.prose {
  overflow-wrap: anywhere;
}

.msg.assistant .prose {
  font-family: var(--serif);
  font-size: 16.5px;
  line-height: 1.68;
  color: var(--ink);
  font-feature-settings: "kern", "liga", "onum" 0;
}

.prose > *:first-child {
  margin-top: 0;
}

.prose > *:last-child {
  margin-bottom: 0;
}

.prose p {
  margin: 0 0 0.85em;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  margin: 1.5em 0 0.5em;
  font-size: 1.08em;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.005em;
}

.prose h1 {
  font-size: 1.3em;
}

.prose h2 {
  font-size: 1.17em;
}

.prose ul,
.prose ol {
  margin: 0 0 0.85em;
  padding-left: 1.4em;
}

.prose li {
  margin: 0.3em 0;
  padding-left: 0.15em;
}

.prose li::marker {
  color: var(--muted);
}

.prose strong {
  font-weight: 700;
}

.prose blockquote {
  margin: 0.9em 0;
  padding: 2px 0 2px 16px;
  border-left: 3px solid var(--line-strong);
  color: var(--ink-soft);
}

.prose hr {
  margin: 1.6em 0;
  border: none;
  border-top: 1px solid var(--line);
}

.prose code {
  font-family: var(--mono);
  font-size: 0.88em;
  padding: 1px 5px;
  border-radius: 6px;
  background: var(--sunk);
  border: 1px solid var(--line);
}

.prose pre {
  margin: 10px 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--sunk);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.5;
}

.prose pre code {
  padding: 0;
  border: none;
  background: none;
  color: inherit;
}

/* figures are compared, not read: tables keep the sans and tabular digits,
   and a wide one scrolls inside the column instead of breaking it */
.prose table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 1em 0;
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}

.prose th,
.prose td {
  padding: 8px 14px 8px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.prose .num {
  padding-left: 18px;
  text-align: right;
  /* a figure is never split across lines; the table scrolls instead */
  white-space: nowrap;
}

.prose td,
.prose th {
  overflow-wrap: normal;
}

.prose th:last-child,
.prose td:last-child {
  padding-right: 0;
}

.prose th {
  font-weight: 600;
  font-size: 12.5px;
  color: var(--muted);
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}

.caret {
  display: inline-block;
  width: 7px;
  height: 15px;
  margin-left: 2px;
  vertical-align: -2px;
  background: var(--accent);
  animation: blink 1s steps(2, start) infinite;
}

/* ----------------------------------------------------------------- tool rows */

/* One row per call, a hairline apart, quieter than the head that holds them.
   A row opens on its own so a bash command can be read without unfolding the
   whole run. */

.tool {
  border-top: 1px solid var(--line);
}

.tool:first-child {
  border-top: none;
}

.tool-head {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  font-size: 12px;
  text-align: left;
  transition: background 120ms ease;
}

.tool-head:hover {
  background: var(--bubble);
}

.tool-head:active {
  background: var(--bubble);
}

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

/* a call that is still running has nothing to show yet, and a call that only
   read something has no output worth unfolding */
.tool.is-running .tool-head,
.tool:not(.has-body) .tool-head {
  cursor: default;
}

.tool.is-running .tool-head:hover,
.tool:not(.has-body) .tool-head:hover {
  background: none;
}

.tool:not(.has-body) .tool-chevron {
  visibility: hidden;
}

.tool-status {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warn);
  flex: none;
  animation: pulse 1.2s ease-in-out infinite;
}

.tool.is-ok .tool-status {
  background: var(--ok);
  animation: none;
}

.tool.is-failed .tool-status {
  background: var(--danger);
  animation: none;
}

.tool-name {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink);
  flex: none;
}

.tool-args {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}

.tool-chevron {
  width: 13px;
  height: 13px;
  margin-left: auto;
  flex: none;
  color: var(--muted);
  transition: transform 320ms cubic-bezier(0.2, 0.8, 0.2, 1), color 160ms ease;
}

.tool:hover .tool-chevron,
.run-head:hover .tool-chevron,
.thought-head:hover .tool-chevron {
  color: var(--ink-soft);
}

.tool.is-open .tool-chevron {
  transform: rotate(90deg);
}

.tool-body-inner {
  position: relative;
  border-top: 1px solid var(--line);
  padding: 9px 11px;
  background: var(--surface);
}

.tool-body-inner pre {
  margin: 0;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--ink-soft);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 260px;
  overflow: auto;
}

.tool.is-failed .tool-body-inner {
  background: var(--danger-soft);
}

/* ------------------------------------------------------------------ todos */

.todos {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.todos li {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-soft);
}

.todo-box {
  width: 15px;
  height: 15px;
  margin-top: 1px;
  border: 1.5px solid var(--line-strong);
  border-radius: 5px;
  flex: none;
  display: grid;
  place-items: center;
  color: transparent;
}

.todos li.done .todo-box {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.todos li.done span.label {
  color: var(--muted);
  text-decoration: line-through;
}

.todos li.active .todo-box {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 3px var(--accent-soft);
}

.todo-box svg {
  width: 9px;
  height: 9px;
}

/* ------------------------------------------------------- question options */

.question {
  margin-top: 4px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.question p {
  margin: 0 0 10px;
  font-weight: 560;
}

.question-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* --------------------------------------------------------------- composer */

.composer {
  width: min(var(--chat-w), calc(100% - 2 * var(--gutter)));
  margin: 0 auto;
  padding: 6px 0 14px;
  flex: none;
}

/* the box holds the files waiting to be sent and the input row, so the
   tiles read as part of the message, the way Claude shows them */
.composer-box {
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(35, 33, 28, 0.04), 0 10px 30px -18px rgba(35, 33, 28, 0.35);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.composer-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 10px 10px 12px;
}

.composer-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(196, 100, 74, 0.1), 0 10px 30px -18px rgba(35, 33, 28, 0.35);
}

#input {
  flex: 1;
  min-height: 30px;
  max-height: 240px;
  padding: 7px 2px;
  font-size: 15.5px;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  font: inherit;
  color: var(--ink);
  line-height: 1.45;
}

/* the hint stays on one line: wrapped, it made the empty box scroll */
#input::placeholder {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#input:placeholder-shown {
  overflow: hidden;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  flex: none;
  transition: color 140ms ease, background 140ms ease;
}

.icon-btn:hover {
  color: var(--ink);
  background: var(--sunk);
}

.icon-btn.is-recording {
  color: #fff;
  background: var(--danger);
  animation: pulse 1.2s ease-in-out infinite;
}

.send-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  font-weight: 550;
  flex: none;
  transition: background 140ms ease, transform 120ms ease, opacity 140ms ease;
}

.send-btn:hover:not(:disabled) {
  opacity: 0.86;
}

.send-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.send-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.hint {
  margin: 8px 4px 0;
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
}

.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 12px 2px;
}

.attach-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  width: 120px;
  height: 118px;
  padding: 10px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--sunk);
  animation: rise 180ms ease-out both;
}

.attach-tile-name {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.attach-tile-kind {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  align-self: flex-start;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--bubble);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.attach-tile-remove {
  position: absolute;
  top: -7px;
  right: -7px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  opacity: 0;
  transition: opacity 120ms ease, color 120ms ease;
}

.attach-tile:hover .attach-tile-remove,
.attach-tile-remove:focus-visible {
  opacity: 1;
}

.attach-tile-remove:hover {
  color: var(--danger);
}

@media (hover: none) {
  .attach-tile-remove {
    opacity: 1;
  }
}

.attach-tile.is-uploading {
  opacity: 0.75;
}

.spinner {
  width: 9px;
  height: 9px;
  border: 1.6px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

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

/* --------------------------------------------------------- sidebar lists */

.files,
.reports {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.files li,
.reports li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px 4px;
  font-size: 12.5px;
  min-width: 0;
}

/* the name and its size stack in the first column, and the save mark holds the
   right edge so a row reads as one line of text with one action beside it */
.files li > .file-name,
.files li > .file-meta,
.reports li > .report-link,
.reports li > .report-meta,
.files li > .empty-line,
.reports li > .empty-line {
  grid-column: 1;
}

.files li > .file-download,
.reports li > .file-download {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
}

.file-name,
.report-link {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  text-decoration: none;
  overflow-wrap: anywhere;
}

/* an uploaded file that the preview panel can open behaves like a link, and
   says so with an eye that appears under the pointer */
button.file-name.is-openable {
  width: 100%;
  padding: 0;
  text-align: left;
  font: inherit;
  color: var(--ink);
  border-radius: 4px;
  transition: color 140ms ease;
}

.file-open-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-open-icon {
  flex: none;
  color: var(--muted);
  opacity: 0.55;
  transition: opacity 140ms ease, color 140ms ease;
}

button.file-name.is-openable:hover {
  color: var(--accent-text);
}

button.file-name.is-openable:hover .file-open-icon {
  opacity: 1;
  color: var(--accent);
}

.report-link:hover {
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.file-meta,
.report-meta {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.chats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chats li {
  min-width: 0;
}

.chat-row {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
  line-height: 1.35;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background-color 120ms ease, color 120ms ease;
}

.chat-row:hover {
  background: var(--sunk);
}

.chat-row.is-active {
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 600;
}

/* ------------------------------------------------------------------ scrim */

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(35, 33, 28, 0.38);
  z-index: 25;
}

.scrim[hidden] {
  display: none;
}

/* ------------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 16px);
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 40;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.is-error {
  background: var(--danger);
}

/* --------------------------------------------------------- preview panel */

/* The right-hand panel that shows a report, a workbook, a PDF or an image in
   place. Chat keeps its column beside it, so the window width stops being
   wasted once a file opens. */
.preview {
  display: flex;
  flex-direction: column;
  flex: none;
  width: var(--preview-w);
  min-width: 0;
  min-height: 0;
  background: var(--surface);
  animation: preview-in 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.preview-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--top-h);
  flex: none;
  padding: 0 10px 0 14px;
  border-bottom: 1px solid var(--line);
}

/* a three letter stamp for the file type, the way a filing tab is labelled */
.preview-kind {
  flex: none;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--sunk);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.5;
}

.preview-kind:empty {
  display: none;
}

.preview-name {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* one flex child so a frame and an image share the same stage */
.preview-stage {
  flex: 1;
  display: flex;
  min-width: 0;
  min-height: 0;
}

.preview-frame {
  flex: 1;
  min-width: 0;
  min-height: 0;
  width: 100%;
  border: none;
  background: var(--surface);
}

/* an image floats on the warm canvas like a print on a desk */
.preview-image {
  flex: 1;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 24px;
  object-fit: contain;
  background: var(--sunk);
}

.preview-blank {
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--muted);
  font-size: 13.5px;
  text-align: center;
}

/* ------------------------------------------------------------- the seam */

/* A hairline between the conversation and the file. It reads as the edge of a
   measuring rule: quiet at rest, a clay line under the pointer, the grip grows
   while it is held, and the width is given in figures. */
.splitter {
  position: relative;
  flex: none;
  width: 7px;
  z-index: 5;
  cursor: col-resize;
  touch-action: none;
  background: transparent;
  outline: none;
}

.splitter::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  transform: translateX(-50%);
  background: var(--line);
  transition: width 160ms cubic-bezier(0.2, 0.8, 0.2, 1), background 160ms ease;
}

.splitter:hover::before,
.splitter:focus-visible::before,
.splitter.is-dragging::before {
  width: 2px;
  background: var(--accent);
}

.splitter-grip {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 34px;
  transform: translate(-50%, -50%) scaleY(0.45);
  border-radius: 999px;
  background: var(--line-strong);
  opacity: 0;
  transition: opacity 160ms ease, transform 200ms cubic-bezier(0.2, 0.8, 0.2, 1),
    background 160ms ease;
}

.splitter:hover .splitter-grip,
.splitter:focus-visible .splitter-grip,
.splitter.is-dragging .splitter-grip {
  opacity: 1;
  transform: translate(-50%, -50%) scaleY(1);
  background: var(--accent);
}

.splitter-readout {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translate(-50%, -4px);
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.splitter:hover .splitter-readout,
.splitter.is-dragging .splitter-readout {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* while the seam is held the pointer belongs to it, so the iframe inside the
   preview must not swallow the drag */
body.is-resizing {
  cursor: col-resize;
  user-select: none;
}

body.is-resizing .preview-frame {
  pointer-events: none;
}

/* ------------------------------------------------------------ file chips */

/* A generated file as one clickable card, the way a chat shows an artifact:
   icon, name, kind. Clicking opens the preview panel above. */
.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  padding: 8px 13px 8px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: border-color 140ms ease, transform 120ms ease, box-shadow 140ms ease;
}

.file-chip:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.file-chip:active {
  transform: scale(0.985);
}

.file-chip-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-text);
}

.file-chip-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.file-chip-name {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-chip-kind {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.file-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 2px;
}

/* ------------------------------------------------------------- download */

/* Saving a file is the second thing anyone wants after reading it, so the mark
   sits right beside the file rather than inside a menu. It is quiet at rest and
   gains the accent color under the pointer, so it never competes with the name
   it belongs to. */
.file-chip-group {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 100%;
}

.file-download {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: var(--radius-sm);
  color: var(--muted);
  opacity: 0.7;
  transition: color 140ms ease, background 140ms ease, opacity 140ms ease,
    transform 120ms ease;
}

.file-download:hover {
  color: var(--accent-text);
  background: var(--accent-soft);
  opacity: 1;
}

.file-download:active {
  transform: scale(0.92);
}

/* in a sidebar row the mark is small and stays out of the way until the row is
   pointed at or reached with the keyboard */
.file-download.is-row {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  opacity: 0;
}

.files li:hover .file-download.is-row,
.reports li:hover .file-download.is-row,
.file-download.is-row:focus-visible {
  opacity: 0.75;
}

.files li:hover .file-download.is-row:hover,
.reports li:hover .file-download.is-row:hover,
.file-download.is-row:focus-visible {
  opacity: 1;
}

/* a touch screen has no hover, so the mark stays visible there */
@media (hover: none) {
  .file-download.is-row {
    opacity: 0.65;
  }
}

/* the mark in the preview bar is the loudest of the three: it is the action the
   panel exists to offer after a look */
.preview-download {
  color: var(--accent-text);
  background: var(--accent-soft);
}

.preview-download:hover {
  color: #fff;
  background: var(--accent);
}

.preview-download:active {
  transform: scale(0.94);
}

/* A file path inside prose, shown as a small inline chip. Matches the file
   chips below tools so both read as one affordance. */
.path-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 8px 1px 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--accent-text);
  vertical-align: baseline;
  transition: border-color 140ms ease, background 140ms ease;
}

.path-link:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.path-link:active {
  transform: scale(0.97);
}

/* -------------------------------------------------------------- animation */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes preview-in {
  from {
    opacity: 0;
    transform: translateX(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes preview-in-full {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

/* -------------------------------------------------------------- responsive */

/* ============================================================ office agent */

/* -------------------------------------------------------- left sidebar */

.chat-bucket {
  margin: 12px 4px 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.chat-bucket:first-child {
  margin-top: 2px;
}

.chat-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.chat-item {
  display: flex;
  align-items: center;
  border-radius: var(--radius-sm);
}

.chat-item .chat-row {
  flex: 1;
  min-width: 0;
}

/* a chat still working, perhaps from a tab that was closed */
.chat-running {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 1px;
  animation: pulse 1.1s ease-in-out infinite;
}

.chat-unread {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--ok);
  vertical-align: 1px;
}

.chat-action {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 7px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  opacity: 0;
  transition: opacity 120ms ease, background 120ms ease, color 120ms ease;
}

.chat-item:hover .chat-action,
.chat-item:focus-within .chat-action,
.memory-item:hover .chat-action,
.memory-item:focus-within .chat-action {
  opacity: 1;
}

.chat-action:hover {
  color: var(--ink);
  background: var(--bubble);
}

@media (hover: none) {
  .chat-action {
    opacity: 1;
  }
}

.icon-btn.is-on {
  color: var(--accent-text);
  background: var(--accent-soft);
}

/* ------------------------------------------------------------ answer flow */

/* Pieces of an answer stack in the order they happened, a small gap apart:
   a thought, text, a folded run of tool calls, more text. */
.flow {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flow > .prose:empty {
  display: none;
}

.flow-note {
  font-size: 12.5px;
  color: var(--muted);
  padding: 2px 2px;
}

.flow-note.is-error {
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
}

/* the fold: a grid row that animates from nothing to its content height */
.fold {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 280ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.is-open > .fold {
  grid-template-rows: 1fr;
}

.fold-clip {
  overflow: hidden;
  min-height: 0;
}

/* ----------------------------------------------------------------- thinking */

.thought-head,
.run-head {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 3px 6px 3px 2px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--muted);
  text-align: left;
  transition: color 140ms ease, background 140ms ease;
}

.thought-head:hover,
.run-head:hover {
  color: var(--ink-soft);
  background: var(--sunk);
}

.thought-head .tool-chevron,
.run-head .tool-chevron {
  margin-left: 0;
}

.is-open > .thought-head .tool-chevron,
.is-open > .run-head .tool-chevron {
  transform: rotate(90deg);
}

.thought.is-live .thought-label {
  background: linear-gradient(90deg, var(--muted) 0%, var(--ink) 50%, var(--muted) 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 1.6s linear infinite;
}

.thought-body {
  margin: 4px 0 2px 10px;
  padding: 2px 0 2px 12px;
  border-left: 2px solid var(--line-strong);
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 340px;
  overflow: auto;
}

/* ---------------------------------------------------------------- tool runs */

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

.run.is-live .run-dot {
  background: var(--accent);
  animation: pulse 1.1s ease-in-out infinite;
}

.run.has-failure .run-dot {
  background: var(--danger);
}

.run-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.run.is-live .run-label {
  color: var(--ink-soft);
}

.run-time {
  font-family: var(--mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  flex: none;
}

.run-time:empty {
  display: none;
}

.run-body {
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--sunk);
  overflow: hidden;
}

.run-body > .tool {
  border-top: 1px solid var(--line);
}

.run-body > .tool:first-child {
  border-top: none;
}

/* a helper's own steps, nested in its task card */
.sub-runs {
  margin: 0 11px 8px 22px;
  border-left: 2px solid var(--line-strong);
}

.sub-runs:empty {
  display: none;
}

.sub-runs > .tool {
  border-top: none;
}

.task-result {
  margin: 0 11px 10px 22px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface);
  font-size: 13px;
}

.tool-task > .tool-head .tool-name {
  color: var(--accent-text);
}

.tool-bash .tool-name {
  color: var(--accent-text);
}

/* a command reads like a terminal on any theme: a dark strip, the command in
   green, its output in grey below */
.term {
  position: relative;
  border-radius: 8px;
  background: #0f1720;
  color: #d5dbe3;
  overflow: hidden;
}

.term-cmd {
  margin: 0;
  padding: 10px 40px 8px 12px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  color: #8fd5a6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.term-out {
  margin: 0;
  padding: 8px 12px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.5;
  color: #b9c1cc;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 320px;
  overflow: auto;
}

.tool-body-inner > pre {
  padding-right: 30px;
}

.copy-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  transition: color 120ms ease, background 120ms ease;
}

.term .copy-btn {
  color: #8b96a3;
}

.copy-btn:hover {
  color: var(--ink);
  background: var(--bubble);
}

.term .copy-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.copy-btn.is-done {
  color: var(--ok);
}

.skill-card {
  font-size: 12.5px;
}

.kv-title {
  margin: 2px 0 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
}

.kv {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
  padding: 2px 0;
}

.kv > span:first-child {
  color: var(--muted);
}

.kv > span:last-child {
  font-family: var(--mono);
  font-size: 11.5px;
  overflow-wrap: anywhere;
}

.kv-out {
  margin: 0;
  color: var(--ink-soft);
}

/* an attached image in a sent message */
.attach-thumb {
  display: block;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--sunk);
}

.attach-thumb img {
  display: block;
  max-width: 220px;
  max-height: 160px;
  object-fit: cover;
}

.attach-thumb:hover {
  border-color: var(--accent);
}

/* -------------------------------------------------------- message actions */

.msg.assistant {
  position: relative;
}

.msg-actions {
  display: flex;
  gap: 2px;
  margin-top: 2px;
  opacity: 0;
  transition: opacity 140ms ease;
}

.msg.assistant:hover .msg-actions,
.msg.assistant.is-last .msg-actions,
.msg-actions:focus-within {
  opacity: 1;
}

.msg-action {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: var(--muted);
  transition: color 120ms ease, background 120ms ease;
}

.msg-action:hover {
  color: var(--ink);
  background: var(--sunk);
}

.msg-action.is-on,
.msg-action.is-done {
  color: var(--accent-text);
}

/* only the last answer can be regenerated, only the last question edited */
.msg.assistant:not(.is-last) .msg-action.is-retry,
.msg.user:not(.is-last) .msg-edit {
  display: none;
}

.unverified {
  text-decoration: underline dotted var(--warn);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  cursor: help;
}

.msg-check {
  align-self: center;
  margin-left: 8px;
  font-size: 11px;
  color: var(--ok);
  cursor: help;
}

.msg-check.is-warn {
  color: var(--warn);
}

.msg-usage {
  align-self: center;
  margin-left: 8px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  cursor: help;
}

.activity-total {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}

.activity-total strong {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.activity-total span {
  font-size: 12px;
  color: var(--muted);
}

.activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 12px;
}

.activity-list li {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.msg.user {
  position: relative;
}

.msg-edit {
  align-self: flex-end;
  opacity: 0;
}

.msg.user:hover .msg-edit,
.msg-edit:focus-visible {
  opacity: 1;
}

@media (hover: none) {
  .msg-actions,
  .msg-edit {
    opacity: 1;
  }
}

.edit-box {
  width: min(760px, 100%);
  padding: 10px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
}

.edit-box textarea {
  width: 100%;
  border: none;
  outline: none;
  resize: vertical;
  background: transparent;
  color: var(--ink);
  font: inherit;
  line-height: 1.5;
}

.edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 6px;
}

.chat-search {
  width: 100%;
  margin: 0 0 8px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.chat-search:focus {
  outline: none;
  border-color: var(--accent);
}

/* --------------------------------------------------------------- approval */

.approval {
  margin: 0 11px 10px;
  padding: 10px 12px;
  border: 1px solid rgba(196, 100, 74, 0.45);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
}

.approval-q {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.approval-detail {
  margin: 0 0 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #0f1720;
  color: #8fd5a6;
  font-family: var(--mono);
  font-size: 11.5px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 200px;
  overflow: auto;
}

.approval-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.approval-btn {
  padding: 5px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 550;
  color: var(--ink);
}

.approval-btn:hover:not(:disabled) {
  border-color: var(--accent);
}

.approval-btn.is-primary {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.approval-btn.is-deny:hover:not(:disabled) {
  border-color: var(--danger);
  color: var(--danger);
}

.approval-btn:disabled {
  opacity: 0.55;
  cursor: progress;
}

.tool.is-waiting .tool-status {
  background: var(--accent);
}

/* -------------------------------------------------------------- task dock */

/* The plan and the live status sit just above the message box, in the same
   column as the conversation, and stay there however far it scrolls. */
.dock {
  width: min(var(--chat-w), calc(100% - 2 * var(--gutter)));
  margin: 0 auto;
  padding-top: 6px;
  flex: none;
}

.task-dock {
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  overflow: hidden;
  animation: rise 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.task-dock-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 14px;
  text-align: left;
  font-size: 13px;
}

.task-dock-head:hover {
  background: var(--sunk);
}

.task-dock-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 550;
  color: var(--ink);
}

.task-dock.is-done .task-dock-title {
  color: var(--muted);
}

.task-dock-count {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.task-dock .tool-chevron {
  margin-left: 0;
  transform: rotate(-90deg);
}

.task-dock.is-open .tool-chevron {
  transform: rotate(90deg);
}

.task-list {
  list-style: none;
  margin: 0;
  padding: 2px 14px 10px;
  max-height: min(260px, 32vh);
  overflow-y: auto;
  scrollbar-width: thin;
}

.task-dock:not(.is-open) .task-list {
  display: none;
}

.task {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 4px 0;
  font-size: 13.5px;
  line-height: 1.4;
}

.task-icon {
  display: grid;
  place-items: center;
  width: 16px;
  height: 19px;
  flex: none;
}

.task.is-done .task-icon {
  color: var(--muted);
}

.task.is-done .task-label {
  color: var(--muted);
}

.task.is-pending .task-icon {
  color: var(--line-strong);
}

.task.is-pending .task-label {
  color: var(--ink-soft);
}

.task.is-in_progress .task-label {
  color: var(--ink);
  font-weight: 550;
}

.task-spinner {
  width: 13px;
  height: 13px;
  border: 1.6px solid var(--line-strong);
  border-top-color: var(--ink-soft);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

/* "Running a command 1m 16s" with four dots that blink in turn */
.live-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 4px 8px;
  font-size: 13.5px;
  color: var(--ink-soft);
}

.live-dots {
  display: grid;
  grid-template-columns: repeat(2, 5px);
  gap: 3px;
}

.live-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: dot-blink 1.2s ease-in-out infinite;
}

.live-dots i:nth-child(2) {
  animation-delay: 0.3s;
}

.live-dots i:nth-child(4) {
  animation-delay: 0.6s;
}

.live-dots i:nth-child(3) {
  animation-delay: 0.9s;
}

.live-time {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

@keyframes dot-blink {
  0%, 100% {
    opacity: 0.25;
  }
  50% {
    opacity: 1;
  }
}

/* ------------------------------------------------------------- composer */

.composer {
  position: relative;
}

.stop-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  transition: opacity 140ms ease;
}

.stop-btn:hover {
  opacity: 0.85;
}

.stop-btn:disabled {
  opacity: 0.5;
  cursor: progress;
}

.composer-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 22px;
  padding: 0 4px;
}

.composer-meta .hint {
  flex: 1;
  min-width: 0;
  margin: 0;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-model {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}

.context-meter {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.context-meter:hover {
  background: var(--sunk);
  color: var(--ink-soft);
}

.context-ring {
  --share: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--share) * 360deg), var(--line-strong) 0);
  -webkit-mask: radial-gradient(circle, transparent 3px, #000 3.5px);
  mask: radial-gradient(circle, transparent 3px, #000 3.5px);
}

.context-meter.is-high {
  color: var(--warn);
}

/* ------------------------------------------------------------- slash menu */

.slash-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 6px);
  z-index: 20;
  max-height: min(380px, 50vh);
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.slash-group {
  padding: 8px 8px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.slash-row {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 8px;
  width: 100%;
  padding: 7px 9px;
  border-radius: 8px;
  text-align: left;
}

.slash-row[aria-selected="true"],
.slash-row:hover {
  background: var(--accent-soft);
}

.slash-name {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}

.slash-hint {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slash-desc {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------------------------------- workspace panel */

.inspector {
  display: flex;
  flex-direction: column;
  flex: none;
  width: var(--inspector-w);
  min-height: 0;
  border-left: 1px solid var(--line);
  background: var(--side);
}

.inspector-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--top-h);
  padding: 0 10px 0 16px;
  font-size: 13.5px;
  font-weight: 600;
  border-bottom: 1px solid var(--line);
}

.inspector-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 6px 12px 20px;
}

.inspector .side-panel {
  padding: 12px 2px;
  border-bottom: 1px solid var(--line);
}

.inspector .side-panel:last-child {
  border-bottom: none;
}

.panel-note {
  margin: 6px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}

.context-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.context-bar > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
  transition: width 400ms ease;
}

.memory-list {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.memory-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 5px 4px;
  border-radius: 8px;
  font-size: 12.5px;
}

.memory-item:hover {
  background: var(--sunk);
}

.memory-scope {
  flex: none;
  margin-top: 1px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 10.5px;
  line-height: 17px;
  color: var(--muted);
  background: var(--bubble);
}

.memory-scope.is-global {
  color: var(--accent-text);
  background: var(--accent-soft);
}

.memory-text {
  flex: 1;
  min-width: 0;
  color: var(--ink-soft);
  cursor: text;
  overflow-wrap: anywhere;
}

.memory-form {
  display: flex;
  gap: 6px;
}

.memory-form input,
.memory-form select {
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
}

.memory-form input {
  flex: 1;
}

.connector-list {
  list-style: none;
  margin: 0 0 4px;
  padding: 0;
}

.connector {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 2px;
  font-size: 12.5px;
  cursor: default;
}

.connector-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line-strong);
  flex: none;
}

.connector.is-connected .connector-dot {
  background: var(--ok);
}

.connector.is-error .connector-dot {
  background: var(--danger);
}

.connector-name {
  flex: 1;
  color: var(--ink-soft);
}

.connector-meta {
  color: var(--muted);
  font-size: 11.5px;
}

.schedule-list {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.schedule {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.schedule.is-paused {
  opacity: 0.65;
}

.schedule-title {
  font-size: 13px;
  font-weight: 550;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-meta {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted);
}

.schedule-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.link-btn {
  padding: 0;
  font-size: 12px;
  color: var(--accent-text);
}

.link-btn:hover {
  text-decoration: underline;
}

.schedule-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.schedule-form input[type="text"],
.schedule-form textarea {
  padding: 6px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
  resize: vertical;
}

.schedule-form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
}

.skill-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 4px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  list-style: none;
}

.skill-group summary::-webkit-details-marker {
  display: none;
}

.skill-group summary:hover {
  background: var(--sunk);
}

.skill-group ul {
  list-style: none;
  margin: 0 0 6px;
  padding: 0 0 0 6px;
}

.skill-row {
  display: block;
  width: 100%;
  padding: 3px 6px;
  border-radius: 6px;
  text-align: left;
}

.skill-row:hover {
  background: var(--accent-soft);
}

.skill-name {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-soft);
}

@keyframes shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -100% 0;
  }
}

@media (max-width: 1023px) {
  .inspector {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 32;
    width: min(340px, 92vw);
    box-shadow: var(--shadow-md);
  }
}

@media (max-width: 640px) {
  .meta-model {
    display: none;
  }

  .msg.assistant .prose {
    font-size: 16px;
    line-height: 1.62;
  }

  #new-chat span {
    display: none;
  }

  #new-chat {
    padding: 8px;
  }

  .composer-meta .hint {
    font-size: 11px;
  }
}

@media (max-width: 1023px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 30;
    transform: translateX(-100%);
    transition: transform 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: var(--shadow-md);
  }

  .sidebar.is-open {
    transform: none;
  }

  .icon-btn.side-close {
    display: grid;
  }

  .icon-btn.menu-btn {
    display: grid;
  }

  .topbar-title {
    display: block;
  }

  /* On a narrow screen the preview takes the whole window and the chat
     waits behind it, like a full screen document view. */
  .preview {
    position: fixed;
    inset: 0;
    z-index: 35;
    width: 100%;
    max-width: none;
    border-left: none;
    animation-name: preview-in-full;
  }

  /* there is nothing to drag when the panel is the whole screen */
  .splitter {
    display: none;
  }

  .preview-image {
    padding: 12px;
  }
}

/* side panels grow a little on a large screen */
@media (min-width: 1600px) {
  :root {
    --side-w: 304px;
    --inspector-w: 360px;
  }
}

@media (max-width: 640px) {
  :root {
    --gutter: 14px;
  }

  .messages {
    padding-top: 18px;
    padding-bottom: 16px;
  }

  .composer {
    padding-bottom: 10px;
  }

  .send-btn span {
    display: none;
  }

  .send-btn {
    padding: 10px;
  }

  .empty p {
    font-size: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ------------------------------------------------------------------ login */

body.login-page {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 24px 16px;
  overflow: auto;
}

.login-card {
  width: min(380px, 100%);
  padding: 32px 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  text-align: center;
}

.login-card h1 {
  margin: 14px 0 4px;
  font-size: 22px;
}

.login-sub {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
}

.login-error {
  margin: 0 0 14px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
}

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 550;
  text-decoration: none;
  transition: border-color 140ms ease, background 140ms ease;
}

.google-btn:hover {
  border-color: var(--accent);
  background: var(--sunk);
}

.login-fine {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

.login-admin {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  text-align: left;
}

.login-admin summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
}

.login-chevron {
  transition: transform 160ms ease;
}

.login-admin[open] .login-chevron {
  transform: rotate(90deg);
}

.login-admin summary::-webkit-details-marker {
  display: none;
}

.login-admin summary:hover {
  color: var(--ink-soft);
}

.login-admin[open] summary {
  margin-bottom: 6px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.login-form label {
  margin-top: 6px;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--ink-soft);
}

.login-form input {
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}

/* Chrome paints remembered fields blue; keep them the page's own colour */
.login-form input:-webkit-autofill,
.login-form input:-webkit-autofill:hover,
.login-form input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink);
  -webkit-box-shadow: 0 0 0 1000px var(--paper) inset;
  caret-color: var(--ink);
  transition: background-color 9999s ease-out 0s;
}

.login-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.login-submit {
  justify-content: center;
  margin-top: 14px;
  padding: 11px;
}


/* ---------------------------------------------------------------- sidebar */

/* Quiet by design: icon rows for the few things you do, then your chats.
   Nothing is boxed except what is selected, so the eye goes to the list. */

.sidebar {
  width: var(--side-w);
  background: var(--side);
  border-right: 1px solid var(--line);
}

.sidebar .side-head {
  display: flex;
  align-items: center;
  gap: 9px;
  height: var(--top-h);
  padding: 0 10px 0 14px;
}

.sidebar .brand-name {
  flex: 1;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.side-collapse {
  width: 30px;
  height: 30px;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 4px 8px 10px;
}

.nav-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 34px;
  padding: 0 8px;
  border-radius: 9px;
  font-size: 14px;
  color: var(--ink-soft);
  text-align: left;
  transition: background 120ms ease, color 120ms ease;
}

.nav-row:hover,
.nav-row.is-on {
  background: var(--bubble);
  color: var(--ink);
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  color: var(--muted);
}

.nav-row:hover .nav-icon {
  color: var(--ink-soft);
}

/* New chat is the one action that matters most, so its mark carries the
   accent; everything else stays grey */
.nav-icon.is-accent {
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
}

.nav-label {
  flex: 1;
}

.nav-kbd {
  font-family: var(--font);
  font-size: 11px;
  color: var(--muted);
  opacity: 0;
  transition: opacity 120ms ease;
}

.nav-row:hover .nav-kbd,
.nav-row:focus-visible .nav-kbd {
  opacity: 1;
}

.nav-search {
  padding: 4px 0 6px;
}

.sidebar .chat-search {
  margin: 0;
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--paper);
}

.sidebar .side-scroll {
  padding: 0 8px 12px;
}

.sidebar .side-panel {
  padding: 0;
  border: none;
}

.sidebar .panel-head {
  padding: 8px 8px 4px;
}

.sidebar .panel-head h2 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--muted);
}

.sidebar .panel-head .count {
  display: none;
}

.sidebar .chat-bucket {
  margin: 14px 8px 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  opacity: 0.8;
}

.sidebar .chat-bucket:first-child {
  margin-top: 4px;
}

.sidebar .chat-item {
  border-radius: 9px;
}

.sidebar .chat-item:hover {
  background: var(--sunk);
}

.sidebar .chat-row {
  height: 32px;
  padding: 0 8px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 400;
  color: var(--ink-soft);
  background: none;
}

.sidebar .chat-row:hover {
  background: none;
  color: var(--ink);
}

/* the open chat is marked by a quiet surface, not by colour */
.sidebar .chat-item:has(.chat-row.is-active),
.sidebar .chat-row.is-active {
  background: var(--bubble);
  color: var(--ink);
  font-weight: 500;
}

.sidebar .empty-line {
  padding: 4px 8px;
}

/* --------------------------------------------------------- account footer */

.sidebar .side-foot {
  position: relative;
  padding: 8px;
  border-top: 1px solid var(--line);
}

.account {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 8px;
  border-radius: 10px;
  text-align: left;
  transition: background 120ms ease;
}

.account:hover,
.account[aria-expanded="true"] {
  background: var(--bubble);
}

.avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 13px;
  font-weight: 650;
}

.account-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  line-height: 1.25;
}

.account-name {
  font-size: 13.5px;
  font-weight: 550;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-sub {
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-chevron {
  flex: none;
  color: var(--muted);
  transition: transform 160ms ease;
}

.account[aria-expanded="true"] .account-chevron {
  transform: rotate(180deg);
}

.account-menu {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: calc(100% - 2px);
  z-index: 25;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  animation: rise 160ms ease-out both;
}

.account-menu-model {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px 9px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

.account-menu-model .dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--line-strong);
}

.account-menu-model.is-ready .dot {
  background: var(--ok);
}

.account-menu-model.is-busy .dot {
  background: var(--accent);
  animation: pulse 1.1s ease-in-out infinite;
}

.account-menu-model.is-off .dot {
  background: var(--danger);
}

.menu-row {
  display: block;
  width: 100%;
  padding: 8px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--ink-soft);
  text-align: left;
}

.menu-row:hover {
  background: var(--sunk);
  color: var(--ink);
}

/* a Workspace section reached from the sidebar shows where it is */
.side-panel.is-flash {
  animation: flash 900ms ease-out;
}

@keyframes flash {
  from {
    background: var(--accent-soft);
  }
  to {
    background: transparent;
  }
}

/* the sidebar put away on a wide screen; the menu button brings it back */
@media (min-width: 1024px) {
  .app.side-collapsed .sidebar {
    display: none;
  }

  .app.side-collapsed .icon-btn.menu-btn {
    display: grid;
  }
}

@media (max-width: 1023px) {
  .side-collapse {
    display: none;
  }
}

/* --------------------------------------------------------------- settings */

/* Things about you, not this chat: one window, sections on the left, the
   chosen section on the right, the way Claude's own settings are laid out. */

.settings-gear {
  flex: none;
  width: 34px;
  height: 34px;
}

.sidebar .side-foot {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sidebar .side-foot .account {
  flex: 1;
  min-width: 0;
}

.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: rgba(10, 9, 8, 0.55);
  animation: fade-in 140ms ease-out both;
}

.settings-dialog {
  display: grid;
  grid-template-columns: 200px 1fr;
  grid-template-rows: auto 1fr;
  width: min(880px, 100%);
  height: min(640px, calc(100dvh - 48px));
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  animation: rise 180ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.settings-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 10px 20px;
  border-bottom: 1px solid var(--line);
}

.settings-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
}

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

.settings-tab {
  padding: 8px 10px;
  border-radius: 9px;
  font-size: 13.5px;
  color: var(--ink-soft);
  text-align: left;
  transition: background 120ms ease, color 120ms ease;
}

.settings-tab:hover {
  background: var(--sunk);
  color: var(--ink);
}

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

.settings-count {
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.settings-count:empty,
.settings-count[data-zero] {
  visibility: hidden;
}

.settings-tab.is-on {
  background: var(--bubble);
  color: var(--ink);
  font-weight: 550;
}

.settings-body {
  min-width: 0;
  overflow-y: auto;
  padding: 18px 24px 28px;
}

.settings-pane h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 650;
  color: var(--ink);
}

.settings-note {
  margin: 0 0 18px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.settings-label {
  font-size: 13.5px;
  font-weight: 550;
  color: var(--ink);
}

.settings-help {
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.settings-select {
  flex: none;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.segmented {
  display: inline-flex;
  flex: none;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--paper);
}

.segmented button {
  padding: 5px 12px;
  border-radius: 7px;
  font-size: 12.5px;
  color: var(--ink-soft);
}

.segmented button.is-on {
  background: var(--bubble);
  color: var(--ink);
  font-weight: 550;
}

.settings-account {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar.is-large {
  width: 40px;
  height: 40px;
  font-size: 16px;
}

/* the moved panels keep their own markup; give them room in the window */
.settings-pane .memory-list,
.settings-pane .schedule-list,
.settings-pane .connector-list {
  margin-bottom: 14px;
}

.settings-pane .memory-item {
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  font-size: 13px;
}

.settings-pane .memory-form,
.settings-pane .schedule-form {
  max-width: 560px;
}

.settings-pane .skill-groups {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px 16px;
}

.settings-pane .skill-group {
  padding: 4px 0;
}

.settings-pane .activity-total strong {
  font-size: 24px;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 640px) {
  .settings-overlay {
    padding: 0;
  }

  .settings-dialog {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
    width: 100%;
    height: 100dvh;
    border-radius: 0;
  }

  .settings-nav {
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 8px 10px;
  }

  .settings-tab {
    flex: none;
  }

  .settings-body {
    padding: 16px;
  }

  .settings-row {
    flex-direction: column;
    align-items: flex-start;
  }
}


/* ------------------------------------------------------------ mode picker */

.mode-picker {
  position: relative;
  flex: none;
}

.mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 8px 0 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11.5px;
  color: var(--muted);
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
}

.mode-btn:hover,
.mode-btn[aria-expanded="true"] {
  border-color: var(--line-strong);
  background: var(--sunk);
  color: var(--ink-soft);
}

.mode-btn-icon {
  display: grid;
  place-items: center;
}

/* Auto is the one mode that acts without asking, so it is the one that is
   coloured: a glance at the composer says the agent will not stop */
.mode-btn[data-mode="auto"] {
  border-color: rgba(214, 161, 58, 0.45);
  color: var(--warn);
}

.mode-chevron {
  opacity: 0.7;
}

.mode-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 30;
  width: 300px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  animation: rise 150ms ease-out both;
}

.mode-menu-title {
  padding: 6px 10px 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}

.mode-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 10px;
  text-align: left;
  transition: background 100ms ease;
}

.mode-option:hover,
.mode-option:focus-visible {
  background: var(--sunk);
  outline: none;
}

.mode-option[aria-selected="true"] {
  background: var(--bubble);
}

.mode-option-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink-soft);
}

.mode-option[data-mode="auto"] .mode-option-icon {
  color: var(--warn);
}

.mode-option-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  gap: 2px;
}

.mode-option-name {
  font-size: 13px;
  font-weight: 550;
  color: var(--ink);
}

.mode-option-desc {
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--muted);
}

.mode-check {
  display: grid;
  place-items: center;
  width: 16px;
  flex: none;
  margin-top: 5px;
  color: var(--accent-text);
}

/* the browser's own dropdown list, where one is still used, in the app's
   colours instead of the system's white */
select option {
  background: var(--surface);
  color: var(--ink);
}

@media (max-width: 640px) {
  .mode-menu {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 96px;
    width: auto;
  }
}
