@font-face {
  font-family: Inter; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/fonts/inter-latin.woff2') format('woff2');
}
@font-face {
  font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap;
  src: url('/fonts/jetbrains-mono-latin.woff2') format('woff2');
}
:root {
  color-scheme: dark;
  --frame: #202022;
  --sidebar: #19191a;
  --canvas: #1d1d1e;
  --surface: #252527;
  --overlay: #232325;
  --raised: #252527;
  --hover: #303033;
  --selected: #2a2a2d;
  --line: #38383c;
  --control-line: #535357;
  --line-soft: #2c2c2f;
  --ink: #eeece7;
  --subtle: #cfcbc5;
  --muted: #a19d97;
  --accent: #eb7169;
  --accent-dim: #4a3532;
  --accent-ink: #1d1d1e;
  --good: #93c3a0;
  --busy: #e2b36b;
  --bad: #f0948a;
  --code: #222224;
  --bubble: #263d58;
  --bubble-link: #b5d9ff;
  --lens: url("/icons/lens-dark.png");
  --shadow: 0 18px 50px #06070c80;
  --bar-height: 56px;
  --side-width: 240px;
  --detail-width: 300px;
  --read-width: 680px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --sans: Inter, -apple-system, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --press-ease: cubic-bezier(.23, 1, .32, 1);
  font-family: var(--sans);
  accent-color: var(--accent);
  font-size: 87.5%;
  font-synthesis: none;
}
:root[data-scheme="light"] {
  color-scheme: light;
  --frame: #f1eee7;
  --sidebar: #f3f0ea;
  --canvas: #f8f6f0;
  --surface: #ffffff;
  --overlay: #ffffff;
  --raised: #ffffff;
  --hover: #e7e3d9;
  --selected: #ece8df;
  --line: #d5d0c6;
  --control-line: #aaa59c;
  --line-soft: #e2ded5;
  --ink: #1f1e1c;
  --subtle: #46423d;
  --muted: #66615b;
  --accent: #9b1419;
  --accent-dim: #efdbd9;
  --accent-ink: #ffffff;
  --good: #396346;
  --busy: #805819;
  --bad: #a3252c;
  --code: #f1eee7;
  --bubble: #dceafa;
  --bubble-link: #245a87;
  --lens: url("/icons/lens-light.png");
  --shadow: 0 12px 36px #24251e24;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { background: var(--canvas); color: var(--ink); line-height: 1.5; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .48; }
button, input, select, textarea, summary, a { -webkit-tap-highlight-color: transparent; }
:is(button, a, input, select, textarea, summary, [tabindex]):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button svg, a svg { flex: none; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
small, .muted { color: var(--muted); }
code, pre, .path-label { font-family: var(--mono); }
pre { background: var(--code); border: 1px solid var(--line-soft); border-radius: 9px; padding: 12px; overflow: auto; margin: 8px 0; font-size: 12px; line-height: 1.62; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
input:not([type=file]), select, textarea {
  border: 1px solid var(--line); border-radius: 9px; background: var(--canvas);
  padding: 8px 10px; min-width: 0;
}
input:not([type=file])::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
textarea { resize: vertical; }
input[readonly] { color: var(--muted); }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 34px;
  padding: 5px 10px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); color: var(--ink); white-space: nowrap; text-decoration: none;
  font-size: 12.5px; font-weight: 610;
}
.button.ghost { border-color: transparent; background: transparent; color: var(--subtle); }
.button.icon-button { width: 34px; padding: 0; flex: 0 0 auto; }
.button.primary, .send-button { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.button.danger { border-color: var(--bad); color: var(--accent-ink); background: var(--bad); }
.button.danger-quiet { color: var(--bad); }
.actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.mobile-only.button { display: none; }
#app {
  width: 100%; height: var(--visual-height, 100dvh); min-height: 0; padding-inline: var(--safe-left) var(--safe-right);
  --nav-column: min(var(--nav-width, var(--side-width)), 29vw);
  --details-column: min(var(--inspector-width, var(--detail-width)), 38vw);
  --visible-nav: var(--nav-column);
  --right-column: 0px;
  display: grid; grid-template: auto minmax(0, 1fr) / var(--visible-nav) minmax(0, 1fr) var(--right-column);
  background: var(--canvas);
}
#app.sidebar-hidden { --visible-nav: 0px; }
#app.has-inspector { --right-column: var(--details-column); }
.resize-handle { grid-row: 2; z-index: 6; width: 7px; cursor: col-resize; touch-action: none; }
.resize-handle:is(:hover, :focus-visible, :active) { background: color-mix(in srgb, var(--accent), transparent 70%); }
.nav-resize { grid-column: 1; justify-self: end; margin-inline-end: -4px; }
.details-resize { grid-column: 3; justify-self: start; margin-inline-start: -4px; }
.sidebar-hidden .nav-resize, #app:not(.has-inspector) .details-resize { display: none; }
.topbar { grid-column: 1 / -1; grid-row: 1; display: flex; justify-content: space-between; align-items: center; padding: max(8px, var(--safe-top)) 16px 4px; }
.top-right, .sidebar-head, .sidebar-footer { display: flex; align-items: center; gap: 6px; }
.brand { display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 5px 8px; font-size: 16px; font-weight: 650; }
.brand::before, .message-byline::before { content: ""; background: var(--accent); width: 8px; height: 8px; border-radius: 50%; flex: none; }
.lens { display: inline-block; width: 26px; aspect-ratio: 1; flex: none; background: var(--lens) center / contain no-repeat; }
.connection { display: inline-flex; align-items: center; gap: 7px; border: 0; background: transparent; padding: 7px; border-radius: 8px; color: var(--subtle); font-size: 12px; }

.connection i, .badge i, .nav-status { display: inline-block; width: 6px; height: 6px; flex: none; border-radius: 50%; background: var(--muted); }
.connection.online i { background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good), transparent 87%); }
.sidebar {
  grid-column: 1; grid-row: 2; min-width: 0; background: var(--sidebar); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: max(14px, var(--safe-top)) 10px max(12px, var(--safe-bottom)); gap: 12px; overflow: hidden;
}
.sidebar-hidden .sidebar { visibility: hidden; padding-inline: 0; border: 0; }
.sidebar-head .brand { margin-right: auto; }
.theme-toggle[aria-pressed="true"] svg:first-child,
.theme-toggle[aria-pressed="false"] svg:last-child { display: none; }
.new-thread.button, .side-search.button { justify-content: flex-start; width: 100%; padding-inline: 10px; }
.side-search.button { border-color: transparent; background: var(--hover); color: var(--muted); font-weight: 450; }
.new-thread.button { min-height: 36px; font-size: 14px; font-weight: 500; }
.stage-letter { width: 17px; height: 17px; border-radius: 4px; background: var(--hover); display: grid; place-items: center; font-size: 10px; }
.nav-row > .lens { flex: 0 0 17px; width: 17px; }

.side-nav { flex: 1; overflow: auto; min-height: 0; }
.side-nav section { margin: 7px 0 18px; }
.side-nav h2 { display: flex; align-items: center; gap: 10px; margin: 0 8px 6px; font: 600 11px var(--sans); letter-spacing: .065em; text-transform: uppercase; color: var(--muted); }
.nav-row {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 5px 9px;
  border: 1px solid transparent; border-radius: 9px; text-align: left; color: var(--subtle);
  background: transparent; font-size: 13px; font-weight: 520;
}
.nav-row.selected { background: var(--selected); border-color: transparent; color: var(--ink); font-weight: 550; }
.nav-row.selected svg { color: var(--accent); }
.nav-row > span { flex: 1; min-width: 0; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }
.sidebar-footer { flex-wrap: wrap; justify-content: space-between; border-top: 1px solid var(--line-soft); margin-top: auto; padding-top: 8px; }
.setup-home.button { color: var(--accent); border: 0; background: transparent; }
.main { container: work-area / inline-size; grid-column: 2; grid-row: 2; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.content-head { border-bottom: 1px solid var(--line-soft); background: var(--canvas); }
.heading-row { display: flex; align-items: center; gap: 8px; min-height: 62px; padding: 10px 24px; }
.stage-head .head-title { display: flex; align-items: baseline; gap: 10px; }
.head-context, .inspector-body h3, .list-count, .timestamp, .message-byline time { font: 11px var(--mono); color: var(--muted); }
.stage-switch, .nav-toggle.button { display: none; }
.sidebar-hidden .nav-toggle.button { display: inline-flex; }
.task-docked .task-pane .nav-toggle { display: none; }
.empty-icon { display: grid; place-items: center; aspect-ratio: 1; color: var(--accent); }

.head-title { min-width: 0; flex: 1; }
.head-title h1 { font-size: 19px; font-weight: 650; letter-spacing: -.015em; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-title p { margin-top: 4px; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-actions { display: flex; align-items: center; gap: 3px; }
.tabs { display: flex; gap: 19px; align-items: center; padding-inline: 24px; overflow-x: auto; }
.tab {
  display: flex; align-items: center; gap: 7px; min-height: 42px; padding: 4px 0; color: var(--muted);
  background: transparent; border: 0; border-bottom: 2px solid transparent; font-size: 13px; white-space: nowrap;
}
.tab[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 650; }
.tab[aria-current="page"] svg { color: var(--accent); }
.tab small { font: 11px var(--mono); }
.conversation { display: flex; flex: 1; flex-direction: column; min-height: 0; position: relative; }
.transcript-scroll, .list-scroll { min-height: 0; overflow: auto; flex: 1; overscroll-behavior: contain; }
.messages, .live, .compose-inner, .list-inner { width: min(100% - 44px, var(--read-width)); margin-inline: auto; }
.messages { padding-top: 25px; padding-bottom: 16px; display: flex; flex-direction: column; gap: 19px; }
.messages:has(> .empty:only-child) { min-height: min(100%, 500px); justify-content: center; }
.empty, .empty-page { text-align: center; }
.empty { padding: 25px 15px; }
.empty-icon { margin: 0 auto 13px; width: 47px; }
.empty h2 { font-size: 19px; font-weight: 675; letter-spacing: -.025em; }
.empty p { color: var(--muted); margin: 7px auto 14px; max-width: 36ch; font-size: 13px; }
.empty-page { display: grid; place-items: center; flex: 1; }
.message { min-width: 0; }
.message-byline { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.message-byline::before { width: 7px; height: 7px; }
.message-byline strong, .live strong { font-size: 13px; font-weight: 600; }
.message-content { max-width: 100%; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.mine .message-content { --accent: var(--bubble-link); width: fit-content; max-width: 82%; margin-left: auto; padding: 9px 14px; border-radius: 18px 18px 6px 18px; background: var(--bubble); }
.mine .message-byline { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
.mine .message-actions { justify-content: end; }
.live { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 8px; }
.live .lens { width: 18px; }

.message-actions { justify-content: flex-end; }
.message-actions { display: flex; gap: 4px; margin-top: 4px; }
.message-actions .button { width: 28px; min-height: 26px; border-color: transparent; background: transparent; color: var(--muted); }
.message-body .compact-row { margin-top: 8px; }
.markdown > :first-child { margin-top: 0; }
.markdown > :last-child { margin-bottom: 0; }
.markdown p { margin: 0 0 .7em; }
.markdown h3, .markdown h4, .markdown h5 { margin: .9em 0 .35em; }
.markdown ul, .markdown ol { padding-left: 23px; margin: .6em 0; }
.markdown blockquote { border-left: 3px solid var(--line); padding-left: 12px; margin: .7em 0; color: var(--subtle); }
.markdown :not(pre) > code { padding: 1px 4px; background: var(--code); border: 1px solid var(--line-soft); border-radius: 9px; font-size: .85em; }
.markdown .code-block { border: 1px solid var(--line); background: var(--code); border-radius: 9px; margin: .7em 0; overflow: hidden; }
.code-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 11px; min-height: 30px; padding-inline: 10px 4px; background: var(--frame); border-bottom: 1px solid var(--line); }
.code-top .button { width: 26px; min-height: 26px; border: none; background: transparent; }
.code-block pre { border: 0; margin: 0; }
.table-scroll { overflow-x: auto; }
.markdown table { border-collapse: collapse; margin: .5em 0; }
.markdown :is(th, td) { border: 1px solid var(--line); padding: 5px 9px; text-align: left; }
.markdown th { background: var(--surface); }
.inline-link { border: 0; background: none; padding: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-align: left; }
.attachment-image, .file-image { display: block; max-width: 100%; max-height: 420px; height: auto; object-fit: contain; margin: 9px 0 0; border-radius: 9px; }
.event-detail { border: 1px solid var(--line); border-radius: 9px; min-width: 0; }
.event-detail + .event-detail { margin-top: 6px; }
.messages > .event-detail { margin: -6px 0 0; }
.event-detail summary { list-style: none; display: flex; align-items: center; gap: 7px; min-height: 35px; padding: 6px 9px; color: var(--muted); cursor: pointer; }
summary::-webkit-details-marker { display: none; }
.event-detail summary > span { color: var(--subtle); flex: 1; min-width: 0; font-size: 12px; }
.event-detail[open] summary { border-bottom: 1px solid var(--line-soft); }
.event-detail[open] summary svg:first-child { rotate: 90deg; }
.event-detail > :not(summary) { margin: 8px; }
.event-error { display: flex; align-items: flex-start; gap: 7px; color: var(--bad); background: color-mix(in srgb, var(--bad), transparent 92%); border-radius: 9px; padding: 8px 12px; }
.turn-end { display: flex; align-items: center; gap: 9px; margin: -8px 0 -6px; color: var(--muted); font-size: 11px; }
.turn-end .button { background: transparent; border: 0; width: 27px; min-height: 25px; color: var(--muted); }
.live { padding: 0 0 16px; }
.live p { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 4px; }
.live p::after { display: inline-block; margin-left: 5px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); content: ""; animation: pulse 1s alternate infinite; }
.task-intro { padding: 13px 15px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.task-intro > div:first-child { display: flex; gap: 9px; align-items: center; color: var(--subtle); }
.task-intro h2 { font-size: 13px; flex: 1; }
.task-intro p { margin-top: 7px; font-size: 13px; }
.task-intro ul { margin: 8px 0; padding-left: 19px; color: var(--subtle); }
.task-intro .actions { margin-top: 10px; }
.composer-dock { background: var(--canvas); flex: none; padding: 6px 0 max(13px, var(--safe-bottom)); position: relative; }
.composer {
  border: 1px solid var(--line); border-radius: 16px; background: var(--raised);
  padding: 4px; position: relative;
}
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 65%, var(--line)); }
.composer textarea {
  min-height: 50px; width: 100%; display: block; padding: 8px 10px 4px; background: transparent; border: 0;
  border-radius: 9px; outline: none; resize: none; field-sizing: content; max-height: min(25dvh, 200px);
}
.composer textarea:focus-visible { outline: none; }
.composer.shell-mode textarea { font-family: var(--mono); }
.composer-bar { display: flex; justify-content: space-between; align-items: center; gap: 5px; padding: 4px 8px; background: transparent; }
.compose-options { display: flex; align-items: center; gap: 3px; min-width: 0; }
.compose-options > span { min-width: 0; }
.compose-options :is(select, .model-button) {
  min-height: 32px; max-width: 100%; padding: 3px 6px; border: 1px solid transparent; background: transparent; color: var(--subtle); font-size: 11.5px;
}
.model-button { overflow: hidden; }
.model-button span { overflow: hidden; text-overflow: ellipsis; }
.model-button svg { order: 1; width: 12px; }
.send-button { padding: 0; width: 32px; height: 32px; border-radius: 50%; }
.send-button:disabled { background: var(--line); border-color: var(--line); color: var(--muted); opacity: 1; }
.composer-foot { display: flex; align-items: center; justify-content: flex-end; gap: 9px; color: var(--muted); font-size: 11px; min-height: 19px; margin-top: 5px; }
.composer-foot:empty { min-height: 0; }
.offline-copy { color: var(--busy); display: flex; align-items: center; gap: 4px; }
.composer-recipient, .attachment-chips { display: flex; align-items: center; gap: 5px; padding: 5px 10px 0; color: var(--muted); font-size: 12px; }
.composer-recipient .button { min-height: 24px; width: 24px; border: 0; background: transparent; }
.attachment-chips { flex-wrap: wrap; }
.attachment-chip.button { min-height: 26px; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.attachment-chip svg { order: 1; height: 13px; width: 13px; }
.reference-menu {
  position: absolute; bottom: calc(100% + 7px); left: 0; width: min(440px, 100%); max-height: min(35dvh, 270px); overflow: auto; z-index: 4;
  padding: 5px; background: var(--overlay); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow);
}
.reference-menu p { padding: 8px; color: var(--muted); }
.reference-row { display: flex; align-items: flex-start; gap: 8px; width: 100%; text-align: left; border: 0; border-radius: 9px; background: transparent; padding: 6px 8px; }
.reference-row.active { background: var(--hover); }
.reference-row span { min-width: 0; overflow-wrap: anywhere; }
.reference-row small { display: block; }
[data-part=jump-bottom] { position: absolute; bottom: calc(100% + 5px); left: 50%; transform: translateX(-50%); z-index: 2; }
[data-part=jump-bottom] .button { border-radius: 9px; box-shadow: var(--shadow); }
.request-card, .plan {
  border: 1px solid var(--line); background: var(--surface); border-radius: 9px; padding: 9px 12px; margin-bottom: 7px; font-size: 12.5px;
}
.request-card { max-height: min(36dvh, 330px); overflow: auto; border-color: color-mix(in srgb, var(--busy), transparent 72%); }
.request-card h3 { display: flex; align-items: center; gap: 7px; font-size: 13px; margin-bottom: 5px; color: var(--busy); }
.request-card form, .inline-form { display: flex; gap: 6px; align-items: stretch; margin-top: 7px; }
.request-card input, .inline-form input { flex: 1; min-width: 0; }
.request-card .actions { margin-top: 7px; }
.answer-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 6px; margin-top: 7px; }
.answer-option { text-align: left; padding: 7px 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--canvas); }
.answer-option small { display: block; }
.plan { padding: 5px 10px; }
.plan summary { display: flex; align-items: center; gap: 7px; cursor: pointer; list-style: none; }
.plan summary span { flex: 1; }
.plan > p { padding-top: 7px; }
.plan ol { margin: 6px 0; padding-left: 24px; max-height: 16dvh; overflow: auto; }
.plan li[data-status=completed] { color: var(--good); }
.plan li[data-status=in_progress] { color: var(--busy); }
.list-inner { padding: 22px 0 max(25px, var(--safe-bottom)); }
.list-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 14px; }
.list-toolbar select { min-height: 36px; }
.list-search { min-width: min(100%, 220px); display: flex; align-items: center; gap: 7px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--muted); flex: 1; }
.list-search input { width: 100%; border: 0; padding: 8px 1px; background: transparent; outline: none; color: var(--ink); }
.list-search:focus-within { border-color: var(--accent); }
.list-count { color: var(--muted); font-size: 12px; margin-left: auto; }
.work-list { display: flex; flex-direction: column; }
.work-list > .work-row { border: 1px solid transparent; border-radius: 10px; background: transparent; margin: 0; padding-block: 10px; }
.work-row {
  display: flex; align-items: center; gap: 9px; width: 100%; min-height: 55px; padding: 8px 10px;
  border: 1px solid var(--line-soft); border-radius: 9px; background: var(--surface); text-align: left; margin-block: 2px;
}
.work-row > svg { color: var(--muted); }
.work-icon { width: 29px; height: 29px; color: var(--muted); border-radius: 9px; background: var(--canvas); display: grid; place-items: center; flex: none; }
.work-title { flex: 1; min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
.work-title strong, .work-title small { display: block; }
.work-title small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compact-row { min-height: 50px; gap: 12px; padding: 9px 12px; border-radius: 14px; }
.compact-row .work-title { font-size: 14px; }
.compact-row .work-icon { width: 23px; height: 23px; }
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 6px; min-height: 21px; border-radius: 9px;
  background: var(--canvas); color: var(--subtle); border: 1px solid var(--line-soft); white-space: nowrap; font-family: var(--mono);
  font-size: 10.5px; font-weight: 600; width: max-content; max-width: 100%;
}
:is(.badge, .nav-status)[data-status=is-working] { color: var(--blue); }
.badge:is([data-status=in_progress], [data-status=running]) { color: var(--blue); }
.badge:is([data-status=needs_approval], [data-status=needs_input], [data-status=waiting_on_job]) { color: var(--busy); }
.badge:is([data-status=done], [data-status=completed]) { color: var(--good); }
.badge:is([data-status=failed], [data-status=interrupted]) { color: var(--bad); }
.badge i { background: currentColor; width: 5px; height: 5px; }
.nav-status[data-status=running] { background: var(--blue); }
.nav-status:is([data-status=needs_approval], [data-status=needs_input], [data-status=waiting_on_job]) { background: var(--busy); }
.inspector {
  min-height: 0; grid-column: 3; grid-row: 2; min-width: 0; background: var(--frame); border-left: 1px solid var(--line); display: flex; flex-direction: column;
}
.inspector-head {
  min-height: 54px; display: flex; align-items: center; justify-content: space-between; padding: 8px 12px 8px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.inspector-head h2 { font-size: 13px; font-weight: 680; }
.inspector-body { overflow: auto; min-height: 0; padding: 13px 15px max(14px, var(--safe-bottom)); font-size: 12.5px; }
.inspector-body section { padding: 3px 0 14px; margin-bottom: 12px; border-bottom: 1px solid var(--line-soft); }
.inspector-body section:last-child { border-bottom: 0; }
.inspector-body h3 { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 680; margin: 2px 0 8px; }
.inspector-body h3 small { font-size: 11px; }
.inspector-body p { margin: 5px 0 8px; }
.inspector-body dl { margin: 0; }
.inspector-body dt { color: var(--muted); font-size: 11px; }
.inspector-body dd { margin: 1px 0 9px; overflow-wrap: anywhere; }
.inspector-body .button { max-width: 100%; overflow: hidden; }
.inspector-body .button span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.location { padding: 8px 9px; display: flex; gap: 8px; align-items: center; margin-bottom: 5px; border: 1px solid var(--line-soft); border-radius: 9px; background: var(--surface); }
.location svg { color: var(--accent); flex: none; }
.location div { min-width: 0; }
.location strong { display: block; font-size: 12px; }
.location small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 11px; }
.path-label { color: var(--muted); white-space: normal; overflow-wrap: anywhere; font-size: 11px; }
.file-lines code > span, .diff code > span { display: block; min-height: 1lh; width: max-content; min-width: 100%; }
.file-lines b { display: inline-block; min-width: 3ch; margin-right: 12px; color: var(--muted); font-weight: 500; user-select: none; }
.diff code .add { color: var(--good); background: color-mix(in srgb, var(--good), transparent 92%); }
.diff code .remove { color: var(--bad); background: color-mix(in srgb, var(--bad), transparent 92%); }
.diff code .range { color: var(--blue); }
.diff code .file { color: var(--accent); }
.scrim { display: none; }
.pair-screen { flex: 1; min-height: 0; overflow: auto; display: flex; padding: 24px 24px max(24px, var(--safe-bottom)); }
.pair-panel { display: flex; flex-direction: column; width: min(100%, 380px); margin: auto; }
.pair-panel > .lens { align-self: center; width: clamp(96px, 21dvh, 176px); margin-bottom: 28px; }
.pair-panel h1 { font-size: 26px; line-height: 32px; letter-spacing: -.025em; font-weight: 650; text-align: center; }
.pair-panel > p { text-align: center; margin: 8px auto 24px; max-width: 34ch; color: var(--muted); font-size: 15px; }
.pair-meta { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; padding: 0 10px; margin: 4px 0 16px; font-size: 13px; }
.pair-meta dt { color: var(--muted); }
.pair-meta dd { text-align: right; margin: 0; overflow-wrap: anywhere; font: 12px/1.6 var(--mono); }
.pair-panel form > .button, .pair-actions .primary { width: 100%; min-height: 50px; border-radius: 16px; font-size: 16px; }
.pair-panel .field { margin-bottom: 16px; gap: 7px; }
.pair-panel .field input { min-height: 46px; background: var(--raised); }
.field :is(input:not([type=file]), select, textarea), .list-search { border-color: var(--control-line); }
.pair-install { margin-top: 8px; text-align: center; }
.pair-qr { display: block; width: min(100%, 300px); height: auto; margin: 12px auto; background: white; border-radius: 9px; }
.pair-code { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.pair-code code { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pair-actions { display: grid; gap: 6px; margin-top: 22px; }
.pair-actions .button:last-child { background: transparent; border-color: transparent; color: var(--muted); }

.loading-bar { height: 3px; width: 38px; background: var(--accent); border-radius: 2px; animation: pulse 1s alternate infinite; }
@keyframes pulse { to { opacity: .3; } }
dialog {
  width: min(570px, calc(100vw - 30px)); padding: 0; max-width: 100%; max-height: min(760px, calc(var(--visual-height, 100dvh) - var(--safe-top) - var(--safe-bottom) - 35px));
  background: var(--overlay); border: 1px solid var(--line); border-radius: 9px; color: var(--ink);
  box-shadow: var(--shadow); overflow: auto; overscroll-behavior: contain;
}
dialog::backdrop { background: #101212ae; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); padding: 10px 15px 10px 17px; position: sticky; top: 0; z-index: 1; background: var(--overlay); }
.dialog-head h2 { font-size: 20px; letter-spacing: -.02em; overflow-wrap: anywhere; }
.dialog-body { padding: 15px 17px 17px; overflow-wrap: anywhere; }
.dialog-body > p + p, .dialog-body > p + .actions { margin-top: 9px; }
.dialog-group { padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.dialog-group:first-child { padding-top: 0; }
.dialog-group:last-child { border-bottom: 0; padding-bottom: 0; }
.dialog-group h3 { margin-bottom: 8px; font-size: 12px; color: var(--muted); }
.dialog-footer { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 10px 17px; border-top: 1px solid var(--line); background: var(--overlay); position: sticky; bottom: 0; }
.field { display: grid; gap: 5px; margin: 1px 0 11px; font-size: 12.5px; }
.field > span { font-weight: 640; }
.field > small { font-size: 11px; }
fieldset { border: 1px solid var(--line); border-radius: 9px; margin: 12px 0 0; padding: 9px 10px 0; min-width: 0; }
.tool-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.data-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); padding: 7px 0; }
.data-row small { display: block; }
.dependency { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0; }
.dependency strong { width: 100%; }
.form-error { color: var(--bad) !important; }
.install-steps { display: grid; gap: 9px; margin: 12px 0; }
.install-steps > div { display: grid; grid-template-columns: 24px 1fr; gap: 8px; padding: 9px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: 9px; }
.install-steps svg { color: var(--accent); }
.install-steps p { color: var(--subtle); font-size: 13px; margin-top: 4px; }
#search-results { margin-top: 10px; }
.notice {
  position: fixed; z-index: 20; right: max(15px, var(--safe-right)); bottom: max(15px, var(--safe-bottom));
  width: max-content; max-width: min(380px, calc(100vw - 30px)); background: var(--overlay); color: var(--ink); border: 1px solid var(--line);
  padding: 8px 12px; border-radius: 9px; box-shadow: var(--shadow); font-size: 13px;
}
.notice.is-error { color: var(--bad); }
@media (min-width: 901px) and (max-width: 1160px) {
  :root { --side-width: 193px; --detail-width: 243px; }
  .inspector .compact-row .work-icon { display: none; }
}
@media (max-width: 900px) {
  :root { --bar-height: 52px; }
  #app { grid-template-columns: minmax(0, 1fr); position: relative; }
  .main { grid-column: 1; }
  .resize-handle { display: none; }
  .sidebar, .inspector {
    position: absolute; inset-block: var(--safe-top) 0; z-index: 10;
    width: min(82vw, 315px); box-shadow: var(--shadow);
  }
  .sidebar, .sidebar-hidden .sidebar { inset: max(24px, var(--safe-top)) 0 0; width: min(100%, 540px); margin-inline: auto; border: 1px solid var(--line); border-bottom: 0; border-radius: 16px 16px 0 0; background: var(--overlay); padding: 8px 16px max(14px, var(--safe-bottom)); visibility: hidden; }
  .sidebar::before { content: ""; flex: none; align-self: center; width: 36px; height: 5px; border-radius: 3px; background: var(--control-line); }
  .mobile-nav .sidebar { visibility: visible; transform: translateX(0); }
  .inspector { width: min(89vw, 430px); inset-inline-end: 0; }
  .inspector-body { padding-right: max(12px, var(--safe-right)); }
  .scrim { display: block; position: absolute; inset: 0; z-index: 9; width: 100%; background: #06070b82; border: 0; }
  .mobile-only.button { display: inline-flex; }
  .heading-row { min-height: 69px; gap: 9px; padding-inline: 13px; }
  .head-title h1 { font-size: 1.6rem; }
  .head-title p { font-size: 11px; }
  .tabs { padding-inline: 13px; gap: 17px; }
  .messages, .live, .compose-inner, .list-inner { width: min(100% - 26px, var(--read-width)); }
  .messages { padding-top: 17px; }
  .composer-dock { padding-bottom: max(7px, var(--safe-bottom)); }
  .inspector-head .icon-button, .topbar .icon-button, .head-actions .icon-button, .sidebar .icon-button { width: 42px; min-height: 42px; }
  .button, .nav-row { min-height: 41px; }
  .message-actions .icon-button { width: 34px; min-height: 34px; }
  .composer .icon-button, .send-button { min-height: 42px; width: 42px; }
  .composer-bar { padding: 2px 5px 5px; }
  .composer textarea { min-height: 52px; padding: 10px 10px 3px; }
  input:not([type=file]), textarea, .request-card input, .list-search input { font-size: 16px; }
  .attachment-chip.button { min-height: 34px; }
  .composer-foot { margin-top: 3px; }
  .request-card { max-height: min(27dvh, 245px); }
  dialog { max-height: calc(var(--visual-height, 100dvh) - var(--safe-top) - var(--safe-bottom) - 20px); }
}
@media (max-width: 510px) {
  .head-actions { gap: 0; }
  .compose-options { gap: 1px; }
  .composer-bar { flex-wrap: wrap; }
  .delivery-options { margin-left: auto; }
  .compose-options :is(select, .model-button) { min-height: 40px; padding-inline: 3px; font-size: 11px; }
  [data-part=delivery] { width: 58px; }
  [data-part=stage-folder] { max-width: 65px; }
  .compose-options .model-button { max-width: min(87px, 100%); }
  .composer-recipient { padding-top: 3px; }
  .tab { font-size: 12px; min-height: 43px; gap: 5px; }
  .tab svg { width: 14px; }
  .timestamp { display: none; }
}
@media (max-width: 370px) {
  .tabs { gap: 12px; }
  [data-part=stage-folder] { max-width: 51px; }
  .compose-options .model-button { max-width: min(62px, 100%); }
}
@media (hover: hover) and (pointer: fine) {
  .button:not(:disabled):hover { background: var(--hover); }
  .button.ghost:not(:disabled):hover { color: var(--ink); }
  .button.primary:not(:disabled):hover, .send-button:not(:disabled):hover { background: color-mix(in srgb, var(--accent), var(--canvas) 12%); }
  .button.danger:not(:disabled):hover { border-color: var(--bad); color: var(--accent-ink); background: var(--bad); }
  .connection:hover { background: var(--hover); }
  .nav-row:hover { background: var(--hover); color: var(--ink); }
  .tab:hover { color: var(--ink); }
  .compose-options :is(select, .model-button):hover { background: var(--hover); }
  .reference-row:hover { background: var(--hover); }
  .answer-option:hover { background: var(--hover); }
  .work-row:hover, .work-list > .work-row:hover { background: var(--hover); border-color: var(--line); }

}
@media (hover: none) and (pointer: coarse) {
  button, summary { touch-action: manipulation; }
  .message-actions .icon-button { width: 42px; min-height: 42px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.skip-link { position: fixed; top: max(8px, var(--safe-top)); left: 8px; z-index: 30; transform: translateY(-200%); background: var(--overlay); color: var(--ink); padding: 8px 12px; }
.skip-link:focus { transform: none; }

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .button:active:not(:disabled):not(:focus-visible), .brand:active:not(:focus-visible) { transform: scale(.97); }
  .button:hover:not(:focus-visible), .brand:hover:not(:focus-visible) { transition: transform 120ms var(--press-ease); }
}
@media (forced-colors: active) {
  .nav-row.selected { border-color: Highlight; }
  .tab[aria-current="page"] { border-bottom-color: Highlight; }
  .composer:focus-within { outline: 2px solid Highlight; }
}
.keyboard-open { --safe-bottom: 0px; }

.earlier-messages { display: flex; justify-content: center; }

/* A Task shares the workspace with its source whenever both conversations fit. */
.task-pane {
  --canvas: var(--frame); grid-row: 2; grid-column: 2; min-width: 0; min-height: 0; display: flex; flex-direction: column;
  container: task / inline-size; background: var(--canvas);
}
.task-pane .head-title h1 {
  font-size: 19px; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; white-space: normal; overflow-wrap: anywhere;
}
.task-resize { display: none; }
.has-task:not(.task-docked) .main { display: none; }
#app.has-task { --right-column: 0px; }
#app.task-docked {
  --right-column: clamp(360px, var(--task-width, min(560px, (100% - var(--visible-nav)) * .42)), min(900px, 100% - var(--visible-nav) - 400px));
}
.task-docked .task-pane { grid-column: 3; border-inline-start: 1px solid var(--line); }
.task-docked .task-resize { display: block; grid-column: 3; justify-self: start; margin-inline-start: -4px; }
.has-task .details-resize { display: none; }
.has-task .inspector { grid-column: 2; z-index: 7; justify-self: end; width: min(100%, var(--details-column)); box-shadow: var(--shadow); }
.task-docked .inspector { grid-column: 3; width: 100%; }
.work-row[aria-current="true"] { background: var(--selected); box-shadow: inset 3px 0 var(--accent); }
@container (max-width: 550px) {
  .heading-row { padding-inline: 14px; gap: 6px; min-height: 58px; }
  .head-title h1 { font-size: 17px; }
  .messages, .live, .compose-inner, .list-inner { width: calc(100% - 28px); }
  .composer-bar { flex-wrap: wrap; }
  .delivery-options { margin-inline-start: auto; }
  .compose-options .model-button { max-width: 110px; }
}
@media (max-width: 900px) {
  .task-pane, .has-task .inspector { grid-column: 1; }
  .has-task .inspector { z-index: 10; width: min(89vw, 430px); }
}

.task-ring { flex: none; width: 11px; height: 11px; border: 2px solid var(--muted); border-radius: 50%; }
.task-ring[data-status=in_progress] { border-color: var(--busy); border-right-color: transparent; }
.task-ring:is([data-status=done], [data-status=closed]) { background: var(--good); border-color: var(--good); }
.work-row .badge { background: none; border: none; font: 500 12px var(--sans); }
.work-row .badge i { display: none; }
.work-row .badge[data-status=in_progress] { color: var(--busy); }
.work-title small, .head-title p { font-family: var(--mono); }
.request-card { padding: 14px; border-radius: 16px; }
.request-card .actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.request-card .actions .button { min-height: 40px; }
.compose-options :is(select, .model-button) { border: 1px solid var(--line); border-radius: 16px; padding-inline: 8px; }
.task-pane .head-context { display: block; margin-bottom: 2px; }
.topbar[hidden] + .scrim ~ .main, .task-pane { padding-top: var(--safe-top); }
.mobile-nav .sidebar { visibility: visible; }
@media (max-width: 900px) {
  .desktop-only, .button.desktop-only { display: none; }
  .stage-switch { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; border: 0; border-radius: 8px; min-height: 44px; padding: 0; background: transparent; font: inherit; }
  .stage-switch .lens { width: 26px; min-width: 26px; }
  .nav-toggle.button { display: inline-flex; }
  .stage-head .nav-toggle.button, .stage-head .head-title p { display: none; }
  .heading-row { min-height: 52px; padding-block: 3px; }
  .tabs { padding-inline: 16px; gap: 22px; }
  .tab { font-size: 14px; }
  .stage-head .head-title h1 { font-size: 20px; }
  .composer { border-radius: 24px; }
  .composer textarea { min-height: 42px; }
  .request-card .actions .button { min-height: 46px; }
}

.task-head { padding: 10px 16px 12px; background: transparent; }
.task-heading-actions, .task-meta { display: flex; align-items: center; gap: 6px; }
.task-heading-actions .head-context { flex: 1; text-transform: uppercase; letter-spacing: .06em; }
.task-heading-actions .thread-link, .task-meta select { min-height: 28px; padding: 3px 9px; border-radius: 14px; font-size: 12px; }
.task-head h1 { margin: 4px 0 8px; font-size: 17px; line-height: 1.35; overflow-wrap: anywhere; }
.task-meta span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font: 11px var(--mono); }
.task-intro summary { display: flex; align-items: center; gap: 8px; list-style: none; cursor: pointer; color: var(--subtle); }
.task-intro[open] summary svg { rotate: 90deg; }
.compose-settings { position: relative; }
.compose-settings summary { display: flex; gap: 4px; align-items: center; justify-content: center; min-width: 32px; min-height: 32px; border-radius: 16px; list-style: none; color: var(--muted); font-size: 12px; cursor: pointer; }
.compose-settings[open] summary, .compose-settings summary:hover { background: var(--hover); }
.compose-settings-body { position: absolute; bottom: calc(100% + 5px); left: 0; width: max-content; display: grid; gap: 6px; z-index: 3; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--overlay); box-shadow: var(--shadow); }
.compose-settings-body span:empty { display: none; }
.compose-settings-body :is(.button, select) { width: 100%; }
.pair-meta { margin-top: 14px; }
.pair-code b { color: var(--accent); font-weight: 500; }
.pair-code code > span { color: var(--muted); }
@container (max-width: 550px) {
  .compose-settings-body { left: auto; right: 0; }
  .task-head { padding-inline: 14px; }
  .task-head .thread-link { min-height: 32px; }
}
.nav-subtitle { display: none; }
.request-card.approval { border-color: var(--line-soft); background: var(--surface); }
.approval h3 { color: var(--ink); font-size: 15px; }
.approval h3::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.approval pre { border: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 900px) {
  .nav-subtitle { display: block; font-size: 12px; font-weight: 400; }
  .nav-row:has(.nav-subtitle) { min-height: 52px; }
  .request-card.approval { box-shadow: 0 8px 24px color-mix(in srgb, var(--ink) 7%, transparent); }
  .pair-panel.awaiting-approval { margin-block: auto 0; }
  .awaiting-approval .pair-actions { margin-top: clamp(20px, 9dvh, 96px); }
}
