/* Agent Proof dashboard. Light and dark follow the system setting. */
:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --border: #e3e6eb;
  --text: #1b1f27;
  --muted: #6b7280;
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --err: #dc2626;
  --err-soft: #fdecec;
  --ok: #059669;
  --ok-soft: #e6f6f0;
  --warn: #b45309;
  --warn-soft: #fdf3e2;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  --s0: #6366f1; --s1: #0ea5e9; --s2: #10b981; --s3: #f59e0b;
  --s4: #ec4899; --s5: #8b5cf6; --s6: #14b8a6; --s7: #f97316;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #161a21;
    --surface-2: #1d222b;
    --border: #2a303b;
    --text: #e6e8ec;
    --muted: #8b93a1;
    --accent: #818cf8;
    --accent-soft: #23264a;
    --err: #f87171;
    --err-soft: #3a1d1f;
    --ok: #34d399;
    --ok-soft: #12302a;
    --warn: #fbbf24;
    --warn-soft: #3a2e15;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; font-weight: 600; margin: 4px 0 16px; }
h2 { font-size: 16px; margin: 0; }
h3 { font-size: 13px; font-weight: 600; margin: 0 0 8px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12px; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.err { color: var(--err); font-weight: 600; }
.ok { color: var(--ok); font-weight: 600; }
.note { margin-top: 12px; font-size: 12px; }
.empty { padding: 24px 0; }
.error { background: var(--err-soft); color: var(--err); padding: 12px 14px; border-radius: 8px; }

/* header */
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.logo { width: 18px; height: 18px; border-radius: 5px; background: linear-gradient(135deg, var(--s0), var(--s1)); }
#tabs { display: flex; gap: 12px; align-items: center; }
#tabs a { padding: 6px 12px; border-radius: 6px; color: var(--muted); font-weight: 500; }
#tabs a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.view-pick { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 600; }
.view-pick select { font-weight: 600; min-width: 250px; border-color: var(--accent); }
.filters { display: flex; gap: 12px; align-items: center; margin-left: auto; flex-wrap: wrap; }
.filters label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.filters .check { gap: 4px; }
select, button, .button {
  font: inherit; font-size: 13px; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 5px 10px; cursor: pointer;
}
button:hover, .button:hover { background: var(--surface-2); text-decoration: none; }
button:disabled { opacity: 0.6; cursor: default; }
.button { display: inline-block; color: var(--text); }

main { padding: 20px; max-width: 1400px; margin: 0 auto; }

/* tables */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: auto; box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
thead th { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
table.kv th { width: 34%; font-weight: 500; color: var(--muted); font-size: 12px; background: none; }
table.kv td, table.kv th { padding: 5px 8px; }

/* chips and badges */
.chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; color: #fff; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-pending { background: var(--surface-2); color: var(--muted); }
.badge-batched { background: var(--warn-soft); color: var(--warn); }
.badge-anchored { background: var(--accent-soft); color: var(--accent); }
.badge-verified { background: var(--ok-soft); color: var(--ok); }
.svc-0 { background: var(--s0); } .svc-1 { background: var(--s1); } .svc-2 { background: var(--s2); }
.svc-3 { background: var(--s3); } .svc-4 { background: var(--s4); } .svc-5 { background: var(--s5); }
.svc-6 { background: var(--s6); } .svc-7 { background: var(--s7); }

/* trace waterfall */
.trace-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.kv-inline { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; color: var(--muted); }
.waterfall { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }
.wf-row { display: grid; grid-template-columns: minmax(220px, 30%) 1fr 230px; align-items: center; min-height: 32px; border-bottom: 1px solid var(--border); }
.wf-row:last-child { border-bottom: none; }
.wf-row.clickable { cursor: pointer; }
.wf-row.clickable:hover, .wf-row.selected { background: var(--surface-2); }
.wf-axis { background: var(--surface-2); font-size: 11px; color: var(--muted); font-weight: 600; min-height: 26px; }
.wf-name { display: flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; padding-right: 8px; }
.wf-label { overflow: hidden; text-overflow: ellipsis; }
.wf-track { position: relative; height: 100%; min-height: 26px; margin-right: 12px; }
.wf-tick { position: absolute; top: 6px; transform: translateX(-50%); }
.wf-tick:first-child { transform: none; }
.wf-tick:last-child { transform: translateX(-100%); }
.wf-bar { position: absolute; top: 9px; height: 14px; border-radius: 3px; opacity: 0.9; }
.wf-bar-err { background: var(--err); }
.wf-dur { position: absolute; top: 8px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.wf-proof { padding-right: 10px; display: flex; gap: 4px; justify-content: flex-end; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.dot-err { background: var(--err); }
.back { font-weight: 500; }

/* side panel */
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); z-index: 10; overflow: auto;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
}
.panel[hidden] { display: none; }
.panel-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; background: var(--surface); border-bottom: 1px solid var(--border); }
.panel-head button { font-size: 18px; line-height: 1; padding: 2px 10px; }
#panel-body { padding: 4px 18px 24px; }
.panel-section { padding: 14px 0; border-bottom: 1px solid var(--border); }
.panel-section:last-child { border-bottom: none; }
.content-key { font-size: 12px; font-weight: 600; margin: 8px 0 4px; }
pre.content { margin: 0; padding: 10px; background: var(--surface-2); border-radius: 6px; font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow: auto; }
.content-erased, .content-hidden { font-style: italic; }
.proof-status { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 4px; }
.verify-result p { margin: 6px 0; }

/* overview */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; box-shadow: var(--shadow); }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value { font-size: 24px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 12px; }
svg.chart { width: 100%; height: auto; display: block; }
svg.chart .grid { stroke: var(--border); stroke-width: 1; }
svg.chart .axis { fill: var(--muted); font-size: 10px; }
svg.chart .bar.c-req { fill: var(--accent); }
svg.chart .bar.c-err { fill: var(--err); }
svg.chart .line { fill: none; stroke-width: 2; }
svg.chart .line.c-lat { stroke: var(--s3); }
svg.chart .pt.c-lat { fill: var(--s3); }

/* sign-in, project switcher, admin */
[hidden] { display: none !important; }
input { font: inherit; font-size: 13px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 5px 10px; }
.user { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; }
.login { max-width: 360px; margin: 64px auto; }
.login form, form.inline { display: flex; flex-direction: column; gap: 10px; }
.login label, form.inline label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
form.inline { flex-direction: row; flex-wrap: wrap; align-items: flex-end; margin: 10px 0; }
form.inline label.check { flex-direction: row; align-items: center; gap: 4px; }
.admin-section { margin-bottom: 24px; }
pre.secret { margin: 8px 0; padding: 10px; background: var(--warn-soft); border-radius: 6px; font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-all; }

/* agents map */
.agents-bar { display: flex; gap: 14px; align-items: center; margin: -6px 0 12px; }
.agents-bar .check { display: flex; align-items: center; gap: 4px; font-size: 13px; }
.agents-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 12px; align-items: start; }
@media (max-width: 1100px) { .agents-layout { grid-template-columns: minmax(0, 1fr); } }
.agents-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.agent-map { position: relative; padding: 8px; min-height: 460px; display: flex; align-items: center; justify-content: center; }
.agent-map > svg { flex: 1 1 auto; }
.empty-map { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.anchor-rows { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
svg.agent-svg { width: 100%; height: auto; display: block; }
.agent-svg text { font-size: 12px; fill: var(--text); }
.agent-svg .node-stats, .agent-svg .edge-label { font-size: 11px; fill: var(--muted); }
.agent-svg .edge-label { paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.agent-svg .err-text { fill: var(--err); }
.agent-svg .node-name { font-weight: 600; }
.agent-svg .node-turns { font-size: 11px; font-weight: 600; fill: var(--accent); }
.agent-svg .edge { fill: none; stroke: var(--muted); opacity: 0.75; }
.agent-svg .edge-err { stroke: var(--err); opacity: 0.85; }
.agent-svg .arrow { fill: var(--muted); }
.agent-svg .arrow-err { fill: var(--err); }
.agent-svg .node-circle { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2; }
.agent-svg .guest-node .node-circle { fill: var(--surface-2); stroke: var(--muted); stroke-dasharray: 3 3; }
.agent-svg .fail-ring { fill: none; stroke: var(--err); stroke-width: 3; }
.agent-svg .agent-node.clickable { cursor: pointer; }
.agent-svg .agent-node.clickable:hover .node-circle, .agent-svg .agent-node:focus .node-circle { stroke-width: 3; }
.agent-svg .agent-node:focus { outline: none; }
.agent-svg .agent-node.visited .node-circle { fill: var(--accent); stroke-width: 4; }
.agent-svg .agent-node.visited .node-turns { fill: var(--surface); }
.agent-svg .agent-node.pulse .node-circle { animation: agent-pulse 0.8s ease-out 2; }
.agent-svg .replay-dot { fill: var(--s3); stroke: var(--surface); stroke-width: 2; }
@keyframes agent-pulse {
  0% { stroke-width: 2; stroke-opacity: 1; }
  50% { stroke-width: 12; stroke-opacity: 0.35; }
  100% { stroke-width: 2; stroke-opacity: 1; }
}
.chain-node {
  position: absolute; top: 10px; left: 10px; max-width: 220px; padding: 8px 10px; font-size: 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
}
.chain-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.chain-node .actions { margin: 6px 0 0; }
.chain-node .verify-result p { margin: 4px 0 0; }
ul.turns { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow: auto; }
ul.turns li { display: flex; flex-direction: column; gap: 1px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
ul.turns li:hover, ul.turns li.selected { background: var(--surface-2); }
ul.turns li.selected { box-shadow: inset 3px 0 0 var(--accent); }
.turn-path { font-size: 12px; word-break: break-word; }
.agent-path { font-size: 13px; color: var(--text); word-break: break-word; }
.agent-path a { display: inline-block; margin-top: 6px; }

/* sessions */
.sessions-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 12px; align-items: start; }
@media (max-width: 1100px) { .sessions-layout { grid-template-columns: minmax(0, 1fr); } }
.sessions-side { min-width: 0; }
.sessions-side ul.turns { max-height: 760px; }
.sessions-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.session-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.session-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.session-head .actions { margin: 0; }
.session-turn-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
#session-turn .kv-inline { margin-top: 6px; }
.convo { display: flex; flex-direction: column; gap: 14px; max-height: 640px; overflow: auto; }
.convo-turn { display: flex; flex-direction: column; gap: 6px; }
.convo-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.convo-head button { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; }
.convo-tool { color: var(--muted); font-family: var(--mono); padding-left: 12px; }
.bubble { max-width: 80%; padding: 8px 12px; border-radius: 10px; }
.bubble-guest { align-self: flex-start; background: var(--surface-2); }
.bubble-agent { align-self: flex-end; background: var(--accent-soft); }
.bubble-who { font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.bubble-text { white-space: pre-wrap; word-break: break-word; }
.player { display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; box-shadow: var(--shadow); }
.player-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.speed { display: inline-flex; margin-left: 8px; }
.speed button { border-radius: 0; margin-left: -1px; }
.speed button:first-child { border-radius: 6px 0 0 6px; }
.speed button:last-child { border-radius: 0 6px 6px 0; }
.speed button.active { background: var(--accent-soft); color: var(--accent); }
.timeline { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 6px 2px; }
.timeline::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 2px solid var(--border); }
.turn-dot { position: relative; width: 14px; height: 14px; padding: 0; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
.turn-dot:hover { background: var(--accent); transform: scale(1.25); }
.turn-dot.failed, .turn-dot.failed:hover { background: var(--err); }
.turn-dot.current { box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 5px var(--accent); }
.turn-dot.failed.current { box-shadow: 0 0 0 3px var(--err-soft), 0 0 0 5px var(--err); }
.anchor-item { padding: 8px 0; border-bottom: 1px solid var(--border); }
.anchor-item:last-child { border-bottom: none; }
.anchor-item .anchor-rows { margin-bottom: 0; }

/* operations: blockchain, nodes & storage, overview health strip */
.warn { color: var(--warn); font-weight: 600; }
.badge-good { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--err-soft); color: var(--err); }
.badge-muted { background: var(--surface-2); color: var(--muted); }
.warn-box { background: var(--warn-soft); color: var(--warn); padding: 8px 10px; border-radius: 6px; margin: 8px 0; font-size: 12px; }
.ops-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.section-title { margin: 20px 0 8px; }
.batch-states { display: flex; flex-direction: column; gap: 6px; }
.batch-state { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pager { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.tx-cell { display: inline-flex; gap: 8px; align-items: center; white-space: nowrap; }
.batch-error { display: inline-block; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.stat-value.warn { color: var(--warn); }
.stat-sub { margin-top: 2px; }
.health-strip .stat-value { font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* client signatures (docs/SIGNING.md) */
.badge-signed { background: var(--ok-soft); color: var(--ok); }
.badge-unsigned { background: var(--surface-2); color: var(--muted); }

/* anchor failover panel (failover.js, docs/FAILOVER.md) */
.sub-title { margin: 12px 0 6px; }
.meters { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 10px 0 6px; }
.meter-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.meter-track { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.meter-fill { display: block; height: 100%; border-radius: 4px; }
.meter-bad { background: var(--err); }
.meter-good { background: var(--ok); }
.meter-muted { background: var(--muted); opacity: 0.5; }
.failover-line { margin: 4px 0; font-size: 13px; }
table.obs th { width: auto; }
.obs-error { font-weight: 400; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.obs td.mono { word-break: normal; white-space: nowrap; }

/* ---------- backend ---------- */
.be-map { margin-bottom: 16px; }
svg.be-svg { width: 100%; height: auto; display: block; }
.be-svg .be-edge { fill: none; stroke: var(--muted); stroke-width: 1.5; opacity: 0.8; }
.be-svg .be-edge.err { stroke: var(--err); }
.be-svg .be-edge.loop { stroke: var(--warn); stroke-dasharray: 6 4; stroke-width: 2; }
.be-svg .be-arrow { fill: var(--muted); }
.be-svg .be-arrow.err { fill: var(--err); }
.be-svg .be-arrow.loop { fill: var(--warn); }
.be-svg .be-edge-label { font-size: 11px; fill: var(--muted); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.be-svg .be-edge-label.err-text { fill: var(--err); }
.be-svg .be-node rect { stroke-width: 1.5; }
.be-svg .be-node.svc rect { stroke: none; }
.be-svg .be-node.svc.svc-0 rect { fill: var(--s0); } .be-svg .be-node.svc.svc-1 rect { fill: var(--s1); }
.be-svg .be-node.svc.svc-2 rect { fill: var(--s2); } .be-svg .be-node.svc.svc-3 rect { fill: var(--s3); }
.be-svg .be-node.svc.svc-4 rect { fill: var(--s4); } .be-svg .be-node.svc.svc-5 rect { fill: var(--s5); }
.be-svg .be-node.svc.svc-6 rect { fill: var(--s6); } .be-svg .be-node.svc.svc-7 rect { fill: var(--s7); }
.be-svg .be-node.svc text { fill: #fff; }
.be-svg .be-node.db rect { fill: var(--ok-soft); stroke: var(--ok); }
.be-svg .be-node.ext rect { fill: var(--surface-2); stroke: var(--border); }
.be-svg .be-node-name { font-size: 12px; font-weight: 600; fill: var(--text); }
.be-svg .be-node-kind { font-size: 9px; fill: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.be-svg .be-node.svc .be-node-kind { fill: rgba(255, 255, 255, 0.8); }
.be-cov { display: flex; flex-direction: column; gap: 4px; }
.badge-traced { background: var(--ok-soft); color: var(--ok); }
.badge-gap { background: var(--err-soft); color: var(--err); }
.badge-untraced { background: var(--warn-soft); color: var(--warn); }
.badge-ext { background: var(--surface-2); color: var(--muted); }

/* Live: conversations as a chat, each turn's steps as small nodes under the guest's message */
.live-bar { display: flex; align-items: center; gap: 10px; margin: -6px 0 12px; flex-wrap: wrap; }
.live-updated { margin-left: auto; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; animation: live-pulse 2s infinite; }
@keyframes live-pulse { 50% { opacity: 0.35; } }
.live-wrap { max-width: 920px; margin: 0 auto; }
.live-chat { max-height: calc(100vh - 210px); overflow: auto; display: flex; flex-direction: column; gap: 18px; padding: 18px 20px; }
.chat-divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.chat-divider::before, .chat-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.chat-turn { display: flex; flex-direction: column; gap: 6px; }
.chat-turn.fresh { animation: chat-in 0.3s ease-out; }
@keyframes chat-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.bubble-left, .bubble-right { max-width: 75%; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; }
.bubble-left { align-self: flex-start; border-bottom-left-radius: 3px; }
.bubble-right { border-bottom-right-radius: 3px; }
.bubble-missing .bubble-text { color: var(--muted); font-style: italic; font-size: 12px; }
.chat-right { align-self: flex-end; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; max-width: 75%; }
.chat-right .bubble-right { max-width: 100%; }
.trail { list-style: none; margin: 0 0 0 14px; padding: 2px 0 2px 14px; border-left: 1px solid var(--border); }
.trail-step { display: flex; align-items: baseline; gap: 8px; padding: 2px 6px; margin-left: -20px; border-radius: 4px; font-size: 12px; cursor: pointer; transition: opacity 0.25s; }
.trail-step:hover { background: var(--surface-2); }
.trail-step.waiting { opacity: 0; }
.trail-step.hit { background: var(--surface-2); }
.trail-step.hit .trail-dot { background: var(--accent); animation: trail-hit 0.7s ease-out; }
@keyframes trail-hit { 0% { box-shadow: 0 0 0 3px var(--surface), 0 0 0 3px var(--accent); } 100% { box-shadow: 0 0 0 3px var(--surface), 0 0 0 9px transparent; } }
.chat-right { transition: opacity 0.3s, transform 0.3s; }
.chat-right.waiting { opacity: 0; transform: translateY(6px); }
.trail-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; align-self: center; box-shadow: 0 0 0 3px var(--surface); }
.trail-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px; }
.trail-time { color: var(--muted); font-size: 11px; word-break: normal; }
.trail-dur { font-size: 11px; }
.trail-step.failed .trail-dot { background: var(--err); }
.trail-step.failed .trail-name { color: var(--err); }
.trail-tail { padding: 2px 0; }
.trail-more { font-size: 11px; padding: 1px 8px; color: var(--muted); }
.trail-none { margin: 0 0 0 16px; }
.chat-note { margin: 0; font-style: italic; }
.chain-line { font-size: 11px; color: var(--muted); background: none; border: 0; padding: 0 2px; }
.chain-line.done { color: var(--ok); }
.chain-line:hover { background: none; text-decoration: underline; }
.step-sentence { font-size: 14px; margin: 0 0 8px; }

/* Blockchain tab: choose the anchor chain */
.chain-chooser { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.chain-chooser.awaiting { border-color: var(--accent); background: var(--accent-soft); }
.chain-options { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.chain-option { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer; background: var(--surface); }
.chain-option.active { border-color: var(--accent); }
.chain-option-state { margin-left: auto; }
.chain-reason { flex: 1; min-width: 220px; font: inherit; font-size: 13px; padding: 5px 8px; border: 1px solid var(--border);
  border-radius: 6px; background: var(--surface); color: var(--text); }
/* Header: one-click chain toggle */
.chain-toggle { display: flex; align-items: center; gap: 0; flex-wrap: wrap; }
.chain-toggle-label { color: var(--muted); font-size: 12px; font-weight: 600; margin-right: 8px; }
.chain-toggle-opt { display: inline-flex; align-items: center; gap: 6px; border-radius: 0; font-weight: 600; color: var(--muted); }
.chain-toggle-opt:first-of-type { border-radius: 6px 0 0 6px; }
.chain-toggle-opt:last-of-type { border-radius: 0 6px 6px 0; margin-left: -1px; }
.chain-toggle-opt .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.chain-toggle-opt.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); position: relative; }
.chain-toggle-opt.on .dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.chain-toggle-opt.on:disabled { opacity: 1; }
.chain-toggle-opt.pending .dot { background: var(--warn); }
.chain-toggle-note { font-size: 12px; margin-left: 8px; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: var(--accent); opacity: 0.9; }
.wallet-lead { margin: 4px 0 12px; }
.wallet-advice { margin: 8px 0; }
.wallet-why { margin-top: 16px; }
.wallet-why ul { margin: 6px 0; padding-left: 18px; }
.wallet-why li { margin: 4px 0; }
