/* Agent Intercom control panel prototype. Light mode only. */

@font-face { font-family: "Atkinson Next"; src: url("fonts/AtkinsonHyperlegibleNext.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Atkinson Mono"; src: url("fonts/AtkinsonHyperlegibleMono.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Source Serif"; src: url("fonts/SourceSerif4.woff2") format("woff2"); font-weight: 200 900; font-display: swap; }

:root {
  color-scheme: light only;
  /* Neutrals: warm, close to the Claude desktop app */
  --bg: #F6F4EF;
  --surface: #FFFFFF;
  --transcript: #FBFAF7;
  --sunk: #EFECE4;
  --bubble: #EDEAE2;
  --ink: #23211D;
  --ink-2: #514D45;
  --ink-3: #6A655B;          /* 5.4:1 on white */
  --line: #E1DDD3;
  --line-strong: #CFC9BC;
  /* Runtime identity */
  --claude: #B06A1A;         /* fill and band only */
  --claude-ink: #85500F;     /* text on light */
  --claude-tint: #F6EBDD;
  --codex: #0E7A6F;
  --codex-ink: #0B665D;
  --codex-tint: #DDF0EC;
  /* States */
  --attention: #B4235A;
  --attention-tint: #F8E3EB;
  --working: #2C64C9;
  --working-tint: #E2EAF8;
  --ok: #2F7D3B;
  --ok-tint: #E3F1E4;
  --error: #B3261E;
  --error-tint: #F9E4E2;
  /* Type */
  --ui: "Atkinson Next", -apple-system, "Segoe UI", system-ui, sans-serif;
  --prose: "Source Serif", "Iowan Old Style", Georgia, serif;
  --mono: "Atkinson Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --r-s: 6px;
  --r-m: 10px;
  --r-l: 16px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.45 var(--ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--working); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Layout ---------- */
.app {
  display: grid;
  height: 100dvh;
  grid-template-columns: 300px minmax(0, 1fr) 320px;
  padding-left: var(--safe-l);
  padding-right: var(--safe-r);
}
.sidebar { border-right: 1px solid var(--line); overflow-y: auto; padding: calc(12px + var(--safe-t)) 0 24px; background: var(--bg); }
.main { min-width: 0; display: flex; flex-direction: column; background: var(--transcript); height: 100dvh; }
.details { border-left: 1px solid var(--line); overflow-y: auto; background: var(--surface); padding-top: var(--safe-t); }
.tabbar { display: none; }
.scrim { position: fixed; inset: 0; background: rgb(35 33 29 / 0.28); z-index: 30; }

/* iPad and narrow desktop: details become a slide-over */
@media (max-width: 1199px) {
  .app { grid-template-columns: 290px minmax(0, 1fr); }
  .details {
    position: fixed; top: 0; right: 0; bottom: 0; width: min(360px, 92vw);
    transform: translateX(105%); transition: transform .22s ease; z-index: 40;
    box-shadow: -12px 0 32px rgb(35 33 29 / 0.12);
    padding-bottom: var(--safe-b);
  }
  body.details-open .details { transform: none; }
}

/* iPhone: one screen at a time, tab bar at the bottom */
@media (max-width: 767px) {
  .app { grid-template-columns: minmax(0, 1fr); padding: 0; }
  .sidebar { display: none; }
  .main { height: 100dvh; padding-bottom: calc(58px + var(--safe-b)); }
  body.in-agent .main { padding-bottom: 0; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: rgb(246 244 239 / 0.94); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    padding: 6px 8px calc(6px + var(--safe-b));
  }
  body.in-agent .tabbar { display: none; }
  .details { width: 100vw; }
}

/* ---------- Sidebar ---------- */
.side-head { display: flex; align-items: center; gap: 10px; padding: 4px 16px 12px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.brand-mark { width: 26px; height: 26px; }
.side-head .spacer { flex: 1; }
.session-chip {
  margin: 0 16px 12px; padding: 8px 10px; border-radius: var(--r-m); background: var(--surface);
  border: 1px solid var(--line); font-size: 13px; color: var(--ink-2); display: flex; gap: 8px; align-items: center;
}
.session-chip b { color: var(--ink); font-weight: 600; }
.session-chip.low { border-color: var(--attention); background: var(--attention-tint); }
.session-chip button { margin-left: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 16px; border: 0; background: none; text-align: left; font-size: 15px; color: var(--ink);
  min-height: 40px;
}
.nav-item:hover { background: var(--sunk); }
.nav-item[aria-current="page"] { background: var(--surface); box-shadow: inset 3px 0 0 var(--ink); font-weight: 600; }
.nav-item .count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--attention); color: #fff; font-size: 12.5px; font-weight: 700; display: grid; place-items: center; }
.side-group { margin-top: 18px; }
.side-label { display: flex; align-items: center; justify-content: space-between; padding: 0 16px 6px; font-size: 13px; color: var(--ink-3); font-weight: 600; }
.side-label button { border: 0; background: none; color: var(--ink-2); font-size: 13px; padding: 2px 4px; }
.device-line { display: flex; align-items: center; gap: 8px; padding: 10px 16px 4px; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.device-line .os { font-weight: 400; color: var(--ink-3); }
.device-line.offline { color: var(--ink-3); }

/* ---------- Agent row ---------- */
.agent-row {
  position: relative; display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; column-gap: 10px; row-gap: 2px;
  width: 100%; padding: 9px 16px 9px 20px; border: 0; background: none; text-align: left; align-items: center;
  min-height: 52px;
}
.agent-row::before { content: ""; position: absolute; left: 8px; top: 10px; bottom: 10px; width: 3px; border-radius: 2px; background: var(--rt); }
.agent-row:hover { background: var(--sunk); }
.agent-row[aria-current="page"] { background: var(--surface); }
.agent-row .state { grid-row: 1 / span 2; }
.agent-row .name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-row .meta { grid-column: 2; font-size: 12.5px; color: var(--ink-3); display: flex; gap: 8px; align-items: center; min-width: 0; white-space: nowrap; overflow: hidden; }
.agent-row .end { grid-row: 1 / span 2; grid-column: 3; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.rt-claude { --rt: var(--claude); --rt-ink: var(--claude-ink); --rt-tint: var(--claude-tint); }
.rt-codex { --rt: var(--codex); --rt-ink: var(--codex-ink); --rt-tint: var(--codex-tint); }

/* Runtime badge: mark + name, never colour alone */
.rt-badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 11px; background: var(--rt-tint); color: var(--rt-ink); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.rt-badge .mk { font-family: var(--mono); font-weight: 600; }
.rt-badge.small { height: 18px; padding: 0 6px; font-size: 11.5px; }

/* State marks: shape + colour */
.state { width: 14px; height: 14px; display: inline-block; border-radius: 50%; flex: none; }
.state.working { background: var(--working); box-shadow: 0 0 0 0 rgb(44 100 201 / 0.5); animation: pulse 1.8s infinite; }
.state.idle { border: 2px solid var(--ink-3); }
.state.waiting { border: 2px solid var(--attention); background: linear-gradient(90deg, var(--attention) 50%, transparent 50%); }
.state.offline { border: 2px dashed var(--line-strong); }
.state.starting { border: 2px solid var(--working); border-right-color: transparent; animation: spin 0.9s linear infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgb(44 100 201 / 0.45); } 70% { box-shadow: 0 0 0 7px rgb(44 100 201 / 0); } 100% { box-shadow: 0 0 0 0 rgb(44 100 201 / 0); } }
@keyframes spin { to { transform: rotate(360deg); } }
.state-word { font-size: 12.5px; color: var(--ink-3); }
.state-word.waiting { color: var(--attention); font-weight: 600; }
.state-word.working { color: var(--working); }

/* Effort meter: labelled segments */
.effort { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.effort .seg { display: inline-flex; gap: 2px; }
.effort .seg i { width: 7px; height: 9px; border-radius: 2px; background: var(--line-strong); }
.effort .seg i.on { background: var(--ink-2); }
.effort.lg .seg i { width: 14px; height: 10px; }

.lock { font-size: 12px; color: var(--ink-3); }

/* ---------- Main header ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px; padding: calc(12px + var(--safe-t)) 20px 12px;
  border-bottom: 1px solid var(--line); background: var(--bg); min-height: 60px; flex: none;
}
.topbar h1 { font-size: 19px; line-height: 1.2; margin: 0; font-weight: 700; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .sub { font-size: 13px; color: var(--ink-3); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 3px; }
.topbar .titles { min-width: 0; flex: 1; }
.topbar .actions { display: flex; gap: 8px; flex: none; }
.back { display: none; border: 0; background: none; padding: 6px 4px; font-size: 16px; color: var(--working); font-weight: 600; }
@media (max-width: 767px) {
  .back { display: inline-flex; }
  .topbar { padding-left: 12px; padding-right: 12px; }
  .topbar h1 { font-size: 17px; }
  .hide-phone { display: none !important; }
}
@media (min-width: 1200px) { .details-toggle { display: none !important; } }
@media (min-width: 1200px) { body:not(.agent-route) .app { grid-template-columns: 300px minmax(0, 1fr); } body:not(.agent-route) .details { display: none; } }

.agent-tabs { display: flex; gap: 4px; padding: 8px 20px 0; border-bottom: 1px solid var(--line); background: var(--bg); flex: none; }
.agent-tabs button { border: 0; background: none; padding: 9px 12px 11px; font-size: 14.5px; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.agent-tabs button[aria-selected="true"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }
.agent-tabs button[aria-disabled="true"] { color: var(--ink-3); }
@media (min-width: 1200px) { .agent-tabs .tab-details { display: none; } }
@media (max-width: 767px) { .agent-tabs { padding: 4px 8px 0; } .agent-tabs button { flex: 1; } }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: var(--r-m); border: 1px solid var(--line-strong); background: var(--surface); font-size: 14.5px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #3A372F; }
.btn.danger { color: var(--error); }
.btn.attention { background: var(--attention); border-color: var(--attention); color: #fff; }
.btn.ghost { border-color: transparent; background: none; }
.btn.small { min-height: 30px; padding: 0 10px; font-size: 13.5px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.icon-btn { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: var(--r-m); border: 1px solid var(--line-strong); background: var(--surface); font-size: 18px; line-height: 1; }

/* ---------- Transcript (Claude desktop style) ---------- */
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.transcript { max-width: 760px; margin: 0 auto; padding: 24px 24px 32px; }
@media (max-width: 767px) { .transcript { padding: 16px 14px 24px; } }
.msg-user { display: flex; flex-direction: column; align-items: flex-end; margin: 22px 0 18px; }
.msg-user .bubble { max-width: 85%; background: var(--bubble); border-radius: 18px; padding: 10px 15px; font-size: 15.5px; white-space: pre-wrap; }
.msg-user .who { font-size: 12.5px; color: var(--ink-3); margin-bottom: 5px; display: flex; gap: 8px; align-items: center; }
.signed { color: var(--ok); font-weight: 600; }
.msg-text { font-family: var(--prose); font-size: 17px; line-height: 1.6; margin: 12px 0; color: var(--ink); }
.msg-text p { margin: 0 0 12px; }
.msg-text p:last-child { margin-bottom: 0; }
.msg-text code, .inline-code { font-family: var(--mono); font-size: 0.82em; background: var(--sunk); padding: 1px 5px; border-radius: 4px; }
.caret { display: inline-block; width: 8px; height: 1.05em; vertical-align: -2px; background: var(--ink); margin-left: 2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.disclosure { margin: 8px 0; }
.disclosure > summary { list-style: none; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--ink-2); font-size: 14px; padding: 5px 0; min-height: 32px; }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary .chev { transition: transform .15s; display: inline-block; color: var(--ink-3); }
.disclosure[open] > summary .chev { transform: rotate(90deg); }
.thinking-body { border-left: 2px solid var(--line-strong); padding: 4px 0 4px 14px; margin: 4px 0 8px 4px; color: var(--ink-2); font-family: var(--prose); font-size: 15.5px; line-height: 1.55; font-style: italic; }

.tool-group { margin: 10px 0; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); }
.tool-group > summary { padding: 8px 12px; width: 100%; display: flex; }
.tool-group[open] > summary { border-bottom: 1px solid var(--line); }
.tool { border-top: 1px solid var(--line); }
.tool:first-of-type { border-top: 0; }
.tool > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; font-size: 14px; min-height: 40px; }
.tool > summary::-webkit-details-marker { display: none; }
.tool .ico { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; background: var(--sunk); font-size: 12px; flex: none; color: var(--ink-2); font-family: var(--mono); }
.tool .label { color: var(--ink-2); flex: none; }
.tool .target { font-family: var(--mono); font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.tool .dur { font-size: 12.5px; color: var(--ink-3); flex: none; }
.tool .st-run { width: 12px; height: 12px; border: 2px solid var(--working); border-right-color: transparent; border-radius: 50%; animation: spin .9s linear infinite; flex: none; }
.tool .st-err { color: var(--error); font-weight: 700; font-size: 12.5px; }
.tool-out { margin: 0; padding: 10px 12px 12px 44px; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; color: var(--ink-2); background: var(--transcript); border-top: 1px dashed var(--line); max-height: 280px; overflow: auto; }
@media (max-width: 767px) { .tool-out { padding-left: 12px; } }

.diff { margin: 10px 0; border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; background: var(--surface); }
.diff-head { display: flex; gap: 10px; align-items: center; padding: 8px 12px; font-size: 13.5px; border-bottom: 1px solid var(--line); }
.diff-head .file { font-family: var(--mono); font-size: 13px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.diff-head .add { color: var(--ok); font-weight: 600; }
.diff-head .rem { color: var(--error); font-weight: 600; }
.diff-body { overflow-x: auto; font-family: var(--mono); font-size: 12.5px; line-height: 1.55; touch-action: pan-x pan-y; }
.diff-line { white-space: pre; padding: 0 12px; min-width: max-content; }
.diff-line.add { background: var(--ok-tint); }
.diff-line.rem { background: var(--error-tint); }
.diff-line .sign { display: inline-block; width: 16px; color: var(--ink-3); }

.todo { margin: 12px 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); }
.todo h4 { margin: 0 0 6px; font-size: 13.5px; color: var(--ink-2); font-weight: 600; }
.todo ul { list-style: none; padding: 0; margin: 0; }
.todo li { display: flex; gap: 10px; align-items: baseline; padding: 3px 0; font-size: 14.5px; }
.todo li .box { width: 14px; height: 14px; border: 1.5px solid var(--ink-3); border-radius: 4px; flex: none; transform: translateY(2px); display: grid; place-items: center; font-size: 10px; }
.todo li.done { color: var(--ink-3); text-decoration: line-through; }
.todo li.done .box { background: var(--ink-3); color: #fff; border-color: var(--ink-3); }
.todo li.active { font-weight: 600; }
.todo li.active .box { border-color: var(--working); box-shadow: inset 0 0 0 3px var(--surface); background: var(--working); }

.subagent { margin: 10px 0; border: 1px solid var(--line); border-left: 3px solid var(--rt, var(--ink-3)); border-radius: var(--r-m); background: var(--surface); }
.subagent > summary { padding: 9px 12px; }
.subagent .inner { padding: 0 14px 10px; border-top: 1px solid var(--line); }
.subagent .inner .msg-text { font-size: 15.5px; }

.event { display: flex; gap: 10px; align-items: center; margin: 16px 0; color: var(--ink-3); font-size: 13px; }
.event::before, .event::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.event span { max-width: 80%; text-align: center; }
.callout { margin: 14px 0; padding: 10px 14px; border-radius: var(--r-m); font-size: 14.5px; }
.callout.error { background: var(--error-tint); color: #7A1A14; }
.callout.system { background: var(--sunk); color: var(--ink-2); }

.question { margin: 16px 0; padding: 14px 16px; border-radius: var(--r-l); background: var(--surface); border: 1.5px solid var(--attention); }
.question .q-head { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--attention); font-weight: 700; margin-bottom: 6px; }
.question .q-text { font-size: 16px; margin: 0 0 10px; }
.question .cmd { font-family: var(--mono); font-size: 13px; background: var(--sunk); border-radius: var(--r-s); padding: 8px 10px; margin: 0 0 12px; word-break: break-all; }
.question .opts { display: flex; flex-wrap: wrap; gap: 8px; }
.question .free { display: flex; gap: 8px; margin-top: 10px; }
.question .free input { flex: 1; min-width: 0; height: 38px; border: 1px solid var(--line-strong); border-radius: var(--r-m); padding: 0 12px; font-size: 16px; background: var(--surface); }
.question.answered { border-color: var(--line); }
.question.answered .q-head { color: var(--ink-3); }
.answered-line { font-size: 14px; color: var(--ink-2); }
.answered-line b { color: var(--ink); }

.working-line { display: flex; align-items: center; gap: 10px; color: var(--working); font-size: 14px; margin: 14px 0 4px; }
.working-line .dots i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--working); margin-right: 3px; animation: dot 1.2s infinite; }
.working-line .dots i:nth-child(2) { animation-delay: .15s; }
.working-line .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* ---------- Composer ---------- */
.composer { flex: none; border-top: 1px solid var(--line); background: var(--bg); padding: 10px 16px calc(10px + var(--safe-b)); }
.composer-inner { max-width: 760px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-l); padding: 8px 10px 8px 14px; }
.composer textarea { width: 100%; border: 0; resize: none; outline: none; background: none; font-size: 16px; line-height: 1.4; min-height: 24px; max-height: 160px; padding: 4px 0; }
.composer .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.composer .row .grow { flex: 1; }
.composer select { height: 30px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); padding: 0 6px; font-size: 13.5px; color: var(--ink-2); }
.composer .hint { max-width: 760px; margin: 6px auto 0; font-size: 12.5px; color: var(--ink-3); }
.composer.disabled .composer-inner { background: var(--sunk); }
.send { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 17px; }
.send[disabled] { background: var(--line-strong); }

/* ---------- Terminal (light) ---------- */
.term-wrap { flex: 1; display: flex; flex-direction: column; min-height: 0; background: var(--transcript); }
.term-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--bg); font-size: 13.5px; }
.term-bar .where { font-family: var(--mono); color: var(--ink-2); }
.term-bar .grow { flex: 1; }
.seg-ctl { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-m); overflow: hidden; }
.seg-ctl button { border: 0; background: var(--surface); padding: 6px 12px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); min-height: 32px; }
.seg-ctl button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.term-timer { font-variant-numeric: tabular-nums; color: var(--attention); font-weight: 600; }
.term {
  flex: 1; overflow: auto; margin: 12px; padding: 12px 14px; border-radius: var(--r-m);
  background: #FFFFFF; border: 1px solid var(--line-strong);
  font-family: var(--mono); font-size: 13px; line-height: 1.5; color: #1F1E1A; white-space: pre;
}
.term .dim { color: #807A6E; }
.term .bold { font-weight: 600; }
.term .green { color: #1E7A2E; }
.term .red { color: #B3261E; }
.term .yellow { color: #8A5A00; }
.term .blue { color: #1F57B8; }
.term .magenta { color: #9A3D86; }
.term .cursor { background: #1F1E1A; color: #fff; }
.term-status { margin: 0 12px 12px; padding: 4px 10px; border-radius: var(--r-s); background: var(--sunk); font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); display: flex; gap: 14px; overflow-x: auto; white-space: nowrap; }
.term-status .cur { color: var(--ink); font-weight: 600; }
.term-input { display: flex; gap: 8px; padding: 0 12px 10px; }
.term-input input { flex: 1; min-width: 0; height: 40px; border: 1px solid var(--line-strong); border-radius: var(--r-m); padding: 0 12px; font-family: var(--mono); font-size: 16px; background: var(--surface); }
.keybar { display: flex; gap: 6px; overflow-x: auto; padding: 0 12px calc(10px + var(--safe-b)); }
.keybar button { flex: none; min-width: 44px; height: 36px; border-radius: var(--r-s); border: 1px solid var(--line-strong); background: var(--surface); font-family: var(--mono); font-size: 13.5px; }
.keybar button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.term-note { margin: 0 12px 10px; padding: 9px 12px; border-radius: var(--r-m); font-size: 13.5px; background: var(--attention-tint); color: #7D1640; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.term-note.info { background: var(--sunk); color: var(--ink-2); }

/* ---------- Panels, lists, cards ---------- */
.page { max-width: 820px; margin: 0 auto; padding: 18px 20px 40px; }
@media (max-width: 767px) { .page { padding: 12px 12px 32px; } }
.page h2 { font-size: 15px; color: var(--ink-2); margin: 22px 0 8px; font-weight: 600; }
.page h2:first-child { margin-top: 4px; }
.empty { padding: 40px 20px; text-align: center; color: var(--ink-2); }
.empty b { display: block; font-size: 17px; color: var(--ink); margin-bottom: 6px; }

.inbox-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 14px 16px; margin-bottom: 12px; }
.inbox-card .ic-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.inbox-card .ic-head .name { font-weight: 700; }
.inbox-card .ic-head .where { color: var(--ink-3); font-size: 13px; }
.inbox-card .ic-head .time { margin-left: auto; color: var(--ink-3); font-size: 13px; }
.inbox-card .context { border-left: 2px solid var(--line-strong); padding-left: 12px; margin: 0 0 10px; color: var(--ink-2); font-size: 14px; }
.inbox-card .context p { margin: 0 0 4px; }
.inbox-card .context .ctx-tool { font-family: var(--mono); font-size: 12.5px; color: var(--ink-3); }
.inbox-card .question { margin: 0; }
.inbox-card .open-link { margin-top: 10px; }

.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; }
.list .agent-row { border-top: 1px solid var(--line); }
.list .agent-row:first-child { border-top: 0; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; min-height: 56px; }
.list-row:first-child { border-top: 0; }
.list-row .main-col { flex: 1; min-width: 0; }
.list-row .t { font-weight: 600; }
.list-row .s { font-size: 13.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .r { font-size: 13px; color: var(--ink-3); }
.hash { font-family: var(--mono); color: var(--ink-3); font-weight: 600; }

.kv { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 8px 12px; font-size: 14px; margin: 0; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.kv .mono { font-family: var(--mono); font-size: 13px; }
.det-section { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.det-section h3 { margin: 0 0 10px; font-size: 13.5px; color: var(--ink-2); font-weight: 600; }
.det-head { padding: 18px; border-bottom: 1px solid var(--line); }
.det-head .name-line { display: flex; align-items: center; gap: 10px; }
.det-head h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.det-head .addr { font-family: var(--mono); font-size: 13px; color: var(--ink-3); margin-top: 4px; }
.det-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ctx-bar { height: 6px; border-radius: 3px; background: var(--sunk); overflow: hidden; margin-top: 6px; }
.ctx-bar i { display: block; height: 100%; background: var(--ink-2); }
.ctx-bar.high i { background: var(--attention); }
.det-close { display: none; }
@media (max-width: 1199px) { .det-close { display: inline-grid; margin-left: auto; } }

.chat-msg { margin: 14px 0; }
.chat-msg .who { font-size: 13px; color: var(--ink-3); margin-bottom: 3px; display: flex; gap: 8px; }
.chat-msg .who b { color: var(--ink); }
.chat-msg .txt { font-family: var(--prose); font-size: 16.5px; line-height: 1.55; }
.chat-msg.mine { text-align: right; }
.chat-msg.mine .who { justify-content: flex-end; }
.chat-msg.mine .txt { display: inline-block; text-align: left; background: var(--bubble); border-radius: 18px; padding: 9px 14px; font-family: var(--ui); font-size: 15.5px; }
.peer-flag { font-size: 12px; color: var(--ink-3); border: 1px solid var(--line-strong); border-radius: 9px; padding: 0 6px; }

/* ---------- Tab bar (phone) ---------- */
.tabbar button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11.5px; color: var(--ink-3); padding: 4px 0; position: relative; min-height: 46px; }
.tabbar button .ti { font-size: 20px; line-height: 1; }
.tabbar button[aria-current="page"] { color: var(--ink); font-weight: 700; }
.tabbar .badge { position: absolute; top: 0; left: calc(50% + 6px); min-width: 18px; height: 18px; border-radius: 9px; background: var(--attention); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 5px; }

/* ---------- Sheet / dialog ---------- */
.sheet { border: 0; padding: 0; border-radius: var(--r-l); width: min(560px, 94vw); max-height: 90dvh; background: var(--surface); color: var(--ink); box-shadow: 0 24px 64px rgb(35 33 29 / 0.25); }
.sheet::backdrop { background: rgb(35 33 29 / 0.32); }
.sheet form { display: flex; flex-direction: column; max-height: 90dvh; }
.sheet .sh-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px 12px; border-bottom: 1px solid var(--line); }
.sheet .sh-head h2 { margin: 0; font-size: 18px; flex: 1; }
.sheet .sh-body { padding: 16px 20px; overflow-y: auto; }
.sheet .sh-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 20px calc(14px + var(--safe-b)); border-top: 1px solid var(--line); background: var(--bg); }
@media (max-width: 767px) {
  .sheet { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 18px 18px 0 0; max-height: 92dvh; }
  .sheet form { max-height: 92dvh; }
  .sheet .sh-foot .btn { flex: 1; min-height: 46px; }
}
.field { margin-bottom: 16px; }
.field > label, .field > .lbl { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field input[type="text"], .field select, .field textarea { width: 100%; min-height: 42px; border: 1px solid var(--line-strong); border-radius: var(--r-m); padding: 8px 12px; font-size: 16px; background: var(--surface); }
.field textarea { min-height: 76px; resize: vertical; }
.field .help { font-size: 13px; color: var(--ink-3); margin-top: 5px; }
.field .err { font-size: 13px; color: var(--error); margin-top: 5px; font-weight: 600; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice label { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-m); cursor: pointer; min-height: 48px; }
.choice input { accent-color: var(--ink); }
.choice label:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.choice label.disabled { opacity: .5; cursor: not-allowed; }
.choice .c-sub { font-size: 12.5px; color: var(--ink-3); display: block; }
.effort-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.effort-pick label { flex: 1; min-width: 64px; text-align: center; border: 1px solid var(--line-strong); border-radius: var(--r-m); padding: 8px 4px 6px; cursor: pointer; font-size: 13px; }
.effort-pick label:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); font-weight: 600; }
.effort-pick input { position: absolute; opacity: 0; pointer-events: none; }
.effort-pick .seg { display: flex; gap: 2px; justify-content: center; margin-bottom: 5px; }
.effort-pick .seg i { width: 8px; height: 8px; border-radius: 2px; background: var(--line-strong); }
.effort-pick .seg i.on { background: var(--ink-2); }
.summary-box { background: var(--sunk); border-radius: var(--r-m); padding: 12px 14px; font-size: 14px; }
.carry { list-style: none; padding: 0; margin: 8px 0 0; font-size: 14px; }
.carry li { padding: 3px 0 3px 22px; position: relative; }
.carry li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 700; }
.carry li.chg::before { content: "→"; color: var(--working); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; }
.check input { margin-top: 3px; accent-color: var(--ink); width: 18px; height: 18px; }

/* Face ID confirmation */
.faceid { text-align: center; padding: 8px 4px 4px; }
.faceid .glyph { width: 64px; height: 64px; margin: 4px auto 12px; border-radius: 16px; border: 2px solid var(--ink); display: grid; place-items: center; font-size: 30px; }
.faceid.scanning .glyph { animation: scan 1s ease-in-out infinite alternate; }
.faceid.done .glyph { border-color: var(--ok); color: var(--ok); }
@keyframes scan { from { box-shadow: 0 0 0 0 rgb(35 33 29 / 0.25); } to { box-shadow: 0 0 0 8px rgb(35 33 29 / 0); } }
.faceid .what { text-align: left; margin-top: 12px; }

/* Toast */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + var(--safe-b)); z-index: 60; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--r-m); font-size: 14.5px; max-width: 92vw; box-shadow: 0 8px 24px rgb(35 33 29 / 0.25); }
@media (max-width: 767px) { body:not(.in-agent) .toast { bottom: calc(72px + var(--safe-b)); } }

/* Onboarding */
.onboard { max-width: 460px; margin: 0 auto; padding: 32px 20px; }
.onboard ol { padding-left: 20px; }
.onboard li { margin-bottom: 14px; }
.onboard .step-state { font-size: 13px; color: var(--ok); font-weight: 600; }

/* Search & audit */
.search-box { display: flex; gap: 8px; margin-bottom: 8px; }
.search-box input { flex: 1; height: 44px; border: 1px solid var(--line-strong); border-radius: var(--r-m); padding: 0 14px; font-size: 16px; background: var(--surface); }
.hit mark { background: #F5E2A8; color: inherit; border-radius: 3px; padding: 0 2px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; }
.table th, .table td { text-align: left; padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--ink-3); font-weight: 600; font-size: 13px; border-top: 0; background: var(--bg); }
@media (max-width: 767px) { .table .hide-phone { display: none; } }
.viewer-switch { display: flex; gap: 8px; align-items: center; font-size: 13.5px; color: var(--ink-2); padding: 8px 16px; }
.viewer-switch select { border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); padding: 4px 6px; }

/* ---------- Usage windows ---------- */
.usage { display: grid; gap: 12px; }
.usage-row .u-top { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--ink-2); }
.usage-row .u-top b { color: var(--ink); font-weight: 600; }
.u-bar { position: relative; height: 8px; border-radius: 4px; background: var(--sunk); margin: 5px 0 4px; overflow: hidden; }
.u-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; }
.u-bar .u-total { background: var(--line-strong); }
.u-bar .u-share { background: var(--rt, var(--ink-2)); }
.usage-row:not(:has(.u-share)) .u-total { background: var(--ink-2); }
.usage-row.high .u-top b { color: var(--attention); }
.usage-row.high:not(:has(.u-share)) .u-total { background: var(--attention); }
.usage-row.high .u-total { background: var(--attention-tint); }
.u-sub { font-size: 12.5px; color: var(--ink-3); }
.u-acc { font-size: 12.5px; color: var(--ink-3); }
.usage-chip { font-size: 12.5px; color: var(--ink-2); border: 1px solid var(--line); border-radius: 10px; padding: 0 7px; white-space: nowrap; }
.usage-chip.high { color: var(--attention); border-color: var(--attention); font-weight: 600; }
.usage-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 16px; margin-bottom: 16px; }
.usage-card .uc-head { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.usage-card h2 { margin-top: 16px; }
.share-bar { width: 80px; height: 6px; border-radius: 3px; background: var(--sunk); overflow: hidden; flex: none; }
.share-bar i { display: block; height: 100%; background: var(--rt, var(--ink-2)); }

/* ---------- Reviews and media ---------- */
.review { margin: 16px 0; padding: 14px 16px; border-radius: var(--r-l); background: var(--surface); border: 1.5px solid var(--working); }
.review .q-head { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--working); font-weight: 700; margin-bottom: 6px; }
.review .q-text { margin: 0 0 4px; font-size: 16px; }
.review .r-note { margin: 0 0 12px; color: var(--ink-2); font-size: 14.5px; }
.review .opts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.review.approved, .review.changes { border-color: var(--line); }
.review.approved .q-head { color: var(--ok); }
.review.changes .q-head { color: var(--attention); }
.m-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.m-grid.big { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.m-tile { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 0; border: 0; background: none; text-align: left; }
.m-tile img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: var(--r-m); border: 1px solid var(--line); background: var(--sunk); display: block; }
.m-tile .m-cap { font-size: 13.5px; font-weight: 600; }
.m-tile .m-sub { font-size: 12.5px; color: var(--ink-3); margin-top: -4px; }
.m-tag { position: absolute; top: 8px; left: 8px; background: var(--codex); color: #fff; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 9px; }
.v-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; margin-top: 10px; background: var(--surface); }
.v-row { display: flex; gap: 12px; align-items: center; padding: 8px 10px; border: 0; border-top: 1px solid var(--line); background: none; text-align: left; width: 100%; min-height: 64px; }
.v-row:first-child { border-top: 0; }
.v-row:hover { background: var(--sunk); }
.v-thumb { position: relative; flex: none; width: 128px; height: 72px; border-radius: var(--r-s); overflow: hidden; background: var(--sunk); }
.v-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.v-play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 20px; text-shadow: 0 1px 6px rgb(0 0 0 / .6); }
.v-dur { position: absolute; right: 4px; bottom: 4px; background: rgb(35 33 29 / .82); color: #fff; font-size: 11.5px; padding: 0 5px; border-radius: 4px; font-variant-numeric: tabular-nums; }
.v-meta { display: flex; flex-direction: column; min-width: 0; }
.v-meta .t { font-weight: 600; font-size: 14.5px; }
.v-meta .s { font-size: 12.5px; color: var(--ink-3); }
@media (max-width: 767px) { .v-thumb { width: 104px; height: 58px; } }
.sheet.wide { width: min(1100px, 96vw); }
.viewer .v-full { width: 100%; max-height: 70dvh; object-fit: contain; border-radius: var(--r-m); background: var(--sunk); display: block; }
.viewer .v-info { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--ink-3); margin-top: 8px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 4px; }
.filters select { height: 34px; border: 1px solid var(--line-strong); border-radius: var(--r-m); background: var(--surface); padding: 0 8px; font-size: 14px; }
.inbox-card .review { margin: 0; }
@media (max-width: 767px) { .m-grid, .m-grid.big { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Sharing ---------- */
.grants { list-style: none; padding: 0; margin: 0 0 10px; }
.grants li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.share-note { font-size: 14px; margin: 0; color: var(--ink-2); }
.choice.one { grid-template-columns: 1fr; }
.nr-tag { font-size: 11.5px; font-weight: 700; color: var(--ink-2); background: var(--sunk); border-radius: 9px; padding: 1px 8px; }

/* Pager in the media viewer: count centred between the arrows */
.sheet .sh-foot { align-items: center; }
.pager { display: inline-flex; align-items: center; gap: 4px; }
.pager .btn { width: 34px; padding: 0; font-size: 18px; }
.pager-count { min-width: 56px; text-align: center; font-size: 13.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.device-line .dev-chat { margin-left: auto; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 12px; padding: 1px 9px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.device-line .dev-chat[aria-current="page"] { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Clicked rows inside cards: no focus frame on mouse click, an inset one for keyboard */
summary:focus:not(:focus-visible) { outline: none; }
.tool > summary:focus-visible, .tool-group > summary:focus-visible, .disclosure > summary:focus-visible { outline: 2px solid var(--working); outline-offset: -2px; border-radius: 0; }
.tool > summary:hover, .tool-group > summary:hover { background: var(--transcript); }

/* ---------- Code windows: dark, syntax highlighted (the app itself stays light) ---------- */
:root { --code-bg: #16181D; --code-bg-2: #1D2027; --code-ink: #E6E8EB; --code-dim: #8B929C; --code-line: #2A2E36; }
.hljs { background: transparent !important; color: var(--code-ink); }
.code-win { background: var(--code-bg); border-top: 1px solid var(--line); position: relative; }
pre.code { margin: 0; padding: 10px 14px; font-family: var(--mono); font-size: 12.5px; line-height: 1.55; color: var(--code-ink); background: var(--code-bg); white-space: pre-wrap; word-break: break-word; max-height: 300px; overflow: auto; }
pre.code.out { color: #C9CED6; border-top: 1px solid var(--code-line); background: var(--code-bg-2); }
pre.code .prompt { color: #7EE787; user-select: none; }
.code-lang { position: absolute; top: 6px; right: 10px; font-family: var(--mono); font-size: 11.5px; color: var(--code-dim); }
.code-lang.inline { position: static; margin-left: auto; }
.tool-out { display: none; }
.question pre.code.cmd { border-radius: var(--r-s); margin: 0 0 12px; max-height: 160px; }

.diff { border-color: var(--code-line); }
.diff-head { background: var(--surface); }
.diff-body { background: var(--code-bg); color: var(--code-ink); font-size: 12.5px; }
.diff-line { padding: 0 12px 0 0; display: flex; }
.diff-line .ln { width: 38px; flex: none; text-align: right; padding-right: 8px; color: #5D6470; user-select: none; }
.diff-line .sign { width: 18px; flex: none; color: var(--code-dim); text-align: center; }
.diff-line .src { white-space: pre; }
.diff-line.add { background: rgb(46 160 67 / 0.16); }
.diff-line.add .sign { color: #7EE787; }
.diff-line.rem { background: rgb(248 81 73 / 0.16); }
.diff-line.rem .sign { color: #FF7B72; }

/* Terminal pane: dark like the code windows */
.term { background: var(--code-bg); color: var(--code-ink); border-color: var(--code-line); }
.term .dim { color: #8B929C; }
.term .green { color: #7EE787; }
.term .red { color: #FF7B72; }
.term .yellow { color: #E3B341; }
.term .blue { color: #79C0FF; }
.term .magenta { color: #D2A8FF; }
.term .cursor { background: var(--code-ink); color: var(--code-bg); }
.term-status { background: #23262E; color: #C9CED6; }
.term-status .cur { color: #FFFFFF; }
.page h2.dev-h { display: flex; align-items: center; gap: 8px; }
.page h2.dev-h .dev-chat { margin-left: auto; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 12px; padding: 2px 10px; font-size: 13px; font-weight: 600; color: var(--ink-2); min-height: 30px; }

/* ---------- Subagents ---------- */
.sub-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; background: var(--surface); }
.sub-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 0; border-top: 1px solid var(--line); background: none; text-align: left; width: 100%; min-height: 48px; }
.sub-row:first-child { border-top: 0; }
.sub-row:hover { background: var(--sunk); }
.sub-row .sub-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sub-row .s { font-size: 12.5px; color: var(--ink-3); }
.sub-row .sub-main .s { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page .sub-list { margin-bottom: 8px; }
a.crumb { color: var(--working); font-weight: 600; text-decoration: none; }

/* ---------- Reordering devices and agents ---------- */
.tree-head { margin-top: 18px; }
.tree-head button { border: 1px solid var(--line-strong) !important; background: var(--surface) !important; border-radius: 12px; padding: 1px 10px !important; font-weight: 600; }
.ro-dev.on { border-radius: var(--r-m); }
.ro-dev.on .device-line, .ro-dev.on h2.dev-h { cursor: grab; }
.ro-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 16px; min-height: 46px; background: var(--surface); border-top: 1px solid var(--line); cursor: grab; position: relative; }
.sidebar .ro-row { margin: 0 8px; border: 1px solid var(--line); border-radius: var(--r-s); margin-bottom: 4px; }
.ro-row::before { content: ""; position: absolute; left: 6px; top: 10px; bottom: 10px; width: 3px; border-radius: 2px; background: var(--rt); }
.ro-row .name { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grip { color: var(--ink-3); font-size: 16px; line-height: 1; }
.ro-arrows { display: inline-flex; gap: 4px; margin-left: auto; }
.device-line .ro-arrows, h2.dev-h .ro-arrows { margin-left: auto; }
.ro-arrows button { width: 32px; height: 32px; border: 1px solid var(--line-strong); border-radius: var(--r-s); background: var(--surface); font-size: 15px; }
.ro-arrows button[disabled] { opacity: .35; }
.dragging { opacity: .45; }
.drop-before { box-shadow: inset 0 3px 0 var(--working); }
.drop-after { box-shadow: inset 0 -3px 0 var(--working); }

/* ---------- Approval risk, key-code check ---------- */
.risk { font-size: 12px; font-weight: 700; border-radius: 9px; padding: 1px 8px; }
.risk.harmless { background: var(--ok-tint); color: var(--ok); }
.risk.risky { background: var(--attention-tint); color: var(--attention); }
.question .why { font-size: 13px; color: var(--ink-3); margin: -2px 0 8px; }
.fp-box { border: 1.5px solid var(--attention); border-radius: var(--r-m); padding: 12px 14px; font-size: 14px; }
.fp-box p { margin: 6px 0 10px; color: var(--ink-2); }
.fp-code { font-family: var(--mono); font-size: 20px; letter-spacing: .06em; margin-top: 8px; font-weight: 600; }

/* ---------- Round 3: hand-off, autopilot unlock, renew ---------- */
.handoff { display: flex; gap: 18px; align-items: center; justify-content: center; margin-bottom: 12px; }
.handoff .qr svg { fill: var(--ink); background: #fff; padding: 6px; border: 1px solid var(--line); border-radius: var(--r-s); }
.code-match { display: flex; flex-direction: column; text-align: left; }
.code-match b { font-family: var(--mono); font-size: 26px; letter-spacing: .08em; }
.composer.bypass { padding-top: 12px; }
.bypass-box { max-width: 760px; margin: 0 auto; display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 14px; border: 1.5px solid var(--attention); border-radius: var(--r-l); background: var(--attention-tint); color: #5E1230; font-size: 14.5px; }
.soon { margin-left: 8px; font-size: 12px; font-weight: 700; color: var(--attention); }
.fp-code { font-size: 16px; }

/* ---------- Image markup ---------- */
.mk-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.mk-color { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--surface); background: var(--c); box-shadow: 0 0 0 1px var(--line-strong); }
.mk-color[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ink); }
.mk-tools [data-w][aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.mk-sep { width: 1px; height: 24px; background: var(--line); }
.mk-stage { background: var(--sunk); border-radius: var(--r-m); padding: 8px; display: flex; justify-content: center; }
#mk-canvas { max-width: 100%; max-height: 58dvh; touch-action: none; cursor: crosshair; border-radius: var(--r-s); background: #fff; }
.markup-thumb { border: 1px solid var(--line); border-radius: var(--r-m); padding: 0; background: none; margin-bottom: 6px; overflow: hidden; }
.markup-thumb img { display: block; max-width: 260px; max-height: 180px; }
.update-card { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 12px 16px; margin-bottom: 12px; font-size: 14.5px; color: var(--ink-2); }
.update-card b { color: var(--ink); }

/* Approval command: dark shell line like the other code windows (overrides the old light .cmd box) */
.question pre.code.cmd { background: var(--code-bg); color: var(--code-ink); padding: 10px 14px; font-size: 13px; word-break: break-word; white-space: pre-wrap; }
.question pre.code.cmd::before { content: "$ "; color: #7EE787; }
