:root {
  --bg: #0e1116;
  --panel: #171c24;
  --panel-2: #1f262f;
  --line: #2b333d;
  --text: #e6edf3;
  --muted: #9aa7b4;
  --accent: #4da3ff;
  --warn: #ffb020;
  --danger: #ff5c5c;
  --ok: #3fb950;
  --phase-a: #ff6b6b;
  --phase-b: #ffd166;
  --phase-c: #4dd0e1;
  --phase-n: #b085f5;
}

* { box-sizing: border-box; }

/* Global button baseline + reusable .btn */
button { font-family: inherit; }
.btn {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 14px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.btn:hover { border-color: var(--accent); background: #10233a; color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn + .btn { margin-left: 8px; }

/* Collapsible panels */
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; user-select: none; }
.panel-head h3 { margin: 0; }
.panel-head .head-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
/* "showing N of M channels" note in the waveforms panel header. */
.wave-note { color: var(--muted); font-size: 12px; }
.chev { color: var(--muted); font-size: 11px; transition: transform 0.15s; }
.collapsible.collapsed .chev { transform: rotate(-90deg); }
.collapsible .panel-body { margin-top: 12px; }
.collapsible.collapsed .panel-body { display: none; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }

.topbar-right { display: flex; align-items: center; gap: 14px; }

.lang-toggle button {
  background: var(--panel-2);
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 4px 10px;
  cursor: pointer;
  font-weight: 600;
}
.lang-toggle button:first-child { border-radius: 6px 0 0 6px; }
.lang-toggle button:last-child { border-radius: 0 6px 6px 0; border-left: none; }
.lang-toggle button.active { background: var(--accent); color: #04101f; border-color: var(--accent); }

.badge {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.badge.live { color: var(--ok); border-color: var(--ok); }
.badge.mock { color: var(--warn); border-color: var(--warn); }
/* Approximate-topology caption on the one-line diagram panel: informational
 * amber, calm (no glow, tinted background instead of a hot border). */
.badge.approx { color: var(--warn); border-color: rgba(255, 176, 32, 0.45); background: rgba(255, 176, 32, 0.08); }

.layout { display: grid; grid-template-columns: 280px 1fr; height: calc(100vh - 53px); }

.sidebar { background: var(--panel); border-right: 1px solid var(--line); padding: 16px; overflow-y: auto; }
.sidebar h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 10px; }

.record-list { list-style: none; margin: 0 0 20px; padding: 0; }
.record-list li {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  background: var(--panel-2);
}
.record-list li:hover { border-color: var(--accent); }
.record-list li.active { border-color: var(--accent); background: #10233a; }
.record-list .rid { font-weight: 600; font-family: ui-monospace, monospace; font-size: 13px; }
.record-list .rlabel { color: var(--muted); font-size: 12px; margin-top: 3px; line-height: 1.4; }
.tag-row { display: flex; align-items: center; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.record-list .tag { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; padding: 1px 6px; border-radius: 4px; display: inline-block; }
.tag.real { background: #10331c; color: var(--ok); }
.tag.synthetic { background: #33280f; color: var(--warn); }
/* Neutral slate "N IEDs" multi-device chip. */
.ied-chip { font-size: 10px; font-weight: 700; letter-spacing: 0.04em; padding: 1px 6px; border-radius: 4px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); font-family: ui-monospace, monospace; }

/* Monospace helper (relay ids, device pills). */
.mono { font-family: ui-monospace, monospace; }

/* Device pill: a neutral monospace relay id used in the SOE + tabs + evidence. */
.dev-pill { display: inline-block; font-family: ui-monospace, monospace; font-size: 11px; padding: 1px 7px; border-radius: 5px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }

.hint { color: var(--muted); font-size: 12px; line-height: 1.5; border-top: 1px solid var(--line); padding-top: 12px; }

.content { padding: 20px 24px; overflow-y: auto; }
.empty { display: flex; height: 100%; align-items: center; justify-content: center; color: var(--muted); }
.hidden { display: none !important; }

.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.detail-head h1 { font-size: 20px; margin: 0 0 4px; }
.meta { color: var(--muted); margin: 0; font-size: 13px; }

.primary {
  background: var(--accent);
  color: #04101f;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.primary:disabled { opacity: 0.6; cursor: default; }

/* Station overview */
.ov-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ov-head h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.ov-meta { color: var(--muted); font-size: 12px; font-family: ui-monospace, monospace; }
.ov-summary { line-height: 1.6; margin: 10px 0 16px; max-width: 90ch; }
.ov-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 8px; }
.ov-schematic { background: #0b0e12; border: 1px solid var(--line); border-radius: 8px; padding: 14px 14px 8px; margin-bottom: 16px; }
#plant-diagram { overflow-x: auto; }

/* Active relay's equipment detail inside the merged station-overview panel. */
.ov-device { border-top: 1px solid var(--line); padding-top: 14px; }
.ov-device-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.ov-device .ov-summary { margin: 8px 0 14px; }

/* Interactive SVG one-line diagram. */
.oneline { width: 100%; height: auto; max-height: 260px; display: block; }
.oneline .pd-edge { fill: none; stroke: var(--muted); stroke-width: 1.5; }
.oneline .pd-backdrop { fill: #0b0e12; stroke: none; }
.oneline .pd-glyph { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.oneline .pd-glyph-fill { fill: var(--muted); stroke: none; }
.oneline .pd-bus { stroke: var(--text); stroke-width: 4; stroke-linecap: round; }
.oneline .pd-sym { fill: var(--text); font-size: 15px; font-weight: 700; text-anchor: middle; font-family: "Segoe UI", system-ui, sans-serif; }
.oneline .pd-sym.sm { font-size: 11px; font-weight: 600; }
.oneline .pd-label { fill: var(--muted); font-size: 10.5px; text-anchor: middle; font-variant: small-caps; letter-spacing: 0.04em; font-family: "Segoe UI", system-ui, sans-serif; }

/* Device badges: rounded pill, monospace relay id, dashed connector. */
.oneline .pd-connector { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.oneline .pd-badge-box { fill: var(--panel-2); stroke: var(--line); stroke-width: 1; }
.oneline .pd-badge-text { fill: var(--text); font-size: 11px; text-anchor: middle; font-family: ui-monospace, monospace; }
.oneline .pd-badge-g { cursor: pointer; }
.oneline .pd-badge-g:hover .pd-badge-box { stroke: var(--accent); }
.oneline .pd-badge-g.ghost { cursor: default; opacity: 0.4; }
.oneline .pd-badge-g.ghost:hover .pd-badge-box { stroke: var(--line); }

/* Post-analysis: amber "operated" ring on devices whose elements asserted. */
.oneline .pd-badge-g.asserted .pd-badge-box { stroke: var(--warn); stroke-width: 1.6; filter: drop-shadow(0 0 4px rgba(255,176,32,0.55)); }
.oneline .pd-badge-g.asserted .pd-badge-text { fill: var(--warn); }
/* Post-analysis: red outline + pulse on the fault-zone node. */
.oneline .pd-node-g.faultzone .pd-glyph { stroke: var(--danger); stroke-width: 2; animation: zonepulse 1.6s ease-in-out infinite; }
.oneline .pd-node-g.faultzone .pd-bus { stroke: var(--danger); animation: zonepulse 1.6s ease-in-out infinite; }
.oneline .pd-faultcap { fill: var(--danger); font-size: 9px; font-weight: 700; letter-spacing: 0.08em; text-anchor: middle; font-family: ui-monospace, monospace; }
@keyframes zonepulse { 0%, 100% { filter: drop-shadow(0 0 0 rgba(255,92,92,0)); } 50% { filter: drop-shadow(0 0 5px rgba(255,92,92,0.7)); } }
.ov-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .ov-cols { grid-template-columns: 1fr; } }
.ov-list { list-style: none; margin: 0; padding: 0; }
.ov-list li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.ov-list li:last-child { border-bottom: none; }
.ov-list li b { color: var(--text); margin-right: 6px; }
.ov-list li code { background: var(--panel-2); border: 1px solid var(--line); padding: 0 5px; border-radius: 4px; font-size: 11px; color: var(--muted); }
.ov-list li .ansi { color: var(--warn); font-size: 11px; font-family: ui-monospace, monospace; }
.ov-list li span { display: block; color: var(--muted); font-size: 12px; line-height: 1.5; margin-top: 3px; }

.panels { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; }
@media (max-width: 980px) { .panels { grid-template-columns: 1fr; } }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
/* Uniform vertical rhythm between the page-level sections. */
.detail > .panel { margin-bottom: 16px; }
.panel h3 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

canvas { width: 100%; height: auto; background: #0b0e12; border-radius: 6px; border: 1px solid var(--line); }
#wave { cursor: crosshair; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.legend i { width: 12px; height: 3px; border-radius: 2px; display: inline-block; flex: none; }
/* Long (e.g. Chinese substation) channel ids truncate; full id in the title. */
.legend .lg-name { max-width: 30ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Digital (0/1 step lane) legend swatch: hollow bar in the trace colour. */
.legend i.lg-step { height: 7px; background: transparent; border: 1.5px solid; border-radius: 2px; }

/* Waveform channel picker: pick which of the record's channels are plotted. */
.cp-toggle { padding: 4px 10px; font-size: 12px; }
.cp-toggle.open { border-color: var(--accent); background: #10233a; color: var(--text); }
.chan-picker { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin: 2px 0 14px; }
.cp-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.cp-filter { flex: 1 1 180px; min-width: 140px; background: #0b0e12; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; color: var(--text); font-size: 12.5px; font-family: inherit; }
.cp-filter:focus { outline: none; border-color: var(--accent); }
/* Cap note: informational amber, styled like the approx-topology badge. */
.cp-note { font-size: 11px; padding: 2px 8px; border-radius: 999px; color: var(--warn); border: 1px solid rgba(255, 176, 32, 0.45); background: rgba(255, 176, 32, 0.08); white-space: nowrap; }
.cp-error { font-size: 12px; color: var(--danger); }
.cp-spacer { flex: 1; }
.cp-top .btn { padding: 6px 12px; font-size: 12.5px; }
.cp-top .btn:disabled { opacity: 0.5; cursor: default; }
.cp-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 900px) { .cp-cols { grid-template-columns: 1fr; } }
.cp-col-head { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 6px; }
.cp-count { font-family: ui-monospace, monospace; color: var(--text); letter-spacing: 0; }
/* Bounded, scrollable checkbox lists — real records carry 96+ channels. */
.cp-list { max-height: 240px; overflow-y: auto; background: #0b0e12; border: 1px solid var(--line); border-radius: 6px; padding: 4px; }
.cp-item { display: flex; align-items: center; gap: 7px; padding: 3px 7px; border-radius: 4px; font-size: 12px; cursor: pointer; }
.cp-item:hover { background: var(--panel-2); }
.cp-item input { flex: none; margin: 0; accent-color: var(--accent); }
/* Long (GBK) channel ids truncate; the full id lives in the label's title. */
.cp-item .cp-id { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cp-item .cp-sub { color: var(--muted); flex: none; font-size: 11px; }
.cp-item.cp-off { opacity: 0.45; cursor: default; }
.cp-item.cp-hidden { display: none; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0 8px 16px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 12px; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.timeline li.status-change::before { background: var(--warn); }
.timeline .dev-pill { margin-right: 8px; }
.timeline .t { font-family: ui-monospace, monospace; color: var(--accent); font-size: 12px; }
.timeline .d { display: block; margin-top: 3px; overflow-wrap: anywhere; }
.timeline li .ref { overflow-wrap: anywhere; }

/* Device switcher: chip buttons inside the waveforms panel, styled like the
 * event-list cards (panel-2 base, accent border + tinted bg when active). */
.device-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 14px; }
.device-tab {
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 12px; cursor: pointer; font-weight: 600;
  font-size: 12.5px; display: inline-flex; align-items: center; gap: 8px;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.device-tab:hover { border-color: var(--accent); }
.device-tab { max-width: 100%; }
.device-tab .tab-name { max-width: 28ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device-tab .mono { color: var(--text); font-size: 12px; }
.device-tab.active { background: #10233a; border-color: var(--accent); color: var(--text); }
.device-tab.active .mono { color: var(--accent); }
.device-tab .tab-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 6px var(--warn); }
#device-body .panel { margin-bottom: 16px; }

.report { margin-top: 20px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; }
.report-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.report-head h3 { margin: 0; font-size: 14px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.report h4 { margin: 16px 0 6px; font-size: 13px; color: var(--accent); }
.report .headline { font-size: 18px; font-weight: 700; margin: 6px 0 12px; }
.report .classify { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 14px; }
.report .classify .pill { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); }
.report .classify .pill.hit { color: var(--danger); border-color: var(--danger); background: #331014; }
.report .classify .pill.ok { color: var(--ok); border-color: var(--ok); background: #10331c; }
.report .classify .pill.zone { color: var(--muted); border-color: var(--line); background: var(--panel-2); font-weight: 600; }
.report .classify .pill.zone b { color: var(--muted); font-weight: 700; }
.report .classify .pill.zone.hit { color: var(--danger); border-color: var(--danger); background: #331014; }
.report .classify .pill.zone.hit b { color: var(--danger); }
.report .classify .cls { font-size: 13px; color: var(--muted, var(--text)); }
.report .classify .cls b { color: var(--accent); font-weight: 600; }
.report p { line-height: 1.6; margin: 0; }
.report ol { line-height: 1.6; padding-left: 20px; margin: 6px 0 0; }
.report .conf { text-transform: capitalize; }
.report .sources { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.report .sources code { background: var(--panel-2); border: 1px solid var(--line); padding: 2px 8px; border-radius: 6px; font-size: 12px; color: var(--muted); }

.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #04101f; border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Clickable sources and timeline events */
.report .sources code, .report .sources .src { cursor: pointer; transition: border-color 0.15s, color 0.15s; }
.report .sources .src:hover { border-color: var(--accent); color: var(--text); }
.report .sources .src.doc::before { content: "\1F4C4  "; }
.report .sources .src.evidence::before { content: "\1F4C8  "; }
.src-group-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 12px 0 4px; }
.timeline li.clickable { cursor: pointer; }
.timeline li.clickable:hover .d { color: var(--accent); }
.timeline li .ref { font-size: 11px; color: var(--muted); }

/* Drawer */
.drawer-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: min(680px, 92vw);
  background: var(--panel); border-left: 1px solid var(--line); z-index: 50;
  display: flex; flex-direction: column; box-shadow: -12px 0 32px rgba(0,0,0,0.4);
}
.drawer.hidden, .drawer-overlay.hidden { display: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { margin: 0; font-size: 15px; min-width: 0; overflow-wrap: anywhere; }
.drawer-close { background: none; border: none; color: var(--muted); font-size: 24px; line-height: 1; cursor: pointer; }
.drawer-close:hover { color: var(--text); }
.drawer-body { padding: 18px 20px; overflow-y: auto; }

.evidence-explain { background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 6px; padding: 12px 14px; line-height: 1.55; margin-bottom: 16px; }
.evidence-explain b { color: var(--text); }
.evidence-meta { color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.log-table { width: 100%; border-collapse: collapse; font-family: ui-monospace, monospace; font-size: 12px; }
.log-table th, .log-table td { padding: 5px 8px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.log-table th { color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--panel); }
/* Long channel-id headers wrap inside a bounded column instead of forcing a
 * huge table; the full id is in the header's title attribute. */
.log-table th { white-space: normal; overflow-wrap: anywhere; max-width: 130px; min-width: 56px; vertical-align: bottom; }
/* The column the timeline event refers to. */
.log-table th.evcol { color: var(--accent); }
.log-table td.evcol { box-shadow: inset 2px 0 0 var(--accent); }
.log-table td:first-child, .log-table th:first-child { text-align: left; color: var(--muted); }
.log-table tr.hit td { background: #10233a; color: var(--text); }
.log-table tr.hit td:first-child { color: var(--accent); font-weight: 700; }
.log-table .status-on { color: var(--warn); font-weight: 700; }
.raw-log { margin-top: 16px; }
.raw-log pre { background: #0b0e12; border: 1px solid var(--line); border-radius: 6px; padding: 12px; overflow-x: auto; font-size: 11.5px; line-height: 1.5; }
.raw-log pre .hit { color: var(--accent); font-weight: 700; }
.raw-log .cap { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.cols-note { color: var(--muted); font-size: 12px; margin-top: 6px; }
/* Binary records have no text .dat to show; explain where the table came from. */
.binary-note { margin-top: 16px; background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--warn); border-radius: 6px; padding: 10px 14px; color: var(--muted); font-size: 12.5px; line-height: 1.5; }

.doc-md { line-height: 1.6; }
.doc-md h1 { font-size: 18px; margin: 0 0 10px; }
.doc-md h2 { font-size: 15px; color: var(--accent); margin: 18px 0 6px; }
.doc-md h3 { font-size: 13px; margin: 14px 0 4px; }
.doc-md code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.doc-md ul, .doc-md ol { padding-left: 20px; }
.doc-md .kw { color: var(--muted); font-size: 12px; }

/* Debug button + panel */
.report-head { position: relative; }
.ghost-btn { margin-left: auto; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; font-size: 12px; cursor: pointer; }
.ghost-btn:hover { border-color: var(--accent); color: var(--text); }
.ghost-btn.hidden { display: none; }
.dbg-meta { display: flex; gap: 18px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.dbg-meta b.live { color: var(--ok); }
.dbg-meta b.mock { color: var(--warn); }
.dbg-sec { margin-top: 16px; }
.dbg-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 6px; display: flex; align-items: center; gap: 10px; }
.dbg-label .role { text-transform: none; letter-spacing: 0; background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; color: var(--accent); font-size: 11px; }
.dbg-pre { background: #0b0e12; border: 1px solid var(--line); border-radius: 6px; padding: 12px; overflow-x: auto; font-size: 11.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; max-height: 42vh; overflow-y: auto; }
.sources .dim { color: var(--muted); font-size: 11px; }
/* Investigation trace (agentic tool calls) in the debug panel. */
.trace-list { display: flex; flex-direction: column; gap: 8px; }
.trace-list .dim { color: var(--muted); font-size: 12.5px; }
.trace-item { border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); padding: 8px 10px; }
.trace-line { font-size: 12.5px; color: var(--muted); }
.trace-line b { color: var(--accent); font-family: ui-monospace, monospace; }
.trace-args { display: block; margin-top: 6px; background: #0b0e12; border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; font-size: 11.5px; line-height: 1.5; color: var(--text); white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, monospace; }

/* Follow-up chat */
.chat { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; }
.chat.hidden { display: none; }
.chat h4 { margin: 0 0 10px; font-size: 13px; color: var(--accent); }
.chat-log { display: flex; flex-direction: column; gap: 10px; max-height: 340px; overflow-y: auto; margin-bottom: 12px; }
.chat-log:empty { display: none; }
.bubble { max-width: 82%; padding: 9px 13px; border-radius: 12px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.bubble.user { align-self: flex-end; background: #10233a; border: 1px solid #1d3a5c; border-bottom-right-radius: 3px; }
.bubble.assistant { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--line); border-bottom-left-radius: 3px; }
.bubble.pending { color: var(--muted); }
.bubble .doc-md p { margin: 0 0 8px; }
.bubble .doc-md p:last-child, .bubble .doc-md ul:last-child, .bubble .doc-md ol:last-child { margin-bottom: 0; }
.bubble .doc-md ul, .bubble .doc-md ol { margin: 6px 0; }
.bubble .doc-md h1, .bubble .doc-md h2, .bubble .doc-md h3 { margin: 8px 0 4px; }
.chat-form { display: flex; gap: 10px; }
.chat-form input {
  flex: 1; background: #0b0e12; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 14px; color: var(--text); font-size: 14px; font-family: inherit;
}
.chat-form input:focus { outline: none; border-color: var(--accent); }
.chat-form .primary { padding: 10px 18px; }

/* "+N more" tail of capped station-overview lists (real records have 100s of channels). */
.ov-list .ov-more { color: var(--muted, #8b98a9); font-style: italic; list-style: none; }
