/* One stylesheet, one register. A turn lands finished and is read once by
   someone deciding what to do next, so the UI reads like a document: sans for
   prose and labels, mono only for what is code or a path, one warm ground with
   surfaces a step lighter, the accent kept for the wordmark, the primary
   button and work that is waiting on you. */

:root {
  --sans: "Segoe UI", -apple-system, BlinkMacSystemFont, Inter, Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, Consolas, "Cascadia Mono", monospace;
  --bg: #171717;
  --surface: #1f1f1e;      /* cards, fields, code blocks */
  --raised: #262624;       /* the user's bubble, a selected row */
  --hover: #2a2a28;
  --line: #262624;         /* pane edges */
  --line-2: #2e2e2c;       /* pill borders */
  --line-3: #3a3936;       /* chip borders, focused fields */
  --fg: #e6e4df;
  --fg-dim: #8b8985;
  --fg-faint: #5c5a56;
  --chip-fg: #e8a48a;      /* inline code, and definition names in the highlighter */
  --link: #7fa8d8;
  --accent: #d97757;
  --accent-ink: #1a1412;   /* text on an accent button */
  --ok: #6fbf73;
  --warn: #d9a457;
  --bad: #d67a6f;
  --azure: #5aa0e6;        /* the az logs mark */
  --col: 760px;            /* the chat column */
}

* { box-sizing: border-box; margin: 0; scrollbar-width: thin; scrollbar-color: #424242 transparent; }
/* the reset above takes margin off dialogs too, and auto margins are what centre
   a modal one — without this every dialog opens in the top-left corner */
dialog { margin: auto; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(121, 121, 121, 0.4); }
::-webkit-scrollbar-thumb:hover { background: rgba(160, 160, 160, 0.7); }
::-webkit-scrollbar-thumb:active { background: rgba(190, 190, 190, 0.8); }

body { font: 14px/1.5 var(--sans); background: var(--bg); color: var(--fg); display: flex; flex-direction: column; height: 100vh; }
body.booting #topbar, body.booting #body, body.booting #home { display: none; }
h1 { font: 600 16px/1 var(--sans); letter-spacing: -.2px; color: var(--accent); }
h1 a { color: inherit; text-decoration: none; }
h2 { font: 600 11px/1 var(--sans); letter-spacing: .6px; text-transform: uppercase; color: var(--fg-faint); }
a { color: var(--link); }
button { font: 13px var(--sans); padding: 4px 10px; border-radius: 7px; color: var(--fg-dim); background: transparent; border: 1px solid var(--line-2); cursor: pointer; }
button:hover { color: var(--fg); border-color: #3e3e3c; }
button:disabled { opacity: .4; cursor: default; }
button:disabled:hover { color: var(--fg-dim); border-color: var(--line-2); }
button.on { background: #2f2f2d; color: var(--fg); border-color: transparent; }
.primary { color: var(--accent-ink); background: var(--accent); border-color: transparent; font-weight: 600; }
.primary:hover { color: var(--accent-ink); background: #e28a6c; }
textarea, input { font: 14px/1.5 var(--sans); color: var(--fg); background: var(--surface); border: 1px solid #383836; border-radius: 9px; padding: 8px 12px; }
textarea:focus, input:focus { outline: none; border-color: #5a5956; }
@keyframes breathe { 0%, 55%, 100% { opacity: .18 } 25% { opacity: .85 } }
.sess .live, #modes .live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; animation: breathe 2.4s ease-in-out infinite; }

/* ── topbar: the task line, on a row of its own only until the dock is up
   (setting up, failed, denied, local); then git.js moves it into the dock's
   left corner and the row goes ── */
#topbar { flex-shrink: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; padding: 10px 20px; border-bottom: 1px solid var(--line); color: var(--fg-dim); }
body.docked #topbar { display: none; }
.tb-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
/* in the dock: the left column, ellipsized before it can touch the tiles */
#modes .tb-left { grid-column: 1; gap: 10px; padding-right: 12px; font-size: 13px; }
#topbar-text { color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-branch { font: 12px var(--mono); color: var(--fg-dim); margin-left: 6px; }
#installbar { font-size: 12px; color: var(--warn); white-space: nowrap; }
.spin { color: var(--warn); }
.svc { display: flex; gap: 4px; align-items: center; padding: 4px 6px 4px 10px; border: 1px solid var(--line-2); border-radius: 9px; }
.svc:hover { border-color: #3e3e3c; background: var(--surface); }
.svc-toggle { display: flex; align-items: center; font-size: 12px; padding: 2px 5px; border: none; border-radius: 6px; color: var(--fg-faint); }
.svc-toggle.running { color: var(--ok); }

/* ── the dock: the task's apps along the bottom, icon over name, the one in
   front filled. Badges on the tile's corners: claude's live dot or waiting
   count, a repo's uncommitted count, a server's light. Actions float above
   on hover, so the dock never changes width. ── */
#modes { flex-shrink: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: 66px; padding: 0 16px; border-top: 1px solid var(--line); background: #131313; }
/* the tiles in the middle column: equal columns either side keep them centred
   whatever sits in the left one */
.dk-mid { grid-column: 2; display: flex; align-items: center; gap: 10px; }
.dk-apps, #dk-repos, #dk-pages { display: flex; align-items: center; gap: 2px; }
.dk { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 66px; height: 58px; padding: 0; border: none; border-radius: 10px; color: var(--fg-dim); cursor: pointer; }
.dk:hover { background: var(--surface); color: var(--fg); }
.dk.on { color: var(--fg); }
.dk.down { color: var(--fg-faint); }
.dk-lb { max-width: 62px; font-size: 11px; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dk-ic { position: relative; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line-2); color: var(--fg-dim); }
.dk:hover .dk-ic { border-color: var(--line-3); }
.dk.on .dk-ic { background: #2f2f2d; border-color: var(--line-3); }
/* a favicon sits in our tile at the size of claude's and vscode's marks, so
   every app in the dock reads as the same object */
.dk-ic.fav img { width: 18px; height: 18px; border-radius: 4px; }
.dk-ic.fav b { font: 600 13px var(--sans); }
.dk.down .dk-ic { filter: grayscale(1); opacity: .45; }
/* a stopped tile says what a click does: play over its mark, undimmed */
.dk-play { position: absolute; inset: 0; display: none; place-items: center; border-radius: 7px; background: var(--surface); color: var(--fg); }
.dk.stopped { cursor: pointer; }
.dk.stopped:hover .dk-ic { filter: none; opacity: 1; }
.dk.stopped:hover .dk-play { display: grid; }
.dk-act svg { display: block; }
.dk-badge { position: absolute; top: -5px; right: -7px; display: flex; align-items: center; gap: 3px; }
.dk-badge.n, .dk-badge .live-n { min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: #3a3936; color: var(--fg); font: 600 10px/16px var(--sans); text-align: center; }
.dk-badge .live-n { background: var(--accent); color: var(--accent-ink); }
.dk-st { position: absolute; right: -3px; bottom: -3px; width: 9px; height: 9px; border-radius: 50%; background: var(--fg-faint); border: 2px solid #131313; }
.dk-st.running { background: var(--ok); }
.dk-st.installing { background: var(--warn); }
.dk-st.failed, .dk-st.crashed { background: var(--bad); }
.dk-acts { position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); display: flex; visibility: hidden; opacity: 0; transition: opacity .1s, visibility 0s .1s; gap: 1px; padding: 3px; background: var(--surface); border: 1px solid var(--line-3); border-radius: 8px; box-shadow: 0 4px 14px #0008; z-index: 5; }
/* bridges the gap, or the hover drops on the way up */
.dk-acts::after { content: ''; position: absolute; left: 0; right: 0; top: 100%; height: 6px; }
/* held back two seconds: passing over the dock on the way to a tile should
   not flash a popover at every one; leaving hides it at once */
.dk:hover .dk-acts { visibility: visible; opacity: 1; transition-delay: 2s; }
.dk-act { display: flex; align-items: center; padding: 3px 6px; border-radius: 5px; font-size: 12px; color: var(--fg-dim); }
.dk-act:hover { color: var(--fg); background: var(--hover); }
#dk-svcs { display: flex; align-items: center; gap: 2px; height: 40px; padding-left: 10px; border-left: 1px solid var(--line-2); }
#dk-svcs:empty { display: none; }
.dk-svc { cursor: default; }
.dk-svc .dk-ic { background: none; }
/* local mode: no agent */
body.local #modes, body.local #composer, body.local #composer-hint { display: none; }
/* live wins over waiting */
#modes .live-dot, #modes .live-n, #modes .wait-n { display: none; }
#modes.live .live-dot { display: inline-block; }
#modes.live.many .live-n { display: inline; }
#modes.wait:not(.live) .wait-n { display: inline; }
.dk-badge .wait-n { min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--warn); color: var(--accent-ink); font: 600 10px/16px var(--sans); text-align: center; }

/* ── the two faces: one shown, both full width ── */
#body { flex: 1; display: flex; min-height: 0; }
.mode { display: none; flex: 1; min-width: 0; min-height: 0; }
.mode.on { display: flex; }
#main { flex: 1; display: flex; flex-direction: column; min-width: 0; font-size: 15px; line-height: 1.6; }

/* the sessions rail. A group is a block: its name as a header, its sessions
   under it; the rows outside any block are the plain list, and the empty space
   under them is where a dragged row leaves its group. */
#side { width: 240px; flex-shrink: 0; padding: 16px 12px; border-right: 1px solid var(--line); overflow-y: auto; display: flex; flex-direction: column; }
#side-sessions { flex: 1; display: flex; flex-direction: column; }
#side h2 { margin: 4px 0 10px 8px; }
#newsess { width: 100%; text-align: left; padding: 7px 10px; border-radius: 9px; }
#sessions { flex: 1; margin-top: 12px; display: flex; flex-direction: column; gap: 2px; padding-bottom: 40px; border-radius: 9px; }
#sessions.over { background: var(--surface); }
.sess { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 9px; cursor: pointer; }
.sess:hover { background: var(--surface); }
.sess.sel { background: var(--raised); }
.sess.dragging { opacity: .4; }
.sess.over { outline: 1px dashed var(--fg-dim); outline-offset: -1px; }
.sess-head { display: flex; align-items: center; gap: 6px; }
.sess-head > div { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg); }
.sess-sub { font-size: 12px; color: var(--fg-faint); }
.sess .rename, .grp-hd .rename { padding: 0 4px; font-size: 12px; color: var(--fg-faint); border: none; opacity: 0; }
.sess:hover .rename, .grp-hd:hover .rename { opacity: 1; }
.sess .rename:hover, .grp-hd .rename:hover { color: var(--fg); }
.sess-name { width: 100%; padding: 1px 6px; border-radius: 6px; border-color: #5a5956; }
/* the row's state: working breathes, waiting is the amber that says "read me", idle is nothing */
.st { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; background: transparent; }
.st.working { background: var(--accent); animation: breathe 2.4s ease-in-out infinite; }
.st.waiting { background: var(--warn); }
.grp { margin: 4px 0; padding: 2px; border: 1px solid var(--line-2); border-radius: 11px; }
.grp.open { border-color: var(--line-3); }
.grp-hd { display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px; cursor: pointer; }
.grp-hd:hover { background: var(--surface); }
.grp-hd.over { outline: 1px dashed var(--fg-dim); outline-offset: -1px; }
.grp-hd > div { flex: 1; font: 600 11px/1.5 var(--sans); letter-spacing: .5px; text-transform: uppercase; color: var(--fg-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grp .sess { padding-left: 14px; }

/* ── the grid: one pane, or a group's worth. The count picks the layout — a
   fixed table rather than free splits, so a pane is always where the count
   says and dragging only changes the order. ── */
#grid { flex: 1; min-height: 0; display: grid; gap: 1px; background: var(--line); }
#grid.single, #grid.group.n1 { grid-template-columns: 1fr; }
#grid.n2 { grid-template-columns: 1fr 1fr; }
#grid.n3, #grid.n4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
#grid.n3 .pane:first-child { grid-row: 1 / 3; }
#grid.n5, #grid.n6 { grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr 1fr; }
#grid.n7 { grid-template-columns: 1fr 1fr 1fr; grid-auto-rows: minmax(50vh, 1fr); overflow-y: auto; }
#grid.max { display: flex; }
#grid.max .pane:not(.maxed) { display: none; }
#grid.max .pane.maxed { flex: 1; }
.pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
#grid.single .pane-hd { display: none; }
#grid.group .log { padding-top: 16px; }
/* tiled (a group, not maximized) the column is a third of the screen: one
   notch down so a sentence still fits a line and a third more transcript
   shows. Not below 13 — that is where a reply stops being read and starts
   being glanced at. Maximize is the screen again, at full size. */
#grid.tiled .pane { font-size: 13px; line-height: 1.5; }
#grid.tiled .pane .msg.assistant { margin-top: 18px; }
#grid.tiled .pane .msg.assistant + .msg.assistant { margin-top: 14px; }
#grid.tiled .pane .msg.user { margin-top: 28px; margin-bottom: 4px; }
#grid.tiled .pane .msg.user .pc-bubble { padding: 9px 14px; border-radius: 14px; }
#grid.tiled .pane .md code, #grid.tiled .pane .md .md-code { font-size: 12px; }
#grid.tiled .pane .md .md-h1 { font-size: 17px; }
#grid.tiled .pane .md .md-h2 { font-size: 15px; }
#grid.tiled .pane .md .md-h3 { font-size: 13px; }
#grid.tiled .pane .md .md-h { margin: 14px 0 6px; }
#grid.tiled .pane .md .md-p, #grid.tiled .pane .md .md-list, #grid.tiled .pane .md .md-code, #grid.tiled .pane .md .md-table { margin-bottom: 9px; }
#grid.tiled .pane .md table { font-size: 12.5px; }
#grid.tiled .pane #composer textarea { font-size: 14px; }
#grid.tiled .pane .reply-bar { font-size: 13px; padding: 8px 14px; }
/* a finished turn nobody has answered: the header warms up and a faint ring
   sits just inside the pane, so it reads the same in every layout — a border
   would vanish into the grid's own lines. Stays until a message goes in; focus,
   reading and scrolling clear nothing. Only in a group: alone, the reply is the
   whole screen and needs no flag */
#grid.group .pane.waiting { box-shadow: inset 0 0 0 1px rgba(217, 164, 87, .35), inset 0 0 40px rgba(217, 164, 87, .05); }
#grid.group .pane.waiting .pane-hd { background: rgba(217, 164, 87, .07); border-bottom-color: rgba(217, 164, 87, .4); }
#grid.group .pane.waiting .pn-name { color: #e8c48a; }
.pane-hd { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--fg-dim); user-select: none; }
.pane-hd .pn-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; background: transparent; }
.pane.working .pn-dot { background: var(--accent); animation: breathe 2.4s ease-in-out infinite; }
.pane.waiting .pn-dot { background: var(--warn); }
.pane-hd .pn-name { color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pane.focused .pn-name { font-weight: 600; }
.pane-hd .pn-live { flex: 1; font: 11px var(--mono); color: var(--fg-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pane-hd button { padding: 0 5px; font-size: 12px; border: none; color: var(--fg-faint); opacity: 0; }
.pane-hd:hover button { opacity: 1; }
.pane-hd button:hover { color: var(--fg); }
/* an unfocused pane offers a reply bar where the composer would be; a click brings the composer over */
.cslot { flex-shrink: 0; }
.reply-bar { display: none; width: calc(100% - 48px); max-width: calc(var(--col) - 48px); margin: 8px auto 20px; padding: 10px 16px; text-align: left; font-size: 14px; color: var(--fg-faint); background: var(--surface); border: 1px solid #383836; border-radius: 16px; }
.reply-bar:hover { color: var(--fg-dim); border-color: #5a5956; }
#grid.group .pane:not(.focused) .reply-bar, body.code-mode .pane .reply-bar, body.browser-mode .pane .reply-bar { display: block; }

/* ── the log: one centred column, the reply as bare text, the user's message
   as the only bubble ── */
.logwrap { flex: 1; position: relative; display: flex; min-height: 0; }
/* positioned so a message's offsetTop is its coordinate in the scrolled content, which is what jumpTo compares against */
.log { flex: 1; position: relative; overflow-y: auto; padding: 32px 0 24px; }
/* history still arriving (chat.js connect): laid out, not shown */
.log.replaying { visibility: hidden; }
.log > .msg { max-width: var(--col); margin-left: auto; margin-right: auto; padding: 0 24px; }
.msg { white-space: pre-wrap; word-break: break-word; }
.msg.assistant { white-space: normal; margin-top: 28px; }
.msg.assistant + .msg.assistant { margin-top: 20px; }
.msg.user { margin-top: 44px; margin-bottom: 8px; }
.msg.user .pc-bubble { display: block; margin-left: auto; width: fit-content; max-width: 78%; padding: 12px 18px; background: var(--raised); border-radius: 18px; line-height: 1.55; }
.msg.user .pc-from { display: block; text-align: right; font-size: 12px; color: var(--fg-faint); margin: 0 6px 4px 0; }
.msg.err { font: 13px/1.5 var(--mono); color: var(--bad); margin-top: 12px; }

/* jump to the previous/next thing you said: faint until the log is under the cursor */
.jump { position: absolute; right: 16px; bottom: 10px; display: flex; flex-direction: column; gap: 2px; opacity: .3; transition: opacity .12s; }
.logwrap:hover .jump { opacity: 1; }
.jump button { padding: 0 6px; font-size: 10px; line-height: 1.7; border-radius: 6px; background: var(--raised); border-color: transparent; }

/* a run of tool calls: one grey line, its latest call under it while the run is
   open, the calls and their results two clicks away */
.msg.tool, .msg.tool-group { font-size: 13px; line-height: 1.5; color: var(--fg-dim); white-space: normal; margin-top: 18px; }
.msg.tool { color: var(--fg-faint); }
.tool-group > summary { cursor: pointer; list-style: none; }
.tool-group > summary::-webkit-details-marker { display: none; }
.tool-group > summary::before { content: '›'; display: inline-block; width: 12px; color: var(--fg-faint); transition: transform .12s; }
.tool-group[open] > summary::before { transform: rotate(90deg); }
.tool-group > summary:hover { color: var(--fg); }
.host-tag { white-space: nowrap; }
.host-tag svg { width: 12px; height: 12px; vertical-align: -1px; margin-right: 4px; }
.host-db { color: var(--warn); }
.host-planetscale { color: var(--fg); }
.host-azurelogs { color: var(--azure); }
.tg-live { display: block; padding-left: 12px; font-size: 12px; color: var(--fg-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-live:empty { display: none; }
.tg-rows { margin: 6px 0 4px 5px; padding-left: 14px; border-left: 1px solid var(--line-3); }
.tg-row > summary { cursor: pointer; list-style: none; padding: 1px 0; font: 12.5px/1.6 var(--mono); color: var(--fg-dim); }
.tg-row > summary::-webkit-details-marker { display: none; }
.tg-row > summary:hover, .tg-row[open] > summary { color: var(--fg); }
.tg-io, .tg-out { margin: 2px 0 6px; padding: 6px 8px; max-height: 300px; overflow: auto; font: 12px/1.5 var(--mono); color: #999; background: var(--surface); border: 1px solid var(--line-3); border-radius: 6px; white-space: pre-wrap; word-break: break-word; }
.tg-io { color: #7a8; }
.tg-out.err { color: var(--bad); border-color: #442; }

/* the turn's meta: a faint row under the reply, the fork on hover */
.msg.result-line { margin-top: 10px; font-size: 12px; line-height: 1.6; color: var(--fg-faint); white-space: normal; }
.msg .fork { margin-left: 12px; padding: 0; font: inherit; color: var(--fg-faint); border: none; opacity: 0; transition: opacity .1s; }
.msg:hover .fork, .msg .fork:focus { opacity: 1; }
.msg .fork:hover { color: var(--fg); }
.msg .fork-name { margin-left: 10px; padding: 1px 6px; width: 240px; font: inherit; border-radius: 6px; }

/* markdown. The parse decides where lines break, so the pre-wrap a message
   carries for raw text is off here — a fence keeps its own. break-word only
   when a word cannot fit a line: word-break shrinks min-content too, which let
   a table column collapse to a few characters. */
.md { white-space: normal; word-break: normal; overflow-wrap: break-word; }
.md strong { color: #fff; font-weight: 600; }
.md em { font-style: italic; }
.md s { color: var(--fg-dim); }
.md a { text-decoration: underline; text-decoration-color: rgba(127, 168, 216, .5); text-underline-offset: 2px; }
.md code { font: 13px/1 var(--mono); padding: 2px 6px; background: var(--hover); border: 1px solid var(--line-3); border-radius: 5px; color: var(--chip-fg); }
/* the box already sets a code span apart; bold on top of it reads as a third
   colour rather than as emphasis */
.md strong > code { font-weight: 400; }
.md .md-h { font-weight: 600; margin: 20px 0 8px; }
.md .md-h1 { font-size: 20px; } .md .md-h2 { font-size: 17px; } .md .md-h3 { font-size: 15px; }
/* a paragraph is spaced like any other block, so text after a list or a fence
   sits the same distance away as text between two paragraphs */
.md .md-p { margin: 0 0 12px; }
.md > .md-p:last-child { margin-bottom: 0; }
.md .md-quote { margin: 12px 0; padding-left: 14px; border-left: 3px solid var(--line-3); color: var(--fg-dim); }
.md .md-hr { margin: 20px 0; border: none; border-top: 1px solid var(--line-3); }
.md .md-list { margin: 0 0 12px; }
/* an item's own paragraphs are its text, not blocks stacked inside it */
.md .md-li .md-p { margin: 0; }
.md .md-li .md-list { margin: 4px 0 0; padding-left: 4px; }
/* hanging indent: the marker sits in its own column so wrapped text lines up
   under the words, not under the bullet */
.md .md-li { display: flex; gap: 10px; margin: 4px 0; }
.md .md-mark { flex-shrink: 0; min-width: 18px; color: var(--fg-dim); text-align: right; }
.md .md-code { margin: 12px 0; padding: 12px 14px; font: 13px/1.5 var(--mono); background: var(--surface); border: 1px solid var(--line-3); border-radius: 8px; white-space: pre; overflow-x: auto; }
/* the block is what a reader takes away; the button sits in its top-right
   corner on hover. The block's margin collapses through the wrapper, so the
   wrapper's top edge is the block's own. */
.md .md-codewrap { position: relative; }
.md .md-copy { position: absolute; top: 8px; right: 8px; height: 20px; padding: 0 8px; font-size: 11px; line-height: 18px; border-radius: 6px; background: var(--hover); border-color: var(--line-3); opacity: 0; transition: opacity .12s; }
.md .md-codewrap:hover .md-copy, .md .md-copy:focus { opacity: 1; }
/* a table wider than the message scrolls in its own strip rather than pushing
   the log sideways */
.md .md-table { margin: 12px 0; overflow-x: auto; }
.md table { border-collapse: collapse; font-size: 14px; line-height: 1.5; }
.md th, .md td { border-bottom: 1px solid var(--line-3); padding: 6px 12px; text-align: left; vertical-align: top; }
.md th { color: var(--fg-dim); font-weight: 600; font-size: 13px; }
.md .mermaid-box { margin: 6px 0; padding: 10px; background: var(--surface); border: 1px solid var(--line-3); border-radius: 8px; overflow-x: auto; }
.md .mermaid-box svg { max-width: 100%; }

/* ── composer: a rounded field in the chat column, or floating over the code
   and browser faces — one node, moved by layout.js ── */
#composer { position: relative; display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: var(--col); margin: 0 auto; padding: 8px 24px 20px; }
/* the row itself is the box: chips across the top, then the borderless
   textarea with the controls in a column at its right edge, pinned to the
   bottom so a growing message leaves them where the hand expects */
#composer-row { display: grid; grid-template-columns: auto 1fr auto; align-items: end; background: var(--surface); border: 1px solid #383836; border-radius: 16px; box-shadow: 0 2px 12px rgba(0, 0, 0, .25); }
#composer-row:focus-within { border-color: #5a5956; }
/* one line to start (rows=1, no fixed height, so nothing clips), growing
   upward into the log as it fills — height is set from scrollHeight in
   composer.js, so the cap lives there too */
#composer textarea { font-size: 15px; padding: 10px 16px 10px 10px; background: none; border: none; border-radius: 0; resize: none; overflow-y: hidden; }
#composer textarea::placeholder { color: var(--fg-faint); }
/* claude's mark, so the box says who it goes to */
.ca-mark { display: flex; flex-shrink: 0; color: var(--accent); }
.ca-mark svg { width: 15px; height: 15px; fill: currentColor; }
#composer-row .ca-mark { padding: 0 0 13px 14px; }
#composer-acts { display: flex; align-items: center; gap: 8px; padding: 0 10px 8px 0; }
#composer-acts button { border-radius: 8px; }
.ca-icon { border: none; padding: 2px 4px; }
.ca-send { padding: 4px 14px; color: var(--accent-ink); background: var(--accent); border-color: transparent; font-weight: 600; }
.ca-send:hover { color: var(--accent-ink); background: #e28a6c; }
#composer.drag { outline: 1px dashed var(--accent); outline-offset: -4px; }
/* what the keys do, for the first message only: shown while the field has
   focus, retired after the first send */
#composer-hint { display: none; padding: 6px 16px 0; font-size: 11px; color: var(--fg-faint); }
#composer-hint b { font-weight: 500; color: var(--fg-dim); }
#composer:focus-within:not(.hint-seen) #composer-hint { display: block; }
/* floating (code and browser): a pill in the page's corner — placeholder or
   the draft's first words, and a count of what it holds — that opens into the
   box on a click and folds on esc, send, or a click anywhere else */
#composer-pill { display: none; align-items: center; gap: 10px; max-width: 420px; padding: 9px 16px; font-size: 13px; color: var(--fg-faint); background: var(--surface); border: 1px solid var(--line-3); border-radius: 999px; box-shadow: 0 4px 18px #000a; cursor: text; white-space: nowrap; }
#composer-pill:hover { border-color: #5a5956; color: var(--fg-dim); }
#cp-text { overflow: hidden; text-overflow: ellipsis; }
#cp-text.draft { color: var(--fg); }
#cp-n { flex-shrink: 0; padding: 1px 8px; font-size: 12px; color: var(--fg); background: var(--raised); border-radius: 999px; }
body.code-mode #composer, body.browser-mode #composer { align-items: flex-end; width: auto; max-width: none; margin: 0; padding: 0; }
body.code-mode #composer:not(.open) > :not(#composer-pill), body.browser-mode #composer:not(.open) > :not(#composer-pill) { display: none; }
body.code-mode #composer:not(.open) #composer-pill, body.browser-mode #composer:not(.open) #composer-pill { display: flex; }
body.code-mode #composer.open, body.browser-mode #composer.open { width: min(680px, calc(100vw - 32px)); }
body.code-mode #composer.open #composer-row, body.browser-mode #composer.open #composer-row { width: 100%; box-shadow: 0 8px 32px #000c; }
/* queued: sent, not yet taken in by the agent — chips above the field */
#queued { display: none; flex-direction: column; gap: 4px; padding: 0 4px; }
.qd { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 12px; font-size: 13px; background: var(--surface); border: 1px dashed var(--line-3); border-radius: 10px; }
.qd-tag { flex-shrink: 0; font-size: 11px; color: var(--warn); }
.qd-txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg-dim); }
.qd-now, .qd-x { flex-shrink: 0; padding: 1px 8px; font-size: 12px; border-color: transparent; }
.qd-now:hover, .qd-x:hover { color: var(--fg); border-color: var(--line-3); }
#filedrop { position: absolute; bottom: 100%; left: 24px; right: 24px; margin-bottom: 2px; max-height: 240px; overflow-y: auto; display: none; font-size: 13px; background: var(--surface); border: 1px solid #444; border-radius: 10px; }
#filedrop div { padding: 3px 8px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#filedrop div.sel { background: var(--raised); }
#filedrop .sum { color: var(--fg-dim); margin-left: 8px; }
/* attachments: chips inside the field above the text, one per pasted/picked file */
#attachments { grid-column: 1 / -1; display: none; flex-wrap: wrap; gap: 6px; padding: 12px 12px 0; }
#attachments.on { display: flex; }
.att { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; font-size: 12px; color: var(--fg-dim); background: var(--hover); border: 1px solid var(--line-3); border-radius: 8px; }
.att.err { border-color: #6a3a36; color: var(--bad); }
.att img { height: 28px; width: 28px; object-fit: cover; border-radius: 5px; }
.att .kind { padding: 4px 6px; font: 600 10px var(--sans); letter-spacing: .5px; color: var(--chip-fg); background: var(--surface); border-radius: 5px; }
.att .path { color: var(--fg); }
.att .x { cursor: pointer; color: var(--fg-faint); }
.att .x:hover { color: var(--bad); }
/* a quote: the anchor in mono, the note dimmed after it, clipped so a long one
   stays a chip */
.att.quote { padding: 6px 8px 6px 10px; cursor: pointer; }
.att.quote:hover { border-color: #4a4946; }
.q-at { font: 11px var(--mono); color: var(--link); white-space: nowrap; }
.q-tag { font-size: 11px; color: var(--warn); }
.att .q-note { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg); }

/* a sent message with quotes: cards on top, the text under */
.q-card { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line-3); border-radius: 10px; white-space: normal; }
.q-card .q-at { cursor: pointer; }
.q-card .q-at:hover { text-decoration: underline; }
.q-code { margin: 0; max-height: 120px; overflow: hidden; font: 12px/1.45 var(--mono); color: var(--fg-dim); white-space: pre; }
.q-card .q-note { padding-left: 8px; border-left: 2px solid var(--line-3); }
.q-text { white-space: pre-wrap; }
.q-file { display: inline-block; margin-top: 8px; padding: 2px 8px; font-size: 12px; color: var(--fg-dim); background: var(--surface); border: 1px solid var(--line-3); border-radius: 6px; }

/* status tray: what the session is doing, pinned above the composer. Lives
   outside the log on purpose: re-appending a node restarts its CSS animation, so
   the dots would never finish a cycle inside the message list. */
.status { display: flex; flex-direction: column; gap: 4px; width: 100%; max-width: var(--col); margin: 0 auto; padding: 4px 24px 0; font-size: 12px; line-height: 1.5; }
/* a reply still arriving: each new run of characters fades in rather than
   popping. No cursor — the tray under the log already says it is working. */
@keyframes fresh { from { opacity: 0 } to { opacity: 1 } }
.msg.streaming .fresh { animation: fresh .18s ease-out; }
.st-work { display: flex; align-items: center; gap: 8px; color: var(--fg-dim); }
.st-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); display: inline-block; margin-right: 4px; opacity: .18; animation: breathe 3.6s ease-in-out infinite; }
.st-dots i:nth-child(2) { animation-delay: 1.2s; }
.st-dots i:nth-child(3) { animation-delay: 2.4s; }

/* ── the code face: files | diff, the review foot under both ── */
#code { position: relative; flex-direction: column; }
#gitpanel { display: flex; flex: 1; min-height: 0; min-width: 0; }
/* Three fixed regions: the bar, the scrolling list, the foot. Only the list
   scrolls, so its headers stick at 0 and no offset has to match a height
   above it — the layout, not arithmetic, keeps the stack closed. */
#gp-side { width: 300px; flex-shrink: 0; display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); font-size: 13px; }
#gp-bar { flex-shrink: 0; display: flex; flex-direction: column; gap: 6px; padding: 12px 12px 8px; }
#gp-bar button { font-size: 12px; }
#gp-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px 10px; }
#gp-foot { flex-shrink: 0; padding: 8px 8px 6px; border-top: 1px solid var(--line); }
.gp-row { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.gp-status { display: flex; align-items: baseline; gap: 10px; padding: 6px 8px 2px; font: 11px var(--mono); color: var(--fg-faint); }
.gp-branch { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gp-arrows { flex-shrink: 0; display: inline-flex; gap: 5px; }
.gp-status .gp-pr-link { margin-left: auto; flex-shrink: 0; }
.gp-status .gp-pr-link + .gp-pr-link { margin-left: 0; }
/* what is left, not what is done */
.gp-unread { margin-left: auto; flex-shrink: 0; font: 11px var(--sans); color: var(--accent); }
.gp-unread.done { color: var(--ok); }
.gp-pr-warn { color: var(--warn); }
.gp-pr-link { text-decoration: none; }
.gp-pr-new:not(.ready) { color: var(--fg-faint); }
.gp-pr-link:hover { text-decoration: underline; }
.gp-pr-merged { color: #b8a7d9; } .gp-pr-closed { color: var(--bad); } .gp-pr-draft { color: var(--fg-dim); }
.gp-log { padding: 0 8px 6px; font: 11px var(--mono); color: var(--fg-dim); }
.gp-log > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gp-author { color: var(--fg-faint); }
.gp-note { padding: 4px 8px; font-size: 12px; color: var(--fg-faint); }
.gp-dirrow { padding: 8px 8px 2px; font: 11px var(--mono); color: var(--fg-faint); }
.gp-file { display: flex; gap: 6px; align-items: center; padding: 4px 8px; border-radius: 7px; font: 12.5px var(--mono); cursor: pointer; }
.gp-file:hover { background: var(--surface); }
.gp-file.sel { background: var(--raised); }
/* one mono glyph and no more — a wider box reads as a gap before the name */
.gp-st { width: 10px; flex-shrink: 0; font-size: 11px; }
/* chunk: staged is done and recedes like a read row (git.js) */
/* the panel's one sticky element, at the scroller's own top */
.gp-sect { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 6px; padding: 8px 8px 4px; font: 11px var(--sans); color: var(--fg-faint); background: var(--bg); }
.gp-sect .gp-unread { margin-left: auto; }
.gp-sect button { margin-left: auto; padding: 1px 8px; font-size: 11px; }
.gp-sect.busy button { opacity: .4; pointer-events: none; }
/* done rows go quiet whole, status letter included: staged, or read */
.gp-file.staged .gp-name, .gp-file.staged .gp-counts span, .gp-file.staged .gp-st,
.gp-file.seen .gp-name, .gp-file.seen .gp-counts span, .gp-file.seen .gp-st { color: var(--fg-faint); }
/* + / − at the row's right edge */
.gp-act { flex-shrink: 0; margin-left: auto; display: grid; place-items: center; width: 22px; height: 20px; box-sizing: border-box; color: var(--fg-dim); border: 1px solid var(--line-2); border-radius: 5px; }
.gp-act svg { width: 9px; height: 9px; fill: currentColor; display: block; }
.gp-act:hover { color: var(--fg); background: var(--raised); border-color: var(--fg-faint); }
.gp-file.staged .gp-act { color: var(--fg-faint); border-color: transparent; }
.gp-file.staged:hover .gp-act { border-color: var(--line-2); }
.gp-file.busy { opacity: .4; pointer-events: none; }
.gp-st-A { color: var(--ok); } .gp-st-M { color: var(--warn); } .gp-st-D { color: var(--bad); } .gp-st-R, .gp-st-C { color: var(--link); }
/* A name truncates when the row runs out, not before. The cap is the flat
   list's alone: there the dimmed folder follows the name and has to fit. */
.gp-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gp-file.flat .gp-name { flex-shrink: 0; max-width: 60%; }
/* rtl truncates the far end, where a deep path repeats what the row above says.
   The directory carries no trailing slash — rtl would swing it to the front. */
.gp-dir { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: rtl; text-align: left; color: var(--fg-faint); font-size: 11px; }
.gp-counts { flex-shrink: 0; font-size: 11px; }
.gp-add { color: var(--ok); } .gp-del { color: var(--bad); }
/* read: the name recedes, the row stays where it is */
/* Pinned to the row's right edge: the rest of a row is ragged. It holds its
   width whether or not it is on — a mark that appears on hover moves the row's
   contents under the pointer. */
.gp-seen { flex-shrink: 0; margin-left: auto; padding-left: 8px; width: 12px; box-sizing: content-box; text-align: right; color: transparent; }
.gp-file:hover .gp-seen { color: var(--fg-faint); }
.gp-seen.on, .gp-file:hover .gp-seen.on { color: var(--ok); }
/* read, then edited underneath: the tick is gone already, and this says the row
   is back because the file moved rather than because it was never opened */
.gp-file.moved .gp-name::after { content: ' ·changed'; font: 10px var(--sans); color: var(--warn); }
.gp-commit { display: flex; flex-direction: column; gap: 6px; padding: 0 0 6px; }
.gp-commit textarea { font-size: 13px; line-height: 1.45; padding: 8px 10px; resize: vertical; }
/* one row, the primary at the right end; the quiet buttons before it read as
   the alternatives they are rather than as a second call to action */
.gp-commit-row { display: flex; justify-content: flex-end; gap: 6px; }
.gp-commit-row button { padding: 6px 12px; border-radius: 9px; font-size: 12px; }
.gp-commit-row button:disabled { opacity: .4; pointer-events: none; }
.gp-commit-row .gp-primary, .gp-commit-row .gp-push { color: var(--ok); border-color: #2c4a2e; }
.gp-commit-row .gp-primary:hover, .gp-commit-row .gp-push:hover { background: #1c2a1d; border-color: var(--ok); }
.gp-commit-row .gp-commit-only { color: var(--fg-dim); margin-right: auto; }

/* the diff: a column, so the action bar sits under it rather than over its last
   lines. Header as a quiet strip, the editor filling the pane edge to edge. */
#gp-main { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; }
#gp-diff { flex: 1; overflow: auto; font-size: 13px; color: var(--fg-faint); }
#gp-diff:has(.gp-fname) { display: flex; flex-direction: column; overflow: hidden; }
.gp-fname { flex-shrink: 0; display: flex; align-items: center; gap: 8px; padding: 10px 18px; color: var(--fg-dim); border-bottom: 1px solid var(--line); }
.gp-fname > span:not(.gp-view) { font: 500 13px var(--mono); color: var(--fg); }
.gp-fname .gp-st { width: auto; }
.gp-fname .gp-side { font: 11px var(--sans) !important; color: var(--fg-faint) !important; }
.gp-fname .gp-view { margin-left: auto; display: flex; gap: 4px; }
.gp-fname .gp-view button { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; font-size: 12px; }
/* the layout icon is part of the diff button, not a control of its own */
.gp-fname .gp-view button .gp-sub { display: inline-flex; opacity: .7; }
.gp-fname .gp-view button .gp-sub svg { width: 10px; height: 10px; fill: currentColor; }
.gp-cm { flex: 1; min-height: 0; overflow: auto; }
.gp-md { flex: 1; overflow: auto; padding: 20px 24px; font-size: 15px; line-height: 1.6; color: var(--fg); }
#gp-actions { flex-shrink: 0; display: flex; align-items: center; gap: 10px; padding: 8px 18px; font-size: 12px; border-top: 1px solid var(--line); }
#gp-actions button { font-size: 12px; }
#gp-actions button.tick { color: var(--ok); border-color: #2c4a2e; }
#gp-actions button.tick:hover:not(:disabled) { border-color: var(--ok); background: #1c2a1d; }
/* the count is the finish line — deep in a file the list is off screen */
.gp-left { margin-right: auto; color: var(--accent); }
.gp-left.done { color: var(--ok); }
.gp-left .gp-of { color: var(--fg-faint); }

/* codemirror merge view, on the same ground */
.gp-cm .cm-mergeView, .gp-cm .cm-editor { background: var(--bg); }
.gp-cm .cm-editor { font-size: 12.5px; }
.gp-cm .cm-editor .cm-gutters { background: var(--bg); border-color: var(--line); color: var(--fg-faint); }
.gp-cm .cm-collapsedLines { padding: 3px 10px; font: 11px var(--sans); color: var(--fg-dim); background: var(--surface); }
.gp-cm .cm-collapsedLines:hover { background: var(--hover); }
.gp-cm .cm-mergeViewEditor:first-child { border-right: 1px solid var(--line); }
/* A tint marks the row a change lands on, nothing narrower: the token colours
   are the other thing painted on this text, and a per-character wash fights
   them for the same pixels. Changes are <ins>/<del>, so the browser's underline
   and strike have to be turned off — the tint says which way the line went. */
.gp-cm ins, .gp-cm del { text-decoration: none; }
/* The merge theme paints changed characters with a background *image*, so a
   background colour of our own leaves it standing. Its own selectors carry the
   generated theme class, so these have to out-specify a three-class rule. */
.gp-cm .cm-editor .cm-line .cm-changedText,
.gp-cm .cm-editor .cm-line .cm-insertedText,
.gp-cm .cm-editor .cm-deletedChunk .cm-deletedText { background-image: none; }
.gp-cm .cm-merge-a .cm-changedLine, .gp-cm .cm-deletedChunk { background: rgba(214, 122, 111, .10); }
.gp-cm .cm-merge-b .cm-changedLine, .gp-cm .cm-insertedLine, .gp-cm .cm-changedLine { background: rgba(111, 191, 115, .09); }
/* the gutter mark is the one place a change still shows at full strength */
.gp-cm .cm-merge-a .cm-changedLineGutter { background: var(--bad); }
.gp-cm .cm-merge-b .cm-changedLineGutter { background: var(--ok); }
/* split marks a wholly added line twice: an <ins> inside a .cm-changedLine row.
   The row already carries the tint, and <ins> is inline — tinting it as well
   doubles the green and ends it at the last character, not the row's edge. */
.gp-cm .cm-mergeView ins.cm-insertedLine { background: none; }

/* review comments: select lines, write one, stack a few, send them as one
   message. The pill and card are fixed: coordsAtPos hands back viewport
   coordinates, and fixed is the one position that takes them as they are. */
.gp-cmt-line { background: rgba(217, 119, 87, .10); box-shadow: inset 2px 0 0 var(--accent); }
#gp-pill, #gp-card { position: fixed; z-index: 12; }
#gp-pill { padding: 3px 9px; font-size: 11px; color: var(--accent-ink); background: var(--accent); border: none; border-radius: 6px; box-shadow: 0 2px 8px #0008; }
#gp-pill:hover { background: #e28a6c; }
#gp-card { width: 300px; padding: 8px; background: var(--surface); border: 1px solid var(--line-3); border-radius: 10px; box-shadow: 0 4px 16px #000a; }
.gp-card-at { margin-bottom: 6px; font: 11px var(--mono); color: var(--link); }
#gp-card textarea { width: 100%; padding: 5px 8px; font-size: 13px; background: var(--bg); border-radius: 6px; resize: vertical; }
.gp-card-acts { display: flex; justify-content: flex-end; gap: 6px; margin-top: 6px; }

/* the floating composer's corner, clear of the actions bar under it */
#code-foot { position: absolute; right: 16px; bottom: 48px; z-index: 6; }

/* the toast: a reply announcing itself over the diff */
#gp-toast { display: none; position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 5; max-width: min(720px, calc(100% - 40px)); align-items: baseline; gap: 10px; padding: 9px 14px; font-size: 13px; line-height: 1.4; background: var(--hover); border: 1px solid #3e3e3c; border-radius: 12px; box-shadow: 0 6px 24px rgba(0, 0, 0, .4); cursor: pointer; }
#gp-toast.on { display: flex; }
#gp-toast .t-who { color: var(--accent); white-space: nowrap; }
#gp-toast .t-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#gp-toast .t-go { color: var(--fg-dim); white-space: nowrap; }
#gp-toast .t-x { color: var(--fg-faint); padding-left: 4px; }
#gp-toast:hover .t-go { color: var(--fg); }

/* ── path links + the file viewer they open ── */
.pathlink { color: var(--link); text-decoration: underline; text-decoration-color: rgba(127, 168, 216, .45); text-underline-offset: 2px; cursor: pointer; }
.pathlink:hover { text-decoration-color: var(--link); }
/* a drawer off the right edge: the conversation stays in view beside the file
   it was talking about. Slides in; esc or × puts it away. */
/* a modal <dialog> keeps the UA inset:0; margin auto on the left alone pushes
   it to the right edge and the 0 top/bottom margins let it fill the height */
#viewer { inset: 0; margin: 0 0 0 auto; width: min(1100px, 72vw); max-width: none; height: 100dvh; max-height: 100dvh; padding: 0; color: var(--fg); background: var(--bg); border: none; border-left: 1px solid var(--line-3); box-shadow: -12px 0 40px rgba(0, 0, 0, .45); overflow: hidden; }
#viewer.vw-wide { width: min(1600px, 94vw); }
#viewer::backdrop { background: rgba(0, 0, 0, .35); }
#viewer[open] { display: flex; flex-direction: column; animation: slide-in .16s ease-out; }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0 } to { transform: none; opacity: 1 } }
.vw-bar { flex-shrink: 0; display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.vw-path { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 13px var(--mono); color: var(--fg-dim); }
.vw-path b { font-weight: 500; color: var(--fg); }
.vw-repo { color: var(--fg-faint); }
.vw-line { margin-left: 2px; color: var(--accent); }
.vw-lines { flex-shrink: 0; font-size: 12px; color: var(--fg-faint); }
.vw-acts { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-shrink: 0; }
.vw-acts button, .vw-acts .vw-dl { font-size: 12px; padding: 4px 10px; color: var(--fg-dim); border: 1px solid var(--line-2); border-radius: 7px; text-decoration: none; }
.vw-acts button:hover, .vw-acts .vw-dl:hover { color: var(--fg); border-color: #3e3e3c; }
.vw-back { flex-shrink: 0; font-size: 12px; padding: 4px 10px; color: var(--fg-dim); border: 1px solid var(--line-2); border-radius: 7px; }
.vw-back:hover { color: var(--fg); border-color: #3e3e3c; }
.vw-acts .vw-x { font-size: 16px; line-height: 1; padding: 2px 8px; border: none; }
.vw-body { flex: 1; overflow: auto; padding: 16px 0 40vh; color: var(--fg-faint); }
.vw-body-page { display: flex; padding: 0; overflow: hidden; }
.vw-page { flex: 1; border: none; background: #fff; }
.vw-body:focus { outline: none; } /* autofocused so the buttons don't open with a focus ring */
.vw-md { max-width: var(--col); padding: 4px 28px; font-size: 15px; line-height: 1.6; color: var(--fg); }
/* the gutter is a second <pre> beside the code, so the two share one
   line-height; sticky keeps it in place while long lines scroll under it */
.vw-code { position: relative; display: flex; align-items: flex-start; gap: 18px; width: max-content; min-width: 100%; padding: 0 28px 0 0; }
.vw-nums { position: sticky; left: 0; z-index: 2; min-width: 56px; padding: 0 12px 0 20px; font: 13px/1.7 var(--mono); color: var(--fg-faint); text-align: right; white-space: pre; background: var(--bg); user-select: none; }
.vw-text { position: relative; z-index: 1; font: 13px/1.7 var(--mono); color: #c9c7c2; white-space: pre; }
/* the line a link pointed at */
.vw-mark { position: absolute; left: 0; right: 0; z-index: 0; background: rgba(217, 119, 87, .10); box-shadow: inset 3px 0 0 var(--accent); }

/* highlighting — landmarks, not syntax classes: names lead, effects cool, the
   rest recedes. Worn by chat fences, the file viewer and the diff alike. */
.hl { --hl-def: var(--chip-fg); --hl-effect: #8fb3b3; --hl-comment: #7e9c7e; --hl-lit: #c9b07a; --hl-recede: #77756f; }
.hl .hl-def { color: var(--hl-def); }
.hl .hl-effect { color: var(--hl-effect); }
.hl .hl-comment { color: var(--hl-comment); }
.hl .hl-kw, .hl .hl-punct { color: var(--hl-recede); }
.hl .hl-lit { color: var(--hl-lit); }
.hl .hl-type { color: var(--hl-lit); } /* last: an annotation reads as one run, keywords in it included */

/* ── metro preview: a QR a phone camera has to read — dark modules on a white
   card, whatever the page ── */
.qr-overlay { position: fixed; inset: 0; background: #000a; display: flex; align-items: center; justify-content: center; z-index: 50; }
.qr-box { background: #fff; border-radius: 12px; padding: 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.qr-box svg { width: 260px; height: 260px; }
.qr-box code { color: #333; font: 12px var(--mono); }
.qr-hint { color: #777; font-size: 12px; }

/* ── dashboard (/): its own page rather than a pane — no rail, no topbar, one
   centred column. body.dash is set by start() when there is no task in the URL. ── */
#home { display: none; }
body.dash { display: block; overflow-y: auto; }
body.dash #topbar, body.dash #body { display: none; }
body.dash #home { display: block; }
.home-inner { max-width: 880px; margin: 0 auto; padding: 56px 32px 64px; }
.home-hd { display: flex; align-items: center; gap: 16px; margin-bottom: 40px; }
.home-hd h1 { font-size: 24px; letter-spacing: -.3px; }
.home-hd #who { margin-left: auto; }
.learnlink { font-size: 13px; color: var(--fg-faint); text-decoration: none; margin-right: auto; align-self: center; }
.learnlink:hover { color: var(--fg); }
#who, .who { font-size: 12px; color: var(--fg-faint); }
#who a, .who a { color: var(--fg-dim); }
/* one icon, two states: a bell when turn-end pings are on, a struck-through
   bell when they are not — the reason is in the tooltip */
#notif { display: flex; padding: 4px; color: var(--fg-faint); border: none; }
#notif.on { color: var(--ok); }
#notif:hover:not(:disabled) { color: var(--fg); }
.home-secthead { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.home-secthead .primary { margin-left: auto; }
.home-secthead .primary, .home-hd .primary { padding: 7px 14px; border-radius: 9px; }
#taskcount { font-size: 11px; color: var(--fg-faint); }
.tk-sect { margin: 18px 0 8px 4px; font: 600 11px/1 var(--sans); letter-spacing: .6px; text-transform: uppercase; color: var(--fg-faint); }
#tasks { display: flex; flex-direction: column; gap: 6px; }
/* #tokens replaces the task list (host strip, heading, rows) while body.tokens */
#tokens { display: none; }
body.tokens #host, body.tokens .home-secthead:not(#tokens .home-secthead), body.tokens #tasks { display: none; }
body.tokens #tokens { display: block; }
.tok-back { font-size: 13px; color: var(--fg-faint); text-decoration: none; }
.tok-back:hover { color: var(--fg); }
#tok-form { display: flex; gap: 8px; margin-left: auto; }
#tok-form input { padding: 6px 12px; width: 220px; }
.tok-help { font-size: 13px; color: var(--fg-dim); margin: 0 0 16px; }
.tok-help code { font: 12px var(--mono); color: var(--fg); }
#tok-reveal { margin-bottom: 16px; padding: 12px 14px; border: 1px solid var(--line-3); border-radius: 11px; background: var(--surface); }
.tok-reveal-hd { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 13px; color: var(--fg); }
.tok-reveal-hd span { flex: 1; }
.tok-where { margin-top: 8px; font-size: 12px; color: var(--fg-faint); }
.tok-where code { font: 12px var(--mono); color: var(--fg-dim); }
#tok-reveal pre { font: 12px/1.6 var(--mono); color: var(--fg); white-space: pre-wrap; word-break: break-all; margin: 0; }
#tok-list { display: flex; flex-direction: column; gap: 6px; }
.tok { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border: 1px solid var(--line-2); border-radius: 11px; font-size: 13px; }
.tok-name { color: var(--fg); min-width: 120px; }
.tok-user { font: 12px var(--mono); color: var(--fg-dim); }
.tok-meta, .tok-used { font-size: 12px; color: var(--fg-faint); }
.tok-meta { margin-left: auto; }
.tok button { padding: 2px 8px; font-size: 12px; }
.tk-empty { padding: 40px; text-align: center; color: var(--fg-faint); border: 1px dashed var(--line-2); border-radius: 12px; }
/* one row per task: name and branch on the left, state and controls on the
   right — controls take the state/time slot on hover rather than a column of
   their own, so nothing shifts */
body.dash .task { position: relative; display: flex; align-items: center; gap: 12px; padding: 14px 18px; background: var(--surface); border: 1px solid var(--hover); border-radius: 12px; cursor: pointer; transition: border-color .12s, background .12s; }
body.dash .task:hover { background: #242422; border-color: var(--line-3); }
body.dash .task.failed { border-color: #4a2a28; }
.dot { font-size: 9px; }
.dot.running { color: var(--ok); } .dot.stopped { color: var(--fg-faint); }
.dot.creating, .dot.installing { color: var(--warn); } .dot.failed { color: var(--bad); }
.tk-name { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; max-width: 40%; }
.tk-branch { flex: 1; min-width: 0; font: 12px var(--mono); color: var(--fg-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-res { flex-shrink: 0; width: 92px; text-align: right; font-size: 12px; color: var(--fg-faint); font-variant-numeric: tabular-nums; }
.tk-state { flex-shrink: 0; width: 150px; text-align: right; font-size: 12px; color: var(--fg-dim); }
.tk-state.running { color: var(--ok); } .tk-state.creating, .tk-state.installing { color: var(--warn); } .tk-state.failed { color: var(--bad); }
.tk-meta { flex-shrink: 0; width: 68px; text-align: right; font-size: 12px; color: var(--fg-faint); }
.tk-acts { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); display: flex; gap: 6px; opacity: 0; pointer-events: none; transition: opacity .12s; }
.task:hover .tk-acts, .tk-acts:focus-within { opacity: 1; pointer-events: auto; }
.tk-state, .tk-meta, .tk-res { transition: opacity .12s; }
.task:hover .tk-state, .task:hover .tk-meta, .task:hover .tk-res { opacity: 0; }
.tk-acts button { font-size: 12px; background: var(--surface); border-color: var(--line-3); }
.tk-acts button:hover { border-color: #5a5956; }
.tk-acts button.del:hover { color: var(--bad); border-color: #6a3a36; }
/* host meters: one VM runs every task, and the first sign of a full box must
   not be a task dying mid-install */
#host { display: grid; grid-template-columns: repeat(3, 1fr) auto; gap: 8px; align-items: stretch; margin-bottom: 32px; }
.hm { padding: 12px 14px; background: var(--surface); border: 1px solid var(--hover); border-radius: 12px; }
.hm-top { display: flex; align-items: baseline; gap: 8px; }
.hm-lbl { font: 600 11px var(--sans); letter-spacing: .5px; text-transform: uppercase; color: var(--fg-faint); }
.hm-val { margin-left: auto; font-variant-numeric: tabular-nums; }
.hm-val em { font-style: normal; color: var(--fg-faint); }
.hm-bar { height: 4px; border-radius: 2px; background: var(--line-2); margin: 8px 0 6px; overflow: hidden; }
.hm-bar i { display: block; height: 100%; background: var(--ok); transition: width .3s; }
.hm.warn .hm-bar i { background: var(--warn); } .hm.bad .hm-bar i { background: var(--bad); }
.hm-note { font-size: 11px; color: var(--fg-faint); }
.hm.warn .hm-note { color: var(--warn); } .hm.bad .hm-note { color: var(--bad); }
.hm-room { display: flex; align-items: center; padding: 0 14px; font-size: 13px; color: var(--ok); background: var(--surface); border: 1px solid var(--hover); border-radius: 12px; }
.hm-room.warn { color: var(--warn); border-color: #3a3020; }
.hm-room.bad { color: var(--bad); border-color: #4a2a28; }

/* ── new task: one modal ── */
#newtask { width: 440px; max-width: calc(100vw - 32px); padding: 20px; background: var(--surface); color: var(--fg); border: 1px solid var(--line-3); border-radius: 14px; font: inherit; }
#newtask[open] { display: flex; flex-direction: column; gap: 10px; }
#newtask::backdrop { background: rgba(0, 0, 0, .6); }
#newtask h2 { margin: 0 0 2px; font-size: 15px; letter-spacing: 0; text-transform: none; color: var(--fg); }
.nt-row { display: flex; flex-direction: column; gap: 3px; }
.nt-row label { font-size: 12px; color: var(--fg-dim); }
#newtask input:not([type=checkbox]) { width: 100%; background: var(--bg); }
.nt-hint { min-height: 17px; font-size: 12px; color: var(--fg-faint); word-break: break-word; }
.nt-hint.ok { color: var(--ok); } .nt-hint.warn { color: var(--warn); } .nt-hint.bad { color: var(--bad); }
.nt-check { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--fg-dim); cursor: pointer; }
.nt-check input { accent-color: var(--accent); }
.nt-services { display: flex; gap: 6px; padding-top: 2px; font-size: 12px; }
.nt-svc { cursor: pointer; user-select: none; }
.nt-svc .svc-toggle { pointer-events: none; }
.nt-actions { display: flex; gap: 6px; justify-content: flex-end; margin-top: 2px; }
.nt-actions a { text-decoration: none; }
.nt-actions button { padding: 7px 14px; border-radius: 9px; }
#nt-create:not([disabled]), #nt-retry { color: var(--accent-ink); background: var(--accent); border-color: transparent; font-weight: 600; }
.nt-branchline { font: 12px var(--mono); word-break: break-all; }
.nt-phases { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--fg-faint); }
.nt-phases .done { color: var(--ok); } .nt-phases .now { color: var(--warn); } .nt-phases .bad { color: var(--bad); }
.nt-err { max-height: 130px; overflow-y: auto; padding-left: 6px; font: 12px var(--mono); color: var(--bad); white-space: pre-wrap; word-break: break-word; border-left: 2px solid var(--bad); }

/* the private task's "you can't" page: centred, quiet, one way out */
#denied { flex: 1; display: flex; align-items: center; justify-content: center; }
.denied-box { text-align: center; color: var(--fg-dim); display: flex; flex-direction: column; gap: 8px; }
.denied-lock { font-size: 28px; }
.denied-title { font-size: 16px; color: var(--fg); }
.denied-box a { font-size: 12px; margin-top: 10px; }

/* ── quick open (palette.js) ── */
#palette { margin: 12vh auto 0; width: min(640px, 90vw); padding: 0; color: var(--fg); background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 16px 48px rgba(0, 0, 0, .5); overflow: hidden; }
#palette::backdrop { background: rgba(0, 0, 0, .35); }
#pal-input { width: 100%; box-sizing: border-box; padding: 12px 14px; font: 14px var(--mono); color: var(--fg); background: transparent; border: none; border-bottom: 1px solid var(--line-2); outline: none; }
#pal-list { max-height: 50vh; overflow-y: auto; padding: 4px 0; font: 13px var(--mono); }
.pal-row { display: flex; align-items: baseline; padding: 4px 14px; white-space: nowrap; cursor: pointer; }
.pal-row.sel { background: var(--raised); }
.pal-repo { flex: none; color: var(--fg-faint); margin-right: 10px; }
.pal-repo::after { content: '/'; margin-left: 2px; }
.pal-dir { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--fg-dim); }
.pal-row b { flex: none; font-weight: 500; color: var(--fg); }
.pal-st { flex: none; margin-left: auto; padding-left: 12px; font-size: 11px; }
.pal-empty { padding: 10px 14px; color: var(--fg-faint); font: 13px var(--sans); }

/* ── the browser face: a bar, the frame, the composer (browser.js) ── */
#browser { position: relative; flex-direction: column; }
#bw-bar { flex-shrink: 0; display: flex; align-items: center; gap: 6px; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.bw-btn { padding: 3px 8px; border: none; font-size: 14px; color: var(--fg-dim); text-decoration: none; border-radius: 6px; }
.bw-btn:hover { color: var(--fg); background: var(--hover); }
#bw-url { flex: 1; display: flex; align-items: center; min-width: 0; padding: 0 0 0 12px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 9px; font: 12px var(--mono); }
#bw-url:focus-within { border-color: #5a5956; }
#bw-host { color: var(--fg-faint); white-space: nowrap; }
#bw-path { flex: 1; min-width: 0; padding: 5px 12px 5px 0; font: 12px var(--mono); background: transparent; border: none; border-radius: 0; }
#bw-sizes { display: flex; gap: 2px; }
#bw-sizes button { padding: 2px 8px; border: none; font-size: 13px; }
#bw-stage { --bw-w: 100%; flex: 1; min-height: 0; position: relative; display: flex; justify-content: center; background: #0f0f0f; }
#bw-stage iframe { display: none; width: var(--bw-w); height: 100%; border: none; background: #fff; }
#bw-stage iframe.on { display: block; }
#bw-stage.narrow { padding: 16px 0; }
#bw-stage.narrow iframe { border-radius: 14px; box-shadow: 0 0 0 1px var(--line-3), 0 8px 32px #000a; }
#bw-empty { margin: auto; color: var(--fg-faint); align-self: center; }
#bw-foot { position: absolute; right: 16px; bottom: 12px; z-index: 6; }

/* ── /oracle: a list and a chat. On a phone they are two screens and
   body.chat-open flips between them; from 768px they sit side by side. The
   chat reuses the task page's message styles (.msg, .md, .tool-group). ── */
body.oracle { flex-direction: row; height: 100dvh; overflow: hidden; }
body.oracle.booting > aside, body.oracle.booting > main, body.oracle.gated > aside, body.oracle.gated > main { display: none; }
.oracle .or-hd { display: flex; align-items: center; gap: 10px; flex-shrink: 0; height: 52px; padding: 0 16px; padding-top: env(safe-area-inset-top); box-sizing: content-box; border-bottom: 1px solid var(--line); }
.oracle .or-hd h1 { flex: 1; font-size: 17px; }
.oracle .or-hd .primary { padding: 6px 14px; border-radius: 999px; }

#or-list { display: flex; flex-direction: column; width: 100%; min-width: 0; background: var(--bg); }
.or-filter { display: flex; gap: 4px; margin: 12px 16px 6px; padding: 3px; width: fit-content; background: var(--surface); border-radius: 999px; }
.or-filter button { padding: 5px 16px; border: none; border-radius: 999px; font-size: 13px; }
.or-filter button.on { background: var(--raised); color: var(--fg); }
#or-sessions { flex: 1; overflow-y: auto; padding: 4px 8px calc(16px + env(safe-area-inset-bottom)); }
.or-row-s { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 11px 12px; border: none; border-radius: 10px; text-align: left; color: var(--fg); }
.or-row-s:hover { background: var(--hover); color: var(--fg); }
.or-row-s.on { background: var(--raised); }
.or-s-title { font-size: 15px; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.or-s-meta { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--fg-faint); }
.or-s-meta .live { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: breathe 2.4s ease-in-out infinite; }
.or-empty { padding: 28px 12px; color: var(--fg-faint); font-size: 14px; }

#or-chat { display: none; flex-direction: column; flex: 1; min-width: 0; background: var(--bg); }
body.chat-open #or-list { display: none; }
body.chat-open #or-chat { display: flex; }
.or-chat-hd #or-back { padding: 0 10px 2px; font-size: 26px; line-height: 1; border: none; margin-left: -8px; }
#or-title { flex: 1; min-width: 0; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#or-archive { flex: none; padding: 4px 10px; border: none; font-size: 13px; color: var(--fg-dim); }
#or-archive:hover { color: var(--fg); }
/* the column is the task page's width, centred, with a phone's gutter below it */
#or-log { flex: 1; overflow-y: auto; padding: 0 max(16px, calc((100% - var(--col)) / 2)) 24px; overscroll-behavior: contain; }
#or-log.replaying { visibility: hidden; }
#or-log .msg.user { margin-top: 28px; }
#or-log .msg.user .pc-bubble { max-width: 85%; }
#or-log .msg.assistant { margin-top: 18px; }
.or-hello { margin: 30vh auto 0; text-align: center; color: var(--fg-faint); font-size: 15px; line-height: 1.6; }
.or-note { margin-top: 12px; font-size: 12px; color: var(--fg-faint); }
.or-note.err { color: var(--bad); }
#or-status { padding: 6px max(16px, calc((100% - var(--col)) / 2)) 0; font-size: 12px; color: var(--fg-dim); }

#or-foot { flex-shrink: 0; padding: 8px max(12px, calc((100% - var(--col)) / 2)) calc(12px + env(safe-area-inset-bottom)); }
#or-readonly { padding: 12px; text-align: center; font-size: 13px; color: var(--fg-faint); border-top: 1px solid var(--line); }
#or-composer { background: var(--surface); border: 1px solid #383836; border-radius: 20px; }
#or-composer:focus-within { border-color: #5a5956; }
#or-composer.drag { border-color: var(--accent); }
.or-row { display: flex; align-items: flex-end; gap: 4px; padding: 6px; }
/* 16px: iOS zooms the page into any field smaller than that */
#or-input { flex: 1; min-width: 0; padding: 8px 6px; font-size: 16px; line-height: 1.4; border: none; background: transparent; resize: none; max-height: 40vh; }
#or-attach, #or-send, #or-stop { flex-shrink: 0; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border-radius: 50%; }
#or-attach { border: none; }
#or-stop { color: var(--fg); background: var(--raised); border: none; }
#or-atts { display: none; flex-wrap: wrap; gap: 8px; padding: 10px 10px 0; }
#or-atts.on { display: flex; }
.or-att { position: relative; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 10px; overflow: hidden; background: var(--raised); font-size: 11px; color: var(--fg-dim); }
.or-att img { width: 100%; height: 100%; object-fit: cover; }
.or-att.up img { opacity: .4; }
.or-att.err { outline: 1px solid var(--bad); }
.or-att button { position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; padding: 0; font-size: 10px; line-height: 16px; border-radius: 50%; color: #fff; background: rgba(0, 0, 0, .6); border: none; }

@media (min-width: 768px) {
  #or-list { width: 300px; flex-shrink: 0; border-right: 1px solid var(--line); }
  #or-chat, body.chat-open #or-list { display: flex; }
  #or-back { display: none; }
}
