/* gtmux browser mirror. List styled like the app (avatar + status badge, primary/
 * secondary, relative time); colors taken from the user's Ghostty config so the
 * terminal + chrome match (bg #17171a, fg #d4d2cc, selection #2a2a33). Status
 * colors are the authoritative status-language values (semantic, not theme). */
/* bundled monospace set (latin-subset woff2, served from /fonts) so the font
   picker works on any computer; "System" uses ui-monospace (no bytes). */
@font-face { font-family: 'Hack'; font-weight: 400; src: url('fonts/Hack-Regular.woff2') format('woff2'); }
@font-face { font-family: 'Hack'; font-weight: 700; src: url('fonts/Hack-Bold.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 400; src: url('fonts/JetBrainsMono-Regular.woff2') format('woff2'); }
@font-face { font-family: 'Fira Code'; font-weight: 400; src: url('fonts/FiraCode-Regular.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 400; src: url('fonts/IBMPlexMono-Regular.woff2') format('woff2'); }

:root {
  --bg: #17171a;          /* ghostty background */
  --surface: #222228;
  --fg: #d4d2cc;          /* ghostty foreground */
  --fg2: rgba(212, 210, 204, 0.62);
  --fg3: rgba(212, 210, 204, 0.34);
  --divider: rgba(255, 255, 255, 0.07);
  --sel: #2a2a33;         /* ghostty selection-background */
  --waiting: #EF4444;
  --working: #06B6D4;
  --idle: #22C55E;
  --running: #8E8E93;
  --amber: #F59E0B;       /* connection "reconnecting" dot */
  --waiting-tint: rgba(239, 68, 68, 0.08);
  --col: 820px;           /* centered content column on wide screens */
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }  /* beat #gate's display:flex when hidden */
html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--fg);
  font: 14px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body { display: flex; flex-direction: column; }

/* header — full-width border, content centered to the column */
#bar { border-bottom: 1px solid var(--divider); background: var(--bg); flex: 0 0 auto; }
.bar-inner {
  display: flex; align-items: center; gap: 10px;
  max-width: var(--col); margin: 0 auto; width: 100%; padding: 11px 16px;
}
#bar #title { font-weight: 600; }
#bar #sub { color: var(--fg3); font-size: 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* connection indicator: server name + status dot (no "live" text). 3 states. */
#bar .conn { margin-left: auto; }
.conn { font-size: 12px; color: var(--fg3); flex: 0 0 auto; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn::before { content: "● "; color: var(--running); }
.conn.live::before  { color: var(--idle); }
.conn.retry::before { color: var(--amber); }
.conn.off::before   { color: var(--waiting); }
#back {
  background: none; border: none; color: var(--fg2);
  font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px;
}

section { flex: 1 1 auto; min-height: 0; overflow: auto; }

/* gate (pairing / errors) */
#gate { display: flex; align-items: center; justify-content: center; }
.gate-box { text-align: center; color: var(--fg2); max-width: 460px; padding: 24px; line-height: 1.5; }
.gate-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--running); margin: 0 auto 14px; }

/* radar — centered column */
#radar { max-width: var(--col); margin: 0 auto; width: 100%; padding: 6px 0 40px; }
.group-label {
  padding: 16px 16px 6px; font-size: 11px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--fg3);
}
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; cursor: pointer;
  border-bottom: 1px solid var(--divider); position: relative;
}
.row:hover { background: rgba(255, 255, 255, 0.03); }
.row.waiting { background: var(--waiting-tint); }
/* desktop keyboard selection (j/k · Enter) */
.row.kbd-sel { background: rgba(255, 255, 255, 0.08); box-shadow: inset 2px 0 0 var(--working); }

/* avatar (rounded square) + status badge, like the app */
.avatar {
  position: relative; width: 34px; height: 34px; flex: 0 0 auto;
  border-radius: 9px; background: var(--surface);
  border: 1px solid var(--divider); overflow: visible;
  display: flex; align-items: center; justify-content: center;
}
.avatar img { width: 100%; height: 100%; border-radius: 9px; object-fit: contain; }
.avatar .mono { font: 600 14px Menlo, monospace; color: var(--fg2); }
.avatar .badge { position: absolute; right: -3px; bottom: -3px; width: 14px; height: 14px; }
.avatar .badge svg { display: block; }

.row .text { flex: 1 1 auto; min-width: 0; }
.row .primary {
  font-size: 15px; font-weight: 600; color: var(--fg);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.row .secondary {
  font-size: 12.5px; color: var(--fg3); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.row .secondary .task { color: var(--fg2); }
.row .right { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; color: var(--fg3); }
.row .time { font-size: 12px; font-variant-numeric: tabular-nums; }
.row .agent { font-size: 12px; color: var(--fg3); }
.row .chev { font-size: 18px; font-weight: 300; }

/* pane (terminal) — Ghostty background; terminal fills full width */
#pane { padding: 0; background: var(--bg); position: relative; }
#term { position: absolute; inset: 49px 0 0 0; padding: 8px 10px; background: var(--bg); }
.xterm { height: 100%; }

/* settings (font + size) */
#gear {
  background: none; border: none; color: var(--fg3); cursor: pointer;
  font-size: 16px; line-height: 1; padding: 0 2px; flex: 0 0 auto;
}
#gear:hover { color: var(--fg); }
#settings {
  position: absolute; top: 46px; right: 12px; z-index: 50;
  background: var(--surface); border: 1px solid var(--divider); border-radius: 10px;
  padding: 10px 12px; min-width: 220px; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
#settings .srow { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
#settings label { color: var(--fg3); font-size: 12px; width: 44px; flex: 0 0 auto; }
#settings select {
  flex: 1 1 auto; background: var(--bg); color: var(--fg);
  border: 1px solid var(--divider); border-radius: 6px; padding: 5px 6px; font-size: 13px;
}
#settings input[type=range] { flex: 1 1 auto; accent-color: var(--working); }
#settings .sz { color: var(--fg2); font-size: 12px; width: 30px; text-align: right; font-variant-numeric: tabular-nums; }

/* pane-view tab switcher (对话 / 终端) */
#mode { display: inline-flex; border: 1px solid var(--divider); border-radius: 8px; overflow: hidden; flex: 0 0 auto; }
#mode button { background: none; border: none; color: var(--fg3); font-size: 12px; padding: 4px 11px; cursor: pointer; }
#mode button + button { border-left: 1px solid var(--divider); }
#mode button.on { background: var(--surface); color: var(--fg); }
#mode button:hover:not(.on) { color: var(--fg2); }

/* chat (对话 mode) — dark bubbles, mirrors the phone's ChatView */
#chat { background: var(--bg); display: flex; overflow: hidden; position: relative; }

/* branded loading placeholder (gtmux mark + pulse) — over a pane/chat/tile until
   its first frame, so opening a session reads as "loading", not a black screen. */
.brandload {
  position: absolute; inset: 0; z-index: 6;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 13px;
  background: var(--bg);
}
.brandload-mark { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 4px; width: 38px; height: 38px; }
.brandload-mark > i { background: rgba(255, 255, 255, 0.16); border-radius: 5px; }
.brandload-mark > i.lit { background: var(--working); animation: brandload-pulse 1.1s ease-in-out infinite; }
.brandload-mark > i.wide { grid-column: span 2; }
.brandload-label { font-size: 12.5px; color: var(--fg3); letter-spacing: 0.02em; }
@keyframes brandload-pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
.conv-scroll { flex: 1 1 auto; min-width: 0; height: 100%; overflow-y: auto; }
.chat-col { max-width: var(--col); margin: 0 auto; width: 100%; padding: 14px 16px 56px; }
.chat-state { display: flex; align-items: center; gap: 10px; padding: 2px 2px 16px; }
.chat-state .avatar { width: 30px; height: 30px; }
.cs-text { min-width: 0; }
.cs-name { font-size: 14px; font-weight: 600; color: var(--fg); }
.cs-status { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.cs-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.cs-status span:last-child { font-size: 12px; color: var(--fg3); }
.chat-empty { color: var(--fg3); font-size: 13px; line-height: 1.55; padding: 28px 10px; text-align: center; max-width: 460px; margin: 0 auto; }
.cturn { margin-bottom: 18px; }
.urow { display: flex; justify-content: flex-end; align-items: flex-start; gap: 9px; margin-bottom: 8px; }
.user-avatar { width: 26px; height: 26px; flex: 0 0 auto; }
.user-avatar svg { display: block; }
.ububble {
  max-width: 82%; background: rgba(6, 182, 212, 0.16); color: var(--fg);
  border: 1px solid rgba(6, 182, 212, 0.30); border-radius: 12px;
  padding: 8px 11px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
}
.steps-toggle { background: none; border: none; color: var(--fg3); font-size: 12px; cursor: pointer; padding: 2px 0; margin: 0 0 6px; }
.steps-toggle:hover { color: var(--fg2); }
.step-row { display: flex; gap: 8px; padding: 2px 0 2px 12px; font-size: 12.5px; min-width: 0; }
.step-name { color: var(--fg2); font-family: Menlo, monospace; flex: 0 0 auto; }
.step-detail { color: var(--fg3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.arow { display: flex; gap: 10px; align-items: flex-start; }
.arow .avatar { width: 26px; height: 26px; margin-top: 2px; }
.abubble {
  flex: 1 1 auto; min-width: 0; background: var(--surface);
  border: 1px solid var(--divider); border-radius: 12px; padding: 10px 13px;
}
/* keeps a follow-up reply bubble aligned with the first when its avatar is omitted */
.arow-spacer { width: 26px; flex: 0 0 26px; }

/* ── §03 wide chat: turn outline rail + hover actions + approval card ── */
.turn-rail {
  flex: 0 0 196px; width: 196px; border-right: 1px solid var(--divider);
  display: flex; flex-direction: column; min-height: 0; background: var(--bg);
}
.to-head { padding: 16px 14px 8px; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--fg3); }
.to-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0 6px; }
.to-item {
  display: flex; gap: 8px; align-items: baseline; width: 100%; text-align: left;
  background: none; border: none; color: var(--fg2); cursor: pointer;
  padding: 6px 8px; border-radius: 7px; font-size: 12.5px; line-height: 1.35;
}
.to-item:hover { background: var(--surface); }
.to-item.on { background: var(--surface); color: var(--fg); }
.to-item.on .to-n { color: var(--working); }
.to-n { flex: 0 0 auto; color: var(--fg3); font-variant-numeric: tabular-nums; font-size: 11px; }
.to-tx { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.to-foot { padding: 8px 14px 12px; font-size: 11px; color: var(--fg3); border-top: 1px solid var(--divider); }

/* hover floating copy / quote on an agent bubble (desktop pointer only) */
.abubble { position: relative; }
.bub-act {
  position: absolute; top: 6px; right: 6px; display: flex; gap: 4px;
  opacity: 0; transition: opacity .12s; pointer-events: none;
}
.arow:hover .bub-act { opacity: 1; pointer-events: auto; }
.bub-act button {
  background: var(--bg); border: 1px solid var(--divider); color: var(--fg2);
  font-size: 11px; padding: 2px 7px; border-radius: 6px; cursor: pointer; line-height: 1.5;
}
.bub-act button:hover { color: var(--fg); border-color: var(--fg3); }
@media (pointer: coarse) { .bub-act { display: none; } }

/* waiting approval card — read-only mirror of the agent's 1/2/3 */
.appr-card {
  margin: 6px 0 8px 36px; border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 12px; background: rgba(239, 68, 68, 0.06); overflow: hidden;
}
.appr-head {
  display: flex; align-items: center; gap: 8px; padding: 9px 13px;
  font-size: 13px; font-weight: 600; color: var(--fg);
  border-bottom: 1px solid rgba(239, 68, 68, 0.22);
}
.appr-dot { width: 9px; height: 9px; border-radius: 2px; background: var(--waiting); flex: 0 0 auto; }
.appr-opt { display: flex; align-items: center; gap: 10px; padding: 9px 13px; font-size: 14px; color: var(--fg); }
.appr-opt + .appr-opt { border-top: 1px solid var(--divider); }
.appr-key {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 6px;
  background: var(--surface); border: 1px solid var(--divider);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: var(--fg2); font-variant-numeric: tabular-nums;
}
.appr-label { min-width: 0; }
.appr-empty { padding: 12px 13px; font-size: 13px; color: var(--fg3); }
.appr-hint { padding: 8px 13px; font-size: 11.5px; color: var(--fg3); background: var(--surface); }

/* markdown inside the agent bubble */
.md { color: var(--fg); font-size: 14px; line-height: 1.6; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md-p { margin: 0 0 8px; word-break: break-word; }
.md-h { font-weight: 700; margin: 12px 0 6px; line-height: 1.3; color: var(--fg); }
.md-h1 { font-size: 19px; } .md-h2 { font-size: 17px; } .md-h3 { font-size: 15px; }
.md-h4, .md-h5, .md-h6 { font-size: 14px; }
.md-list { margin: 0 0 8px; padding-left: 20px; }
.md-list li { margin: 2px 0; }
.md-q { margin: 0 0 8px; padding: 2px 0 2px 10px; border-left: 3px solid var(--divider); color: var(--fg2); }
.md-ic { font-family: Menlo, monospace; font-size: 12.5px; background: rgba(255, 255, 255, 0.08); border-radius: 4px; padding: 1px 4px; }
.md-pre { background: rgba(255, 255, 255, 0.06); border: 1px solid var(--divider); border-radius: 8px; padding: 10px 12px; overflow-x: auto; margin: 0 0 8px; }
.md-pre code { font-family: Menlo, monospace; font-size: 12.5px; color: #E6F7FB; white-space: pre; }
.md a { color: var(--working); text-decoration: none; }
.md a:hover { text-decoration: underline; }
.md-tablewrap { overflow-x: auto; margin: 0 0 8px; }
.md-table { border-collapse: collapse; font-size: 13px; }
.md-table th, .md-table td { border: 1px solid var(--divider); padding: 5px 9px; }
.md-table th { background: rgba(255, 255, 255, 0.05); font-weight: 700; }
.md hr { border: none; border-top: 1px solid var(--divider); margin: 10px 0; }

/* ============================================================================
 * Desktop workbench (WEB.md §1–§3): a session tree rail + a freeform board of
 * concurrent pane mirrors. Wide screens only; <900px keeps the single column.
 * ========================================================================== */
#workbench { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow: hidden; }

/* top bar */
#wb-bar { display: flex; align-items: center; gap: 12px; padding: 9px 14px; background: var(--bg); border-bottom: 1px solid var(--divider); flex: 0 0 auto; }
.wb-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--fg); font-size: 14px; }
.wb-mark { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 1.5px; width: 15px; height: 15px; }
.wb-mark > i { background: rgba(255,255,255,0.4); border-radius: 2px; }
.wb-mark > i.lit { background: var(--working); } /* top-right lit = focused pane */
.wb-mark > i.wide { grid-column: span 2; }
.wb-toggle { display: flex; align-items: center; gap: 6px; background: rgba(255,255,255,0.06); border: none; border-radius: 7px; padding: 5px 11px; font-size: 12px; color: var(--fg2); cursor: pointer; }
.wb-toggle.on { color: var(--fg); }
.wb-sw { width: 24px; height: 14px; border-radius: 7px; background: rgba(255,255,255,0.16); position: relative; flex: 0 0 auto; transition: background .15s; }
.wb-sw::after { content: ""; position: absolute; left: 1px; top: 1px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: left .15s; }
.wb-toggle.on .wb-sw { background: var(--working); }
.wb-toggle.on .wb-sw::after { left: 11px; }
.wb-spacer { flex: 1 1 auto; }
#wb-bar #wb-gear { background: none; border: none; color: var(--fg3); cursor: pointer; font-size: 14px; }
#wb-bar #wb-gear:hover { color: var(--fg); }
.wb-toggle:hover { color: var(--fg); }
#wb-preset-cur { color: var(--working); }

/* layout-presets dropdown */
#wb-preset-wrap { position: relative; display: inline-flex; }
#wb-preset-menu {
  position: absolute; top: 32px; left: 0; z-index: 60; min-width: 200px;
  background: var(--surface); border: 1px solid var(--divider); border-radius: 10px;
  padding: 5px; box-shadow: 0 10px 28px rgba(0,0,0,0.45);
}
.pm-row { display: flex; align-items: center; border-radius: 6px; }
.pm-row.on { background: rgba(255,255,255,0.06); }
.pm-row:hover { background: rgba(255,255,255,0.08); }
.pm-name { flex: 1 1 auto; padding: 7px 9px; font-size: 13px; color: var(--fg); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-row.on .pm-name { color: var(--working); }
.pm-del { background: none; border: none; color: var(--fg3); cursor: pointer; font-size: 14px; padding: 0 9px; }
.pm-del:hover { color: var(--waiting); }
.pm-empty { padding: 8px 9px; font-size: 12px; color: var(--fg3); }
.pm-save { margin-top: 4px; border-top: 1px solid var(--divider); padding: 8px 9px; font-size: 12.5px; color: var(--fg2); cursor: pointer; border-radius: 0 0 6px 6px; }
.pm-save:hover { color: var(--fg); background: rgba(255,255,255,0.05); }

/* tile auto-surface flash (a one-time attention pulse) */
.tile.flash { animation: tile-flash 1.6s ease-out 1; }
@keyframes tile-flash {
  0% { box-shadow: 0 10px 30px rgba(0,0,0,0.4), 0 0 0 4px rgba(6,182,212,0.55); }
  100% { box-shadow: 0 10px 30px rgba(0,0,0,0.4), 0 0 0 0 rgba(6,182,212,0); }
}

/* ⌘K command palette */
#cmdk { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,0.45); display: flex; justify-content: center; align-items: flex-start; }
#cmdk-box { margin-top: 12vh; width: 540px; max-width: 92vw; background: var(--surface); border: 1px solid var(--divider); border-radius: 13px; box-shadow: 0 24px 64px rgba(0,0,0,0.55); overflow: hidden; }
#cmdk-input { width: 100%; box-sizing: border-box; background: none; border: none; outline: none; color: var(--fg); font-size: 15px; padding: 15px 17px; border-bottom: 1px solid var(--divider); }
#cmdk-input::placeholder { color: var(--fg3); }
#cmdk-list { max-height: 50vh; overflow-y: auto; padding: 5px; }
.ck-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.ck-row.on { background: rgba(255,255,255,0.08); }
.ck-tx { flex: 1 1 auto; min-width: 0; }
.ck-nm { font-size: 13.5px; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ck-sb { font-size: 11.5px; color: var(--fg3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.ck-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.ck-empty { padding: 14px 12px; font-size: 13px; color: var(--fg3); text-align: center; }

#wb-body { flex: 1 1 auto; display: flex; min-height: 0; position: relative; background: var(--bg); }

/* left rail — session/window/pane tree */
#rail { flex: 0 0 auto; width: 232px; border-right: 1px solid var(--divider); display: flex; flex-direction: column; position: relative; min-height: 0; }
#workbench.rail-collapsed #rail { display: none; }
#rail-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; }
.rail-title { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--fg3); }
.rail-spacer { flex: 1 1 auto; }
#rail-search { width: 90px; background: var(--surface); border: 1px solid var(--divider); border-radius: 6px; color: var(--fg); font-size: 11.5px; padding: 3px 7px; }
#rail-collapse { background: none; border: none; color: var(--fg2); font-size: 13px; cursor: pointer; }
#tree { flex: 1 1 auto; overflow-y: auto; min-height: 0; padding-bottom: 8px; }
.rail-hint { padding: 10px 14px; font-size: 10.5px; color: var(--fg3); line-height: 1.4; }
#rail-resize { position: absolute; right: -3px; top: 0; bottom: 0; width: 7px; cursor: col-resize; display: flex; align-items: center; justify-content: center; z-index: 6; }
#rail-resize span { width: 2px; height: 34px; border-radius: 1px; background: rgba(255,255,255,0.14); }

/* tree groups + rows */
.tree-group { padding: 10px 14px 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--fg3); }
.tree-group.waiting { color: var(--waiting); }
.tree-win { display: flex; align-items: center; gap: 7px; padding: 5px 12px 3px 14px; font-size: 11px; color: var(--fg3); font-family: Menlo, monospace; }
.tree-row { display: flex; align-items: center; gap: 9px; padding: 6px 12px 6px 14px; cursor: grab; }
.tree-row.nested { padding-left: 26px; }
.tree-row:hover { background: rgba(255,255,255,0.04); }
.tree-row.waiting { background: var(--waiting-tint); border-left: 2px solid var(--waiting); }
.tree-row .tr-text { flex: 1 1 auto; min-width: 0; }
.tree-row .tr-name { font-size: 12.5px; font-weight: 600; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-row .tr-sub { font-size: 10.5px; color: var(--fg3); font-family: Menlo, monospace; }
.tree-row .tr-grip { font-size: 12px; color: var(--fg3); opacity: .5; }

/* collapsed-rail reopen tab */
#rail-tab { position: absolute; left: 0; top: 14px; z-index: 7; display: flex; align-items: center; gap: 5px; background: var(--surface); border: 1px solid var(--divider); border-left: none; border-radius: 0 8px 8px 0; padding: 6px 9px 6px 7px; color: var(--fg2); font-size: 12px; cursor: pointer; }
#rail-tab #rail-tab-n { font-size: 10px; font-weight: 700; color: var(--waiting); }

/* board */
#board { flex: 1 1 auto; position: relative; min-width: 0; overflow: hidden; background-image: radial-gradient(rgba(255,255,255,0.04) 1px, transparent 1px); background-size: 22px 22px; }
#board.snap { background-size: 20px 20px; }
.board-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--fg3); font-size: 13px; text-align: center; padding: 24px; pointer-events: none; }

/* tile */
.tile { position: absolute; display: flex; flex-direction: column; border-radius: 10px; background: #17171a; border: 1px solid var(--divider); overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.4); }
.tile.waiting { border-color: rgba(239,68,68,0.45); animation: tile-pulse 2.4s ease-in-out infinite; }
@keyframes tile-pulse { 0%,100% { box-shadow: 0 10px 30px rgba(0,0,0,0.4), 0 0 0 0 rgba(239,68,68,0); } 50% { box-shadow: 0 10px 30px rgba(0,0,0,0.4), 0 0 0 3px rgba(239,68,68,0.26); } }
.tile.focused { z-index: 50; }
.tile-head { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-bottom: 1px solid var(--divider); cursor: move; flex: 0 0 auto; }
.tile.waiting .tile-head { background: var(--waiting-tint); }
.tile-head .avatar { width: 20px; height: 20px; border-radius: 5px; }
.tile-head .avatar .mono { font-size: 8px; }
.tile-name { font-size: 12px; font-weight: 600; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }
.tile-id { font-size: 10.5px; color: var(--fg3); font-family: Menlo, monospace; }
.tile-head .th-spacer { flex: 1 1 auto; }
.tile-modes { display: inline-flex; gap: 1px; background: rgba(255,255,255,0.06); border-radius: 5px; padding: 2px; }
.tile-modes button { background: none; border: none; color: var(--fg3); font-size: 10px; padding: 2px 7px; border-radius: 3px; cursor: pointer; }
.tile-modes button.on { background: rgba(255,255,255,0.14); color: #fff; }
.tile-btn { background: none; border: none; color: var(--fg3); font-size: 12px; cursor: pointer; padding: 0 2px; }
.tile-btn:hover { color: var(--fg); }
.tile-body { flex: 1 1 auto; min-height: 0; position: relative; overflow: hidden; }
.tile-body .xt { position: absolute; inset: 0; padding: 6px 8px; }
.tile-body .tile-chat { position: absolute; inset: 0; overflow: auto; padding: 4px 0; }
.tile-body .tile-diff { position: absolute; inset: 0; overflow: auto; margin: 0; padding: 10px 12px; font-family: Menlo, monospace; font-size: 11.5px; line-height: 1.5; white-space: pre; color: var(--fg2); }
.tile-body .tile-diff .add { color: var(--idle); }
.tile-body .tile-diff .del { color: var(--waiting); }
.tile-resize { position: absolute; right: 1px; bottom: 1px; width: 16px; height: 16px; cursor: nwse-resize; color: var(--fg3); font-size: 11px; line-height: 16px; text-align: right; opacity: .5; }
.tile-offline { position: absolute; inset: 0; background: rgba(13,13,15,0.5); }

/* show/hide single-column vs workbench is driven by JS toggling [hidden]. */

/* ---- focus pane (§02) enrichments: toolbar + jump pill + read-only reply bar -- */
#focus-nav, #focus-ctl { display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto; }
#focus-nav button, #focus-ctl button {
  background: rgba(255,255,255,0.06); border: none; border-radius: 6px;
  color: var(--fg2); font-size: 12px; padding: 4px 9px; cursor: pointer; line-height: 1;
}
#focus-nav button:hover, #focus-ctl button:hover { color: var(--fg); background: rgba(255,255,255,0.12); }

#jump {
  position: absolute; right: 18px; bottom: 18px; z-index: 20;
  display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 12px;
  border: none; border-radius: 14px; background: var(--working); color: #fff;
  font-size: 12px; font-weight: 600; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,0.45);
}
#jump .jdot { width: 6px; height: 6px; border-radius: 50%; background: #fff; }
#pane.has-reply #jump { bottom: 60px; }

#reply-bar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 15;
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  border-top: 1px solid var(--divider); background: var(--waiting-tint);
  font-size: 11.5px; color: var(--fg2);
}
#pane.has-reply #term { bottom: 44px; }
.rb-lead { color: var(--fg2); }
.rb-opts { display: inline-flex; gap: 6px; }
.rb-opts .rb-opt { font-size: 11px; color: var(--fg3); border: 1px solid var(--divider); border-radius: 6px; padding: 4px 10px; cursor: not-allowed; }
.rb-hint { color: var(--fg3); }
.rb-spacer { flex: 1 1 auto; }
.rb-size { color: var(--fg3); font-family: Menlo, monospace; }

/* ---- board: single-click maximize a tile to fill the board (§05) ---------- */
#board.maximized .tile:not(.max) { opacity: 0; pointer-events: none; }
.tile.max { left: 8px !important; top: 8px !important; }
.tile.max .tile-resize { display: none; }
.tile.max .tile-head { cursor: default; }
.max-exit {
  position: absolute; left: 14px; top: 14px; z-index: 60;
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--surface); border: 1px solid var(--divider); border-radius: 8px;
  padding: 5px 11px; color: var(--fg2); font-size: 12px; cursor: pointer;
}
