/* Agent Hub UI. Every chat is a git branch, so agent replies sit on a branch rail with a commit node;
   the live run is the node that pulses. Machine facts (branch, account, timings, states) use the mono face. */
:root {
  --bg: #ffffff; --side: #f4f5f7; --raised: #ffffff; --sunk: #eef0f3; --hover: #e9ebef;
  --text: #161a22; --muted: #5e6573; --faint: #8a909c; --line: #e2e5ea; --line-strong: #cfd3da;
  --accent: #161a22; --accent-text: #ffffff;
  --live: #0e8a75; --ok: #0e8a75; --warn: #a8660c; --bad: #c4352b; --info: #2f5fd0; --link: #2f5fd0;
  --code: #14171d; --codetext: #e4e6eb; --focus: #2f5fd0;
  --shadow-sm: 0 1px 2px rgba(16, 20, 28, .06);
  --shadow: 0 0 0 1px rgba(16, 20, 28, .05), 0 6px 20px -4px rgba(16, 20, 28, .10);
  --shadow-lg: 0 0 0 1px rgba(16, 20, 28, .06), 0 24px 60px -12px rgba(16, 20, 28, .28);
  --sans: system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, "Noto Sans Arabic", sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --r-sm: 8px; --r: 12px; --r-lg: 16px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161b; --side: #0f1115; --raised: #1b1e25; --sunk: #1f232b; --hover: #22262f;
    --text: #e7e9ee; --muted: #9aa1ae; --faint: #6f7684; --line: #272b34; --line-strong: #353a45;
    --accent: #e7e9ee; --accent-text: #14161b;
    --live: #3cc4ac; --ok: #3cc4ac; --warn: #e3a945; --bad: #f0645a; --info: #7aa2ff; --link: #8fb0ff;
    --code: #0c0e12; --codetext: #dfe2e8; --focus: #8fb0ff;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 0 0 1px rgba(255, 255, 255, .06), 0 8px 24px -6px rgba(0, 0, 0, .5);
    --shadow-lg: 0 0 0 1px rgba(255, 255, 255, .07), 0 28px 70px -12px rgba(0, 0, 0, .7);
  }
}

/* Base */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15.5px/1.6 var(--sans); }
button { font: inherit; cursor: pointer; color: inherit; }
button:disabled { cursor: default; opacity: .45; }
input, select, textarea { font: inherit; color: inherit; background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 11px; transition: border-color .15s, box-shadow .15s; }
input:hover, select:hover { border-color: var(--line-strong); }
input:focus, select:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
code, kbd { font-family: var(--mono); }
kbd { font-size: 11px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; }
a { color: var(--link); text-underline-offset: 2px; }
h1, h2, h3 { text-wrap: balance; }
p, li { text-wrap: pretty; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); } .small { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: .86em; }
.error { color: var(--bad); min-height: 1em; margin: 6px 0; font-size: 14px; } .ok { color: var(--ok); min-height: 1em; margin: 6px 0; font-size: 14px; }

/* Buttons */
.link { background: none; border: 0; color: var(--link); padding: 2px 4px; border-radius: 6px; }
.link:hover { text-decoration: underline; text-underline-offset: 2px; }
.primary { background: var(--accent); color: var(--accent-text); border: 0; border-radius: var(--r-sm); padding: 9px 16px; font-weight: 600; transition: transform .1s, opacity .15s; }
.primary:hover { opacity: .9; }
.primary:active, .round:active, .ghost:active { transform: scale(.97); }
.ghost { display: inline-flex; align-items: center; gap: 6px; background: none; border: 1px solid var(--line-strong);border-radius: 999px; padding: 5px 12px; font-size: 13.5px; transition: background-color .15s, border-color .15s, transform .1s; }
.ghost .ico { width: 16px; height: 16px; }
.ghost:hover { background: var(--hover); border-color: var(--line-strong); }
.ghost.sm { padding: 3px 10px; font-size: 12.5px; }
.ghost.danger { color: var(--bad); }
.ghost.danger:hover { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); background: color-mix(in srgb, var(--bad) 8%, transparent); }
.icon-btn { display: inline-grid; place-items: center; background: none; border: 0; width: 36px; height: 36px; border-radius: var(--r-sm); color: var(--muted); transition: background-color .15s, color .15s; }
.icon-btn:hover { background: var(--hover); color: var(--text); }

/* Sign-in */
.login { display: grid; place-items: center; height: 100%; padding: 16px; background: radial-gradient(120% 80% at 50% 0%, var(--side), var(--bg)); }
.login-card { width: min(380px, 100%); display: grid; gap: 10px; background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 28px 24px 20px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 22px; letter-spacing: -.01em; margin: 4px 0 0; }
.login-card p.muted { margin: 0 0 8px; font-size: 14px; }
.login-card label { font-size: 13px; font-weight: 600; }
.login-card .primary { padding: 10px 16px; margin-top: 4px; }
.login-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--r); background: var(--sunk); color: var(--live); }
.login-mark .ico { width: 22px; height: 22px; }

/* Layout */
.shell { display: grid; grid-template-columns: 272px 1fr; height: 100dvh; }
.sidebar { background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 12px 10px 10px; min-height: 0; gap: 4px; }
.brand { display: flex; align-items: center; gap: 9px; padding: 4px 10px 10px; font-weight: 650; letter-spacing: -.01em; }
.brand-mark { color: var(--live); width: 20px; height: 20px; }
.new-chat { display: flex; gap: 10px; align-items: center; background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; text-align: left; font-weight: 550; box-shadow: var(--shadow-sm); transition: border-color .15s, background-color .15s; }
.new-chat:hover { border-color: var(--line-strong); }
.new-chat .ico { width: 17px; height: 17px; color: var(--muted); }
.search { position: relative; display: block; margin: 4px 0 2px; }
.search .ico { position: absolute; left: 10px; top: 50%; translate: 0 -50%; width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.search input { width: 100%; padding: 7px 10px 7px 33px; font-size: 14px; background: transparent; border-color: transparent; }
.search input:hover { background: var(--hover); border-color: transparent; }
.search input:focus { background: var(--raised); }
.chats { flex: 1; overflow: auto; margin: 6px -4px 4px; padding: 0 4px; min-height: 0; scrollbar-width: thin; }
.group { margin-bottom: 8px; }
.group-head { display: flex; align-items: center; gap: 6px; width: 100%; background: none; border: 0; border-radius: 6px; padding: 6px 8px 4px; font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); font-weight: 600; text-align: left; }
.group-head:hover { color: var(--muted); }
.group-head .caret { width: 14px; height: 14px; transition: transform .15s var(--ease); }
.group-head .count { margin-left: auto; font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: 0; text-transform: none; }
.group.collapsed .caret { transform: rotate(-90deg); }
.group.collapsed .group-items { display: none; }
.chat-item { position: relative; display: flex; align-items: center; border-radius: var(--r-sm); transition: background-color .12s; }
.chat-item:hover { background: var(--hover); }
.chat-item.active { background: var(--raised); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line); }
.chat-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; background: none; border: 0; border-radius: var(--r-sm); text-align: left; padding: 7px 4px 7px 10px; font-size: 14px; }
.chat-name { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chat-more { display: grid; place-items: center; width: 28px; height: 28px; margin-right: 3px; opacity: 0; background: none; border: 0; border-radius: 6px; color: var(--muted); transition: opacity .12s; }
.chat-more .ico { width: 16px; height: 16px; }
.chat-item:hover .chat-more, .chat-item.active .chat-more, .chat-more[aria-expanded="true"], .chat-more:focus-visible { opacity: 1; }
.chat-more:hover { background: var(--sunk); color: var(--text); }
.menu-pop { position: absolute; right: 2px; top: 36px; z-index: 5; background: var(--raised); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 4px; min-width: 160px; animation: pop .14s var(--ease); }
.menu-pop button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 7px 10px; border-radius: var(--r-sm); font-size: 14px; }
.menu-pop button:hover, .menu-pop button:focus-visible { background: var(--hover); outline: none; }
.menu-pop .danger { color: var(--bad); }
.rename-input { flex: 1; margin: 3px; padding: 4px 8px; font-size: 14px; }
/* Run state in the list: ring = waiting for an account, pulsing node = running, red node = failed. */
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.status-dot.queued { border: 1.5px solid var(--warn); }
.status-dot.running { background: var(--live); box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 50%, transparent); animation: ping 1.6s var(--ease) infinite; }
.status-dot.failed { background: var(--bad); }
.side-link { display: flex; align-items: center; gap: 8px; background: none; border: 0; border-radius: var(--r-sm); padding: 6px 10px; font-size: 13px; color: var(--muted); text-align: left; }
.side-link:hover { background: var(--hover); color: var(--text); }
.side-link .ico { width: 16px; height: 16px; }
.side-foot { display: grid; gap: 1px; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 2px; }
.foot-btn { display: flex; align-items: center; gap: 10px; background: none; border: 0; border-radius: var(--r-sm); padding: 7px 10px; font-size: 14px; text-align: left; transition: background-color .12s; }
.foot-btn:hover { background: var(--hover); }
.foot-btn .ico { color: var(--muted); }
.foot-row { display: flex; align-items: center; justify-content: space-between; padding: 4px 0 0 10px; }
.audit { display: inline-flex; align-items: center; gap: 6px; font: 11.5px var(--mono); color: var(--faint); }
.audit .ico { width: 14px; height: 14px; color: var(--ok); }
.audit.bad { color: var(--bad); font-weight: 600; } .audit.bad .ico { color: var(--bad); }

.main { display: flex; flex-direction: column; min-height: 0; min-width: 0; position: relative; }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 10px 18px; min-height: 60px; width: 100%; }
.menu { display: none; }
.head-text { flex: 1; min-width: 0; }
.chat-title { display: block; max-width: 100%; background: none; border: 0; padding: 1px 6px; margin-left: -6px; border-radius: 6px; font-weight: 600; font-size: 15.5px; letter-spacing: -.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.chat-title:hover { background: var(--hover); }
.title-input { width: min(420px, 100%); padding: 3px 8px; font-weight: 600; }
.chat-meta { display: flex; gap: 6px; flex-wrap: wrap; font: 11.5px/1.5 var(--mono); color: var(--faint); }
.chat-meta span + span::before { content: "/"; margin-right: 6px; color: var(--line-strong); }
.chat-meta .review { color: var(--warn); }

.thread { flex: 1; overflow: auto; padding: 12px 18px 28px; mask-image: linear-gradient(to bottom, transparent 0, #000 14px); scrollbar-width: thin; }
.column { max-width: 760px; margin: 0 auto; }
.main.empty { justify-content: center; }
.main.empty .chat-head { position: absolute; top: 0; left: 0; }
.main.empty .chat-title { color: var(--muted); font-weight: 500; }
.main.empty .thread { flex: 0 0 auto; overflow: visible; mask-image: none; }
.main.empty .hint { visibility: hidden; }
.welcome { text-align: center; padding: 0 8px 22px; animation: rise .35s var(--ease) both; }
.welcome-mark { width: 30px; height: 30px; color: var(--live); margin-bottom: 10px; stroke-width: 1.5; }
.welcome h1 { font-size: 27px; font-weight: 600; letter-spacing: -.02em; margin: 0 0 8px; }
.welcome p { margin: 0 auto; font-size: 14.5px; max-width: 46ch; }

/* Messages */
.msg { margin: 26px 0; }
.msg.user { display: flex; justify-content: flex-end; }
.msg.user .bubble { background: var(--sunk); padding: 10px 16px; border-radius: 20px 20px 6px 20px; max-width: min(80%, 600px); white-space: pre-wrap; word-break: break-word; }
.msg.assistant { position: relative; padding-left: 28px; }
.msg.assistant::before { content: ""; position: absolute; left: 0; top: 6px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--live); background: var(--bg); z-index: 1; }
.msg.assistant::after { content: ""; position: absolute; left: 5px; top: 20px; bottom: -4px; width: 1.5px; border-radius: 1px; background: linear-gradient(var(--line-strong), transparent); }
.msg.assistant.live::before { background: var(--live); animation: ping 1.6s var(--ease) infinite; }
.msg.assistant.live::after { background: linear-gradient(var(--live), transparent); opacity: .5; }
.who { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 7px; align-items: baseline; flex-wrap: wrap; }
.who strong { color: var(--text); font-weight: 600; font-size: 13.5px; }
.who .fact { font: 11.5px var(--mono); color: var(--faint); font-variant-numeric: tabular-nums; }
.md { word-break: break-word; }
.md p { margin: 0 0 12px; } .md ul, .md ol { margin: 0 0 12px; padding-inline-start: 22px; } .md li { margin: 4px 0; }
.md h3, .md h4 { margin: 20px 0 8px; line-height: 1.3; letter-spacing: -.01em; } .md h3 { font-size: 18px; } .md h4 { font-size: 15.5px; }
.md code { font-size: .86em; background: var(--sunk); padding: 1.5px 5px; border-radius: 5px; }
.md blockquote { margin: 0 0 12px; padding-inline-start: 12px; border-inline-start: 3px solid var(--line-strong); color: var(--muted); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.md a { word-break: break-all; }
.md > :last-child { margin-bottom: 0; }
pre.code { position: relative; background: var(--code); color: var(--codetext); padding: 14px 16px; border-radius: var(--r); overflow: auto; font: 13px/1.6 var(--mono); margin: 0 0 12px; border: 1px solid var(--line); }
.md-table { overflow-x: auto; margin: 0 0 12px; border: 1px solid var(--line); border-radius: var(--r); width: fit-content; max-width: 100%; }
.md table { border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.md th, .md td { padding: 7px 12px; text-align: start; vertical-align: top; border-bottom: 1px solid var(--line); }
.md tr:last-child td { border-bottom: 0; }
.md th { background: var(--sunk); font-weight: 600; font-size: 13px; }
.actions { display: flex; gap: 2px; margin: 8px 0 0 -8px; opacity: .7; transition: opacity .15s; }
.msg:hover .actions, .actions:focus-within { opacity: 1; }
.act { display: inline-flex; align-items: center; gap: 5px; background: none; border: 0; border-radius: var(--r-sm); padding: 4px 8px; font-size: 12.5px; color: var(--muted); }
.act .ico { width: 15px; height: 15px; }
.act:hover { background: var(--hover); color: var(--text); }
.gallery { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 4px; }
.gallery a { display: block; border-radius: var(--r); overflow: hidden; background: var(--sunk); }
.gallery img, .md img.inline-img { outline: 1px solid rgba(0, 0, 0, .1); outline-offset: -1px; }
.gallery img { display: block; max-width: min(100%, 420px); max-height: 420px; object-fit: contain; border-radius: var(--r); }
.md img.inline-img { display: block; max-width: min(100%, 520px); border-radius: var(--r); margin: 6px 0 12px; }
.file-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.file-chip { display: inline-flex; gap: 8px; align-items: center; border: 1px solid var(--line); background: var(--raised); border-radius: var(--r-sm); padding: 7px 12px 7px 10px; font-size: 13px; color: var(--text); text-decoration: none; max-width: 100%; box-shadow: var(--shadow-sm); transition: border-color .15s; }
.file-chip:hover { border-color: var(--line-strong); }
.file-chip .ico { width: 16px; height: 16px; color: var(--muted); }
.file-chip .name { font-family: var(--mono); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.steps { margin: 8px 0; color: var(--muted); }
.steps summary { cursor: pointer; font-size: 12.5px; width: fit-content; border-radius: 6px; padding: 2px 4px; margin-left: -4px; }
.steps summary:hover { color: var(--text); }
.log { background: var(--code); color: var(--codetext); border-radius: var(--r-sm); padding: 10px 12px; max-height: 340px; overflow: auto; font: 12px/1.55 var(--mono); white-space: pre-wrap; word-break: break-word; margin: 6px 0; }
.ln.stderr { color: #f6a5a0; } .ln.system { color: #9ec0ff; }
.working { display: flex; align-items: center; gap: 10px; color: var(--muted); font: 13px/1.5 var(--mono); min-height: 26px; }
#working-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--live); animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
.error-card { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; border: 1px solid color-mix(in srgb, var(--bad) 35%, var(--line)); background: color-mix(in srgb, var(--bad) 7%, var(--bg)); color: var(--text); border-radius: var(--r); padding: 11px 14px; margin: 16px 0; font-size: 14px; }
.error-card .link { font-weight: 600; }

/* Composer */
.composer { margin: 0 18px; align-self: center; width: calc(100% - 36px); max-width: 760px; border: 1px solid var(--line); border-radius: 22px; padding: 12px 10px 8px 16px; background: var(--raised); box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s; }
.composer:focus-within { border-color: var(--line-strong); box-shadow: var(--shadow), 0 0 0 3px color-mix(in srgb, var(--focus) 14%, transparent); }
.composer textarea { display: block; width: 100%; border: 0; border-radius: 0; resize: none; padding: 2px 4px 8px 0; max-height: 260px; background: transparent; outline: none; line-height: 1.55; box-shadow: none; }
.composer textarea::placeholder { color: var(--faint); }
.toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.toolbar .right { display: flex; gap: 6px; align-items: center; margin-left: auto; min-width: 0; }
.toolbar .right .pill { min-width: 0; text-overflow: ellipsis; }
.pill { appearance: none; -webkit-appearance: none; border: 1px solid var(--line); border-radius: 999px; padding: 5px 26px 5px 12px; font-size: 13px; color: var(--muted); background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23889' fill='none' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 10px center; max-width: 190px; cursor: pointer; transition: background-color .15s, border-color .15s, color .15s; }
.pill:hover { background-color: var(--hover); color: var(--text); }
.pill:focus { box-shadow: none; }
.pill.strong { font-weight: 600; color: var(--text); }
.pill option, .pill optgroup { background: var(--raised); color: var(--text); }
.round { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; flex: none; transition: transform .1s, opacity .15s, background-color .15s; }
.round .ico { width: 18px; height: 18px; stroke-width: 2.2; }
.composer:not(.has-text) #send { opacity: .35; }
.round.stop { background: var(--text); }
.hint { text-align: center; margin: 8px 0 12px; font-size: 11.5px; color: var(--faint); }

/* Dialogs */
dialog.panel { width: min(620px, calc(100vw - 32px)); max-height: 85dvh; border: 0; border-radius: var(--r-lg); background: var(--raised); color: var(--text); padding: 18px 20px 20px; box-shadow: var(--shadow-lg); }
dialog.panel[open] { animation: rise .2s var(--ease); }
dialog::backdrop { background: rgba(10, 12, 16, .45); backdrop-filter: blur(3px); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -4px -8px 8px 0; }
.panel h2 { margin: 0; font-size: 17px; letter-spacing: -.01em; }
.panel > p.muted { margin: 0 0 12px; }
.panel input, .panel select { background: var(--bg); border-color: var(--line-strong); }
.panel-foot { display: flex; justify-content: flex-end; margin-top: 12px; }
.list { list-style: none; margin: 8px 0 12px; padding: 0; }
.list li { display: flex; gap: 8px 10px; align-items: center; flex-wrap: wrap; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.files-list li img { width: 48px; height: 48px; object-fit: cover; border-radius: var(--r-sm); outline: 1px solid rgba(0, 0, 0, .1); outline-offset: -1px; }
.files-list .fname { flex: 1; min-width: 0; word-break: break-all; font: 13px var(--mono); }
.files-list .size { font: 12px var(--mono); color: var(--faint); font-variant-numeric: tabular-nums; }
.acct { flex: 1; min-width: 140px; display: grid; }
.acct strong { font-weight: 600; font-size: 14.5px; }
.acct span { font: 11.5px var(--mono); color: var(--faint); }
.row-actions { display: flex; gap: 6px; margin-left: auto; }
.card-text { flex: 1; min-width: 160px; font-size: 14px; }
.card-scope { font: 11.5px var(--mono); color: var(--faint); }
.chip { --c: var(--muted); display: inline-flex; align-items: center; gap: 6px; font: 500 11.5px/1.6 var(--mono); border-radius: 999px; padding: 1px 9px 1px 8px; color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); white-space: nowrap; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.free, .chip.done, .chip.active { --c: var(--ok); }
.chip.busy, .chip.logging-in, .chip.starting, .chip.waiting, .chip.checking { --c: var(--info); }
.chip.cooling, .chip.candidate { --c: var(--warn); }
.chip.broken, .chip.disabled, .chip.failed { --c: var(--bad); }
.chip.cancelled { --c: var(--faint); }
.chip.waiting::before, .chip.checking::before, .chip.starting::before { animation: blink 1.2s infinite; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 6px; color: var(--muted); }
.legend div { display: flex; align-items: center; gap: 6px; }
.legend dt, .legend dd { margin: 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; } .row input { flex: 1; min-width: 180px; }
.card-form select { padding-right: 8px; }
.login-steps { padding-left: 20px; margin: 10px 0 14px; } .login-steps li { margin-bottom: 12px; }
.login-steps li::marker { color: var(--faint); font-family: var(--mono); font-size: 13px; }
.login-link { font: 12px/1.45 var(--mono); word-break: break-all; margin: 6px 0 8px; max-height: 5.8em; overflow: auto; background: var(--sunk); border-radius: var(--r-sm); padding: 8px 10px; }
.scrim { display: none; }

@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 6px transparent; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

@media (prefers-color-scheme: dark) {
  .gallery img, .md img.inline-img, .files-list li img { outline-color: rgba(255, 255, 255, .1); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Phones: the sidebar slides in over the chat. */
@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 20; transform: translateX(-100%); transition: transform .22s var(--ease); padding-top: max(12px, env(safe-area-inset-top)); }
  .shell.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(10, 12, 16, .4); z-index: 15; }
  .menu { display: inline-grid; }
  .icon-btn { width: 40px; height: 40px; }
  .chat-open { padding-block: 10px; }
  .chat-more { opacity: 1; width: 36px; height: 36px; }
  .chat-head { padding: 6px 8px; min-height: 54px; }
  .thread { padding: 6px 14px 18px; }
  .msg.assistant { padding-left: 22px; }
  .composer { margin: 0 8px max(8px, env(safe-area-inset-bottom)); width: calc(100% - 16px); border-radius: 20px; padding-left: 14px; }
  .pill { max-width: 150px; }
  .chat-meta { display: none; }
  .chat-head .ghost { padding: 7px 10px; }
  .chat-head .ghost span { display: none; }
  .toolbar .right { width: 100%; }
  .toolbar .right .pill { flex: 1 1 0; max-width: none; }
  .hint { display: none; }
  .welcome h1 { font-size: 23px; }
  .msg.user .bubble { max-width: 88%; }
  .row-actions { margin-left: 0; }
}
