@import url('/tokens.css?v=5');

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { background: var(--surface-page); scrollbar-color: var(--border-default) var(--surface-page); touch-action: manipulation; overscroll-behavior: none; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { min-height: 100dvh; overflow-x: clip; overscroll-behavior: none; color: var(--text-primary); background: var(--surface-page); font: 400 16px/1.5 var(--font-body); }
body.sheet-open { overflow: hidden; }
::selection { background: var(--action-primary); color: var(--action-text); }
button, input, select, textarea { font: inherit; }
button { border: 0; background: none; color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: not-allowed; opacity: .55; }
.btn.is-busy:disabled { opacity: .8; cursor: progress; }
.btn.is-busy::before { content: ""; width: 16px; height: 16px; margin-right: 8px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; vertical-align: -3px; animation: btn-spin .8s linear infinite; }
@keyframes btn-spin { to { transform: rotate(360deg); } }
.browser-live img { display: block; width: 100%; min-height: 120px; border: 1px solid var(--border-default); border-radius: var(--radius-control); background: #fff; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-user-drag: none; cursor: crosshair; }
@media (prefers-reduced-motion: reduce) { .btn.is-busy::before { animation-duration: 2.4s; } }
a { color: var(--action-primary); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--action-primary); outline-offset: 3px; }
input, textarea { caret-color: var(--action-primary); }
h1, h2 { text-wrap: balance; line-height: 1.1; }
.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; }
.screen { min-height: 100dvh; display: flex; flex-direction: column; }

#app { max-width: 1120px; margin-inline: auto; }
.topbar { display: flex; align-items: center; gap: var(--space-3); padding: calc(env(safe-area-inset-top) + 28px) 24px 16px; }
.title-block { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; flex: 1; }
.title { font-size: clamp(32px, 4vw, 48px); font-weight: 600; letter-spacing: -.035em; }
.summary { color: var(--text-secondary); font-size: 13px; line-height: 1.4; }
.host { display: grid; gap: 4px; margin-left: auto; font: 11px/1.3 var(--font-data); font-variant-numeric: tabular-nums; color: var(--text-secondary); }
.host-row { display: grid; grid-template-columns: 28px 38px 70px; align-items: center; gap: 7px; }
.host-meter { height: 5px; border-radius: 3px; background: var(--surface-muted); overflow: hidden; }
.host-meter > i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--status-positive); transition: width 600ms ease, background-color 600ms ease; }
.host-v { text-align: right; }
.host-row[data-level="warn"] .host-meter > i { background: var(--status-working); }
.host-row[data-level="warn"] .host-v { color: var(--status-working); }
.host-row[data-level="hot"] .host-meter > i { background: var(--status-danger); }
.host-row[data-level="hot"] .host-v { color: var(--status-danger); }
.icon-btn { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border: 1px solid var(--border-default); border-radius: var(--radius-control); background: var(--surface-panel); }
#btn-menu { margin-left: auto; }
.host:not([hidden]) + #btn-menu { margin-left: 4px; }
.icon-btn:hover { background: var(--surface-muted); }
.tabs { --tabs-gutter: 24px; position: sticky; top: env(safe-area-inset-top); z-index: 4; display: flex; gap: 24px; padding-inline: var(--tabs-gutter); background: linear-gradient(var(--border-default), var(--border-default)) bottom center / calc(100% - 2 * var(--tabs-gutter)) 1px no-repeat, var(--bar-bg); -webkit-backdrop-filter: var(--bar-blur); backdrop-filter: var(--bar-blur); }
/* The status bar is see-through in the installed app: the list scrolls under a
   strip of the same frosted material as the sticky tabs, never under bare text. */
#app::before { content: ""; position: fixed; inset: 0 0 auto; z-index: 6; height: env(safe-area-inset-top); background: var(--bar-bg); -webkit-backdrop-filter: var(--bar-blur); backdrop-filter: var(--bar-blur); pointer-events: none; }
.tab { position: relative; min-height: 48px; padding: 8px 0 14px; color: var(--text-secondary); font-size: 14px; font-weight: 600; }
.tab.selected { color: var(--action-primary); }
.tab.selected::after { content: ''; position: absolute; height: 2px; bottom: -1px; left: 0; right: 0; background: var(--action-primary); }
.tab-n { margin-left: 4px; font-size: 12px; font-variant-numeric: tabular-nums; }
.list { margin: 0 24px 120px; padding: 0 16px; background: var(--surface-panel); border-radius: var(--radius-panel); box-shadow: var(--shadow-list); }
.list .card:last-child { border-bottom: 0; }
.card { width: 100%; display: flex; align-items: center; gap: 16px; padding: 23px 0; text-align: left; border-bottom: 1px solid var(--border-default); transition: background var(--duration-fast); }
.card:hover { background: var(--surface-panel); }
.avatar { width: 40px; height: 40px; flex: none; }
.avatar-halo { display: none; }
.avatar-core { width: 100%; height: 100%; display: grid; place-items: center; border-radius: var(--radius-control); background: var(--surface-muted); font-size: 16px; font-weight: 600; color: var(--text-secondary); }
.card.active .avatar-core { color: var(--status-working); background: var(--status-working-tint); }
.card-main { min-width: 0; flex: 1; }
.card-name, .card-sub, .card-status { display: block; }
.card-name { font-size: 18px; font-weight: 600; letter-spacing: -.015em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.card-sub { color: var(--text-secondary); font: 12px/1.6 var(--font-data); margin-top: 3px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.card-status { margin-top: 5px; font-size: 13px; line-height: 1.45; color: var(--text-secondary); overflow-wrap: anywhere; }
.card[data-activity="running"] .card-status,
.card[data-activity="starting"] .card-status,
.card[data-activity="waiting"] .card-status { color: var(--status-working); }
.card[data-activity="finished"] .card-status { color: var(--status-positive); }
.card[data-activity="failed"] .card-status { color: var(--status-danger); }
.activity-label { display: inline-flex; align-items: center; gap: 6px; }
.activity-label .s-dot { flex: none; margin: 0; }
.status-icon { flex: none; }
.activity-detail { display: block; margin-top: 4px; }

.card.ended .avatar-core { background: none; border: 1px solid var(--border-default); }
.card-side { text-align: right; flex: none; max-width: 125px; }
.card-prs { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 6px; }
.pr-link { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 2px 8px 2px 6px; border-radius: 6px; background: var(--surface-muted); color: var(--text-secondary); font: 500 12px/1.5 var(--font-data); font-variant-numeric: tabular-nums; white-space: nowrap; cursor: pointer; transition: background var(--duration-fast), color var(--duration-fast); }
.pr-num { overflow: hidden; text-overflow: ellipsis; }
.pr-icon { flex: none; color: var(--text-secondary); opacity: .7; }
.pr-link[data-state="open"] .pr-icon { color: var(--status-positive); opacity: 1; }
.pr-link[data-state="merged"] .pr-icon { color: var(--pr-merged); opacity: 1; }
.pr-link[data-state="closed"] .pr-icon { color: var(--status-danger); opacity: 1; }
.pr-link[data-state="draft"] .pr-icon { color: var(--text-secondary); opacity: 1; }
.pr-link:hover, .pr-link:focus-visible { color: var(--text-primary); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; outline: none; }
.pr-link:focus-visible { box-shadow: 0 0 0 2px var(--border-default); }
@media (pointer: coarse) { .pr-link { min-height: 32px; padding: 4px 8px 4px 6px; gap: 4px; font-size: 12.5px; } .card-prs { gap: 6px 4px; margin-top: 8px; } }
.card-time { color: var(--text-secondary); font: 12px/1.5 var(--font-data); font-variant-numeric: tabular-nums; }
.chip { display: inline-block; margin-top: 5px; padding: 2px 7px; border: 1px solid var(--border-default); border-radius: 4px; color: var(--text-secondary); font-size: 10px; font-weight: 600; letter-spacing: .025em; text-transform: uppercase; }
.chip-model { text-transform: none; letter-spacing: 0; }
.chip-provider-claude { color: var(--provider-claude); }
.chip-provider-codex { color: var(--provider-codex); }
.chip-provider-command { color: var(--provider-command); }
.chip-provider-command-code { color: var(--provider-command-code); }
.s-dot { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: currentColor; vertical-align: 1px; }
.empty { margin: 32px 24px 120px; padding: 24px 0; text-align: center; }
.empty-halo { display: none; }
.empty h2 { font-size: 28px; font-weight: 500; letter-spacing: -.025em; }
.empty p { margin-top: 12px; color: var(--text-secondary); font-size: 15px; }
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; padding: 16px max(24px, env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 16px) max(24px, env(safe-area-inset-left)); border-top: 1px solid var(--border-default); background: var(--bar-bg); -webkit-backdrop-filter: var(--bar-blur); backdrop-filter: var(--bar-blur); }

.btn { border-radius: var(--radius-control); padding: 13px 20px; min-height: 48px; font-size: 15px; font-weight: 600; line-height: 1.4; transition: background var(--duration-fast), color var(--duration-fast); }
a.btn { display: block; text-align: center; text-decoration: none; }
.btn-big { width: 100%; }
.btn-primary { color: var(--action-text); background: var(--action-primary); }
.btn-primary:hover:not(:disabled) { background: var(--action-hover); }
.btn-danger { background: var(--status-danger-tint); color: var(--status-danger); }
.btn-ghost { background: var(--surface-muted); color: var(--text-primary); }
.btn-ghost:hover:not(:disabled) { background: var(--border-default); }
.btn-link { min-height: 44px; color: var(--text-secondary); text-decoration: underline; text-underline-offset: 4px; font-size: 14px; }
.label { display: block; color: var(--text-primary); font-size: 13px; font-weight: 600; margin: 24px 0 8px; }
.field { width: 100%; min-height: 48px; border: 1px solid var(--border-default); border-radius: var(--radius-control); background: var(--surface-panel); color: var(--text-primary); padding: 12px 14px; font: 16px/1.4 var(--font-body); }
.field::placeholder { color: var(--text-muted); }
.field:focus { outline: 2px solid var(--action-primary); outline-offset: 1px; }
.ws-row { display: flex; align-items: center; gap: 12px; min-height: 44px; color: var(--text-secondary); font-size: 14px; line-height: 1.5; margin-block: 8px; cursor: pointer; }
.ws-row input, .provider-pick input { width: 18px; height: 18px; accent-color: var(--action-primary); flex: none; }
.ws-warn { color: var(--status-danger); font-weight: 600; }
.hint { color: var(--text-secondary); font-size: 12px; line-height: 1.55; margin-top: 12px; overflow-wrap: anywhere; }
#name-preview { color: var(--action-primary); }

.scrim { position: fixed; inset: 0; z-index: 10; background: var(--scrim); opacity: 0; transition: opacity var(--duration-panel) var(--ease-out); }
.scrim.show { opacity: 1; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 11; max-height: 90dvh; overflow-y: auto; overscroll-behavior: contain; background: var(--surface-panel); border-radius: 16px 16px 0 0; padding: 12px 24px calc(env(safe-area-inset-bottom) + 24px); box-shadow: var(--shadow-overlay); transform: translateY(100%); transition: transform var(--duration-panel) var(--ease-out); }
.sheet.show { transform: translateY(0); }
.grab { width: 32px; height: 4px; margin: 0 auto 24px; border-radius: 2px; background: var(--border-default); }
.sheet-title { font-size: 27px; font-weight: 500; letter-spacing: -.025em; margin-bottom: 12px; padding-right: 24px; }
.sheet-body { font-size: 14px; line-height: 1.55; color: var(--text-secondary); margin-bottom: 20px; overflow-wrap: anywhere; }
.sheet .btn-big { margin-top: 12px; }
.sheet-close { position: absolute; right: 16px; top: 24px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: var(--radius-control); color: var(--text-secondary); }
.sheet-back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin: -8px 48px 8px 0; padding: 8px 0; color: var(--action-primary); font-size: 14px; }
.sheet-back svg { flex: none; }
.sheet-back:hover { color: var(--action-hover); }
.sheet-close:hover { background: var(--surface-muted); }
.sheet:focus { outline: none; }
.row-btn { width: 100%; min-height: 52px; display: block; text-align: left; padding: 14px 0; font-size: 15px; border-bottom: 1px solid var(--border-default); }
.row-btn:hover { color: var(--action-primary); }
.row-danger { color: var(--status-danger); }
.menu-group { margin-block: 24px; padding-block: 20px; border-block: 1px solid var(--border-default); }
.menu-group .label { margin-top: 0; }
.menu-group .hint { margin-top: 10px; }
.picker { display: flex; flex-direction: column; gap: 8px; }
.pick { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; text-align: left; padding: 12px; border: 1px solid var(--border-default); border-radius: var(--radius-control); background: var(--surface-panel); font-size: 14px; }
.pick.selected { border-color: var(--action-primary); background: var(--action-tint); }
.pick-path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick .pick-path, .proj-row .pick-path { color: var(--text-secondary); font: 12px/1.5 var(--font-data); margin-top: 3px; }
.provider-fieldset { min-width: 0; border: 0; }
.provider-picker { display: flex; flex-direction: column; }
.provider-pick { display: grid; grid-template-columns: auto 32px minmax(0,1fr); gap: 12px; align-items: center; min-height: 68px; padding: 12px 8px; border-bottom: 1px solid var(--border-default); cursor: pointer; }
.provider-pick:hover { background: var(--surface-page); }
.provider-pick:has(input:checked), .provider-pick.selected { background: var(--action-tint); }
.provider-pick:has(input:disabled) { opacity: .6; cursor: not-allowed; }
.provider-mark { width: 32px; height: 32px; display: grid; place-items: center; font-size: 15px; font-weight: 600; }
.provider-mark-claude { color: var(--provider-claude); }
.provider-mark-codex { color: var(--provider-codex); }
.provider-mark-command { color: var(--provider-command); }
.provider-mark-command-code { color: var(--provider-command-code); }
.provider-copy { min-width: 0; }
.provider-name { display: block; font-size: 15px; font-weight: 600; }
.provider-detail { display: block; color: var(--text-secondary); font-size: 12px; line-height: 1.4; margin-top: 2px; }
.provider-note { color: var(--text-secondary); font-size: 12px; line-height: 1.5; margin-top: 10px; }
.repo-results { max-height: 232px; overflow-y: auto; margin-top: 8px; border: 1px solid var(--border-default); border-radius: var(--radius-control); }
.repo-opt { width: 100%; display: block; text-align: left; padding: 12px; border-bottom: 1px solid var(--border-default); font-size: 14px; }
.repo-opt:last-child { border-bottom: 0; }
.repo-opt:hover, .repo-opt.selected { background: var(--action-tint); color: var(--action-primary); }
.repo-sub, .repo-empty { display: block; color: var(--text-secondary); font-size: 12px; }
.repo-empty { padding: 12px; }
.branch-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.branch-label { font-size: 13px; color: var(--text-secondary); }
.branch-btn { min-width: 0; flex: 1; min-height: 44px; padding: 10px 12px; text-align: left; border: 1px solid var(--border-default); border-radius: var(--radius-control); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.branch-btn[data-loading="1"] { color: var(--text-secondary); }
.auth-status { background: var(--surface-page); padding: 16px; font-size: 14px; color: var(--text-secondary); border-radius: var(--radius-control); }
.auth-tail { margin-top: 16px; padding: 12px; overflow-x: auto; background: var(--surface-page); color: var(--text-secondary); font: 12px/1.5 var(--font-data); border-radius: var(--radius-control); }
.device-code-wrap { margin-top: 16px; }
.device-code-wrap .label { margin-top: 0; }
.device-code { color: var(--action-primary); font: 600 24px/1.4 var(--font-data); letter-spacing: .05em; overflow-wrap: anywhere; }
.account-details { margin-top: 24px; }
#agent-account-state { font-weight: 600; color: var(--text-primary); margin-bottom: 0; }
.cli-update-details { display: grid; grid-template-columns: minmax(90px,1fr) minmax(0,2fr); gap: 0 20px; margin-block: 20px; font-size: 13px; }
.cli-update-details dt, .cli-update-details dd { padding-block: 10px; border-bottom: 1px solid var(--border-default); }
.cli-update-details dt { color: var(--text-secondary); }
.cli-update-details dd { text-align: right; margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
#cli-update-status { margin-top: 20px; }
.proj-form { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.proj-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-default); }
.proj-row > div, .proj-row > span { min-width: 0; flex: 1 1 auto; }
.proj-row > button { flex: none; }
.proj-row .proj-note { color: var(--text-secondary); font-size: 12px; line-height: 1.5; margin-top: 3px; overflow-wrap: anywhere; }
.proj-del { padding: 10px; min-height: 44px; color: var(--status-danger); font-size: 13px; }
.secret-fields { display: flex; flex-direction: column; gap: 12px; }
.secret-fields[hidden] { display: none; }
.secret-fields .hint { margin-top: 0; }
#sheet-secrets .proj-row > span { overflow-wrap: anywhere; }
.proj-row .row-actions { display: flex; flex: none; }
.proj-row .proj-act { padding: 10px; min-height: 44px; color: var(--action-primary); font-size: 13px; }
.proj-row .pick-path.row-error { color: var(--status-danger); font-family: var(--font-body); }
.copybox { position: relative; margin-bottom: 12px; border: 1px solid var(--border-default); border-radius: var(--radius-control); background: var(--surface-page); cursor: pointer; }
.copybox:hover, .copybox.copied { border-color: var(--action-primary); }
.cmd { padding: 16px 80px 16px 12px; white-space: pre-wrap; overflow-wrap: anywhere; font: 12px/1.6 var(--font-data); }
.copy-chip { position: absolute; right: 8px; top: 8px; padding: 6px 10px; border-radius: 4px; background: var(--action-primary); color: var(--action-text); font-size: 12px; font-weight: 600; }
.toast { position: fixed; z-index: 20; bottom: calc(env(safe-area-inset-bottom) + 96px); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: var(--radius-control); box-shadow: var(--shadow-overlay); background: var(--text-primary); color: var(--surface-panel); font-size: 14px; }

#login, #offline { align-items: center; justify-content: center; padding: 24px; }
.login-wrap { width: min(380px,100%); }
.wordmark { width: 48px; height: 48px; margin-bottom: 40px; color: var(--action-primary); }
.wordmark-halo, .wordmark-dot { display: none; }
.login-title { font-size: 44px; font-weight: 500; letter-spacing: -.035em; max-width: 8ch; }
.login-sub { margin-top: 16px; color: var(--text-secondary); font-size: 15px; }
.login-actions { margin-top: 32px; display: flex; flex-direction: column; gap: 12px; }
#form-password { display: flex; flex-direction: column; gap: 12px; }
.login-error { color: var(--status-danger); font-size: 14px; margin-top: 16px; }

.term-page { height: var(--term-vh,100dvh); min-height: 0; display: flex; flex-direction: column; overflow: hidden; background: #10171c; }
.term-bar { display: flex; align-items: center; gap: 8px; flex: none; padding: calc(env(safe-area-inset-top) + 8px) calc(env(safe-area-inset-right) + 12px) 8px calc(env(safe-area-inset-left) + 4px); background: var(--surface-page); }
.term-back { flex: none; min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 2px; padding: 0 6px; border-radius: var(--radius-control); color: var(--action-primary); font-size: 14px; font-weight: 600; transition: transform 120ms var(--ease-out), background var(--duration-fast); }
.term-back:hover { background: var(--action-tint); }
.term-back:active { transform: scale(.94); }
.term-back-label { display: none; padding-right: 4px; white-space: nowrap; }
.term-back-note { color: var(--text-secondary); font-weight: 500; }
.term-heading { flex: 1; min-width: 0; }
.term-live { width: 7px; height: 7px; border-radius: 50%; background: var(--status-positive); flex: none; }
.term-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; line-height: 1.3; }
.term-note { display: flex; align-items: center; gap: 6px; min-width: 0; margin-top: 1px; color: var(--text-secondary); font-size: 12px; line-height: 1.4; white-space: nowrap; overflow: hidden; }
.term-note span:last-child { overflow: hidden; text-overflow: ellipsis; }
.term-btn { min-height: 44px; flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 10px 12px; border-radius: var(--radius-control); background: var(--surface-muted); color: var(--text-primary); font-size: 12px; font-weight: 600; text-decoration: none; }
.term-btn-chat { background: var(--action-tint); color: var(--action-primary); }
.term-note-more { display: none; }
@media (min-width: 460px) { .term-note-more { display: inline; } }
@media (min-width: 600px) { .term-back-label { display: inline; } .term-note { display: none; } }
.term-btn[aria-pressed="false"] { color: var(--text-secondary); }
.term-frame { flex: 1; min-height: 0; width: 100%; border: 0; display: block; background: #10171c; }
.term-keys { display: flex; gap: 5px; flex: none; padding: 8px 8px calc(env(safe-area-inset-bottom) + 8px); background: var(--surface-page); overflow-x: auto; }
.key { min-height: 44px; min-width: 34px; flex: 1 1 0; padding: 12px 0; border-radius: 5px; background: var(--surface-muted); font: 600 12px/1 var(--font-data); }
.key:active { background: var(--action-tint); }
.key-wide { flex: 1.2 1 0; }
.term-gone { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center; background: var(--surface-page); }
.term-gone-title { font-size: 24px; font-weight: 500; }
.term-gone-body { max-width: 40ch; font-size: 14px; color: var(--text-secondary); }
@media (max-width: 420px) {
  .topbar { padding-inline: 20px; gap: 8px; }
  .title { font-size: 32px; }
  .host { font-size: 10px; }
  .host-row { grid-template-columns: 24px 28px 62px; gap: 4px; }
  .tabs { --tabs-gutter: 20px; }
  .list { margin-inline: 20px; padding-inline: 12px; }
  .card { gap: 12px; align-items: flex-start; }
  .avatar { width: 32px; height: 32px; margin-top: 3px; }
  .card-name { font-size: 17px; }
  .card-side { max-width: 86px; }
  .chip { font-size: 9px; padding-inline: 5px; }
  .sheet { padding-inline: 20px; }
}
@media (min-width: 760px) {
  #app { padding-inline: 32px; }
  .topbar { padding-top: var(--space-6); padding-bottom: var(--space-5); }
  .host { gap: 5px; font-size: 12px; }
  .host-row { grid-template-columns: 34px 56px 84px; gap: 8px; }
  .tabs { gap: 36px; }
  .list { margin-bottom: 140px; }
  .card { padding: 26px 12px; }
  .card-main { display: grid; grid-template-columns: minmax(180px,1fr) minmax(150px,1fr) minmax(0,1fr); align-items: center; column-gap: 24px; }
  .card-prs { grid-column: 3; grid-row: 1 / 3; margin: 0; align-content: center; }
  .card-name { grid-column: 1; }
  .card-sub { grid-column: 1; }
  .card-status { grid-column: 2; grid-row: 1 / 3; margin: 0; }
  .card-side { width: 140px; max-width: 140px; }
  .dock { left: auto; right: max(56px,calc((100vw - 1008px)/2)); bottom: 28px; border: 0; background: none; padding: 0; }
  .dock .btn { width: 220px; }
  .sheet { left: auto; right: 0; top: 0; bottom: 0; width: 480px; max-height: 100dvh; border-radius: 0; padding: 40px 32px; transform: translateX(100%); }
  .sheet.show { transform: translateX(0); }
  .grab { display: none; }
  .sheet-close { top: 26px; right: 20px; }

}
@media (min-width: 700px) and (hover: hover) {
  .term-keys { justify-content: flex-start; }
  .term-keys .key:not(.key-scroll) { display: none; }
  .key-scroll { flex: 0 0 auto; padding-inline: 16px; }
  #btn-term-keys { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

.appearance-setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border-default); }
.appearance-select { position: relative; flex: none; max-width: 100%; }
.appearance-setting select { appearance: none; -webkit-appearance: none; width: 100%; min-width: 7.5em; min-height: 44px; padding: .625em 2.5em .625em .875em; font: inherit; line-height: 1.5; color: var(--text-primary); background: var(--surface-muted); border: 1px solid var(--border-default); border-radius: var(--radius-control); cursor: pointer; }
.appearance-select > svg { position: absolute; inset-inline-end: .75em; top: 50%; transform: translateY(-50%); width: 1em; height: 1em; pointer-events: none; color: var(--text-secondary); }
.appearance-setting select:hover { border-color: var(--text-secondary); }
@media (max-width: 379px) {
  .topbar { flex-wrap: wrap; }
  .host { order: 3; width: 100%; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 8px; font-size: 9px; }
  .host:not([hidden]) + #btn-menu { margin-left: auto; }
  .host-row { grid-template-columns: auto 1fr; gap: 4px 8px; }
  .host-meter { grid-column: 1 / -1; grid-row: 2; }
  .host-v { grid-column: 2; grid-row: 1; white-space: nowrap; }
}

.setting-label, .row-with-icon { display: flex; align-items: center; gap: 10px; }
.menu-icon { flex: none; color: var(--text-secondary); }

.session-search { display: flex; align-items: center; gap: 10px; margin: 20px 24px 0; padding: 0 12px; border: 1px solid var(--border-default); border-radius: var(--radius-control); background: var(--surface-panel); color: var(--text-secondary); }
.session-search svg { flex: none; }
.session-search:focus-within { outline: 2px solid var(--action-primary); outline-offset: 2px; }
.session-search input { flex: 1; min-width: 0; min-height: 48px; padding: 10px 0; border: 0; background: transparent; color: var(--text-primary); font: inherit; }
.session-search input:focus-visible { outline: none; }
.session-search input::placeholder { color: var(--text-muted); }
.session-search button { min-height: 44px; padding: 8px; color: var(--action-primary); font-size: 14px; }
.search-status { min-height: 20px; margin: 6px 24px 12px; color: var(--text-secondary); font-size: 12px; }
@media (max-width: 420px) { .session-search { margin-inline: 20px; } .search-status { margin-inline: 20px; } }

.session-search input::-webkit-search-cancel-button { -webkit-appearance: none; }

#project-picker { gap: 0; }
#project-picker .pick { justify-content: flex-start; padding: 12px 8px; border: 0; border-bottom: 1px solid var(--border-default); border-radius: 0; background: transparent; }
#project-picker .pick.selected { background: var(--action-tint); border-radius: var(--radius-control); border-bottom-color: transparent; }
.pick-copy { flex: 1; min-width: 0; }
.pick-copy > span { display: block; }
.pick-description { margin-top: 4px; color: var(--text-secondary); font-size: 12px; line-height: 1.5; }
.workspace-icon { flex: none; color: var(--text-secondary); }
.pick-selected { width: 18px; flex: none; }
.pick-selected .workspace-icon { color: var(--action-primary); }
.branch-btn { display: flex; align-items: center; gap: 8px; }
.branch-btn > span { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.branch-btn[aria-expanded="true"] > svg:last-child { transform: rotate(180deg); }

.repo-selection { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: var(--radius-control); background: var(--surface-muted); }
#selected-repo-name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 14px; line-height: 1.6; }
.repo-selection button { flex: none; min-height: 44px; margin-block: -8px; padding: 8px 0; color: var(--action-primary); font-size: 14px; }
.branch-row { display: grid; gap: 8px; margin-top: 20px; }
.branch-label { color: var(--text-primary); font-weight: 600; }
.branch-btn { width: 100%; }
.branch-btn:disabled { opacity: 1; cursor: default; background: var(--surface-muted); border-color: transparent; }
.branch-btn small { flex: none; color: var(--text-secondary); font-size: 12px; }

.settings-section + .settings-section { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border-default); }
.settings-section h3 { margin-bottom: 4px; color: var(--text-secondary); font-size: 13px; font-weight: 600; }
.settings-section .row-btn { min-height: 44px; padding-block: 10px; border: 0; }
.settings-section .appearance-setting { border: 0; }
.settings-section .menu-group { margin: 16px 0 0; padding: 0; border: 0; }
.settings-footer { margin-top: 24px; padding-top: 12px; border-top: 1px solid var(--border-default); }
.settings-footer .row-btn { border: 0; }
#repo-results .repo-opt { display: flex; align-items: flex-start; gap: 10px; }
.repo-provider-icon { flex: none; margin-top: 3px; color: currentColor; }
.repo-option-copy { flex: 1; min-width: 0; }
.repo-option-name, .repo-option-owner { display: block; overflow-wrap: anywhere; white-space: normal; }
.repo-option-owner { margin-top: 3px; color: var(--text-secondary); font-size: 12px; }

.settings-section { --menu-icon-space: 1.75rem; }
#sheet-menu .sheet-title { font-size: 1.6875rem; }
#sheet-menu .appearance-setting, #sheet-menu .field { font-size: var(--type-menu-action); }
#sheet-menu .appearance-setting { flex-wrap: wrap; }
#sheet-menu .setting-label { gap: .625rem; }
#sheet-menu .setting-label .menu-icon { width: 1.125em; height: 1.125em; }
.settings-section .row-btn, .settings-footer .row-btn { font-size: var(--type-menu-action); line-height: 1.5; }
.settings-section .row-btn:not(.row-with-icon), .settings-footer .row-btn { padding-inline-start: var(--menu-icon-space, 1.75rem); }
.settings-section .hint { font-size: var(--type-menu-helper); line-height: 1.55; max-width: 60ch; }
.settings-section .label { font-size: var(--type-menu-label); font-weight: 500; }
.settings-section h3 { font-size: var(--type-menu-label); }
.settings-section .ws-row { font-size: var(--type-menu-helper); }

.settings-section .row-btn.connection-row { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); align-items: baseline; padding-block: var(--space-3); padding-inline-start: var(--menu-icon-space); }
.connection-row > span:first-child { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.connection-status { display: inline-flex; align-items: center; gap: var(--space-1); max-width: 100%; font-size: var(--type-menu-label); font-weight: 500; font-variant-numeric: tabular-nums; color: var(--text-secondary); }
.connection-status svg { width: 1.077em; height: 1.077em; flex: none; }
.connection-status[data-tone="positive"] { color: var(--status-positive); }
.connection-status[data-tone="warning"] { color: var(--status-working); }
.connection-detail { flex-basis: 100%; min-width: 0; color: var(--text-secondary); font-size: var(--type-menu-helper); line-height: 1.55; overflow-wrap: anywhere; }
.connection-detail:empty { display: none; }
.connection-action { position: relative; }
.connection-action .menu-icon { position: absolute; left: calc(-1 * var(--menu-icon-space)); top: .1875em; width: 1.125em; height: 1.125em; }
.logout-detail { display: block; margin-top: var(--space-1); }

/* External MCP connectors */
.connector-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3); margin-top: 4px; }
.connector-host { min-width: 0; color: var(--text-secondary); font-size: 12px; }
.connector-row-text { min-width: 0; overflow-wrap: anywhere; }
.connector-row-detail { display: block; color: var(--text-secondary); font-size: 12px; line-height: 1.5; }
.connector-hint { font-style: italic; }
.connector-field-label { margin-top: 14px; }
.connector-optional { color: var(--text-secondary); font-weight: 400; }
/* Connector rows: name and status on the first line, host and grants on a full-width second line. */
#connector-list .connector-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-3); width: 100%; padding-block: var(--space-3); border-bottom: 1px solid var(--border-default); text-align: left; }
#connector-list .connector-row > .connector-row-name { flex: 1 1 auto; min-width: 0; color: var(--text-primary); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#connector-list .connector-row > .connection-status { flex: none; }
#connector-list .connector-row > .connection-detail { flex-basis: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.connector-row-detail .chip { margin-top: 2px; }
.connector-empty-hint { text-align: left; margin: 2px 2px 10px; }
.connector-outcome { flex: none; color: var(--text-secondary); font-size: 12px; font-variant-numeric: tabular-nums; }
.connector-outcome[data-outcome="ok"] { color: var(--status-positive); }
.connector-outcome:is([data-outcome="denied"], [data-outcome="revoked"], [data-outcome="auth"], [data-outcome="forbidden"]) { color: var(--status-working); }
#connector-tools code, .connector-audit-row code { font-size: 13px; }
.connector-advanced { margin-top: 16px; }
.connector-advanced summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; font-size: 14px; }
.connector-advanced code, .connector-notice { overflow-wrap: anywhere; }
.connector-notice { color: var(--status-working); }

.server-settings-list { display: grid; gap: 4px; }
.server-setting { padding-block: 16px; border-bottom: 1px solid var(--border-default); }
.server-setting .label { margin-top: 0; }
.server-setting select.field { appearance: none; -webkit-appearance: none; cursor: pointer; padding-inline-end: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; background-size: 16px; }
.server-setting select.field:disabled { cursor: not-allowed; opacity: .6; }
.server-setting-source { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; color: var(--text-secondary); font-size: 12px; line-height: 1.55; margin-top: 8px; }
.server-setting-source .text-link { color: var(--action-primary); font-size: 12px; font-weight: 600; padding: 0; background: none; }
.server-setting-confirm { display: grid; gap: 8px; margin-top: 12px; }
.server-setting-confirm[hidden] { display: none; }
.agent-install-output { max-height: 160px; overflow: auto; margin-top: 8px; padding: 10px 12px; border-radius: var(--radius-control); background: var(--surface-muted); color: var(--text-secondary); font: 11px/1.5 var(--font-data); white-space: pre-wrap; overflow-wrap: anywhere; }

/* Launch mode: Terminal or Chat (ACP), from launch-mode.js */
.mode-fieldset { min-width: 0; border: 0; }
.mode-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border: 1px solid var(--border-default); border-radius: var(--radius-control); background: var(--surface-page); }
.mode-opt { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 12px; border-radius: calc(var(--radius-control) - 3px); color: var(--text-secondary); font-size: 14px; font-weight: 600; cursor: pointer; transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out); }
.mode-opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: inherit; }
.mode-opt svg { flex: none; }
.mode-opt:hover { color: var(--text-primary); }
.mode-opt:has(input:checked) { background: var(--surface-panel); color: var(--text-primary); box-shadow: 0 0 0 1px var(--border-default), 0 1px 2px rgb(0 0 0 / .06); }
.mode-opt:has(input:focus-visible) { outline: 2px solid var(--action-primary); outline-offset: 2px; }
.mode-opt:has(input:disabled) { color: var(--text-muted); cursor: not-allowed; }
.mode-tag { margin-left: 2px; padding: 1px 5px; border-radius: 4px; background: var(--surface-muted); color: var(--text-secondary); font-family: var(--font-data); font-size: 10px; font-weight: 600; letter-spacing: .04em; vertical-align: 1px; }
.mode-opt:has(input:disabled) .mode-tag { color: var(--text-muted); }

/* ---------- installed-app feel ---------- */

/* Bars and controls are for tapping, not selecting: no text selection or long-press
   callout on them. Content (sheet text, tokens, paths, chat) stays selectable. */
.topbar, .tabs, .dock, .card, button, .grab, .term-bar, .term-keys, .wordmark, .ptr, .install-hint { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
img, svg { -webkit-user-drag: none; }

/* A press answers at once, the way a native control does. */
.btn, .icon-btn, .term-btn, .key, .sheet-close, .sheet-back, .row-btn, .tab, .pick, .provider-pick, .repo-opt, .branch-btn, .card { transition: transform 120ms var(--ease-out), opacity 120ms var(--ease-out), background var(--duration-fast), color var(--duration-fast); }
.btn:active:not(:disabled), .icon-btn:active, .term-btn:active, .key:active, .sheet-close:active { transform: scale(.96); }
.card:active, .row-btn:active, .pick:active, .provider-pick:active, .repo-opt:active, .branch-btn:active { background: var(--surface-muted); }
.tab:active, .sheet-back:active { opacity: .6; }
@media (prefers-reduced-motion: reduce) {
  .btn:active:not(:disabled), .icon-btn:active, .term-btn:active, .key:active, .sheet-close:active { transform: none; opacity: .7; }
}

@media (pointer: coarse) {
  /* Touch scrolling shows its own indicator; a desktop scrollbar track is a web tell. */
  html, .sheet, .term-keys { scrollbar-width: none; }
  html::-webkit-scrollbar, .sheet::-webkit-scrollbar, .term-keys::-webkit-scrollbar { display: none; }
  /* iOS zooms into any field under 16px when it takes focus. */
  input, select, textarea { font-size: max(16px, 1em); }
}


/* Pull to refresh: the content follows the finger and a spinner fills in above it. */
#app { --pull: 0px; --pull-progress: 0; }
#app > .topbar, #app > .tabs, #app > .session-search, #app > .search-status, #app > .install-hint, #app > .list, #app > .empty { transform: translateY(var(--pull)); transition: transform var(--duration-panel) var(--ease-out); }
#app.ptr-pulling > * { transition: none; }
.ptr { position: fixed; z-index: 7; top: calc(env(safe-area-inset-top) + 10px); left: 50%; width: 32px; height: 32px; margin-left: -16px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-panel); box-shadow: var(--shadow-list); opacity: var(--pull-progress); transform: translateY(calc(var(--pull) - 44px)) scale(calc(.6 + var(--pull-progress) * .4)); transition: transform var(--duration-panel) var(--ease-out), opacity var(--duration-panel) var(--ease-out); pointer-events: none; }
#app.ptr-pulling .ptr { transition: none; }
.ptr-spinner { width: 18px; height: 18px; border: 2px solid var(--border-default); border-top-color: var(--action-primary); border-radius: 50%; transform: rotate(calc(var(--pull-progress) * 300deg)); }
#app.ptr-armed .ptr-spinner { border-color: var(--action-primary); border-top-color: transparent; }
#app.ptr-refreshing .ptr-spinner { border-color: var(--border-default); border-top-color: var(--action-primary); animation: btn-spin .7s linear infinite; }
@media (prefers-reduced-motion: reduce) { #app.ptr-refreshing .ptr-spinner { animation: btn-spin 2.4s linear infinite !important; } }

.sheet.dragging { transition: none; }

.install-hint { display: flex; align-items: center; gap: 12px; margin: 0 24px 16px; padding: 10px 6px 10px 14px; border: 1px solid var(--border-default); border-radius: var(--radius-panel); background: var(--surface-panel); }
.install-icon { flex: none; color: var(--action-primary); }
.install-copy { flex: 1; min-width: 0; }
.install-title { font-size: 14px; font-weight: 600; line-height: 1.35; }
.install-body { margin-top: 2px; color: var(--text-secondary); font-size: 13px; line-height: 1.45; text-wrap: pretty; }
.install-action { flex: none; min-height: 44px; padding: 0 12px; border-radius: var(--radius-control); color: var(--action-primary); font-size: 14px; font-weight: 600; }
.install-action:hover { background: var(--action-tint); }
.install-dismiss { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: var(--radius-control); color: var(--text-secondary); }
.install-dismiss:hover { background: var(--surface-muted); }
@media (max-width: 420px) { .install-hint { margin-inline: 20px; } }
@media (min-width: 760px) { .install-hint { display: none; } }


/* ---------- a session's request for a secret or a connector (secret-request.js) ---------- */

.sr-who { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: -4px 0 20px; color: var(--text-secondary); font-size: 14px; line-height: 1.5; }
.sr-session { min-width: 0; color: var(--text-primary); font-weight: 600; overflow-wrap: anywhere; }
.sr-who .chip { margin-top: 0; }
.sr-name { color: var(--text-primary); font: 600 22px/1.3 var(--font-data); letter-spacing: -.01em; overflow-wrap: anywhere; -webkit-user-select: text; user-select: text; }
.sr-host { margin-top: 6px; color: var(--text-secondary); font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.sr-reason { margin: 20px 0 0; padding: 14px 16px 16px; border-radius: var(--radius-control); background: var(--surface-page); }
.sr-reason-label { margin-bottom: 6px; color: var(--text-secondary); font-size: 12px; font-weight: 600; line-height: 1.4; }
.sr-reason-text { margin: 0; max-height: 40dvh; overflow-y: auto; color: var(--text-primary); font-size: 15px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.sr-note { display: flex; align-items: flex-start; gap: 10px; margin-top: 16px; color: var(--text-secondary); font-size: 13px; line-height: 1.55; text-wrap: pretty; }
.sr-note-icon { flex: none; margin-top: 1px; color: var(--status-working); }
.sr-existing { margin-top: 16px; padding: 12px 14px; border-radius: var(--radius-control); background: var(--status-working-tint); color: var(--text-primary); font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; text-wrap: pretty; }
.sr-conflict { background: var(--status-danger-tint); color: var(--status-danger); }
.sr-form { display: flex; flex-direction: column; margin-top: 24px; }
.sr-form .hint { margin: 0 0 8px; }
.sr-field { font-family: var(--font-data); letter-spacing: .04em; }
.sr-field::placeholder { font-family: var(--font-body); letter-spacing: 0; }
.sr-error { margin-top: 8px; color: var(--status-danger); font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.sr-stepup { margin-top: 16px; padding: 14px 16px 16px; border-radius: var(--radius-control); background: var(--surface-page); }
.sr-stepup .server-setting-confirm { margin-top: 0; }
.sr-stepup-label { color: var(--text-primary); font-size: 14px; line-height: 1.5; }
.sr-paste { display: block; margin: 4px auto 0; }
.sr-expiry { text-align: center; font-variant-numeric: tabular-nums; }
.sheet-title.sr-outcome-title { font-size: 24px; line-height: 1.25; text-wrap: pretty; }
.sr-done-name { display: flex; align-items: center; gap: 10px; margin: 4px 0 12px; color: var(--text-secondary); font: 500 15px/1.5 var(--font-data); overflow-wrap: anywhere; }
.sr-done-name > span { min-width: 0; }
/* The one moment here: the check draws itself once the value is safely stored. */
.sr-done-icon { flex: none; width: 32px; height: 32px; padding: 6px; border-radius: 50%; background: color-mix(in srgb, var(--status-positive) 16%, transparent); color: var(--status-positive); stroke-width: 2.4; stroke-dasharray: 24; stroke-dashoffset: 0; animation: sr-draw 420ms var(--ease-out) 80ms both; }
@keyframes sr-draw { from { stroke-dashoffset: 24; } }

/* Settings › Secrets: requests waiting on the member, above what is stored. */
.sr-requests { margin-bottom: 8px; }
.sr-requests .label { margin-top: 0; }
.sr-row-copy > span { display: block; }
.sr-row-name { color: var(--text-primary); font: 600 14px/1.5 var(--font-data); overflow-wrap: anywhere; }

/* Session card: the request line opens the request, like a PR chip opens the PR. */
.card-request { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; margin-top: 8px; padding: 3px 10px 3px 8px; border-radius: 6px; background: var(--status-working-tint); color: var(--status-working); font-size: 13px; font-weight: 600; line-height: 1.5; cursor: pointer; transition: background var(--duration-fast), color var(--duration-fast); }
.card-request-icon { flex: none; }
.card-request:hover, .card-request:focus-visible { color: var(--text-primary); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.card-request:focus-visible { outline: 2px solid var(--action-primary); outline-offset: 2px; }
@media (pointer: coarse) { .card-request { min-height: 44px; padding-inline: 12px 14px; } }
@media (min-width: 760px) { .card-request { grid-column: 1 / 3; justify-self: start; margin-top: 12px; } }
