/* Converge shell, shared controls, Home board and Runs. Tokens live in theme.css.
   Hierarchy: the page is the base tone, panels are one step up, the rail is one
   step down. Separation comes from tone and spacing, not shadows. */

* { box-sizing:border-box; }
html { background:var(--page-bg); }
body { margin:0; min-height:100vh; background:var(--page-bg); color:var(--ink); font-family:var(--font-ui); }
button,input,textarea,select { font:inherit; color:inherit; }
button,a,input,textarea,select,[tabindex] { -webkit-tap-highlight-color:transparent; }
button { cursor:pointer; }
button:disabled { cursor:not-allowed; opacity:.5; }
a { color:inherit; }
:focus-visible { outline:2px solid var(--focus); outline-offset:2px; }
[hidden] { display:none !important; }
h1,h2,h3,h4,p { margin:0; }
summary { cursor:pointer; }
::selection { background:var(--agent-soft); color:var(--ink); }

/* Type scale: 12 / 13 / 14 / 16 / 20 / 28 / 40. Display face for headings only. */
h1 { font-family:var(--font-display); font-size:28px; line-height:1.15; font-weight:650; letter-spacing:-.02em; font-variation-settings:"opsz" 48; }
h2 { font-family:var(--font-display); font-size:16px; line-height:1.3; font-weight:620; letter-spacing:-.005em; }
h3 { font-size:14px; line-height:1.4; font-weight:600; }
.muted,.help { color:var(--muted); }
.help { font-size:12.5px; line-height:1.55; margin-top:6px; }
.eyebrow { display:block; font-size:12px; font-weight:500; color:var(--muted); letter-spacing:0; text-transform:none; }
.page-heading .eyebrow { display:none; }
.mono,code,kbd,pre { font-family:var(--font-mono); }
.mono { font-size:12px !important; }
.visually-hidden { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
.skip-link { position:fixed; top:10px; left:10px; z-index:50; transform:translateY(-200%); padding:10px 14px; border-radius:var(--radius-control); background:var(--button-bg); color:var(--button-ink); font-weight:600; text-decoration:none; }
.skip-link:focus { transform:none; }

/* Controls */
.button { display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:36px; padding:7px 14px; border:1px solid transparent; border-radius:var(--radius-control); font-size:13px; font-weight:560; line-height:1.2; white-space:nowrap; transition:background .12s,border-color .12s,color .12s; }
.primary { background:var(--button-bg); color:var(--button-ink); }
.primary:hover { background:var(--button-hover); }
.secondary { background:transparent; border-color:var(--line-strong); color:var(--ink); }
.secondary:hover { background:var(--surface-hover); }
.quiet { background:transparent; color:var(--muted); padding-left:8px; padding-right:8px; }
.quiet:hover { color:var(--ink); background:var(--surface-hover); }
.danger { background:transparent; border-color:color-mix(in srgb,var(--danger) 55%,transparent); color:var(--danger); }
.danger:hover { background:var(--danger-bg); }
label { display:block; margin-bottom:6px; font-size:13px; font-weight:550; color:var(--ink); }
input,textarea,select { background:var(--surface-subtle); color:var(--ink); border:1px solid var(--line-strong); border-radius:var(--radius-control); accent-color:var(--agent); }
input,textarea { width:100%; padding:9px 11px; }
select { padding:7px 10px; }
input:hover,textarea:hover,select:hover { border-color:var(--faint); }
input:focus-visible,textarea:focus-visible,select:focus-visible { outline:2px solid var(--focus); outline-offset:0; border-color:transparent; }
input[type="checkbox"],input[type="radio"] { width:auto; }
textarea { resize:vertical; min-height:96px; line-height:1.6; font-size:14px; }
textarea[readonly] { background:var(--sunk); }
::placeholder { color:var(--faint); opacity:1; }
option { background:var(--surface); color:var(--ink); }
fieldset { border:1px solid var(--line); border-radius:var(--radius-control); padding:12px 14px; margin:12px 0; }
legend { padding:0 6px; font-size:13px; font-weight:550; }

/* Status vocabulary. Each fact keeps its own colour: execution (agent/info),
   settled (done), needs a person (human), uncertain (hatched lilac). */
.badge { display:inline-flex; align-items:center; gap:6px; padding:2px 9px 2px 7px; border-radius:999px; font-size:12px; font-weight:550; line-height:1.5; white-space:nowrap; background:var(--surface-hover); color:var(--muted); }
.badge::before { content:""; width:7px; height:7px; border-radius:50%; background:currentColor; flex-shrink:0; }
.badge.running,.badge.starting,.badge.queued { background:var(--agent-soft); color:var(--agent); }
.badge.running::before,.badge.starting::before { animation:pulse 1.6s ease-in-out infinite; }
.badge.succeeded,.badge.accepted,.badge.completed { background:var(--done-soft); color:var(--done); }
.badge.failed,.badge.rejected { background:var(--danger-bg); color:var(--danger); }
.badge.uncertain { background:var(--uncertain-soft); color:var(--uncertain); }
.badge.uncertain::before { background:var(--hatch); border:1px solid currentColor; }
.badge.stop_requested { background:var(--warning-bg); color:var(--warning); }
.badge.stopped,.badge.reconciled { background:var(--surface-hover); color:var(--muted); }
.badge.stopped::before,.badge.reconciled::before { background:transparent; border:1.5px solid currentColor; }
@keyframes pulse { 50% { opacity:.25; } }
.status-dot { width:8px; height:8px; border-radius:50%; flex-shrink:0; background:var(--faint); }
.status-dot.good { background:var(--done); box-shadow:0 0 0 3px var(--done-soft); }
.status-dot.warn { background:var(--warning); box-shadow:0 0 0 3px var(--warning-bg); }
.role,.count { display:inline-block; padding:1px 7px; border-radius:999px; font-size:12px; font-weight:500; background:var(--surface-hover); color:var(--muted); }
.message { margin:12px 0; padding:10px 12px; border-radius:var(--radius-control); font-size:13px; line-height:1.55; background:var(--info-bg); color:var(--ink); border-left:3px solid var(--info); overflow-wrap:anywhere; }
.message.error { background:var(--danger-bg); border-left-color:var(--danger); }
.message.warning { background:var(--warning-bg); border-left-color:var(--warning); }
.truncation-note { padding:9px 14px; background:var(--warning-bg); color:var(--ink); font-size:12.5px; border-left:3px solid var(--warning); }
.state-note { font-size:13px; line-height:1.6; padding:10px 14px; background:var(--surface-subtle); border-left:3px solid var(--line-strong); white-space:pre-wrap; overflow-wrap:anywhere; }
.viewer-note { padding:12px 14px; background:var(--surface-subtle); border:1px dashed var(--line-strong); border-radius:var(--radius-control); color:var(--muted); font-size:13px; }
.panel { background:var(--surface); border:1px solid var(--line); border-radius:var(--radius-panel); overflow:hidden; }
.section-heading { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:14px; }
.subtle-label,.metric-label { font-size:12px; color:var(--muted); font-weight:500; }
.empty-list,.command-empty { color:var(--muted); font-size:13px; line-height:1.6; padding:18px 0; }
.tabs { display:flex; gap:4px; }
.tab { padding:12px 10px 10px; border:0; border-bottom:2px solid transparent; background:transparent; color:var(--muted); font-size:13px; font-weight:550; }
.tab:hover { color:var(--ink); }
.tab[aria-selected="true"] { color:var(--ink); border-bottom-color:var(--ink); }

/* Login: the threads converge once, then rest. */
.login-view { min-height:100vh; display:grid; grid-template-columns:minmax(0,1.1fr) minmax(340px,460px); align-items:center; gap:clamp(24px,6vw,96px); padding:clamp(24px,6vw,88px); max-width:1320px; margin:0 auto; }
.login-story { min-width:0; }
.login-threads { width:100%; height:auto; overflow:visible; }
.login-threads path { stroke-width:2.5; stroke-linecap:round; stroke-dasharray:720; stroke-dashoffset:720; animation:draw 1.6s cubic-bezier(.3,.6,.2,1) forwards; }
.login-threads path:nth-child(2) { animation-delay:.1s; } .login-threads path:nth-child(3) { animation-delay:.2s; } .login-threads path:nth-child(4) { animation-delay:.3s; } .login-threads path:nth-child(5) { animation-delay:.4s; }
.login-threads .t-human { stroke:var(--human); }
.login-threads .t-agent { stroke:var(--agent); stroke-dasharray:6 7; stroke-dashoffset:0; opacity:0; animation:appear .9s ease-out .5s forwards; }
.login-threads .t-node { fill:none; stroke:var(--ink); stroke-width:2; opacity:0; animation:appear .5s ease-out 1.3s forwards; }
.login-threads .t-core { fill:var(--ink); opacity:0; animation:appear .5s ease-out 1.5s forwards; }
@keyframes draw { to { stroke-dashoffset:0; } }
@keyframes appear { to { opacity:1; } }
.login-card { display:flex; flex-direction:column; gap:0; }
.login-card .brand { margin-bottom:40px; }
.login-card h1 { font-size:clamp(30px,3.4vw,42px); line-height:1.08; letter-spacing:-.025em; font-weight:680; font-variation-settings:"opsz" 96; }
.intro { margin:16px 0 32px; color:var(--muted); font-size:15px; line-height:1.6; max-width:42ch; }
.login-card #login-name { margin-bottom:14px; }
.login-card .primary { width:100%; margin-top:18px; min-height:44px; font-size:14px; }
.login-theme { margin-top:28px; }
.github-signin { margin-bottom:28px; }
.login-card .github-signin .primary { margin-top:0; text-decoration:none; }
.login-card #login-submit.secondary { width:100%; margin-top:18px; min-height:44px; font-size:14px; }

/* Brand: three threads into one node. */
.brand { display:inline-flex; align-items:center; gap:10px; text-decoration:none; font-family:var(--font-display); font-size:21px; font-weight:680; letter-spacing:-.03em; color:var(--ink); }
.brand-mark { width:26px; height:26px; fill:none; stroke:currentColor; stroke-width:1.9; stroke-linecap:round; }
.brand-mark circle { fill:var(--human); stroke:none; }
.theme-control { display:flex; align-items:center; gap:8px; color:var(--muted); font-size:12.5px; }
.theme-control label { margin:0; font-size:12.5px; font-weight:500; color:var(--muted); }
.theme-control select { padding:4px 8px; font-size:12.5px; background:transparent; border-color:var(--line); }

/* Workspace shell: a quiet rail and one content column. */
.signed-in .login-view { display:none; }
.workspace { display:grid; grid-template-columns:248px minmax(0,1fr); min-height:100vh; }
.workspace-sidebar { position:sticky; top:0; height:100vh; overflow-y:auto; display:flex; flex-direction:column; gap:6px; padding:22px 14px 16px; background:var(--sidebar); border-right:1px solid var(--line); }
.workspace-sidebar>.brand { margin:0 8px 14px; }
.header-project { position:relative; margin:0 0 10px; padding:8px 12px 9px; border:1px solid var(--line); border-radius:var(--radius-control); background:var(--surface-subtle); }
.header-project:hover { border-color:var(--line-strong); }
.header-project:focus-within { outline:2px solid var(--focus); outline-offset:2px; }
.header-project label { position:relative; z-index:1; pointer-events:none; margin:0; font-size:12px; font-weight:500; color:var(--muted); }
.header-project select { position:absolute; inset:0; width:100%; height:100%; padding:24px 34px 8px 12px; border:0; border-radius:var(--radius-control); background:transparent; appearance:none; cursor:pointer; font-family:var(--font-display); font-size:17px; font-weight:640; letter-spacing:-.01em; text-overflow:ellipsis; }
.header-project select:focus-visible { outline:0; }
.header-project-field { min-height:42px; }
.header-project-switch { position:absolute; right:10px; top:50%; width:16px; height:16px; margin-top:-8px; color:var(--muted); pointer-events:none; }
.header-project .header-project-message { position:absolute; z-index:5; top:calc(100% + 6px); left:0; width:min(320px,calc(100vw - 32px)); margin:0; }
.nav-label { display:block; margin:10px 10px 2px; font-size:12px; font-weight:500; color:var(--faint); }
.workspace-nav { display:grid; gap:2px; }
.nav-item { display:flex; align-items:center; gap:11px; width:100%; min-height:36px; padding:6px 10px; border:0; border-radius:var(--radius-control); background:transparent; color:var(--muted); font-size:14px; font-weight:520; text-align:left; }
.nav-item:hover { background:var(--surface-hover); color:var(--ink); }
.nav-item[aria-current="page"] { background:var(--surface); color:var(--ink); box-shadow:inset 0 0 0 1px var(--line); }
.nav-icon { width:18px; height:18px; flex-shrink:0; fill:none; stroke:currentColor; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round; }
.nav-icon circle:only-of-type { fill:currentColor; stroke:none; }
#nav-work .nav-icon circle,#nav-agents .nav-icon circle:first-child { fill:none; stroke:currentColor; }
.nav-item[aria-current="page"] .nav-icon { color:var(--ink); }
#nav-home[aria-current="page"] .nav-icon circle { fill:var(--human); }
.nav-count { margin-left:auto; min-width:20px; padding:0 6px; border-radius:999px; text-align:center; font-size:12px; font-weight:600; line-height:20px; background:var(--human-soft); color:var(--human); }
.nav-count.live { background:var(--agent-soft); color:var(--agent); }
.sidebar-worker { margin-top:auto; padding:14px 10px 12px; border-top:1px solid var(--line); }
.sidebar-section-title { display:flex; align-items:center; gap:8px; }
.sidebar-section-title .nav-label { margin:0; }
.sidebar-worker>strong { display:block; margin-top:6px; font-size:14px; font-weight:600; }
.sidebar-worker>p { margin-top:2px; font-size:12px; line-height:1.5; color:var(--muted); overflow-wrap:anywhere; }
.project-context-detail { margin-top:10px; }
.project-context-detail summary { font-size:12.5px; color:var(--muted); }
.project-context-detail[open] summary { color:var(--ink); }
.project-context-detail>p { margin-top:8px; font-size:12px; line-height:1.55; color:var(--muted); }
.project-location { display:grid; gap:2px; margin:10px 0 0; font-size:12px; }
.project-location dt { color:var(--faint); margin-top:6px; }
.project-location dd { margin:0; font-family:var(--font-mono); font-size:11.5px; overflow-wrap:anywhere; }
.sidebar-worker .worker-context { color:var(--human); }
.sidebar-footer { display:grid; gap:10px; padding:12px 10px 0; border-top:1px solid var(--line); }
.account { display:flex; align-items:center; gap:10px; min-width:0; }
.account-mark { display:grid; place-items:center; width:28px; height:28px; flex-shrink:0; border-radius:50%; background:var(--human); color:var(--page-bg); font-weight:700; font-size:13px; }
.account-who { display:grid; min-width:0; line-height:1.3; }
#account-name { font-weight:600; font-size:13px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.account .role { padding:0; background:none; font-size:12px; }
.account .quiet { margin-left:auto; font-size:12.5px; min-height:30px; }

.workspace-content { min-width:0; width:100%; max-width:1480px; padding:0 clamp(20px,3vw,44px) 40px; outline:none; }
.workspace-toolbar { display:flex; align-items:center; gap:20px; min-height:68px; margin-bottom:22px; border-bottom:1px solid var(--line); }
.breadcrumbs { display:flex; align-items:center; gap:8px; flex-shrink:0; font-size:13px; color:var(--muted); }
.breadcrumbs strong { color:var(--ink); font-weight:560; }
.project-search { flex:1 1 auto; max-width:520px; margin-left:auto; position:relative; }
.sync { display:flex; align-items:center; gap:8px; flex-shrink:0; font-size:12.5px; color:var(--muted); }
.sync .button { min-height:30px; }
.scope-note { margin:-6px 0 18px; font-size:13px; color:var(--muted); }
.section-nav { display:flex; flex-wrap:wrap; gap:4px; margin:0 0 26px; border-bottom:1px solid var(--line); }
.section-nav button { margin-bottom:-1px; padding:9px 12px 10px; border:0; border-bottom:2px solid transparent; background:transparent; color:var(--muted); font-size:13.5px; font-weight:540; }
.section-nav button:hover { color:var(--ink); }
.section-nav button[aria-current="page"] { color:var(--ink); border-bottom-color:var(--human); }
.page-heading { display:flex; align-items:flex-end; justify-content:space-between; gap:20px; margin-bottom:24px; }
.page-heading>div:first-child { min-width:0; flex:1; }
.page-heading .muted { margin-top:6px; font-size:14px; line-height:1.55; max-width:68ch; }
.page-heading .button { flex-shrink:0; }
.workspace-footer { display:none; }

/* Home */
#metric-reviews strong,#metric-tasks strong { color:var(--human); }
#metric-runs strong { color:var(--agent); }
.home-attention { color:var(--uncertain); }
.home-actions { display:flex; gap:10px; flex-shrink:0; }
.home-grid { display:grid; grid-template-columns:minmax(0,1fr) 340px; gap:28px; align-items:start; }
.board { min-width:0; }
.board-heading,.side-heading { display:flex; align-items:center; gap:14px; margin-bottom:12px; }
.board-heading h2,.side-heading h2 { font-size:18px; }
.side-heading h2 { font-size:15px; }
.board-heading .button,.side-heading .button { margin-left:auto; min-height:30px; font-size:12.5px; }
.board-legend { display:flex; flex-wrap:wrap; gap:4px 14px; font-size:12px; color:var(--muted); }
.board-legend span { display:inline-flex; align-items:center; gap:6px; }
.board-legend span::before { content:""; width:14px; height:0; border-top:2px solid; }
.legend-human::before { border-color:var(--human) !important; }
.legend-agent::before { border-color:var(--agent) !important; border-top-style:dashed !important; }
.legend-settled::before { border-color:var(--done) !important; }
.legend-waiting::before { width:9px !important; height:9px !important; border:2px solid var(--human) !important; border-radius:50%; }
.legend-uncertain::before { border-top:0 !important; height:6px !important; background:var(--hatch); }
.board-list { list-style:none; margin:0; padding:0; display:grid; gap:12px; }
.goal-row { display:grid; grid-template-columns:minmax(170px,.7fr) minmax(0,1.8fr); gap:20px; padding:18px 20px; background:var(--surface); border:1px solid var(--line); border-radius:var(--radius-panel); }
.goal-head { display:flex; flex-direction:column; align-items:flex-start; gap:8px; min-width:0; padding:0; border:0; background:none; text-align:left; }
.goal-title { font-family:var(--font-display); font-size:19px; line-height:1.2; font-weight:640; letter-spacing:-.015em; color:var(--ink); overflow-wrap:anywhere; }
.goal-head:hover .goal-title { text-decoration:underline; text-decoration-thickness:1px; text-underline-offset:4px; }
.goal-owner { display:inline-flex; align-items:center; gap:7px; font-size:12.5px; color:var(--muted); }
.goal-criteria { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; font-size:13px; line-height:1.5; color:var(--muted); }
.mark { display:inline-grid; place-items:center; width:20px; height:20px; flex-shrink:0; border-radius:50%; font-size:11px; font-weight:700; line-height:1; }
.mark.human { background:var(--human); color:var(--page-bg); }
.mark.agent { border:1.5px dashed var(--agent); background:var(--agent-soft); }
.mark.agent::after { content:""; width:6px; height:6px; border-radius:50%; background:var(--agent); }
.goal-threads { position:relative; display:grid; grid-template-columns:minmax(150px,1.5fr) minmax(48px,.9fr) auto; align-items:center; min-width:0; }
.thread-labels { list-style:none; margin:0; padding:0; display:grid; grid-auto-rows:34px; min-width:0; }
.thread { display:flex; align-items:center; min-width:0; }
.thread-button { display:flex; align-items:center; gap:9px; width:100%; min-width:0; padding:4px 8px 4px 0; border:0; background:none; text-align:left; font-size:13.5px; color:var(--ink); }
.thread-button:hover .thread-title { text-decoration:underline; text-underline-offset:3px; }
.thread-title { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.thread.settled .thread-title { color:var(--muted); }
.thread.idle .thread-title,.thread-empty { color:var(--faint); }
.thread-empty { font-size:13px; }
.thread-lines { width:100%; height:calc(var(--lanes) * 34px); overflow:visible; }
.thread-path { fill:none; stroke-width:2; stroke-linecap:round; stroke:var(--line-strong); }
.thread-path.idle { stroke:var(--line-strong); stroke-dasharray:2 5; }
.thread-path.moving { stroke:var(--agent); stroke-dasharray:7 5; animation:flow 1.2s linear infinite; }
.thread-path.waiting { stroke:var(--human); stroke-width:2.5; }
.thread-path.settled { stroke:var(--done); }
.thread-path.uncertain { stroke:var(--uncertain); stroke-dasharray:1.5 4; stroke-width:3; }
.thread-path.broken { stroke:var(--danger); stroke-dasharray:24 6 3 6; }
@keyframes flow { to { stroke-dashoffset:-24; } }
.decision-node { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:0; width:78px; height:78px; margin-left:-4px; border:2px solid var(--line-strong); border-radius:50%; background:var(--surface-subtle); color:var(--muted); line-height:1.15; }
.decision-node strong { font-family:var(--font-display); font-size:20px; font-weight:650; color:var(--ink); font-variant-numeric:tabular-nums; }
.decision-node span { font-size:10.5px; text-align:center; max-width:64px; }
.decision-node:hover { border-color:var(--ink); }
.decision-node.waiting { border-color:var(--human); box-shadow:0 0 0 5px var(--human-soft); }
.decision-node.waiting span { color:var(--human); }
.decision-node.ready { border-color:var(--done); background:var(--done-soft); }
.decision-node.ready span { color:var(--done); }
.decision-node.uncertain { border-color:var(--uncertain); border-style:dashed; }
.thread-more { grid-column:1; justify-self:start; min-height:28px; padding-left:0; font-size:12.5px; }
.home-start { display:flex; align-items:center; gap:24px; padding:28px; border:1px dashed var(--line-strong); border-radius:var(--radius-panel); }
.home-start svg { width:120px; flex-shrink:0; fill:none; stroke:var(--faint); stroke-width:2; stroke-dasharray:3 5; }
.home-start svg circle { fill:var(--human); stroke:none; }
.home-start h3 { font-family:var(--font-display); font-size:19px; font-weight:640; }
.home-start p { margin-top:6px; color:var(--muted); line-height:1.6; max-width:56ch; }
.home-side { display:grid; gap:26px; min-width:0; }
.side-section { min-width:0; }
.command-list { list-style:none; margin:0; padding:0; }
.command-list>li+li { border-top:1px solid var(--line); }
.command-row { display:flex; align-items:center; justify-content:space-between; gap:12px; width:100%; padding:10px 2px; border:0; background:none; text-align:left; color:var(--ink); }
.command-row:hover .command-row-title { text-decoration:underline; text-underline-offset:3px; }
.command-row-copy { display:grid; gap:2px; min-width:0; }
.command-row-title { font-size:13.5px; font-weight:540; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.command-row-meta { font-size:12px; color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.command-row>.badge { flex-shrink:0; max-width:45%; overflow:hidden; text-overflow:ellipsis; }
.home-side .command-empty { padding:6px 0 0; }
.command-section-note { font-size:12px; color:var(--muted); }

/* Runs */
.overview { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); margin-bottom:20px; border:1px solid var(--line); border-radius:var(--radius-panel); background:var(--surface); }
.metric { display:flex; flex-direction:column; gap:2px; padding:14px 20px; }
.metric+.metric { border-left:1px solid var(--line); }
.metric strong { font-family:var(--font-display); font-size:24px; font-weight:620; font-variant-numeric:tabular-nums; }
.metric-note { font-size:12px; color:var(--muted); overflow-wrap:anywhere; }
.workbench { display:grid; grid-template-columns:minmax(260px,320px) minmax(0,1fr); gap:22px; align-items:start; }
.run-sidebar { display:grid; gap:18px; }
.compose { padding:18px; }
.compose .section-heading h2 { font-size:16px; }
.provider-picker { display:flex; align-items:center; gap:8px; margin:0; font-size:12.5px; font-weight:500; color:var(--muted); }
.compose .primary { width:100%; margin-top:14px; }
.compose label { font-size:13px; }
.agent-work-mode { display:flex; gap:10px; align-items:flex-start; margin:10px 0 0; line-height:1.5; font-weight:550; }
.agent-work-mode input { margin:3px 0 0; }
.agent-work-mode+.help { margin:2px 0 0 24px; }
.history .section-heading { margin:0; padding:14px 18px; border-bottom:1px solid var(--line); }
.history-tools,.detail-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
#runs-archived { min-height:28px; font-size:12.5px; }
#runs-archived[aria-pressed="true"] { background:var(--surface-hover); color:var(--ink); }
.run-list { list-style:none; margin:0; padding:0; max-height:640px; overflow-y:auto; }
.run-list li+li .run-item { border-top:1px solid var(--line); }
.run-item { display:block; width:100%; padding:12px 18px; border:0; background:transparent; text-align:left; color:var(--ink); }
.run-item:hover { background:var(--surface-hover); }
.run-item[aria-current="true"] { background:var(--surface-hover); box-shadow:inset 3px 0 var(--agent); }
.run-item-title { display:block; margin-bottom:6px; font-size:13.5px; font-weight:540; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.run-item-meta { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.run-item-time { font-size:12px; color:var(--muted); }
.empty-list { padding:18px; }
.detail-panel { min-height:560px; }
.detail-empty { min-height:560px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:8px; padding:40px; text-align:center; color:var(--muted); }
.detail-empty h2 { font-size:20px; color:var(--ink); }
.detail-empty p { max-width:34ch; line-height:1.6; }
.detail-header { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; padding:22px 26px 16px; }
.detail-title-row { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.detail-title-row h2 { font-size:22px; letter-spacing:-.015em; }
#detail-location { margin-top:8px; max-width:80ch; overflow-wrap:anywhere; }
.detail-header~.message,.state-note,.run-diagnosis { margin:0 26px 14px; }
.run-diagnosis { padding:12px 14px; background:var(--surface-subtle); border-left:3px solid var(--danger, var(--line-strong)); border-radius:var(--radius-control); }
.run-diagnosis h3 { margin:0 0 8px; font-size:15px; }
.run-diagnosis dl { margin:0; display:grid; gap:4px; font-size:13px; line-height:1.6; }
.run-diagnosis dt { color:var(--muted); }
.run-diagnosis dd { margin:0 0 6px; overflow-wrap:anywhere; }
#run-live-status { padding:0 26px; }
.prompt-block { padding:4px 26px 20px; }
.prompt-block>summary { font-size:13px; color:var(--muted); }
.prompt-block p { margin-top:8px; font-size:14px; line-height:1.65; white-space:pre-wrap; overflow-wrap:anywhere; max-width:80ch; }
.output-heading { display:flex; align-items:center; justify-content:space-between; padding:0 22px; border-top:1px solid var(--line); border-bottom:1px solid var(--line); }
.response-panel { min-height:240px; padding:26px; }
.response-panel>section>h3 { margin-bottom:14px; font-size:13px; color:var(--muted); font-weight:550; }
.response-panel .truncation-note { margin-bottom:16px; }
.response-empty,.capture-empty { color:var(--muted); font-size:13.5px; }
.output-panel { min-height:240px; max-height:600px; overflow:auto; padding:18px 24px; background:var(--code); color:var(--ink); }
.output-panel pre { margin:0; white-space:pre-wrap; overflow-wrap:anywhere; font:12px/1.75 var(--font-mono); }
.earlier-messages { margin-top:26px; padding-top:14px; border-top:1px solid var(--line); }
.earlier-messages>summary { font-size:13px; color:var(--muted); }
.earlier-messages section { padding-top:18px; }
.earlier-messages section>h4 { margin:0 0 8px; font-size:12.5px; color:var(--muted); font-weight:550; }
.run-metadata { border-top:1px solid var(--line); }
.run-metadata>summary { padding:13px 26px; font-size:13px; color:var(--muted); }
.run-meta { display:grid; grid-template-columns:1fr 1fr; gap:12px 24px; margin:0; padding:4px 26px 18px; }
.run-meta dt { font-size:12px; color:var(--muted); }
.run-meta dd { margin:2px 0 0; font-size:13px; overflow-wrap:anywhere; }
.detail-footer { display:flex; justify-content:space-between; gap:12px; padding:12px 26px; border-top:1px solid var(--line); font-size:12px; color:var(--faint); }
.session-turns,.follow-up { padding:18px 26px; border-top:1px solid var(--line); }
.follow-up h3 { margin-bottom:6px; font-size:15px; font-family:var(--font-display); font-weight:620; }
.follow-up form { margin-top:12px; }
.follow-up textarea { display:block; margin:6px 0 12px; }
.session-turns summary { color:var(--muted); font-size:13px; }
#session-turn-list { display:flex; flex-wrap:wrap; gap:6px; margin-top:12px; }
#session-turn-list [aria-current="page"] { background:var(--surface-hover); color:var(--ink); border-color:var(--line-strong); }
.project-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.progress-list { list-style:none; margin:10px 0 0; padding:0; }
.progress-list li { display:flex; align-items:baseline; gap:14px; padding:8px 0; border-bottom:1px solid var(--line); }
.progress-list code { min-width:0; font-size:12.5px; white-space:pre-wrap; overflow-wrap:anywhere; }
.progress-status { flex:0 0 7rem; font-size:12px; color:var(--muted); }
.progress-running { color:var(--agent); }
.feedback-comment { display:flex; align-items:flex-start; gap:10px; margin:8px 0; padding:10px 12px; border:1px solid var(--line); border-radius:var(--radius-control); }
.feedback-comment input { margin-top:3px; }
.feedback-comment span { white-space:pre-wrap; overflow-wrap:anywhere; }
#follow-up-feedback { margin:12px 0; }
.session-controls textarea { margin:8px 0; }
.session-controls pre { max-height:16rem; overflow:auto; padding:12px; border:1px solid var(--line); border-radius:var(--radius-control); background:var(--code); white-space:pre-wrap; overflow-wrap:anywhere; font-size:12px; }
.session-controls .project-actions { flex-wrap:wrap; }
.control-history { max-height:20rem; overflow:auto; padding-left:1.5rem; }
.control-history li { padding:8px 0; border-bottom:1px solid var(--line); overflow-wrap:anywhere; }
.control-history p { white-space:pre-wrap; margin:4px 0; }

/* Agent messages: pinned Markdown output, read like a document. */
.agent-message { max-width:74ch; min-width:0; font-size:15px; line-height:1.7; overflow-wrap:anywhere; }
.agent-message>:first-child { margin-top:0; }
.agent-message>:last-child { margin-bottom:0; }
.agent-message :is(p,ul,ol,blockquote,.message-table,.message-code) { margin:0 0 1.1em; }
.agent-message :is(h1,h2,h3,h4,h5,h6) { margin:1.6em 0 .55em; font-family:var(--font-display); font-weight:640; line-height:1.3; letter-spacing:-.01em; color:var(--ink); text-transform:none; }
.agent-message h1 { font-size:1.55em; } .agent-message h2 { font-size:1.3em; } .agent-message h3 { font-size:1.12em; } .agent-message :is(h4,h5,h6) { font-size:1em; }
.agent-message :is(ul,ol) { padding-left:1.5em; }
.agent-message li { margin:.3em 0; }
.agent-message li>:is(p,ul,ol) { margin-bottom:.4em; }
.agent-message li::marker { color:var(--faint); }
.agent-message a { color:var(--agent); text-decoration-thickness:1px; text-underline-offset:3px; }
.agent-message a:hover { color:var(--ink); }
.agent-message code { font:.86em/1.6 var(--font-mono); padding:.12em .38em; border-radius:5px; background:var(--code); }
.agent-message .message-code { overflow-x:auto; border:1px solid var(--line); border-radius:10px; background:var(--code); }
.agent-message pre { margin:0; padding:14px 18px; width:max-content; min-width:100%; white-space:pre; overflow-wrap:normal; font-size:13px; line-height:1.65; tab-size:4; }
.agent-message pre code { padding:0; background:none; border-radius:0; font-size:inherit; }
.agent-message blockquote { padding:4px 16px; border-left:3px solid var(--line-strong); color:var(--muted); }
.agent-message blockquote>:last-child { margin-bottom:0; }
.agent-message .message-table { max-width:100%; overflow-x:auto; border:1px solid var(--line); border-radius:10px; }
.agent-message table { width:100%; border-collapse:collapse; font-size:.9em; line-height:1.55; }
.agent-message :is(th,td) { min-width:8em; padding:9px 14px; text-align:left; border-bottom:1px solid var(--line); }
.agent-message th { background:var(--surface-subtle); font-weight:600; color:var(--ink); }
.agent-message tr:last-child td { border-bottom:0; }
.agent-message .align-left { text-align:left; } .agent-message .align-center { text-align:center; } .agent-message .align-right { text-align:right; }
.agent-message hr { margin:1.8em 0; border:0; border-top:1px solid var(--line); }
.agent-message .image-description { color:var(--muted); font-style:italic; }

/* Responsive */
@media (max-width:1180px) {
  .home-grid { grid-template-columns:1fr; }
  .home-side { grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); }
  .goal-row { grid-template-columns:1fr; gap:14px; }
}
@media (max-width:960px) {
  .workspace { grid-template-columns:1fr; }
  .workspace-sidebar { position:sticky; z-index:20; height:auto; flex-direction:row; flex-wrap:wrap; align-items:center; gap:8px 12px; padding:10px 16px; border-right:0; border-bottom:1px solid var(--line); }
  .workspace-sidebar>.brand { margin:0; font-size:18px; }
  .header-project { order:2; flex:1 1 220px; margin:0; }
  .workspace-nav { order:3; display:flex; flex-wrap:wrap; gap:2px; flex-basis:100%; }
  .workspace-sidebar>.nav-label { display:none; }
  .nav-item { width:auto; min-height:40px; font-size:13.5px; }
  .sidebar-worker { order:4; flex:1 1 auto; margin:0; padding:6px 0 0; border:0; display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
  .sidebar-worker>strong { margin:0; font-size:13px; }
  .sidebar-worker>p { margin:0; }
  .project-context-detail { margin:0; }
  .sidebar-footer { order:5; display:flex; align-items:center; padding:6px 0 0; border:0; }
  .workspace-toolbar { flex-wrap:wrap; gap:10px 16px; padding:12px 0; }
  .project-search { order:3; flex-basis:100%; max-width:none; }
  .workbench { grid-template-columns:1fr; }
  .login-view { grid-template-columns:1fr; align-content:center; }
  .login-story { max-width:420px; }
}
@media (max-width:700px) {
  .goal-threads { grid-template-columns:minmax(0,1fr) 36px auto; }
  .decision-node { width:64px; height:64px; }
  .decision-node span { display:none; }
  .board-legend { display:none; }
  .page-heading { flex-direction:column; align-items:flex-start; }
  .detail-header,.prompt-block,.response-panel,.session-turns,.follow-up,.run-meta,.detail-footer { padding-left:18px; padding-right:18px; }
  .detail-header { flex-direction:column; }
  .detail-header~.message,.state-note,.run-diagnosis { margin-left:18px; margin-right:18px; }
  .run-meta { grid-template-columns:1fr; }
  .overview { grid-template-columns:1fr 1fr 1fr; }
  .metric { padding:12px; }
}
@media (prefers-reduced-motion:reduce) {
  *,*::before,*::after { animation:none !important; transition:none !important; }
  .login-threads :is(path,circle) { stroke-dashoffset:0 !important; opacity:1 !important; }
}

/* Keep project warnings readable when the project control lives in the rail. */
.workspace-sidebar .header-project-field { position:relative; }
.workspace-sidebar .header-project select { padding:16px 22px 0 0; }
.workspace-sidebar .header-project-switch { top:29px; }
.workspace-sidebar .header-project .header-project-message { position:static; width:auto; margin:8px 0 0; overflow-wrap:anywhere; }

/* Run this goal: one sheet that queues every open task as its own isolated run. */
.run-goal { width:min(520px, calc(100vw - 32px)); max-height:calc(100dvh - 32px); padding:22px; border:1px solid var(--line-strong); border-radius:var(--radius-panel); background:var(--surface); color:var(--ink); }
.run-goal::backdrop { background:rgb(0 0 0 / .6); }
.run-goal h2 { margin:0 0 6px; font-family:var(--font-display); font-size:20px; }
.run-goal-summary, .run-goal-note { color:var(--muted); font-size:13px; line-height:1.5; }
.run-goal-tasks { margin:14px 0; padding:0; border:0; display:grid; gap:4px; }
.run-goal-tasks legend { font-size:13px; font-weight:550; margin-bottom:6px; }
.run-goal-task { display:flex; gap:10px; align-items:flex-start; margin:0; padding:8px 4px; font-weight:450; }
.run-goal-task input { width:auto; margin-top:3px; }
.run-goal-task small { display:block; color:var(--muted); font-weight:400; }
.run-goal-task.unavailable { color:var(--faint); }
.run-goal select { width:100%; padding:9px 11px; margin-bottom:6px; }
.run-goal-merge { display:flex; align-items:center; gap:8px; margin:6px 0; font-size:13px; }
.run-goal-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:14px; }
@media (max-width:899px) { .run-goal { width:100vw; max-width:100vw; max-height:92dvh; margin:auto 0 0; border-radius:var(--radius-panel) var(--radius-panel) 0 0; } }

/* Chat layout for runs you can talk to: record and instructions first, then
   activity and messages oldest to newest, then a composer pinned to the bottom. */
#detail.chat { display:flex; flex-direction:column; height:calc(100dvh - 34px); overflow-y:auto; overscroll-behavior:contain; scrollbar-gutter:stable; }
.detail-panel:has(> #detail.chat) { position:sticky; top:16px; align-self:start; min-height:0; }
#detail.chat > #session-turns, #detail.chat > #prompt-details { order:1; }
#detail.chat > #run-progress, #detail.chat > #delegation-children { order:2; }
#detail.chat > .output-heading, #detail.chat > #output-panel, #detail.chat > #truncation-note, #detail.chat > #raw-events-panel, #detail.chat > #diagnostics-panel { order:3; }
#detail.chat > #run-metadata, #detail.chat > .run-worktree { order:1; }
#detail.chat > #session-controls, #detail.chat > #follow-up { order:5; position:sticky; bottom:0; z-index:5; margin:0; padding-top:12px; padding-bottom:14px; background:var(--page-bg); border-top:1px solid var(--line-strong); box-shadow:0 -12px 24px -12px rgb(0 0 0 / .5); }
#detail.chat #output-panel { display:flex; flex-direction:column; }
#detail.chat #earlier-messages { order:-1; }
#detail.chat #earlier-message-list { display:flex; flex-direction:column-reverse; }
#detail.chat .session-controls textarea, #detail.chat #follow-up-prompt { min-height:56px; max-height:30vh; margin:6px 0 8px; }
#detail.chat .session-controls .project-actions { gap:6px; }
#detail.chat #follow-up-title, #detail.chat #follow-up label[for="follow-up-prompt"] { display:none; }
.session-deliveries { margin-top:8px; font-size:13px; }
.session-deliveries summary { cursor:pointer; color:var(--muted); }
@media (max-width:899px) {
  #detail.chat { height:auto; overflow:visible; }
  .detail-panel:has(> #detail.chat) { position:static; overflow:visible; }
  #detail.chat > #session-controls, #detail.chat > #follow-up { bottom:calc(var(--tabs-h) + env(safe-area-inset-bottom)); padding-bottom:10px; }
  #detail.chat:has(textarea:focus) > #session-controls, #detail.chat:has(textarea:focus) > #follow-up { bottom:var(--kb,0px); }
  #detail.chat .session-controls .project-actions { display:flex; }
  #detail.chat .session-controls .project-actions .button.quiet { display:none; }
  #detail.chat .session-controls .project-actions .button { min-height:40px; }
}

/* Focus moves to the page title on navigation so screen readers announce it;
   the title is not a control, so it shows no focus ring. */
h1[tabindex="-1"]:focus { outline:none; }
/* Views refresh live; their own Refresh is a quiet secondary action. */
.page-heading .view-refresh { background:transparent; border-color:transparent; color:var(--muted); }
.page-heading .view-refresh:hover { color:var(--ink); background:var(--surface-hover); }

/* Home opens as a briefing: what needs you, what agents are doing, what to do next. */
.home-brief { display:grid; gap:14px; margin:6px 0 30px; max-width:760px; }
.home-project { font-size:13px; color:var(--muted); }
.home-brief h1 { font-size:clamp(30px,3.4vw,42px); font-weight:690; letter-spacing:-.03em; font-variation-settings:"opsz" 96; }
.home-status { list-style:none; margin:2px 0 0; padding:0; display:grid; gap:2px; }
.home-status li { display:flex; align-items:center; gap:12px; }
.home-status button { border:0; background:none; padding:6px 0; color:var(--ink); font-size:15.5px; line-height:1.45; text-align:left; }
.home-status button:hover { text-decoration:underline; text-decoration-color:var(--line-strong); text-underline-offset:4px; }
.home-status strong { font-weight:650; }
.home-status-dot { flex:0 0 auto; width:9px; height:9px; border-radius:50%; }
.home-status-dot.agent { background:var(--agent); }
.home-status-dot.human { background:var(--human); }
.home-status-dot.review { background:var(--done); }
.home-attention { color:var(--uncertain); }
.home-brief .home-actions { display:flex; flex-wrap:wrap; gap:10px; margin-top:6px; }
.home-brief .home-onboarding { font-size:13.5px; color:var(--muted); }

/* Totals and provider usage are supporting facts: one tap away, below the work. */
.run-stats { margin-top:28px; border-top:1px solid var(--line); padding-top:6px; }
.run-stats > summary { padding:10px 0; color:var(--muted); font-size:13.5px; cursor:pointer; }
.run-stats[open] > summary { color:var(--ink); margin-bottom:10px; }
