:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --panel-2: #f1f3f9;
  --border: #e3e6ef;
  --text: #1a1d29;
  --muted: #6b7185;
  --accent: #5b4bdb;
  --accent-soft: #ecebfd;
  --ok: #1f9d63;
  --ok-soft: #e4f6ed;
  --warn: #c27c0e;
  --warn-soft: #fdf3e1;
  --err: #d04444;
  --err-soft: #fdeaea;
  --c-devmate: #5b4bdb;
  --c-coding: #2f7de1;
  --c-qa: #1f9d63;
  --c-knowledge: #b9572a;
  --c-delivery: #a8329b;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1117;
    --panel: #171a23;
    --panel-2: #1e2230;
    --border: #2a2f3f;
    --text: #e6e8f0;
    --muted: #9198ad;
    --accent: #8f83ff;
    --accent-soft: #252242;
    --ok: #4cc58b;
    --ok-soft: #16301f;
    --warn: #e6a640;
    --warn-soft: #33270f;
    --err: #ef6b6b;
    --err-soft: #3a1a1a;
    --c-devmate: #8f83ff;
    --c-coding: #5aa2ff;
    --c-qa: #4cc58b;
    --c-knowledge: #e58a5b;
    --c-delivery: #d76fca;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
}
button { font: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
code, pre { font-family: var(--mono); font-size: 12.5px; }
h1, h2, h3 { margin: 0; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo { display: block; height: 40px; width: auto; }
.brand-divider { width: 1px; height: 34px; background: var(--border); }
.brand h1 { font-size: 17px; }
.brand p { margin: 0; color: var(--muted); font-size: 12.5px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
}
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.bad { background: var(--err-soft); color: var(--err); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }

/* layout */
.layout {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: 270px minmax(0, 1fr) minmax(360px, 34%);
}
.sidebar, .details { background: var(--panel); overflow-y: auto; }
.sidebar { border-right: 1px solid var(--border); padding: 16px; display: flex; flex-direction: column; gap: 22px; }
.details { border-left: 1px solid var(--border); display: flex; flex-direction: column; }
.sidebar h2, .details h2 { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 10px; }

/* agents */
.agents { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.agents li { display: flex; gap: 10px; align-items: flex-start; padding: 8px; border-radius: 8px; }
.agents li:not(.lead) { margin-left: 14px; border-left: 2px solid var(--border); border-radius: 0 8px 8px 0; }
.agents strong { display: block; font-size: 13.5px; }
.agents small { color: var(--muted); font-size: 12px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--border); margin-top: 6px; flex: none; }
.agents li[data-state="working"] { background: var(--accent-soft); }
.agents li[data-state="working"] .dot { background: var(--accent); animation: pulse 1s infinite; }
.agents li[data-state="done"] .dot { background: var(--ok); }
.agents li[data-state="failed"] .dot { background: var(--err); }
@keyframes pulse { 50% { opacity: 0.3; } }

.actions { display: flex; flex-direction: column; gap: 6px; }
.actions button {
  text-align: left; padding: 8px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
}
.actions button:hover:not(:disabled) { border-color: var(--accent); }
.actions button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.reports { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.link { background: none; border: 0; padding: 0; color: var(--accent); text-align: left; }
.link:hover { text-decoration: underline; }

/* conversation */
.conversation { display: flex; flex-direction: column; min-height: 0; }
.messages { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.welcome { max-width: 560px; margin: auto; text-align: center; color: var(--muted); }
.welcome h2 { color: var(--text); font-size: 22px; margin-bottom: 8px; }
.msg { max-width: 860px; width: fit-content; border-radius: 12px; padding: 12px 16px; }
.msg.user { align-self: flex-end; background: var(--accent); color: #fff; white-space: pre-wrap; }
.msg.agent { background: var(--panel); border: 1px solid var(--border); width: 100%; cursor: default; }
.msg.agent.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.who { font-size: 12px; font-weight: 600; color: var(--accent); margin-bottom: 4px; }
.activity { color: var(--muted); font-style: italic; }
.activity::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 8px; animation: pulse 1s infinite; }
.meta { font-size: 12px; margin-top: 8px; }
.meta:empty { display: none; }
.error { color: var(--err); }

.composer { display: flex; gap: 8px; padding: 14px 24px 20px; border-top: 1px solid var(--border); background: var(--panel); }
.composer textarea {
  flex: 1; resize: none; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit;
}
.composer textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.composer button { padding: 0 20px; border-radius: 10px; border: 0; background: var(--accent); color: #fff; font-weight: 600; }

/* markdown */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3 { margin: 16px 0 8px; font-size: 15.5px; }
.md h1 { font-size: 18px; }
.md table { border-collapse: collapse; margin: 8px 0; font-size: 13px; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--border); padding: 5px 8px; text-align: left; vertical-align: top; }
.md th { background: var(--panel-2); }
.md pre { background: var(--panel-2); padding: 10px; border-radius: 8px; overflow-x: auto; }
.md :not(pre) > code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }

/* run details */
.details-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 16px 0; }
.details-head h2 { margin: 0; }
.run-state { font-size: 12px; color: var(--muted); }
.run-state.running { color: var(--accent); }
.run-state.completed { color: var(--ok); }
.run-state.failed { color: var(--err); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px 16px; }
.stats:empty { display: none; }
.stats div { background: var(--panel-2); border-radius: 8px; padding: 8px 10px; }
.stats span { display: block; font-size: 11px; color: var(--muted); }
.stats strong { font-size: 13.5px; }
.tabs { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 8px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.count { font-size: 11px; background: var(--panel-2); border-radius: 999px; padding: 0 6px; }
.count:empty { display: none; }
.count.warn { background: var(--warn); color: #fff; }
.tab-body { padding: 14px 16px; overflow-y: auto; flex: 1; }

.tag { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 999px; color: #fff; background: var(--c-devmate); }
.tag.coding { background: var(--c-coding); }
.tag.qa { background: var(--c-qa); }
.tag.knowledge { background: var(--c-knowledge); }
.tag.delivery { background: var(--c-delivery); }

.timeline, .timeline ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.timeline ol { margin: 6px 0 0 10px; padding-left: 10px; border-left: 1px dashed var(--border); }
.state { font-size: 12px; margin-left: 4px; }
.state.ok { color: var(--ok); }
.state.err { color: var(--err); }
.state.run { color: var(--accent); }
.ev.step.done b { color: var(--ok); }
.ev { padding: 6px 10px; border-radius: 8px; background: var(--panel-2); font-size: 13px; border-left: 3px solid var(--border); }
.ev p { margin: 2px 0 0; color: var(--muted); }
.ev.run, .ev.step { background: none; border-left: 0; padding-left: 0; }
.ev.step b { color: var(--accent); }
.ev.note { background: none; font-style: italic; color: var(--muted); }
.ev.tool code { font-weight: 600; }
.ev.tool .args { color: var(--muted); font-family: var(--mono); font-size: 11.5px; margin-left: 6px; word-break: break-all; }
.ev.tool.ok { border-left-color: var(--ok); }
.ev.tool.err, .ev.err { border-left-color: var(--err); background: var(--err-soft); }
.ev.tool.pending { border-left-color: var(--accent); }
.ev.approval { border-left-color: var(--warn); background: var(--warn-soft); }
.ev.done { background: none; }
.ms { font-size: 11px; color: var(--muted); }
details summary { cursor: pointer; color: var(--muted); font-size: 12px; }
details p { white-space: pre-wrap; margin: 4px 0; }

.grid { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.grid th { text-align: left; color: var(--muted); font-weight: 500; padding: 4px 6px; border-bottom: 1px solid var(--border); }
.grid td { padding: 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.grid tr.err td { color: var(--err); }
.grid .sub { font-size: 11.5px; color: var(--muted); }
.grid .num { white-space: nowrap; text-align: right; color: var(--muted); }
.grid pre { white-space: pre-wrap; margin: 4px 0; }

.source { margin-bottom: 16px; }
.source h3 { font-size: 13px; display: flex; justify-content: space-between; }
.source h3 span { color: var(--muted); font-weight: 500; }
.source ul, .tasks { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.tasks { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tasks li.step { color: var(--ok); font-weight: 600; }
.tasks .md { margin-top: 6px; padding: 10px; background: var(--panel-2); border-radius: 8px; font-size: 13px; }

.approval-card { border: 1px solid var(--warn); background: var(--warn-soft); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.approval-card.approved { border-color: var(--ok); background: var(--ok-soft); }
.approval-card.rejected, .approval-card.failed { border-color: var(--border); background: var(--panel-2); }
.approval-card .head { display: flex; gap: 8px; align-items: center; }
.approval-card p { margin: 8px 0; }
.approval-card .md { background: var(--panel); padding: 10px; border-radius: 8px; font-size: 13px; }
.diff { background: var(--panel); padding: 10px; border-radius: 8px; overflow-x: auto; margin: 0; }
.diff .add { color: var(--ok); }
.diff .del { color: var(--err); }
.approve-actions { display: flex; gap: 8px; margin-top: 10px; }
.approve-actions button { padding: 6px 16px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); color: var(--text); }
.approve-actions .approve { background: var(--ok); color: #fff; border-color: var(--ok); }
.resolution { font-weight: 600; text-transform: capitalize; }
.resolution.approved { color: var(--ok); }
.resolution.failed { color: var(--err); }

dialog { max-width: 820px; width: 92vw; max-height: 86vh; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); color: var(--text); padding: 24px; }
dialog::backdrop { background: rgb(0 0 0 / 0.45); }
dialog .close { float: right; background: none; border: 0; font-size: 22px; color: var(--muted); }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 230px minmax(0, 1fr); }
  .details { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--border); max-height: 60vh; }
  body { height: auto; }
}
@media (max-width: 720px) {
  .layout { display: flex; flex-direction: column; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--border); }
  .messages { padding: 16px; }
  .composer { padding: 12px 16px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Terminal theme for the chrome: top bar, agent menu, run details ---------- */
.topbar, .sidebar, .details {
  --panel: #0d1117;
  --panel-2: #161b22;
  --border: #262c36;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #3fb950;
  --accent-soft: rgb(63 185 80 / 0.14);
  --ok: #3fb950;
  --ok-soft: rgb(63 185 80 / 0.12);
  --warn: #d29922;
  --warn-soft: rgb(210 153 34 / 0.12);
  --err: #f85149;
  --err-soft: rgb(248 81 73 / 0.12);
  --c-devmate: #a371f7;
  --c-coding: #58a6ff;
  --c-qa: #3fb950;
  --c-knowledge: #f0883e;
  --c-delivery: #db61a2;
  background: var(--panel);
  color: var(--text);
  scrollbar-color: #30363d transparent;
  color-scheme: dark;
}
.topbar { border-bottom-color: var(--border); }
.sidebar { border-right-color: var(--border); }
.details { border-left-color: var(--border); }
.brand h1 { font-family: var(--mono); font-size: 16px; letter-spacing: 0.02em; }
.brand h1::after { content: "_"; color: var(--accent); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.chip { font-family: var(--mono); font-size: 11.5px; border-radius: 6px; }

.sidebar h2, .details h2 { font-family: var(--mono); text-transform: none; letter-spacing: 0; font-size: 12.5px; color: var(--accent); }
.sidebar h2::before, .details h2::before { content: "❯ "; color: var(--muted); }

.agents li:not(.lead) { border-left-color: var(--border); }
.agents strong { font-family: var(--mono); font-size: 13px; }
.agents li[data-state="working"] .dot { box-shadow: 0 0 8px var(--accent); }
.agents li[data-state="done"] .dot { box-shadow: 0 0 6px rgb(63 185 80 / 0.6); }

.actions button { font-family: var(--mono); font-size: 12.5px; background: var(--panel); border-color: var(--border); border-radius: 6px; }
.actions button::before { content: "$ "; color: var(--muted); }
.actions button:hover:not(:disabled) { background: var(--panel-2); border-color: var(--accent); color: var(--accent); }
.actions button.primary { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.actions button.primary::before { color: var(--accent); }
.reports { font-family: var(--mono); font-size: 12px; }
.reports .link { color: #58a6ff; }

.details .tab-body { font-family: var(--mono); font-size: 12.5px; }
.details .tab-body .md { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 13px; }
.stats div { border: 1px solid var(--border); border-radius: 6px; }
.stats span { font-family: var(--mono); text-transform: lowercase; }
.stats strong { font-family: var(--mono); color: var(--accent); }
.tabs button { font-family: var(--mono); font-size: 12.5px; }
.run-state { font-family: var(--mono); }
.run-state::before { content: "● "; }
.ev { border-radius: 6px; }

/* Agent tags as tinted labels instead of solid pills on the dark panels */
.tag { --tc: var(--c-devmate); }
.tag.coding { --tc: var(--c-coding); }
.tag.qa { --tc: var(--c-qa); }
.tag.knowledge { --tc: var(--c-knowledge); }
.tag.delivery { --tc: var(--c-delivery); }
.details .tag { background: color-mix(in srgb, var(--tc) 18%, transparent); color: var(--tc); border: 1px solid color-mix(in srgb, var(--tc) 45%, transparent); font-family: var(--mono); border-radius: 4px; }
.stats strong { white-space: nowrap; }

/* ---------- Dark chat area: a shade lighter than the side panels so the columns stay distinct ---------- */
.conversation, dialog {
  --bg: #10151c;
  --panel: #161b22;
  --panel-2: #1f2630;
  --border: #2a313c;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #3fb950;
  --accent-soft: rgb(63 185 80 / 0.15);
  --err: #f85149;
  background: var(--bg);
  color: var(--text);
  scrollbar-color: #30363d transparent;
  color-scheme: dark;
}
.welcome h2 { font-family: var(--mono); }
.msg.agent { border-color: var(--border); line-height: 1.6; }
.msg.agent.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.who { font-family: var(--mono); color: var(--accent); }
.who::before { content: "◆ "; }
.msg.user {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 13px;
}
.msg.user::before { content: "❯ "; color: var(--accent); font-weight: 700; }
.meta.link { font-family: var(--mono); color: #58a6ff; }
.activity { font-family: var(--mono); font-style: normal; font-size: 12.5px; }
.composer { background: var(--panel); border-top-color: var(--border); }
.composer textarea { font-family: var(--mono); font-size: 13px; background: var(--bg); }
.composer textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.composer button { background: var(--accent); color: #0d1117; font-family: var(--mono); }
.conversation .md a { color: #58a6ff; }
.conversation .md hr { border: 0; border-top: 1px solid var(--border); }
.conversation .md em { color: var(--muted); }

/* ---------- Website speed test (PageSpeed Insights layout) ---------- */
:root { --ps-good: #0c8a4e; --ps-avg: #c76a00; --ps-poor: #cc1f1f; --ps-none: #9a9a9a; }
@media (prefers-color-scheme: dark) { :root { --ps-good: #3fcf8e; --ps-avg: #ffa94d; --ps-poor: #ff6b6b; } }
.speed-dialog { max-width: 1000px; width: 94vw; height: 90vh; max-height: 90vh; padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.speed-dialog:not([open]) { display: none; }
.speed-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px 0; }
.speed-head h2 { font-size: 18px; }
.speed-head form { margin: 0; }
.speed-form { display: flex; gap: 8px; padding: 14px 24px; }
.speed-form input { flex: 1; padding: 11px 14px; font: inherit; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); color: var(--text); }
.speed-form input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.speed-form button { padding: 0 22px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 600; }
.speed-tabs { display: flex; gap: 4px; padding: 0 24px; border-bottom: 1px solid var(--border); }
.speed-tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; color: var(--muted); font-weight: 600; }
.speed-tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.speed-body { overflow-y: auto; padding: 20px 24px 28px; display: flex; flex-direction: column; gap: 16px; background: var(--bg); flex: 1; }
.speed-hint { text-align: center; margin: 40px auto; max-width: 520px; }
.small { font-size: 12.5px; }
.ps-loading, .ps-error { text-align: center; padding: 56px 20px; }
.ps-error { color: var(--err); }
.ps-error p { color: var(--text); }
.spinner { width: 38px; height: 38px; margin: 0 auto 14px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ps-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.ps-ask { border: 1px solid var(--accent); color: var(--accent); background: var(--panel); border-radius: 8px; padding: 7px 12px; font-weight: 600; }
.ps-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.ps-card h3 { font-size: 16px; }
.ps-card h4 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 22px 0 8px; }
.cwv { margin: 12px 0 14px; font-size: 15px; }
.cwv.good strong { color: var(--ps-good); } .cwv.poor strong { color: var(--ps-poor); }
.ps-metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 24px; }
.ps-metric { display: flex; gap: 10px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--border); }
.m-label { font-size: 13px; color: var(--muted); }
.m-value { font-size: 24px; font-weight: 600; }
.shape { flex: none; width: 10px; height: 10px; margin-top: 5px; display: inline-block; }
.shape.good { background: var(--ps-good); border-radius: 50%; }
.shape.average { background: var(--ps-avg); }
.shape.poor { width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 10px solid var(--ps-poor); }
.shape.none { background: var(--ps-none); border-radius: 50%; }
.m-value.good, .good { color: var(--ps-good); } .m-value.average { color: var(--ps-avg); } .m-value.poor { color: var(--ps-poor); }
.legend { display: flex; align-items: center; gap: 6px; } .legend .shape { margin: 0 0 0 8px; }
.ps-scores { display: flex; justify-content: space-around; flex-wrap: wrap; gap: 16px; margin-top: 16px; }
.ps-scores a { color: inherit; text-decoration: none; }
.gauge { position: relative; margin: 0; width: var(--size); text-align: center; }
.gauge svg { width: var(--size); height: var(--size); transform: rotate(-90deg); display: block; }
.gauge circle { fill: none; stroke-width: 8; }
.gauge .g-fill { stroke: none; }
.gauge .g-track { stroke: var(--border); }
.gauge .g-arc { stroke-linecap: round; transition: stroke-dashoffset 0.8s ease; }
.gauge.good .g-arc { stroke: var(--ps-good); } .gauge.good .g-fill { fill: color-mix(in srgb, var(--ps-good) 12%, transparent); } .gauge.good .g-num { color: var(--ps-good); }
.gauge.average .g-arc { stroke: var(--ps-avg); } .gauge.average .g-fill { fill: color-mix(in srgb, var(--ps-avg) 12%, transparent); } .gauge.average .g-num { color: var(--ps-avg); }
.gauge.poor .g-arc { stroke: var(--ps-poor); } .gauge.poor .g-fill { fill: color-mix(in srgb, var(--ps-poor) 12%, transparent); } .gauge.poor .g-num { color: var(--ps-poor); }
.g-num { position: absolute; top: 0; left: 0; width: var(--size); height: var(--size); display: flex; align-items: center; justify-content: center; font-size: calc(var(--size) * 0.3); font-weight: 600; }
.gauge figcaption { margin-top: 8px; font-size: 13.5px; }
.ps-perf { display: flex; gap: 32px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.ps-perf-score { flex: 1 1 300px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.ps-shot { border: 1px solid var(--border); border-radius: 8px; max-height: 300px; }
.ps-shot.mobile { max-width: 180px; } .ps-shot.desktop { max-width: 340px; }
.filmstrip { display: flex; gap: 6px; overflow-x: auto; margin-top: 16px; padding-bottom: 4px; }
.filmstrip figure { margin: 0; text-align: center; flex: none; }
.filmstrip img { height: 90px; border: 1px solid var(--border); border-radius: 4px; display: block; }
.filmstrip figcaption { font-size: 11px; color: var(--muted); }
.audits { border-top: 1px solid var(--border); }
.audit { border-bottom: 1px solid var(--border); }
.audit summary { display: flex; align-items: flex-start; gap: 10px; padding: 11px 4px; cursor: pointer; list-style: none; flex-wrap: wrap; }
.audit summary::-webkit-details-marker { display: none; }
.audit summary:hover { background: var(--panel-2); }
.a-title { flex: 1 1 300px; }
.a-title code, .audit p code { font-size: 12px; }
.a-display { color: var(--muted); font-size: 13px; }
.a-save { color: var(--ps-poor); font-size: 13px; font-weight: 600; }
.audit p { margin: 0 0 12px 20px; color: var(--muted); font-size: 13.5px; }
.ps-cat-head { display: flex; align-items: center; gap: 16px; }
.speed-dialog { --ps-good: #3fcf8e; --ps-avg: #ffa94d; --ps-poor: #ff6b6b; --ps-none: #8b949e; }

/* ---------- General assistant: project card, suggestions, attachments, inline approvals, changes ---------- */
.project { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; font-size: 13px; }
.project p { margin: 0 0 4px; }
.proj-name { font-weight: 700; font-size: 14px; }
.proj-actions { display: flex; gap: 14px; margin-top: 8px; }
.link.danger { color: var(--err); }
.howto { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; display: flex; flex-direction: column; gap: 6px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }
.suggestions button { border: 1px solid var(--border); background: var(--panel); color: var(--text); border-radius: 999px; padding: 7px 14px; font-size: 13px; }
.suggestions button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.composer { align-items: flex-end; }
.composer-main { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.composer-main textarea { width: 100%; }
.attachments { display: flex; gap: 8px; flex-wrap: wrap; }
.attachments:empty { display: none; }
.thumb { position: relative; }
.thumb img { height: 56px; border-radius: 6px; border: 1px solid var(--border); display: block; }
.thumb button { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: var(--err); color: #fff; font-size: 13px; line-height: 1; padding: 0; }
.attach { display: flex; align-items: center; justify-content: center; width: 42px; height: 42px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-size: 18px; background: var(--bg); }
.attach:hover { border-color: var(--accent); }
.composer #send { height: 42px; }
.msg.user .att { max-height: 160px; max-width: 100%; border-radius: 6px; display: block; margin-bottom: 6px; }
.msg.user::before { content: none; }
.notes:empty, .approvals-inline:empty { display: none; }
.notes { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.note { color: var(--muted); font-size: 13px; border-left: 2px solid var(--border); padding-left: 10px; }
.note > :first-child { margin-top: 0; } .note > :last-child { margin-bottom: 0; }
.approvals-inline { margin: 8px 0; }
.approvals-inline .approval-card { max-width: 720px; }
.approve-actions { display: flex; gap: 8px; }
.approve-actions button { border: 0; border-radius: 8px; padding: 7px 16px; font-weight: 600; }
.approve-actions .approve { background: var(--ok); color: #0d1117; }
.approve-actions .reject { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }
.resolution p { display: inline; margin: 0; }
.timeline.flat .ev { list-style: none; }
.changed { list-style: none; margin: 8px 0 12px; padding: 0; font-size: 12.5px; display: flex; flex-direction: column; gap: 4px; }
.st { display: inline-block; min-width: 64px; font-size: 11px; text-transform: uppercase; color: var(--muted); }
.st-new, .st-A { color: var(--ok); } .st-D { color: var(--err); } .st-M { color: var(--warn); }
.diff .file { color: var(--text); font-weight: 600; } .diff .hunk { color: var(--accent); }
#tab-changes .diff { max-height: none; font-size: 12px; }
/* Approval cards inside the dark chat area: keep text readable. */
.conversation .approval-card { background: rgb(230 166 64 / 0.12); border-color: #e6a640; color: var(--text); }
.conversation .approval-card.approved { background: rgb(63 185 80 / 0.12); border-color: var(--accent); }
.conversation .approval-card.rejected, .conversation .approval-card.failed { background: var(--panel-2); border-color: var(--border); }
.conversation .approval-card code, .conversation .approval-card pre { color: var(--text); }

/* ---------- Vercel version: login, agents, conversations, files, monitor, team ---------- */
.login-page { display: grid; place-items: center; min-height: 100vh; background: #0d1117; color: #e6edf3; }
.login-card { width: min(380px, 92vw); background: #161b22; border: 1px solid #2a313c; border-radius: 14px; padding: 32px; }
.login-card .logo { height: 38px; margin-bottom: 18px; }
.login-card h1 { font-size: 22px; margin-bottom: 6px; }
.login-card form { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
.login-card label, .stack-form label, .form-dialog label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.login-card input, .form-dialog input, .form-dialog textarea, .form-dialog select, .inline-form input {
  font: inherit; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
.login-card button, .form-dialog button[type="submit"], .inline-form button, .actions-cell button:not(.link) {
  border: 0; border-radius: 8px; padding: 10px 16px; font-weight: 600; background: var(--accent); color: #0d1117;
}
.inline-form button.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }
.user-menu { display: flex; gap: 14px; align-items: center; font-size: 13px; }
.new-chat { width: 100%; padding: 10px; border-radius: 10px; border: 1px dashed var(--accent); background: transparent; color: var(--accent); font-weight: 600; }
.agent-list { display: flex; flex-direction: column; gap: 6px; }
.agent-list button { text-align: left; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); border-radius: 10px; padding: 9px 11px; }
.agent-list button:hover { border-color: var(--accent); }
.agent-list strong { display: block; font-size: 13px; }
.agent-list small { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.35; margin-top: 2px; }
.history h2 { display: flex; justify-content: space-between; align-items: center; }
.scope { display: flex; gap: 2px; }
.scope button { background: none; border: 0; color: var(--muted); font-size: 11px; padding: 2px 6px; border-radius: 6px; text-transform: none; }
.scope button.active { background: var(--panel-2); color: var(--text); }
.conversations { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.conv { width: 100%; text-align: left; background: none; border: 0; padding: 7px 8px; border-radius: 8px; color: var(--text); }
.conv:hover, .conv.active { background: var(--panel-2); }
.conv-title { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv small { color: var(--muted); font-size: 11px; }
.conv-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 24px; border-bottom: 1px solid var(--border); }
.conv-head h2 { font-size: 15px; }
.conv-actions { display: flex; gap: 10px; align-items: center; }
.stop { border: 1px solid var(--err); color: var(--err); background: transparent; border-radius: 8px; padding: 5px 12px; }
.run-state.warn { color: #e6a640; }
.center { text-align: center; }
.small { font-size: 12.5px; }
.steps { color: var(--muted); font-size: 12.5px; max-width: 860px; }
.steps summary { cursor: pointer; }
.steps ul { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 3px; }
.steps li.err { color: var(--err); }
.steps li.pending::marker { content: "… "; }
.decision { max-width: 860px; font-size: 13px; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border); }
.decision.approved { border-color: var(--accent); }
.decision p { display: inline; margin: 0; }
.conversation .approval-card { background: rgb(230 166 64 / 0.12); border: 1px solid #e6a640; color: var(--text); border-radius: 10px; padding: 12px 14px; max-width: 860px; }
.approval-card .md { max-height: 320px; overflow: auto; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.gallery a { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); text-decoration: none; }
.gallery img { width: 100%; height: 110px; object-fit: cover; object-position: top; border-radius: 6px; border: 1px solid var(--border); }
.file-list { padding-left: 18px; font-size: 13px; }
.form-dialog { max-width: 560px; }
.wide-dialog { max-width: 1100px; width: 94vw; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.dialog-head .close { float: none; }
#agent-fields { display: flex; flex-direction: column; gap: 14px; margin: 16px 0; }
.dialog-actions { display: flex; justify-content: flex-end; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.inline-form input { flex: 1 1 220px; }
.grid.sites td { vertical-align: top; font-size: 13px; }
.grid.sites tr.alert td:first-child { border-left: 3px solid var(--err); }
.alerts { margin: 6px 0 0; padding-left: 16px; color: var(--err); font-size: 12px; }
.actions-cell { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.bad { color: var(--err); font-weight: 600; }
.team-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.stack-form { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.stack-form h3 { font-size: 14px; }
.repo-pick { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.repo-pick[hidden] { display: none; }
.repo-pick select, .form-dialog select { font: inherit; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.settings-block { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 14px; }
.settings-block h3 { font-size: 14px; margin-bottom: 8px; }
.settings-block .row { display: grid; grid-template-columns: 1fr 1fr 120px; gap: 10px; }
.team-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.button-link { display: inline-block; padding: 8px 14px; border-radius: 8px; background: var(--accent); color: #0d1117; font-weight: 600; text-decoration: none; }
.note { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px; font-size: 13px; }
.note .copy { width: 100%; margin-top: 6px; font: 12px var(--mono); padding: 6px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px; }
.login-card .link { background: none; color: var(--muted); font-weight: 400; padding: 0; }
