﻿:root {
  color-scheme: dark;
  --bg: #0a0f1a; --panel: #0f1726; --panel-2: #131d2e; --border: #1e2a3d;
  --text: #e6edf7; --muted: #8a97ab; --dim: #7d8aa3; --cyan: #22d3ee;
  --green: #22c55e; --amber: #f59e0b; --red: #ef4444;
  --font-ui: 'Inter', sans-serif; --font-mono: 'JetBrains Mono', monospace;
  /* Compatibility tokens for the existing Cytoscape renderer. */
  --fg: var(--text); --ok: var(--green); --bad: var(--red);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; min-height: 100vh; color: var(--text); font: 12.5px/1.5 var(--font-ui);
  background: radial-gradient(#1b2436 1px, transparent 1px) 0 0/22px 22px, var(--bg);
  display: grid; grid-template-columns: 220px minmax(0, 1fr); grid-template-rows: 56px 1fr;
}
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 30px; line-height: 1.25; font-weight: 700; margin-bottom: 8px; }
h2 { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
h3 { font-size: 14px; font-weight: 600; margin: 16px 0 6px; }
.card-title { font-size: 14px; font-weight: 600; }
.metric-value { font-size: 28px; line-height: 1.2; font-weight: 700; }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.icon-definitions { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.card { border: 1px solid var(--border); border-radius: 6px; background: var(--panel); padding: 16px; min-width: 0; }
.button, #run, #fix {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 34px; padding: 7px 12px; border: 1px solid transparent; border-radius: 4px;
  background: var(--cyan); color: #06222a; font-weight: 600;
}
.primary { background: var(--cyan); color: #06222a; box-shadow: 0 0 14px #22d3ee1f; }
.button.outline { background: transparent; color: var(--text); border-color: var(--border); }
.button.danger { background: #b91c1c; color: var(--text); border-color: var(--red); }
.button:hover, #run:hover, #fix:hover { filter: brightness(1.12); }
.pill { display: inline-block; font: 10px/1.5 var(--font-mono); padding: 2px 8px; border: 1px solid #8a97ab66; background: #8a97ab1f; border-radius: 3px; }
.pill.complete { color: var(--green); border-color: #22c55e66; background: #22c55e1f; }
.pill.flagged { color: var(--amber); border-color: #f59e0b66; background: #f59e0b1f; }
.pill.alert { color: var(--red); border-color: #ef444466; background: #ef44441f; }
.pill.running { color: var(--cyan); border-color: #22d3ee66; background: #22d3ee1f; }
.top-bar { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--border); min-width: 0; z-index: 20; }
.brand { flex: 0 0 194px; display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--cyan); }
.brand > span { min-width: 0; }
.brand strong { display: block; font-size: 12px; line-height: 1.25; font-weight: 600; }
.brand .mono { display: block; color: var(--muted); font-size: 9px; line-height: 1.4; overflow-wrap: anywhere; }
.brand-icon { width: 24px; height: 24px; }
.top-nav { display: flex; align-self: stretch; gap: 16px; min-width: 0; overflow-x: auto; white-space: nowrap; }
.nav-tab { flex: 0 0 auto; padding: 0; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); font-size: 11px; line-height: 1.3; }
.nav-tab.active { border-bottom-color: var(--cyan); color: var(--cyan); }
.search-box { display: flex; flex: 1 1 150px; min-width: 90px; max-width: 210px; align-items: center; gap: 6px; padding: 4px 7px; border: 1px solid var(--border); border-radius: 4px; background: var(--bg); color: var(--muted); }
.search-box .icon { width: 13px; height: 13px; }
.search-box input { width: 100%; min-width: 0; padding: 0; border: 0; background: transparent; color: var(--text); font: 10px var(--font-mono); }
.top-bar > .button { flex-shrink: 0; font-size: 10px; max-width: 130px; line-height: 1.15; }
#acknowledge-all { max-width: 90px; font-size: 9px; }
.toolbar-icons { display: flex; gap: 2px; border-left: 1px solid var(--border); padding-left: 6px; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 30px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); }
.icon-button:hover { color: var(--cyan); background: var(--panel-2); }
.avatar { display: grid; place-items: center; flex: 0 0 30px; height: 30px; font-size: 10px; background: #0891b2; color: #06222a; border-radius: 3px; }
.hamburger { display: none; }
.mobile-overflow { display: none; position: relative; }
.mobile-overflow summary { display: flex; align-items: center; justify-content: center; width: 28px; height: 30px; cursor: pointer; color: var(--muted); list-style: none; }
.mobile-overflow summary::-webkit-details-marker { display: none; }
.overflow-menu { position: absolute; right: 0; top: calc(100% + 6px); width: 200px; padding: 8px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 4px; box-shadow: 0 8px 24px #0006; z-index: 10; }
.overflow-menu .button { width: 100%; font-size: 11px; }
.sidebar { grid-column: 1; grid-row: 2; display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 12px; border-right: 1px solid var(--border); background: var(--panel); }
.controller-card { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--panel-2); }
.controller-card .icon { width: 22px; height: 22px; color: var(--cyan); }
.controller-card strong { display: block; font-size: 14px; font-weight: 600; }
.controller-card .mono { display: block; font-size: 9px; color: var(--muted); }
#spawn-run { width: 100%; }
.nav-label { color: var(--dim); font-size: 10px; letter-spacing: .08em; margin: 2px 8px 0; }
.domain-nav { display: grid; gap: 4px; }
.domain-nav button { display: flex; align-items: center; text-align: left; gap: 10px; min-height: 36px; padding: 8px; color: var(--text); border: 0; border-left: 2px solid transparent; border-radius: 3px; background: transparent; font-size: 11px; line-height: 1.3; }
.domain-nav button > .icon { color: var(--cyan); }
.domain-nav button.active { border-left-color: var(--cyan); background: var(--panel-2); color: var(--cyan); }
.domain-nav button:hover { background: var(--panel-2); }
.critical-badge { margin-left: auto; padding: 3px 5px; font-size: 9px; line-height: 1.2; background: #b91c1c; color: #fff; border-radius: 2px; text-align: center; white-space: pre-line; flex-shrink: 0; }
.sidebar-bottom { margin-top: 100px; }
.sidebar-footer { display: flex; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--border); padding: 10px 4px 0; margin-top: 12px; font-size: 8px; color: var(--dim); overflow-wrap: anywhere; }
#api-uptime { color: var(--green); }
main { grid-column: 2; grid-row: 2; width: 100%; max-width: 1100px; min-width: 0; padding: 20px; margin: 0 auto; }
.view[data-view-panel="console"], .report-column { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; gap: 16px; }
.eyebrow { color: var(--cyan); font-size: 10px; letter-spacing: .08em; }
.eyebrow span { color: var(--dim); margin-left: 16px; }
/* GROUP 2: full-width hero and coordination pipeline. */
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-bottom: 16px; }
.hero-intro { flex: 1 1 300px; min-width: 0; }
.hero-intro h1 { max-width: 420px; }
.hero-intro > p { margin: 0; font-size: 12.5px; }
.hero-chips { display: flex; align-items: start; gap: 12px; margin-bottom: 8px; font-size: 10px; line-height: 1.4; letter-spacing: .08em; }
.hero-chips > span:first-child { padding: 3px 6px; color: var(--cyan); background: #22d3ee1f; }
.hero-chips > span:last-child { padding: 3px 0; color: var(--dim); }
.hero-actions { display: flex; align-items: center; justify-content: flex-end; flex: 0 1 auto; flex-wrap: wrap; gap: 8px; }
.hero-actions .button { font-size: 12px; line-height: 1.4; min-height: 36px; }
.idle-highlight { box-shadow: 0 0 18px #22d3ee40; border-color: var(--cyan); }
.export-control { position: relative; max-width: 100%; }
.export-menu { position: absolute; top: calc(100% + 6px); right: 0; width: 200px; padding: 4px; border: 1px solid var(--border); border-radius: 4px; background: var(--panel-2); box-shadow: 0 8px 24px #0006; z-index: 10; }
.export-menu button { display: block; width: 100%; padding: 8px; border: 0; border-radius: 3px; background: transparent; color: var(--text); text-align: left; }
.export-menu button:hover, .export-menu button:focus-visible { background: var(--panel); color: var(--cyan); }
.hero-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.hero-stat { position: relative; min-width: 0; min-height: 76px; padding: 12px; border: 1px solid var(--border); border-radius: 4px; background: var(--panel-2); overflow: hidden; }
.stat-label { display: block; margin-bottom: 4px; font-size: 9px; line-height: 1.4; letter-spacing: .08em; color: var(--dim); }
.hero-stat strong { display: block; font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.stat-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-detail { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.health-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: var(--dim); }
.complete { color: var(--green); } .flagged { color: var(--amber); } .alert, .failed { color: var(--red); }
.health-dot.complete { background: var(--green); } .health-dot.flagged { background: var(--amber); } .health-dot.alert { background: var(--red); }
#incident-severity { max-width: 52px; flex-shrink: 0; line-height: 1.3; text-align: center; }
.pipeline-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.pipeline-heading h2 { display: flex; align-items: center; gap: 8px; margin: 0; }
.pipeline-heading .icon { color: var(--cyan); }
.pipeline-heading p { margin: 0; text-align: right; color: var(--dim); font-size: 9px; line-height: 1.5; letter-spacing: .08em; }
#pipeline-consensus { color: var(--muted); font-weight: 500; }
#pipeline-consensus.synchronized { color: var(--cyan); } #pipeline-consensus.resolved, #pipeline-consensus.divergent { color: var(--amber); }
.pipeline-agents { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.agent-card { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 288px; padding: 12px; border: 1px solid var(--border); border-radius: 4px; background: var(--panel-2); color: var(--text); overflow: hidden; }
.agent-card.complete { border-color: #22c55e40; } .agent-card.flagged { border-color: #f59e0b66; }
.agent-card.alert, .agent-card.failed { border-color: #ef444466; }
.agent-card.running, .agent-card.synthesizing { border-color: #22d3ee66; }
.agent-heading { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-bottom: 12px; }
.agent-index { color: var(--dim); font-size: 9px; }
.agent-heading .pill { padding: 2px 6px; white-space: nowrap; }
.agent-heading .pill::before { content: ''; display: inline-block; width: 5px; height: 5px; margin-right: 5px; border-radius: 50%; background: currentColor; }
.pill.failed { color: var(--red); border-color: #ef444466; background: #ef44441f; }
.pill.synthesizing { color: var(--cyan); border-color: #22d3ee66; background: #22d3ee1f; }
.pill.pending, .pill.abstained, .pill.skipped { color: var(--muted); }
.pill.running::before, .pill.synthesizing::before { animation: agent-pulse 1.4s ease-in-out infinite; }
.agent-category { margin: 0 0 4px; color: var(--dim); font-size: 9px; letter-spacing: .08em; }
.agent-card h3 { margin: 0 0 24px; font-size: 14px; line-height: 1.5; font-weight: 600; }
.agent-card.synthesizing h3 { color: var(--cyan); }
.agent-summary { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: auto 0 28px; font-size: 12.5px; line-height: 1.5; overflow-wrap: anywhere; }
.agent-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--border); font-size: 10px; line-height: 1.5; overflow-wrap: anywhere; }
.agent-stats strong { font-weight: 500; }
.is-idle .hero-stat::after, .is-idle .agent-card::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(110deg, transparent 25%, #8a97ab0d 45%, transparent 65%); background-size: 250% 100%; animation: skeleton-shimmer 2.4s linear infinite; }
@keyframes skeleton-shimmer { from { background-position: 150% 0; } to { background-position: -150% 0; } }
@keyframes agent-pulse { 50% { opacity: .25; } }
.report-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.right-rail { min-width: 0; }
.controls { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.controls label { display: flex; flex-direction: column; gap: 4px; min-width: 0; max-width: 100%; color: var(--muted); }
select, input[type=file] { width: 100%; max-width: 100%; padding: 6px; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 4px; }
#status { width: 100%; overflow-wrap: anywhere; }
#topo { height: 320px; border: 1px solid var(--border); border-radius: 6px; }
.legend { margin: 8px 0 0; font-size: 11px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin: 0 4px 0 8px; }
.dot.bad { background: var(--red); } .dot.ok { background: var(--green); }
.big { font-size: 22px; font-weight: 600; }
#report { overflow-wrap: anywhere; }
#report .pill { margin-left: 8px; }
ul { margin: 0; padding-left: 20px; }
#fix { margin-top: 12px; }
#fixresult { margin-top: 8px; font-weight: 600; }
.pass { color: var(--green); } .fail { color: var(--red); }
.table-scroll { min-width: 0; max-width: 100%; overflow-x: auto; }
#run-modal-root, #remediate-modal-root { display: contents; }
#run-modal-root:empty, #remediate-modal-root:empty { display: none; }
/* GROUP 3: unified diagnostic report. */
.diagnostic-report { position: relative; overflow: hidden; }
.report-heading { display: flex; align-items: center; gap: 12px; padding: 4px 0 16px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.report-heading h2 { display: flex; align-items: center; gap: 8px; flex: 1 1 150px; margin: 0; font-size: 15px; line-height: 1.4; }
.report-heading .icon { color: var(--cyan); }
.report-chip { padding: 6px 8px; background: var(--panel-2); color: var(--muted); font-size: 9px; line-height: 1.5; overflow-wrap: anywhere; }
#correlation-hash { flex: 0 1 120px; }
.normalization-chip { flex: 1 1 180px; color: var(--cyan); border: 1px solid #22d3ee26; background: #22d3ee0d; }
.root-cause { border: 1px solid var(--border); border-left: 3px solid var(--cyan); background: var(--panel-2); padding: 16px; border-radius: 3px; }
.root-cause.insufficient { border-left-color: var(--amber); }
.root-cause.error { border-left-color: var(--red); }
.callout-label { color: var(--cyan); font-size: 9px; letter-spacing: .06em; margin: 0 0 8px; }
.insufficient .callout-label { color: var(--amber); } .error .callout-label { color: var(--red); }
.callout-label strong { font-weight: 500; }
.root-cause-text { font-size: 17px; font-weight: 600; line-height: 1.55; margin: 0 0 8px; }
.affected-sentence { font-size: 17px; font-weight: 600; line-height: 1.55; margin: 0 0 12px; }
.callout-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 10px; color: var(--cyan); }
.report-limitations { margin: 8px 0 0; padding: 10px 12px; border: 1px solid var(--border); color: var(--muted); font-size: 11px; }
.report-limitations summary { cursor: pointer; }
.report-limitations ul { margin-top: 8px; }
.report-section { margin-top: 20px; min-width: 0; }
.report-section h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 12.5px; line-height: 1.5; }
.report-section h3 .icon { width: 14px; height: 14px; color: var(--muted); }
.section-heading { display: flex; align-items: start; justify-content: space-between; gap: 8px; }
.section-note { color: var(--dim); font-size: 8px; letter-spacing: .06em; text-align: right; padding-top: 3px; }
.cyan { color: var(--cyan); }
.affected-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.device-card, .evidence-tile, .alternative-card { min-width: 0; border: 1px solid var(--border); padding: 12px; background: var(--panel-2); }
.device-card { overflow-wrap: anywhere; }
.device-card > strong { display: block; font-size: 13px; margin-bottom: 4px; }
.device-description { margin: 0 0 8px; font-size: 11px; }
.device-card .pill { margin: 0 !important; padding: 3px 6px; font-size: 9px; line-height: 1.3; }
.more-devices { grid-column: 1 / -1; margin: 0; }
.evidence-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-bottom: 12px; }
.evidence-tile { padding: 10px; overflow-wrap: anywhere; }
.evidence-tile .stat-label { min-height: 26px; font-size: 8px; text-transform: uppercase; }
.evidence-tile .metric-value { display: block; font-size: 22px; margin-bottom: 4px; white-space: nowrap; }
.metric-unit { font-size: 11px; font-weight: 400; color: var(--muted); }
.evidence-detail { display: block; color: var(--muted); font-size: 9px; }
.telemetry-scroll { max-height: 260px; border: 1px solid var(--border); }
#telemetry-table { width: 100%; border-collapse: collapse; font: 10px/1.5 var(--font-mono); text-align: left; }
#telemetry-table th { position: sticky; top: 0; background: var(--panel-2); color: var(--muted); font-size: 9px; text-transform: uppercase; z-index: 1; }
#telemetry-table th, #telemetry-table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
#telemetry-table td { overflow-wrap: anywhere; min-width: 85px; }
#telemetry-table .raw-fragment { min-width: 230px; color: var(--muted); }
.telemetry-feed { color: var(--cyan); }
.primary-hypothesis { padding: 10px; border: 1px solid #22d3ee40; border-radius: 3px; background: var(--panel-2); }
.primary-title { color: var(--cyan); font-size: 10px; margin-bottom: 8px; }
.confidence-track { height: 5px; background: var(--border); overflow: hidden; }
.confidence-track > span { display: block; height: 100%; background: var(--cyan); }
.hypothesis-rationale { margin: 8px 0 0; font-size: 11px; }
.alternative-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.alternative-card { padding: 10px; }
.alternative-heading { display: flex; align-items: start; justify-content: space-between; gap: 8px; font-size: 11px; margin-bottom: 8px; }
.alternative-heading .mono { font-size: 9px; color: var(--muted); }
.ruled-out .hypothesis-rationale > strong { color: var(--green); }
.partial .hypothesis-rationale > strong, .partial .alternative-heading .mono { color: var(--amber); }
.partial .confidence-track > span { background: var(--amber); }
.action-list { list-style: none; display: grid; gap: 10px; padding: 0; }
.action-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 12px; align-items: center; border: 1px solid var(--border); background: var(--panel-2); padding: 12px; }
.action-number { background: #22d3ee26; color: var(--cyan); text-align: center; font-size: 10px; align-self: start; padding: 2px; }
.action-copy { overflow-wrap: anywhere; }
.action-copy strong { display: block; font-size: 12px; line-height: 1.5; }
.action-copy > span { display: block; margin-top: 4px; font-size: 11px; }
.action-row .button { font-size: 11px; max-width: 180px; }
.action-row #fix { margin: 0; }
.remediation-result { border: 1px solid currentColor; padding: 12px; border-radius: 4px; }
.empty-state { margin: 0; padding: 8px 0; grid-column: 1 / -1; }
#report-state { padding: 32px 0; text-align: center; color: var(--cyan); }
.diagnostic-report.is-idle #report-content { position: relative; min-height: 560px; }
.diagnostic-report.is-idle #report-content::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(110deg, transparent 25%, #8a97ab15 45%, transparent 65%); background-size: 250% 100%; animation: skeleton-shimmer 2.4s linear infinite; }
.diagnostic-report.is-idle .root-cause, .diagnostic-report.is-idle .report-section { opacity: .35; }
#remediate-modal { max-width: min(480px, calc(100vw - 24px)); padding: 24px; color: var(--text); background: var(--panel); border: 1px solid var(--border); border-radius: 6px; overflow-wrap: anywhere; }
#remediate-modal::backdrop { background: #000a; }
.modal-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
/* GROUP 4: 300px rail and local swarm console. */
.right-rail { display: flex; flex-direction: column; gap: 12px; align-self: stretch; }
.rail-heading { display: flex; align-items: start; justify-content: space-between; gap: 6px; color: var(--dim); font-size: 9px; letter-spacing: .06em; }
.rail-heading h2 { margin: 0; font: inherit; }
#latency-anomaly { flex-shrink: 0; font-size: 9px; letter-spacing: 0; }
.latency-reading { display: flex; align-items: baseline; gap: 6px; margin: 8px 0 0; }
.latency-reading strong { font-size: 36px; line-height: 1.2; font-weight: 700; }
.latency-reading > span { font-size: 11px; }
#latency-chart { margin-top: 12px; }
#latency-chart svg { display: block; width: 100%; height: 90px; overflow: visible; }
.chart-grid { stroke: var(--border); stroke-width: .5; opacity: .5; }
.latency-area { fill: #ef44441a; }
.latency-line { fill: none; stroke: var(--red); stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.latency-labels { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 9px; color: var(--muted); }
#latency-empty { display: flex; align-items: center; min-height: 90px; margin: 8px 0 0; font-size: 10px; }
.rail-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.rail-stat { padding: 12px; overflow-wrap: anywhere; }
.rail-stat .stat-label { min-height: 26px; font-weight: 400; font-size: 8px; }
.rail-stat .metric-value { display: block; font-size: 26px; }
.rail-stat-detail { margin: 6px 0 0; font-size: 10px; line-height: 1.4; }
.agent-bus { position: sticky; top: 16px; display: flex; flex-direction: column; min-height: 420px; height: calc(100vh - 32px); max-height: 600px; padding: 0; overflow: hidden; }
.bus-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px; border-bottom: 1px solid var(--border); }
.bus-heading h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 12px; line-height: 1.5; }
.bus-heading .icon { width: 14px; height: 14px; color: var(--cyan); }
.bus-live { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: var(--dim); }
.bus-live.live { background: var(--green); box-shadow: 0 0 6px #22c55e66; }
.bus-messages { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; list-style: none; margin: 0; padding: 12px; scrollbar-width: thin; font: 10px/1.6 var(--font-mono); }
.bus-message { border-left: 2px solid currentColor; margin: 0 0 16px; padding-left: 8px; overflow-wrap: anywhere; color: var(--dim); }
.bus-message:last-child { margin-bottom: 0; }
.bus-message.finding, .bus-message.response { color: var(--cyan); }
.bus-message.query { color: var(--amber); }
.bus-message.error { color: var(--red); }
.bus-message-heading { display: flex; align-items: start; justify-content: space-between; gap: 6px; margin-bottom: 6px; color: var(--muted); font-size: 8px; }
.bus-message-heading > span { min-width: 0; }
.bus-message-heading time { flex-shrink: 0; }
.bus-message p { margin: 0; white-space: pre-wrap; }
#bus-empty { padding: 12px; margin: 0; font-size: 10px; }
.bus-console { display: grid; grid-template-columns: minmax(0, 1fr) 22px; gap: 4px; margin: 0 12px 12px; padding-top: 8px; border-top: 1px solid var(--border); }
.bus-console label { grid-column: 1 / -1; color: var(--cyan); font-size: 10px; }
.bus-console input { width: 100%; min-width: 0; padding: 6px; border: 1px solid var(--border); border-radius: 3px; background: var(--bg); color: var(--text); font: 10px var(--font-mono); }
.bus-console input::placeholder { color: var(--muted); }
.bus-console .icon-button { width: 22px; height: 28px; color: var(--cyan); }
@media (max-width: 1199px) {
  .agent-bus { position: static; height: 480px; max-height: none; }
}
@media (min-width: 1200px) and (max-width: 1399px) {
  .action-row { grid-template-columns: 22px minmax(0, 1fr); }
  .action-row .button { grid-column: 2; justify-self: end; max-width: none; }
}
@media (max-width: 759px) {
  .report-heading { flex-wrap: wrap; }
  .report-heading h2 { flex-basis: 100%; }
  .affected-grid, .alternative-grid { grid-template-columns: minmax(0, 1fr); }
  .section-heading { flex-wrap: wrap; margin-bottom: 8px; }
  .section-heading h3 { margin-bottom: 0; }
  .section-note { text-align: left; }
  .action-row { grid-template-columns: 22px minmax(0, 1fr); }
  .action-row .button { grid-column: 2; max-width: 100%; justify-self: start; }
}
@media (prefers-reduced-motion: reduce) { .diagnostic-report.is-idle #report-content::after { animation: none; } }
@media print {
  .diagnostic-report.is-idle #report-content::after, .action-row .button { display: none; }
  .report-heading { flex-wrap: wrap; }
  .telemetry-scroll { max-height: none; overflow: visible; }
  #telemetry-table { font-size: 8px; }
  #telemetry-table th { position: static; }
  #telemetry-table td, #telemetry-table .raw-fragment { min-width: 0; }
  .root-cause, .device-card, .evidence-tile, .primary-hypothesis, .alternative-card, .action-row { break-inside: avoid; }
}
@media (max-width: 1199px) {
  .hero-top { align-items: start; }
  .hero-actions { flex: 1 1 260px; }
  .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pipeline-heading { flex-wrap: wrap; gap: 8px; }
  .pipeline-heading p { text-align: left; }
  .report-layout { grid-template-columns: minmax(0, 1fr); }
  .top-bar { flex-wrap: wrap; min-height: 56px; height: auto; gap: 8px; padding: 8px 12px; }
  body { grid-template-rows: auto 1fr; }
  .top-nav { min-height: 36px; }
  .search-box { margin-left: auto; }
}
@media (max-width: 759px) {
  .hero-top { flex-direction: column; gap: 16px; }
  .hero-intro, .hero-actions { flex: none; width: 100%; }
  .hero-actions { align-items: stretch; flex-direction: column; }
  .hero-actions .button, .export-control { width: 100%; }
  .hero-chips { flex-wrap: wrap; gap: 4px 12px; }
  .hero-stats { grid-template-columns: minmax(0, 1fr); }
  .pipeline-agents { grid-template-columns: minmax(0, 1fr); }
  .agent-card { min-height: 240px; }
  body { display: block; }
  .top-bar { position: relative; gap: 8px; }
  .hamburger { display: inline-flex; flex-shrink: 0; }
  .brand { flex: 1 1 190px; }
  .top-nav { order: 5; width: 100%; gap: 0; justify-content: space-between; }
  .nav-tab { padding: 6px 10px; font-size: 10px; }
  .search-box { order: 6; max-width: none; flex-basis: 100%; }
  .top-bar > .button { flex: 1 1 auto; max-width: none; }
  #acknowledge-all { max-width: none; }
  .toolbar-icons { margin-left: auto; }
  .sidebar { display: none; border-bottom: 1px solid var(--border); border-right: 0; }
  .sidebar.open { display: flex; }
  .sidebar-bottom { margin-top: 16px; }
  main { padding: 12px; }
  h1 { font-size: 26px; }
  .eyebrow span { display: block; margin: 4px 0 0; }
  .controls { flex-direction: column; align-items: stretch; }
  .controls label { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .is-idle .hero-stat::after, .is-idle .agent-card::after, .pill.running::before, .pill.synthesizing::before { animation: none; }
}
@media print {
  :root { color-scheme: light; --bg: #fff; --panel: #fff; --panel-2: #f5f7fa; --border: #b6bfcc; --text: #111827; --muted: #374151; --dim: #4b5563; --cyan: #00677b; --green: #146c35; --amber: #875500; --red: #b91c1c; }
  @page { margin: 14mm; }
  body { display: block; min-height: auto; background: #fff; font-size: 11px; }
  .top-bar, .sidebar, .hero-actions, #pipeline,
  #right-rail, #fix, #fixresult, #run-modal-root, #remediate-modal-root, [data-view-panel]:not(#view-console) { display: none !important; }
  main { width: 100%; max-width: none; padding: 0; margin: 0; }
  #view-console { display: grid !important; }
  .hero-top { display: block; }
  .hero-intro h1 { max-width: none; font-size: 24px; }
  .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-layout { display: block; }
  #telemetry-more { display: none !important; }
  /* Inner cards carry their own borders; outer frames only spill onto an extra page. */
  #hero, .diagnostic-report { border: 0; padding: 0; background: none; }
  .card { box-shadow: none; }
  #hero, #summary, #report li, #report h3 { break-inside: avoid; }
  #report h3 { break-after: avoid; }
  .is-idle .hero-stat::after { display: none; }
}
/* GROUP 5: shared views, run dialog and backend recovery. */
.view { min-width: 0; }
#view-pipeline, #view-telemetry, #view-terminal { display: grid; gap: 16px; }
.view > *, #pipeline-slot, #telemetry-bus-slot, #terminal-bus-slot { min-width: 0; }
.backend-banner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; padding: 12px 16px; border: 1px solid var(--amber); border-radius: 6px; background: var(--panel); color: var(--amber); }
#status:not([hidden]) { margin: 0 0 16px; overflow-wrap: anywhere; }
#status.workflow-status:not(.error-callout) { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px !important; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.error-callout { border: 1px solid var(--red); border-left-width: 3px; padding: 12px; border-radius: 4px; color: var(--red); background: var(--panel); }
#run-modal { width: 520px; max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px); overflow-y: auto; padding: 24px; border: 1px solid var(--border); border-radius: 6px; color: var(--text); background: var(--panel); }
#run-modal::backdrop { background: #000a; }
.modal-field { display: grid; gap: 8px; margin: 16px 0; }
.modal-field select { min-width: 0; }
.modal-field input { min-width: 0; }
#fail { min-width: 0; margin: 20px 0; padding: 12px; border: 1px solid var(--border); border-radius: 4px; }
#fail legend { padding: 0 4px; color: var(--muted); }
.fault-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.fault-options label, .llm-toggle { display: flex; align-items: center; gap: 8px; overflow-wrap: anywhere; }
input[type=checkbox] { accent-color: var(--cyan); flex-shrink: 0; }
.llm-toggle + p { margin-top: 4px; font-size: 11px; }
#run-error { overflow-wrap: anywhere; }
#view-topology #topo { width: 100%; height: max(400px, 65vh); }
.dot.root { background: var(--amber); }
.device-metrics { margin-top: 16px; overflow-wrap: anywhere; }
.view-table-scroll { border: 1px solid var(--border); border-radius: 4px; }
.view-table { width: 100%; border-collapse: collapse; text-align: left; font: 11px/1.5 var(--font-mono); }
.view-table th, .view-table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; min-width: 100px; max-width: 300px; }
.view-table th { color: var(--muted); background: var(--panel-2); font-weight: 500; }
.table-link { padding: 0; color: var(--cyan); background: transparent; border: 0; text-align: left; font: inherit; }
#incidents-table tbody tr { cursor: pointer; }
#incidents-table tbody tr:hover { background: var(--panel-2); }
.agent-message-group, .playbook-entry { border-bottom: 1px solid var(--border); padding: 0 0 16px; margin-bottom: 16px; overflow-wrap: anywhere; }
.agent-message-list { padding-left: 20px; font-size: 11px; }
.agent-message-list li { margin-bottom: 10px; white-space: pre-wrap; }
.playbook-entry p { margin: 12px 0 0; }
.info-list { display: grid; grid-template-columns: minmax(100px, 1fr) minmax(0, 2fr); gap: 12px; }
.info-list dt { color: var(--muted); }
.info-list dd { margin: 0; overflow-wrap: anywhere; }
#view-telemetry .agent-bus, #view-terminal .agent-bus { position: static; height: 60vh; max-height: none; min-height: 360px; }
#view-terminal .bus-messages { font-size: 13px; }
#view-terminal .bus-console { grid-template-columns: minmax(0, 1fr) 40px; }
#view-terminal .bus-console input { min-height: 44px; font-size: 14px; }
#view-terminal .bus-console .icon-button { width: 40px; height: 44px; }
@media (max-width: 759px) {
  .top-bar, main, .sidebar { max-width: 100%; }
  .top-nav { overflow-x: auto; }
  .nav-tab { flex: 0 0 auto; max-width: none; white-space: nowrap; }
  #quarantine { display: none; }
  .mobile-overflow { display: block; order: 4; margin-left: auto; }
  #run-modal { padding: 16px; }
  .fault-options { grid-template-columns: minmax(0, 1fr); }
  #view-topology #topo { height: 420px; }
}
@media print {
  #status, #backend-banner, #agent-bus, dialog { display: none !important; }
  /* Shared pipeline/bus may currently live in secondary views. */
  #view-console[hidden] { display: grid !important; }
  .root-cause-text, .affected-sentence { font-size: 12px; }
  .diagnostic-report { overflow: visible; }
  .telemetry-scroll { overflow: visible; }
  #telemetry-table { table-layout: fixed; }
  #telemetry-table td { overflow-wrap: anywhere; }
  #report-content[hidden] { display: none !important; }
}

.samples-pagination { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 12px; }
.samples-pagination span { overflow-wrap: anywhere; }
.synthetic-notice { margin: 0 0 16px; overflow-wrap: anywhere; }
