/* FTP Real Estate · Workshop — one dark theme: warm near-black, deep green and gold */
:root {
  /* Brand */
  --green: #0E4D3B;        /* header, user bubbles */
  --green-2: #146E52;      /* filled buttons (white text ≥ 5:1) */
  --green-3: #187B5C;      /* filled button hover */
  --green-ink: #7ED3AE;    /* green text / links on dark */
  --green-soft: #12261F;
  --green-line: #22493B;
  --gold: #C5A04A;
  --gold-ink: #E2C57E;     /* gold text on dark */
  --gold-soft: #1F1B12;
  --gold-line: #4A3E22;
  /* Neutrals */
  --bg: #0F1412;
  --surface: #151B18;
  --panel: #151B18;
  --panel-2: #1B2320;
  --line: #26302C;
  --line-2: #34413B;
  --text: #E8ECE9;
  --dim: #BCC6C1;
  --faint: #9AA6A0;
  /* Status */
  --ok: #4CC38A;
  --warn: #E2B54E;
  --danger: #F07167;
  --danger-ink: #FFA198;
  --danger-soft: #2A1615;
  --danger-line: #5C2A27;
  --code-bg: #0B100E;
  --mono: ui-monospace, "JetBrains Mono", SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow: hidden; }
html { scrollbar-color: var(--line-2) transparent; }
::selection { background: rgba(197,160,74,.35); color: #fff; }
[hidden] { display: none !important; }
button { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 5px 10px; cursor: pointer; }
button:hover { border-color: var(--gold); }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
a { color: var(--green-ink); }
.muted, .dim { color: var(--faint); }
.spacer { flex: 1; }
.gold { color: var(--gold-ink); }
code { font-family: var(--mono); font-size: .9em; }

/* Login + picker */
.login { max-width: 340px; margin: 14vh auto 0; padding: 0 16px; display: flex; flex-direction: column; gap: 10px; text-align: center; }
.login-logo { display: block; margin: 0 auto 4px; border-radius: 14px; box-shadow: 0 6px 22px rgba(0,0,0,.55), 0 0 0 1px rgba(197,160,74,.35); }
.login h1, .picker-card h1 { font-size: 20px; margin: 0; color: var(--text); letter-spacing: .01em; }
.login-sub { margin: 0 0 6px; color: var(--faint); font-size: 14px; }
.login input { font: inherit; font-size: 16px; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); }
.login input::placeholder { color: var(--faint); }
.login input:focus { outline: 2px solid rgba(197,160,74,.45); outline-offset: 0; border-color: var(--gold); }
.login button { padding: 11px; background: var(--green-2); border-color: var(--green-2); color: #fff; font-weight: 600; border-radius: 10px; }
.login button:hover { background: var(--green-3); border-color: var(--gold); }
.error { color: var(--danger-ink); min-height: 1.4em; margin: 0; }
.picker { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: radial-gradient(1200px 600px at 50% -10%, rgba(197,160,74,.10), transparent), radial-gradient(900px 500px at 50% 110%, rgba(14,77,59,.35), transparent), var(--bg); overflow: auto; }
.picker-card { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--gold); border-radius: 18px; padding: 22px 18px 18px; box-shadow: 0 18px 48px rgba(0,0,0,.5); text-align: center; }
.picker-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.pick { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 18px 10px 14px; border-radius: 14px; border: 1.5px solid var(--line-2); background: var(--panel-2); color: var(--text); text-decoration: none; transition: transform .08s, border-color .15s, box-shadow .15s; }
.pick:hover, .pick:focus-visible { border-color: var(--gold); box-shadow: 0 6px 18px rgba(197,160,74,.18); transform: translateY(-1px); outline: none; }
.pick-name { font-size: 20px; font-weight: 700; color: var(--gold-ink); }
.pick-sub { font-size: 12.5px; color: var(--faint); }
.pick-state { margin-top: 6px; font-size: 11.5px; border-radius: 999px; padding: 1px 9px; background: var(--green-soft); color: var(--green-ink); border: 1px solid var(--green-line); }
.pick-state.down { background: var(--gold-soft); color: var(--warn); border-color: var(--gold-line); }
@media (max-width: 380px) { .picker-options { grid-template-columns: 1fr; } }

/* Shell: sized to the visible viewport so the message box stays above a phone keyboard */
.app { position: fixed; left: 0; right: 0; top: var(--app-top, 0px); height: var(--app-h, 100dvh); display: flex; flex-direction: column; }
.top { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; row-gap: 6px; padding: 6px 10px; padding-top: max(6px, env(safe-area-inset-top)); background: linear-gradient(180deg, #10563F, var(--green)); color: #fff; border-bottom: 2px solid var(--gold); }
.top .tab { color: #EAF3EE; background: transparent; border-color: rgba(255,255,255,.22); }
.top .tab:hover { border-color: var(--gold-ink); background: rgba(255,255,255,.06); }
.top .tab.active { background: var(--gold); border-color: var(--gold); color: #17130A; }
.brand { display: inline-flex; align-items: center; gap: 7px; font-weight: 650; font-size: 14px; color: #fff; text-decoration: none; white-space: nowrap; }
.brand img { border-radius: 6px; box-shadow: 0 0 0 1px rgba(255,255,255,.3); }
.brand .gold { color: var(--gold-ink); }
.conn { width: 8px; height: 8px; border-radius: 50%; background: #9fb3a8; flex: none; }
.conn.online { background: #5fd38d; }
.conn.offline { background: #ff7b72; }
.agent-switch { display: inline-flex; gap: 2px; background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.12); border-radius: 999px; padding: 2px; margin-left: 4px; }
.seg { font-size: 13px; font-weight: 650; padding: 3px 13px; border-radius: 999px; color: #D7E7DE; text-decoration: none; line-height: 1.5; }
.seg.on { background: #F1F5F2; color: var(--green); }
a.seg:hover { color: #fff; background: rgba(255,255,255,.12); }
.seg.down::after { content: " •"; color: var(--gold-ink); }
.tab { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; font-size: 13.5px; font-weight: 600; text-decoration: none; white-space: nowrap; line-height: 1.5; }
.tab svg { flex: none; }
.tab.ghost { padding: 4px 9px; display: inline-grid; place-items: center; }
a.tab { border: 1px solid rgba(255,255,255,.22); border-radius: 8px; }
.top .signout { margin-left: 4px; }
.main { flex: 1; min-height: 0; display: flex; }
.view { flex: 1; min-width: 0; min-height: 0; display: flex; }

/* ── Chat ── */
.chat { position: relative; flex-direction: column; }
.scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.col { max-width: 880px; margin: 0 auto; padding: 16px 16px 8px; display: flex; flex-direction: column; gap: 8px; }
.col > *, .turn > *, #messages, #pending, .live { min-width: 0; max-width: 100%; }
#messages, #pending { display: flex; flex-direction: column; gap: 8px; }
.empty { color: var(--faint); text-align: center; padding: 40px 0 12px; }
.earlier { align-self: center; border-radius: 999px; font-size: 13px; color: var(--dim); }
.turn { display: flex; flex-direction: column; gap: 8px; padding-bottom: 6px; }
.turn + .turn { border-top: 1px solid var(--line); padding-top: 14px; }
.turn-done { color: var(--faint); font-size: 12.5px; }
.row { display: flex; }
.row.user { justify-content: flex-end; }
.bubble { max-width: min(85%, 640px); background: var(--green); color: #F1F5F2; border: 1px solid #17644D; border-radius: 16px 16px 4px 16px; padding: 9px 13px 6px; box-shadow: 0 1px 3px rgba(0,0,0,.35); }
.bubble.pending { opacity: .7; }
.bubble-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble-text + .bubble-text { margin-top: 8px; }
.bubble-meta { font-size: 11px; color: #A9CDBB; text-align: right; margin-top: 3px; }
.bubble a { color: var(--gold-ink); }
.chip-file { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 6px 10px; font-size: 13px; color: var(--dim); max-width: 85%; }

/* Markdown */
.md { overflow-wrap: anywhere; min-width: 0; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md pre, .md blockquote { margin: 0 0 .7em; }
.md h1, .md h2, .md h3, .md h4 { margin: 1em 0 .45em; line-height: 1.3; font-size: 1.08em; color: var(--gold-ink); }
.md h1 { font-size: 1.25em; }
.md ul, .md ol { padding-left: 1.4em; }
.md li::marker { color: var(--faint); }
.md a { color: var(--green-ink); }
.md strong { color: #F4F7F5; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 1em 0; }
.md code { font-family: var(--mono); font-size: .88em; background: rgba(197,160,74,.12); border: 1px solid rgba(197,160,74,.25); color: #F0D9A0; border-radius: 5px; padding: .05em .35em; }
.md pre { background: var(--code-bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; overflow-x: auto; }
.md pre code { background: none; border: 0; padding: 0; font-size: 13px; color: #D5DDD8; }
.md blockquote { padding: 2px 12px; border-left: 3px solid var(--gold); color: var(--dim); }
.md-table { overflow-x: auto; margin: 0 0 .8em; border: 1px solid var(--line); border-radius: 10px; }
.md table { border-collapse: collapse; width: 100%; font-size: 14px; }
.md th, .md td { border-bottom: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.md th { background: var(--green-soft); color: var(--green-ink); }
.md tr:nth-child(even) td { background: rgba(255,255,255,.02); }
.md tr:last-child td { border-bottom: 0; }

/* Thinking, notes, cards */
.thinking { color: var(--faint); font-size: 13px; font-style: italic; }
.thinking .card-head { color: var(--faint); font-style: italic; padding: 0; }
.thinking-text { white-space: pre-wrap; margin-top: 6px; padding: 6px 12px; border-left: 2px solid var(--gold-line); color: var(--dim); }
.note { font-size: 13px; color: var(--dim); overflow-wrap: anywhere; }
.note code { font-family: var(--mono); font-size: 12.5px; background: var(--panel-2); border-radius: 5px; padding: 0 5px; }
.note.warn { color: var(--warn); }
.note.err { color: var(--danger-ink); }
.divider { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 12px; margin: 8px 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px dashed var(--line-2); }
.card { border: 1px solid var(--line); background: var(--panel); border-radius: 12px; }
.card.recap { padding: 10px 14px; font-size: 14px; border-color: var(--gold-line); background: var(--gold-soft); }
.card.task.err { border-color: var(--danger-line); }
.card-label { font-size: 11.5px; color: var(--gold-ink); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px; font-weight: 650; }
.card-head { width: 100%; display: flex; justify-content: space-between; gap: 10px; background: none; border: 0; color: var(--dim); padding: 9px 14px; text-align: left; font-size: 13.5px; white-space: normal; }
.card-head > span:first-child { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.card-body { padding: 0 14px 12px; font-size: 14px; max-height: 60vh; overflow: auto; }

/* Tool calls */
.tool { border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 7px 11px; font-size: 13.5px; cursor: pointer; min-width: 0; }
.tool:hover { border-color: var(--line-2); }
.tool.open { background: var(--panel-2); cursor: auto; }
.tool-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tool-title { flex: 1; min-width: 0; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tool.open .tool-title { display: block; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.tool-sub { color: var(--faint); font-size: 12.5px; margin: 2px 0 0 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.caret { color: var(--faint); font-size: 12px; flex: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--ok); }
.dot.running { background: var(--gold); animation: pulse 1.2s ease-in-out infinite; }
.dot.bg { background: var(--warn); }
.dot.error { background: var(--danger); }
@keyframes pulse { 50% { opacity: .35; transform: scale(.8); } }
.badge { flex: none; font-size: 11px; color: var(--dim); border: 1px solid var(--line-2); border-radius: 999px; padding: 0 7px; }
.badge.warn { color: var(--warn); border-color: var(--gold-line); }
.badge.err { color: var(--danger-ink); border-color: var(--danger-line); }
.body { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.sec-label { font-size: 11.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.out { margin: 0; font-family: var(--mono); font-size: 12.5px; line-height: 1.45; background: var(--code-bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 420px; overflow: auto; color: #D5DDD8; }
.out.err { color: var(--danger-ink); border-color: var(--danger-line); background: var(--danger-soft); }
.out.cmd { color: var(--green-ink); }
.wait { color: var(--faint); font-size: 12.5px; }
.q { font-weight: 600; }
.imgs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.imgs img { height: 64px; max-width: 160px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }
.imgs.big img { height: auto; max-height: 420px; max-width: 100%; object-fit: contain; }
.diff { font-family: var(--mono); font-size: 12px; line-height: 1.45; background: var(--code-bg); color: #D5DDD8; border: 1px solid var(--line); border-radius: 8px; overflow: auto; max-height: 480px; }
.diff-line { display: flex; white-space: pre; }
.diff-line.add { background: rgba(46,160,67,.16); color: #8DDBA5; }
.diff-line.del { background: rgba(248,81,73,.16); color: #FFA198; }
.diff-line.add .diff-no, .diff-line.del .diff-no { color: inherit; opacity: .7; }
.diff-no { flex: none; width: 44px; text-align: right; padding-right: 8px; color: var(--faint); user-select: none; }
.diff-sep { color: var(--faint); padding: 2px 10px; }
.todos { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.todo { display: flex; gap: 8px; color: var(--dim); }
.todo.completed { color: var(--faint); text-decoration: line-through; }
.todo.in_progress { color: var(--text); font-weight: 600; }
.todo-box { flex: none; width: 16px; height: 16px; border: 1px solid var(--line-2); border-radius: 4px; font-size: 11px; display: grid; place-items: center; margin-top: 3px; color: var(--green-ink); }

/* Live status */
.live { display: flex; flex-direction: column; gap: 8px; padding-bottom: 6px; }
.working { color: var(--gold-ink); font-size: 14px; font-weight: 550; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px; }
.spark { display: inline-block; animation: spin 2.4s linear infinite; margin-right: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }
.link { margin-left: auto; background: none; border-radius: 999px; padding: 1px 10px; font-size: 12.5px; color: var(--dim); }
.preview { margin: 0; font-family: var(--mono); font-size: 12.5px; color: var(--dim); white-space: pre-wrap; overflow-wrap: anywhere; border-left: 2px solid var(--gold-line); padding: 4px 10px; max-height: 220px; overflow: hidden; }
.bg-list { border: 1px solid var(--gold-line); background: var(--gold-soft); border-radius: 10px; padding: 8px 11px; display: flex; flex-direction: column; gap: 5px; }
.bg-title { font-size: 11.5px; color: var(--gold-ink); text-transform: uppercase; letter-spacing: .04em; font-weight: 650; }
.bg-item { display: flex; align-items: center; gap: 8px; font-size: 13px; min-width: 0; }
.bg-name { color: var(--dim); font-family: var(--mono); font-size: 12px; flex: none; }
.bg-desc { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bg-meta { color: var(--faint); font-size: 12px; flex: none; }
.fallback-screen { max-height: 60vh; font-size: 11.5px; white-space: pre; overflow: auto; }

/* Sign-in needed */
.signin { border: 1px solid var(--gold-line); border-left: 4px solid var(--gold); background: var(--gold-soft); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.signin-title { font-weight: 700; color: var(--gold-ink); }
.signin-text { font-size: 14px; color: var(--text); }
.signin-text code { background: var(--code-bg); border: 1px solid var(--gold-line); color: #F0D9A0; border-radius: 5px; padding: 0 5px; }
.signin-btn { align-self: flex-start; background: var(--green-2); color: #fff; text-decoration: none; font-weight: 600; border-radius: 9px; padding: 7px 14px; font-size: 14px; border: 1px solid var(--green-3); }
.signin-btn:hover { background: var(--green-3); border-color: var(--gold); }

/* Questions from the agent */
.question { border: 1px solid var(--green-line); background: var(--green-soft); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.q-label { font-size: 11.5px; color: var(--green-ink); text-transform: uppercase; letter-spacing: .05em; font-weight: 650; }
.q-text { font-weight: 600; }
.q-raw { white-space: pre-wrap; font-size: 14px; overflow-wrap: anywhere; }
.q-opt { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--green-line); border-radius: 10px; padding: 9px 12px; white-space: normal; }
.q-opt:hover { border-color: var(--gold); }
.q-opt.hl { border-color: var(--green-ink); box-shadow: inset 3px 0 0 var(--gold); }
.q-num { flex: none; width: 22px; height: 22px; border-radius: 6px; background: var(--green-2); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.q-opt-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.q-desc { color: var(--dim); font-size: 13px; }
.q-own { display: flex; gap: 6px; }
.q-own input { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--green-line); color: var(--text); border-radius: 9px; padding: 8px 10px; font: inherit; font-size: 16px; }
.q-own input::placeholder { color: var(--faint); }
.q-own input:focus { outline: 2px solid rgba(197,160,74,.45); outline-offset: 0; border-color: var(--gold); }
.q-own button { background: var(--green-2); color: #fff; border-color: var(--green-3); }
.q-keys { display: flex; gap: 6px; flex-wrap: wrap; }
.q-keys button { padding: 3px 10px; font-size: 12.5px; color: var(--dim); }

/* Floating bits */
.warnings { flex: none; width: min(880px, calc(100% - 24px)); margin: 8px auto 0; display: flex; flex-direction: column; gap: 6px; }
.warnings:empty { display: none; }
.warn-item { display: flex; align-items: center; gap: 10px; background: var(--gold-soft); color: #F0D9A0; border: 1px solid var(--gold-line); border-radius: 10px; padding: 7px 8px 7px 12px; font-size: 13.5px; }
.warn-item span { flex: 1; min-width: 0; }
.warn-item button { background: none; border: 0; color: #F0D9A0; font-size: 18px; padding: 0 4px; }
.jump { position: absolute; left: 50%; transform: translateX(-50%); bottom: 112px; background: var(--green-2); color: #fff; border: 1px solid var(--green-3); border-radius: 999px; padding: 6px 14px; font-size: 13px; z-index: 3; box-shadow: 0 4px 14px rgba(0,0,0,.5); }
.send-error { width: min(880px, calc(100% - 24px)); margin: 0 auto 6px; background: var(--danger-soft); color: var(--danger-ink); border: 1px solid var(--danger-line); border-radius: 10px; padding: 7px 12px; font-size: 13.5px; cursor: pointer; }

/* Composer */
.composer { flex: none; padding: 6px 12px calc(8px + env(safe-area-inset-bottom)); background: linear-gradient(to bottom, rgba(15,20,18,0), var(--bg) 30%); }
.box { max-width: 880px; margin: 0 auto; display: flex; align-items: flex-end; gap: 6px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 22px; padding: 5px 6px; box-shadow: 0 2px 12px rgba(0,0,0,.35); }
.box:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(197,160,74,.18); }
#input { flex: 1; min-width: 0; min-height: 40px; resize: none; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 16px; line-height: 1.4; padding: 8px 4px; max-height: 40vh; overflow-y: hidden; }
#input::placeholder { color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn, .send-btn, .stop-btn { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 0; display: grid; place-items: center; padding: 0; }
.icon-btn { background: transparent; color: var(--dim); font-size: 18px; }
.icon-btn:hover { color: var(--gold-ink); }
.send-btn { background: var(--green-2); color: #fff; font-size: 16px; }
.send-btn:hover { background: var(--green-3); }
.send-btn:disabled { background: #222B27; color: #5F6B65; opacity: 1; }
.stop-btn { background: var(--danger-soft); color: var(--danger-ink); font-size: 13px; }
.foot { max-width: 880px; margin: 5px auto 0; display: flex; align-items: center; gap: 10px; min-height: 26px; }
.hint { margin-left: auto; color: var(--faint); font-size: 11.5px; }

/* Model / thinking switcher */
.mbar { position: relative; }
.mpill { border-radius: 999px; padding: 3px 10px; font-size: 12.5px; border-color: var(--gold-line); background: var(--gold-soft); color: var(--gold-ink); }
.mpop { position: absolute; bottom: calc(100% + 8px); left: 0; width: min(340px, calc(100vw - 24px)); background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; padding: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.55); z-index: 5; display: flex; flex-direction: column; gap: 8px; }
.mlabel { font-size: 11.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; }
.mlive { text-transform: none; letter-spacing: 0; color: var(--dim); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border-radius: 999px; padding: 4px 11px; font-size: 13px; }
.chip.on { background: var(--green-soft); border-color: var(--green-ink); color: var(--green-ink); font-weight: 600; }
.chip.busy { opacity: .6; }
.mnote { font-size: 12.5px; padding: 5px 9px; border-radius: 8px; background: var(--green-soft); color: var(--green-ink); }
.mnote.err { background: var(--danger-soft); color: var(--danger-ink); }

/* ── Files ── */
.files { flex-direction: row; background: var(--surface); }
.tree-pane { width: 300px; max-width: 45%; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.toolbar { display: flex; gap: 6px; padding: 8px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar button { padding: 3px 8px; font-size: 13px; }
.tree { overflow: auto; flex: 1; padding: 4px 0; }
.node { display: flex; gap: 6px; padding: 3px 8px; cursor: pointer; white-space: nowrap; user-select: none; font-size: 14px; }
.node:hover { background: var(--panel-2); }
.node.selected { background: var(--green-soft); color: var(--green-ink); box-shadow: inset 2px 0 0 var(--gold); }
.node .ic { width: 12px; color: var(--faint); flex: none; }
.node .nm { overflow: hidden; text-overflow: ellipsis; }
.node.dir .nm { font-weight: 500; }
.viewer { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.viewer-bar { display: flex; align-items: center; gap: 6px; padding: 8px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.viewer-path { font-family: var(--mono); font-size: 13px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.viewer-body { flex: 1; min-height: 0; overflow: auto; padding: 10px; }
.viewer-body img { max-width: 100%; height: auto; }
.viewer-body code { background: var(--panel-2); border-radius: 5px; padding: 0 5px; }
.editor { width: 100%; height: 100%; min-height: 300px; resize: none; border: 0; outline: 0; background: transparent; color: var(--text); font: 13px/1.5 var(--mono); tab-size: 2; }
button.danger { color: var(--danger-ink); }
button.danger:hover { border-color: var(--danger); }

/* Drop overlay + toast */
.drop { position: fixed; inset: 0; background: rgba(15,20,18,.88); border: 3px dashed var(--gold); display: grid; place-items: center; font-size: 20px; color: var(--gold-ink); z-index: 10; pointer-events: none; }
.toast { position: fixed; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--green); color: #F1F5F2; border: 1px solid var(--gold-line); padding: 8px 14px; border-radius: 10px; z-index: 11; max-width: calc(100vw - 32px); box-shadow: 0 6px 22px rgba(0,0,0,.55); }
.toast.error { background: var(--danger-soft); color: var(--danger-ink); border-color: var(--danger); }

@media (max-width: 760px) {
  .brand-text { display: none; }
}
@media (max-width: 640px) {
  .col { padding: 12px 10px 6px; }
  .bubble { max-width: 90%; }
  .composer { padding-left: 8px; padding-right: 8px; }
  .hint { display: none; }
  .files { flex-direction: column; }
  .tree-pane { width: auto; max-width: none; max-height: 42%; border-right: 0; border-bottom: 1px solid var(--line); }
  .top { gap: 4px; padding-left: 6px; padding-right: 6px; }
  .agent-switch { margin-left: 0; }
  .tab { padding: 4px 8px; font-size: 13px; gap: 5px; }
  .seg { padding: 3px 10px; }
  .top .signout { margin-left: 0; }
}
@media (max-width: 400px) {
  .top .tab:not(.signout) svg { display: none; } /* Chat / Files: text only on small phones */
  .tab { padding: 4px 7px; }
  .seg { padding: 3px 8px; }
}
@media (max-width: 350px) {
  .top .brand { display: none; } /* keep all five buttons on one row on the smallest phones */
  .top { gap: 3px; }
  .tab { padding: 4px 6px; }
  .top .signout { gap: 4px; }
}

/* ── Terminal pages ── */
.term-brand { font-weight: 600; font-size: 14px; }
.terminal { flex: 1; min-width: 0; min-height: 0; padding: 6px 4px 4px 8px; background: var(--bg); }
.terminal .xterm { height: 100%; }
.terminal .xterm-viewport { scrollbar-color: var(--line-2) transparent; }
body.term { background: var(--bg); }

/* One agent has the conversation: the other one's chat is read-only */
.seg.active-agent::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); margin-right: 6px; vertical-align: 1px; box-shadow: 0 0 0 2px rgba(76,195,138,.25); }
.seg.on.active-agent::before { background: var(--green-2); box-shadow: none; }
.pick-active { margin-top: 4px; font-size: 11.5px; font-weight: 650; color: var(--ok); }
.locked { flex: none; max-width: 880px; width: calc(100% - 24px); margin: 6px auto calc(10px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--gold-soft); border: 1px solid var(--gold-line); border-left: 4px solid var(--gold); border-radius: 14px; padding: 10px 12px; }
.locked-text { flex: 1 1 220px; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.locked-text strong { color: var(--gold-ink); }
.locked-text span { color: var(--dim); font-size: 13px; }
.locked-btn, .dlg .primary { background: var(--green-2); border-color: var(--green-3); color: #fff; font-weight: 600; border-radius: 10px; padding: 8px 14px; }
.locked-btn:hover, .dlg .primary:hover { background: var(--green-3); border-color: var(--gold); }
.locked-btn:disabled { opacity: .6; }
.dlg-wrap { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: rgba(5,8,7,.72); }
.dlg { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--gold); border-radius: 16px; padding: 18px 16px 14px; box-shadow: 0 18px 48px rgba(0,0,0,.6); display: flex; flex-direction: column; gap: 10px; }
.dlg h2 { margin: 0; font-size: 18px; color: var(--text); }
.dlg-text { margin: 0; color: var(--dim); font-size: 14.5px; }
.dlg-progress { display: flex; align-items: center; gap: 10px; color: var(--gold-ink); font-size: 14px; }
.dlg-error { margin: 0; color: var(--danger-ink); background: var(--danger-soft); border: 1px solid var(--danger-line); border-radius: 10px; padding: 8px 10px; font-size: 13.5px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.dlg-actions button { padding: 8px 14px; border-radius: 10px; }
.dlg-input { width: 100%; box-sizing: border-box; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-size: 14.5px; }
.dlg-input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 2px rgba(197,160,74,.25); }
.dlg .primary.danger { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger-ink); }
.dlg .primary.danger:hover { border-color: var(--danger-ink); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--gold-line); border-top-color: var(--gold-ink); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
.handover { border: 1px solid var(--green-line); background: var(--green-soft); border-radius: 12px; }
.handover .card-head { color: var(--green-ink); }
.mpop .mnone { font-size: 13px; color: var(--faint); }

/* ── One timeline of both agents: each turn carries its agent's colour and name ── */
:root {
  --claude: #E0956A; --claude-ink: #F2B48F; --claude-edge: rgba(224,149,106,.5); --claude-soft: rgba(224,149,106,.14);
  --kimi: #7FA8F0;   --kimi-ink: #AEC8F7;   --kimi-edge: rgba(127,168,240,.5);   --kimi-soft: rgba(127,168,240,.14);
}
.a-claude { --ac: var(--claude); --ac-ink: var(--claude-ink); --ac-edge: var(--claude-edge); --ac-soft: var(--claude-soft); }
.a-kimi { --ac: var(--kimi); --ac-ink: var(--kimi-ink); --ac-edge: var(--kimi-edge); --ac-soft: var(--kimi-soft); }
.turn[data-agent], .live-agent { border-left: 2px solid var(--ac-edge); padding-left: 11px; }
.live-agent { display: flex; flex-direction: column; gap: 8px; }
.who { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; font-size: 12px; font-weight: 650; color: var(--ac-ink); letter-spacing: .02em; line-height: 1.2; }
.av { flex: none; width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 10.5px; font-weight: 700; color: var(--ac-ink); background: var(--ac-soft); border: 1px solid var(--ac-edge); }
.who-extra { color: var(--faint); font-weight: 500; }
.working .who { margin-right: 6px; align-self: center; }
.bubble-meta .to { color: var(--ac-ink); font-weight: 650; }
.switch { display: flex; flex-direction: column; margin: 4px 0; }
.switch-line { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: 0; border-radius: 0; padding: 4px 0; color: var(--ac-ink); font-size: 12.5px; font-weight: 600; }
.switch-line:hover { border: 0; }
.switch-line:hover .switch-label { background: var(--ac-soft); }
.switch-line::before, .switch-line::after { content: ""; flex: 1; border-top: 1px dashed var(--ac-edge); }
.switch-label { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; padding: 2px 10px 2px 4px; border-radius: 999px; border: 1px solid var(--ac-edge); }
.switch-label .caret { color: var(--ac-ink); }
.switch-body { margin: 6px 0 4px; display: flex; flex-direction: column; gap: 4px; }
.switch-body .out { max-height: 50vh; }
@media (max-width: 640px) { .turn[data-agent], .live-agent { padding-left: 9px; } }
.live-agent .preview { border-left: 0; padding-left: 0; }
