:root {
  color-scheme: dark;
  --ink: #f7fbff;
  --muted: #9aa8b7;
  --bg: #07090d;
  --panel: rgba(15, 19, 27, 0.76);
  --panel-strong: rgba(18, 24, 34, 0.94);
  --line: rgba(174, 197, 223, 0.18);
  --line-strong: rgba(174, 197, 223, 0.34);
  --cyan: #6ee7f9;
  --green: #8ef0b0;
  --amber: #ffc66d;
  --rose: #ff7a95;
  --violet: #c7b7ff;
  --font-display: "Inter Tight", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Inter", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SFMono-Regular", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

html {
  scroll-behavior: smooth;
  height: 100%;
}

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.014) 1px, transparent 1px),
    radial-gradient(circle at 18% 8%, rgba(110, 231, 249, 0.18), transparent 28rem),
    radial-gradient(circle at 80% 0%, rgba(199, 183, 255, 0.16), transparent 26rem),
    radial-gradient(circle at 50% 100%, rgba(142, 240, 176, 0.1), transparent 30rem),
    var(--bg);
  background-size: 28px 28px, 28px 28px, auto, auto, auto, auto;
  color: var(--ink);
  font-family: var(--font-body);
}

a {
  color: inherit;
  text-decoration: none;
}

.skip-link {
  position: fixed;
  top: 0.65rem;
  left: 0.65rem;
  z-index: 100;
  transform: translateY(-160%);
  border: 2px solid var(--cyan);
  border-radius: 8px;
  padding: 0.62rem 0.85rem;
  color: var(--ink);
  background: var(--panel-strong);
  box-shadow: 0 0 0 4px rgba(110, 231, 249, 0.18);
  transition: transform 0.16s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.observatory {
  height: 100vh;
  overflow: hidden;
  padding: clamp(0.45rem, 0.8vw, 0.75rem);
  display: grid;
  /* Persistent nav rail column, surface content beside it.
     Rows: topbar / stale banner / surface / statusbar. The banner row
     collapses to zero height while it is hidden. */
  grid-template-columns: 11.5rem minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 0.55rem;
}

/* Topbar and statusbar span the full width; the rail owns the middle row's
   first column, and every surface section shares the second column. */
.observatory > .topbar {
  grid-column: 1 / -1;
  grid-row: 1;
}

.observatory > .stale-banner {
  grid-column: 1 / -1;
  grid-row: 2;
}

.observatory > .dashboard-statusbar {
  grid-column: 1 / -1;
  grid-row: 4;
}

/* Shown whenever the live feed is not connected, so stale numbers are never
   mistaken for live ones. */
.stale-banner[hidden] {
  display: none !important;
}

.stale-banner {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.42rem 0.75rem;
  border: 1px solid rgba(255, 196, 106, 0.42);
  border-radius: 7px;
  background: rgba(255, 196, 106, 0.11);
  color: #ffd79a;
  font-size: 0.76rem;
}

.stale-banner strong {
  color: #ffc46a;
  font-size: 0.78rem;
}

.stale-banner span:last-child {
  color: rgba(255, 215, 154, 0.82);
}

.stale-banner-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffc46a;
  animation: stale-pulse 1.2s ease-in-out infinite;
}

.stale-banner[data-state="error"] {
  border-color: rgba(255, 122, 149, 0.45);
  background: rgba(255, 122, 149, 0.12);
  color: #ffb3c2;
}

.stale-banner[data-state="error"] strong {
  color: var(--rose);
}

.stale-banner[data-state="error"] .stale-banner-dot {
  background: var(--rose);
}

@keyframes stale-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.observatory > .dashboard-rail {
  grid-column: 1;
  grid-row: 3;
  min-height: 0;
  overflow-y: auto;
}

.observatory > .hero,
.observatory > .panopticon-shell,
.observatory > .runtime-grid,
.observatory > .evidence-band,
.observatory > .component-health-shell,
.observatory > .logs-shell {
  grid-column: 2;
  grid-row: 3;
}

/* Secondary in-content navigation. The rail carries the primary workflow
   surfaces; this reaches supplementary proof surfaces (retained evidence)
   that are deliberately not rail items. */
.surface-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.2rem;
}

.surface-nav a {
  padding: 0.28rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 0.74rem;
  text-decoration: none;
}

.surface-nav a:hover {
  border-color: rgba(110, 231, 249, 0.35);
  color: var(--text);
}

.surface-nav a[aria-current="page"] {
  border-color: rgba(110, 231, 249, 0.45);
  background: rgba(110, 231, 249, 0.12);
  color: var(--cyan);
  font-weight: 600;
}

.surface-nav a:focus-visible,
.roster-row:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.evidence-report-body {
  margin: 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 9, 13, 0.62);
  color: #c8d7ec;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-y: auto;
  min-height: 0;
}

.observatory[data-dashboard-surface="evidence"] > .evidence-band {
  display: grid !important;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 0.6rem;
  width: 100%;
  justify-self: stretch;
  height: 100%;
  min-height: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

/* Module health owns its own rail surface. */
.observatory > .component-health-shell {
  display: none;
}

.observatory[data-dashboard-surface="modules"] > .component-health-shell {
  display: block;
  width: 100%;
  justify-self: stretch;
  height: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 1rem;
}

.topbar {
  position: relative;
  top: auto;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  max-width: none;
  width: 100%;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.52rem 0.75rem;
  background: rgba(7, 9, 13, 0.78);
  backdrop-filter: blur(18px);
}

.topbar .brand {
  flex-shrink: 0;
}

.topbar .polis-chip {
  flex-shrink: 0;
}

.topbar .mode-tabs {
  flex: 1;
  justify-content: center;
}

.topbar .topbar-controls {
  flex-shrink: 0;
  margin-left: auto;
}

.brand,
.nav,
.status-pill,
.button,
.mini-badge,
.top-select,
.top-readout {
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  min-width: 0;
}

.brand-mark {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 1px solid rgba(110, 231, 249, 0.45);
  background:
    radial-gradient(circle, transparent 36%, rgba(110, 231, 249, 0.28) 38%, transparent 42%),
    conic-gradient(from 110deg, #6a7cff, var(--cyan), #6a7cff);
  box-shadow: 0 0 24px rgba(110, 231, 249, 0.35);
}

.version-chip {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.35rem 0.52rem;
  color: #b8d6f6;
  background: rgba(110, 231, 249, 0.06);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.topbar-controls {
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  gap: 0.55rem;
  min-width: 0;
}

/* ── Polis switcher (topbar) ───────────────────────────── */
.polis-switcher {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.55rem 0.3rem 0.65rem;
  border-radius: 6px;
  border: 1px solid rgba(110, 231, 249, 0.3);
  background: rgba(110, 231, 249, 0.07);
  flex-shrink: 0;
  transition: border-color 0.2s;
}

.polis-dot {
  display: inline-block;
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
  transition: background 0.3s;
}

.polis-switcher[data-state="live"] .polis-dot {
  background: var(--ok, #8ef0b0);
  box-shadow: 0 0 6px rgba(142, 240, 176, 0.6);
  animation: pulse-dot 2s ease-in-out infinite;
}

.polis-switcher[data-state="error"] .polis-dot {
  background: #f87171;
}

.polis-switcher[data-state="connecting"] .polis-dot {
  background: #facc15;
  animation: pulse-dot 1s ease-in-out infinite;
}

#polis-select {
  border: none;
  background: transparent;
  color: #b8d6f6;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  max-width: 10rem;
}

#polis-select option {
  background: #0c1219;
  color: var(--ink);
}

.polis-add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 4px;
  border: 1px solid rgba(110, 231, 249, 0.25);
  background: rgba(110, 231, 249, 0.08);
  color: #b8d6f6;
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}

.polis-add-btn:hover {
  background: rgba(110, 231, 249, 0.18);
}

.polis-add-form[hidden] {
  display: none !important;
}

.polis-add-form {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.55rem;
  border: 1px solid rgba(110, 231, 249, 0.3);
  border-radius: 6px;
  background: rgba(7, 9, 13, 0.9);
}

.polis-add-input {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.28rem 0.52rem;
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  width: 9rem;
}

.polis-add-input:focus {
  outline: none;
  border-color: rgba(110, 231, 249, 0.5);
}

/* ── Mode tabs ─────────────────────────────────────────── */
.mode-tabs {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(12, 18, 27, 0.6);
}

.mode-tab {
  padding: 0.32rem 0.75rem;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.mode-tab:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
}

.mode-tab.active,
.mode-tab[aria-selected="true"] {
  color: var(--ink);
  background: rgba(110, 231, 249, 0.1);
  border-color: rgba(110, 231, 249, 0.3);
}

/* ── Topbar WS status dot ──────────────────────────────── */
.topbar-status-dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
  align-self: center;
  transition: background 0.3s;
}

.topbar-status-dot[data-state="live"] {
  background: var(--ok, #8ef0b0);
  box-shadow: 0 0 6px rgba(142, 240, 176, 0.6);
  animation: pulse-dot 2s ease-in-out infinite;
}

.topbar-status-dot[data-state="ok"] {
  background: var(--ok, #8ef0b0);
}

.topbar-status-dot[data-state="warn"] {
  background: #facc15;
}

.topbar-status-dot[data-state="error"] {
  background: #f87171;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ── Polis chip ────────────────────────────────────────── */

.nav a,
.status-pill,
.mini-badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.46rem 0.72rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
}

.status-pill[data-state="ok"],
.mini-badge[data-tone="ok"] {
  color: var(--green);
  border-color: rgba(142, 240, 176, 0.36);
}

.status-pill[data-state="fallback"],
.mini-badge[data-tone="warn"] {
  color: var(--amber);
  border-color: rgba(255, 198, 109, 0.36);
}

.mini-badge[data-tone="blocked"] {
  color: var(--rose);
  border-color: rgba(255, 122, 149, 0.38);
}

.layer8-delivery-panel[hidden] {
  display: none !important;
}

.layer8-delivery-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.78rem;
  background: rgba(12, 18, 27, 0.72);
}

.layer8-delivery-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0.55rem;
  margin: 0.65rem 0 0;
  padding: 0;
  list-style: none;
}

.layer8-delivery-row {
  display: grid;
  gap: 0.42rem;
  min-height: 7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.65rem;
  background: rgba(255, 255, 255, 0.035);
}

.layer8-delivery-row[data-state="delivered"] {
  border-color: rgba(142, 240, 176, 0.34);
}

.layer8-delivery-row[data-state="refused"],
.layer8-delivery-row[data-state="failed"],
.layer8-delivery-row[data-state="revoked"] {
  border-color: rgba(255, 122, 149, 0.32);
}

.layer8-delivery-row[data-state="recovery"] {
  border-color: rgba(255, 198, 109, 0.32);
}

.operator-attention-list {
  display: grid;
  gap: 0.6rem;
  margin: 0.8rem 0 0;
  padding: 0;
  list-style: none;
}

.operator-attention-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.7rem;
  background: rgba(255, 255, 255, 0.035);
}

.operator-attention-row[data-priority="urgent"],
.operator-attention-row[data-state="refused"],
.operator-attention-row[data-status="refused"] {
  border-color: rgba(255, 122, 149, 0.32);
}

.operator-attention-row[data-priority="high"],
.operator-attention-row[data-state="deferred"],
.operator-attention-row[data-status="deferred"] {
  border-color: rgba(255, 198, 109, 0.32);
}

.hero,
.runtime-grid,
.evidence-band {
  max-width: none;
  margin: 0 auto;
}

.runtime-grid,
.evidence-band {
  display: none;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(21rem, 0.95fr);
  gap: clamp(1rem, 2vw, 1.5rem);
  min-height: 0;
  align-items: stretch;
  padding-block: clamp(1rem, 3vw, 2.5rem);
}

.ops-hero {
  grid-template-columns: minmax(0, 1fr) minmax(23rem, 0.32fr);
  gap: 0.8rem;
  height: 100%;
  min-height: 0;
  padding-block: 0;
  align-items: stretch;
  overflow: hidden;
}

.hero-copy,
.dashboard-rail,
.ops-command,
.ops-sidecar,
.ops-map-panel,
.proof-card,
.panopticon-shell,
.panopticon-stage,
.panopticon-column,
.panopticon-events,
.panel,
.evidence-band {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.07), transparent 26%),
    var(--panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(22px);
}

.hero-copy,
.ops-command {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(1.2rem, 4vw, 4rem);
  position: relative;
  overflow: hidden;
}

.ops-command {
  justify-content: start;
  gap: 0.75rem;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.ops-command > .panel-head {
  align-items: start;
  order: 1;
}

.ops-command > .panel-head,
.ops-command > .lede,
.ops-command > .hero-actions {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.ops-command .mini-badge {
  justify-self: start;
}

.hero-copy::after,
.ops-command::after {
  content: "";
  position: absolute;
  inset: auto -12% -20% 20%;
  height: 18rem;
  background: linear-gradient(90deg, transparent, rgba(110, 231, 249, 0.24), transparent);
  transform: rotate(-8deg);
  filter: blur(18px);
  pointer-events: none;
}

.ops-command > *,
.ops-sidecar > * {
  position: relative;
  z-index: 1;
}

.ops-sidecar {
  display: flex;
  flex-direction: column;
  gap: 0.62rem;
  min-height: 0;
  padding: clamp(0.7rem, 1.1vw, 0.95rem);
  overflow: auto;
}

.ops-sidecar > * {
  flex: 0 0 auto;
}

.ops-sidecar h2 {
  font-size: clamp(1.25rem, 1.8vw, 1.9rem);
}

.eyebrow {
  margin: 0 0 0.7rem;
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: 0;
}

h1 {
  max-width: 11ch;
  font-size: clamp(4rem, 9vw, 9rem);
  line-height: 0.88;
}

.ops-hero h1 {
  max-width: 14ch;
  font-size: clamp(2rem, 3.2vw, 3.45rem);
  line-height: 0.98;
}

h2 {
  font-size: clamp(1.25rem, 2vw, 2rem);
}

.lede {
  max-width: 58rem;
  color: #c8d4df;
  font-size: clamp(0.96rem, 1.4vw, 1.15rem);
  line-height: 1.48;
  order: 4;
}

.ops-command .lede {
  max-height: 4.5rem;
  overflow: auto;
  padding-right: 0.25rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.25rem;
  order: 5;
}

.ops-status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.58rem;
  margin-top: 0;
  order: 2;
}

.ops-stat {
  min-height: 4.35rem;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0.52rem 0.58rem;
  background:
    linear-gradient(90deg, rgba(110, 231, 249, 0.06), transparent 58%),
    rgba(16, 23, 34, 0.72);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-content: start;
  gap: 0.32rem 0.44rem;
}

.ops-stat .row-kicker,
.ops-stat strong,
.ops-stat .row-detail {
  grid-column: 2;
}

.stat-icon {
  grid-row: 1 / span 3;
  width: clamp(1.45rem, 1.7vw, 1.9rem);
  height: clamp(1.45rem, 1.7vw, 1.9rem);
  align-self: start;
  color: var(--cyan);
  filter: drop-shadow(0 0 12px rgba(110, 231, 249, 0.28));
}

.ops-stat:nth-child(1) .stat-icon,
.ops-stat:nth-child(4) .stat-icon {
  color: var(--green);
}

.ops-stat:nth-child(3) .stat-icon {
  color: var(--amber);
}

.ops-stat strong {
  font-size: clamp(1rem, 1.35vw, 1.28rem);
  overflow-wrap: anywhere;
}

.ops-stat:has([data-state="active"]),
.ops-stat:has([data-state="running"]),
.ops-stat:has([data-state="ready"]),
.ops-stat:has([data-state="healthy"]),
.ops-stat:has([data-state="passed"]) {
  border-color: rgba(142, 240, 176, 0.38);
  background: rgba(142, 240, 176, 0.07);
}

.ops-stat:has([data-state="degraded"]),
.ops-stat:has([data-state="pending"]),
.ops-stat:has([data-state="stale"]) {
  border-color: rgba(255, 198, 109, 0.38);
  background: rgba(255, 198, 109, 0.06);
}

.ops-stat:has([data-state="failed"]),
.ops-stat:has([data-state="blocked"]),
.ops-stat:has([data-state="error"]) {
  border-color: rgba(255, 122, 149, 0.42);
  background: rgba(255, 122, 149, 0.06);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.35rem;
  border-radius: 8px;
  padding: 0.76rem 1rem;
  border: 1px solid var(--line-strong);
}

.button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(110, 231, 249, 0.14);
}

.button svg {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
}

.button-primary {
  background: linear-gradient(135deg, rgba(110, 231, 249, 0.92), rgba(142, 240, 176, 0.84));
  color: #061013;
  font-weight: 800;
}

.button-secondary {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
}

button {
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

.dashboard-rail {
  display: grid;
  align-content: start;
  gap: 0.5rem;
  padding: 0.75rem 0.55rem;
  min-height: 0;
  overflow: hidden;
  scrollbar-width: none;
}

.dashboard-rail::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* The inspector and event stream hold far more than fits. Hiding their
   scrollbars left no cue that the content continued, so give these two a
   thin visible one. */
.hero-trace,
.inspector-stack,
.ops-command {
  scrollbar-width: thin;
  scrollbar-color: rgba(110, 231, 249, 0.28) transparent;
}

.hero-trace::-webkit-scrollbar,
.inspector-stack::-webkit-scrollbar,
.ops-command::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.hero-trace::-webkit-scrollbar-thumb,
.inspector-stack::-webkit-scrollbar-thumb,
.ops-command::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(110, 231, 249, 0.26);
}

.hero-trace::-webkit-scrollbar-thumb:hover,
.inspector-stack::-webkit-scrollbar-thumb:hover,
.ops-command::-webkit-scrollbar-thumb:hover {
  background: rgba(110, 231, 249, 0.45);
}

.hero-trace::-webkit-scrollbar-track,
.inspector-stack::-webkit-scrollbar-track,
.ops-command::-webkit-scrollbar-track {
  background: transparent;
}

/* Was overflow:hidden, silently truncating the event stream by ~169px. */
.observatory[data-dashboard-surface="runtime"] .ops-command {
  overflow-y: auto;
}

.dashboard-rail a {
  display: flex;
  align-items: center;
  gap: 0.72rem;
  min-height: 2.55rem;
  padding-inline: 0.85rem;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #c8d7ec;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  text-transform: none;
}

.dashboard-rail a svg {
  width: 1.08rem;
  height: 1.08rem;
  flex: 0 0 auto;
  color: #aab9ca;
}

.dashboard-rail a[aria-current="page"],
.dashboard-rail a:hover,
.dashboard-rail a:focus-visible {
  color: var(--cyan);
  border-color: rgba(110, 231, 249, 0.28);
  background: rgba(110, 231, 249, 0.07);
  outline-offset: 2px;
}

.dashboard-rail a[aria-current="page"] svg,
.dashboard-rail a:hover svg,
.dashboard-rail a:focus-visible svg {
  color: var(--cyan);
}

.rail-telemetry {
  align-self: end;
  display: grid;
  gap: 0.35rem;
  margin-top: auto;
  padding: 0.85rem 0.75rem 0.65rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.rail-telemetry strong {
  color: #d7e6f7;
  font-weight: 700;
  line-height: 1.35;
}

.rail-ready {
  justify-self: start;
  border: 1px solid rgba(142, 240, 176, 0.36);
  border-radius: 5px;
  padding: 0.18rem 0.34rem;
  color: var(--green) !important;
  background: rgba(142, 240, 176, 0.08);
}

.proof-card-header,
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.mini-console {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.72rem;
  background: rgba(0, 0, 0, 0.2);
}

.hero-trace {
  max-height: none;
  min-height: 0;
  overflow: auto;
}

.dashboard-core {
  display: grid;
  grid-template-columns: 1fr;
  /* Track minimums must stay small enough to fit a short viewport: if they
     exceed the container height the tracks over-subscribe and the event rows
     are laid out below the clip, rendering an apparently empty panel.
     Collapsed is the default: the event stream keeps one scrollable line so the
     Panopticon orbit gets the height its percentage-positioned nodes need.
     Expanded splits the space evenly (see [data-events="expanded"] below). */
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0.65rem;
  min-height: 0;
  height: 100%;
  order: 3;
  overflow: hidden;
}

.ops-map-panel,
.dashboard-events {
  min-width: 0;
  min-height: 0;
}

/* The Panopticon header is decoration around the topology; the orbit needs the
   height more than the subtitle does. */
.ops-map-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  /* Size container: the orbit needs three rows of cards to clear each other, and
     whether that fits depends on this panel's height - not the viewport's. A
     viewport media query only correlates with the space the map gets, which is
     why a fixed min-height kept overflowing the panel and clipping the bottom
     row of agents. Measure the real container instead. */
  container-type: size;
  container-name: opsmap;
}

.ops-map-panel > .panel-head {
  margin-bottom: 0.15rem;
}

.ops-map-panel h1,
.ops-map-panel h2 {
  font-size: clamp(1rem, 1.6vw, 1.4rem);
  line-height: 1.15;
}

.ops-map-panel .panel-head .row-detail,
.ops-map-panel .lede,
.ops-map-panel .eyebrow {
  display: none;
}

/* Orbit node cards sit at fixed percentage offsets in three rows (1% / 34% /
   bottom 2%), so the card height sets the map's minimum: rows clear only while
   0.33 * mapHeight >= cardHeight and 0.64 * mapHeight >= 2 * cardHeight. The
   card below measures ~52px, which resolves from ~163px of map. Changing this
   typography, the offsets, or .hero-agent-map's min-height means rechecking all
   three together. */
.hero-agent-map .hero-agent-node {
  padding: 0.26rem 0.5rem 0.26rem 2.3rem;
  line-height: 1.12;
}

/* The role is already the node's icon colour and is repeated on the Agents
   surface; dropping it here buys a whole line per card, which is what keeps the
   orbit alive on a laptop instead of collapsing to the flat grid. */
.hero-agent-map .hero-agent-node .row-kicker {
  display: none;
}

.hero-agent-map .hero-agent-node strong {
  font-size: 0.76rem;
  line-height: 1.15;
}

.hero-agent-map .hero-agent-node .row-detail {
  margin-top: 0;
  font-size: 0.66rem;
  line-height: 1.15;
}

.hero-agent-map .node-icon {
  left: 0.5rem;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0.3rem;
}

/* Event stream: one line by default, scrollable, expandable ------------------ */

.events-head-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.events-toggle {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.16rem 0.6rem;
  background: rgba(110, 231, 249, 0.06);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.events-toggle:hover,
.events-toggle:focus-visible {
  border-color: rgba(110, 231, 249, 0.55);
  color: var(--ink);
  background: rgba(110, 231, 249, 0.14);
}

/* The column header lives inside the scrolling list, so pin it or the single
   collapsed line would scroll the labels away. */
.dashboard-events .event-table-header {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel, #0b0f16);
}

.dashboard-core[data-events="collapsed"] .hero-trace {
  /* Sticky header (~1.6rem) plus a single event row. */
  max-height: 3.9rem;
  overflow-y: auto;
}

.dashboard-core[data-events="expanded"] {
  grid-template-rows: minmax(6rem, 1fr) minmax(6rem, 1.35fr);
}

.dashboard-core[data-events="expanded"] .hero-trace {
  max-height: none;
  overflow-y: auto;
}

/* Expanding the log squeezes the map below the orbit's minimum. Keep the orbit
   geometry intact and let the panel scroll rather than collapsing the nodes
   onto each other. */
.dashboard-core[data-events="expanded"] .hero-agent-map {
  overflow-y: auto;
}

.dashboard-events {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.ops-map-panel {
  position: relative;
  overflow: hidden;
  padding: 0.72rem;
  min-height: 0;
}

.ops-map-panel::before {
  content: "";
  position: absolute;
  inset: 10% 13% 13%;
  border: 1px solid rgba(110, 231, 249, 0.16);
  border-radius: 50%;
  box-shadow:
    0 0 0 3.2rem rgba(110, 231, 249, 0.016),
    0 0 0 6.4rem rgba(142, 240, 176, 0.012),
    0 0 80px rgba(110, 231, 249, 0.1);
}

.hero-agent-map {
  position: relative;
  /* The panel is a grid (auto head / 1fr map), so the map already gets the
     leftover row: subtracting the head again here would short it. No
     min-height — a minimum larger than the row is exactly what overflows the
     panel and clips agents. The container query below switches to a flat grid
     when the orbit will not fit. */
  height: 100%;
  min-height: 0;
  margin-top: 0.55rem;
}

.hero-agent-map::before {
  content: "Runtime Kernel\A Runtime v3\A " attr(data-state);
  white-space: pre;
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  width: clamp(6.1rem, 7.2vw, 7.4rem);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  border: 1px solid rgba(142, 240, 176, 0.52);
  border-radius: 50%;
  color: var(--ink);
  background: rgba(12, 25, 19, 0.88);
  box-shadow: 0 0 0 1.2rem rgba(142, 240, 176, 0.04), 0 0 70px rgba(142, 240, 176, 0.18);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1.45;
  text-align: center;
}

.hero-agent-node {
  position: absolute;
  z-index: 2;
  width: min(14rem, 27%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem 0.62rem 0.5rem 2.9rem;
  background: rgba(8, 12, 18, 0.86);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.24);
  line-height: 1.25;
}

.hero-agent-node::after {
  content: "";
  position: absolute;
  top: 50%;
  width: clamp(2.2rem, 6vw, 5rem);
  border-top: 1px solid rgba(110, 231, 249, 0.34);
  transform: translateY(-50%);
  pointer-events: none;
}

.hero-agent-node::before {
  display: none;
}

.node-icon {
  position: absolute;
  left: 0.68rem;
  top: 50%;
  width: 1.72rem;
  height: 1.72rem;
  padding: 0.36rem;
  transform: translateY(-50%);
  border: 1px solid currentColor;
  border-radius: 50%;
  color: var(--cyan);
  background: radial-gradient(circle, rgba(110, 231, 249, 0.16), transparent 64%);
  box-shadow: 0 0 22px rgba(110, 231, 249, 0.18);
}

.hero-agent-node:nth-child(1) .node-icon {
  color: var(--violet);
}

.hero-agent-node:nth-child(2) .node-icon,
.hero-agent-node:nth-child(5) .node-icon {
  color: #62a8ff;
}

.hero-agent-node:nth-child(4) .node-icon {
  color: var(--amber);
}

.hero-agent-node:nth-child(6) .node-icon {
  color: var(--green);
}

.hero-agent-node strong {
  display: block;
  font-size: 0.78rem;
}

.hero-agent-node .row-detail {
  margin: 0.22rem 0 0;
  line-height: 1.25;
}

/* Three rows of cards have to clear each other inside the map. With a 68px card
   the binding constraints are row2.top - row1.bottom and row3.top - row2.bottom,
   i.e. 0.33 * H >= 68 and 0.64 * H >= 136 -> the orbit resolves from ~212px up.
   Changing these offsets or the card height means re-checking both. */
.hero-agent-node:nth-child(1) {
  left: 23%;
  top: 1%;
}

.hero-agent-node:nth-child(2) {
  right: 18%;
  top: 1%;
}

.hero-agent-node:nth-child(3) {
  left: 6%;
  top: 34%;
}

.hero-agent-node:nth-child(4) {
  right: 7%;
  top: 34%;
}

.hero-agent-node:nth-child(5) {
  left: 23%;
  bottom: 2%;
  top: auto;
}

.hero-agent-node:nth-child(6) {
  right: 18%;
  bottom: 2%;
  top: auto;
}

/* Orbit cards are ~36px in three rows at 1% / 34% / bottom 2%, so rows clear
   each other once the map is ~115px — about 180px of panel once the heading and
   padding come out. Below that, drop absolute positioning for a flat grid of the
   same cards: no overlap at any agent count, no clipping, and it grows with the
   roster instead of relying on six hand-placed slots. Measured, not guessed:
   see the orbit threshold assertions in tests/. */
@container opsmap (max-height: 180px) {
  .hero-agent-map {
    min-height: 0;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12.5rem, 1fr));
    grid-auto-rows: min-content;
    align-content: start;
    gap: 0.45rem;
    overflow-y: auto;
    padding-right: 0.2rem;
  }

  /* The kernel medallion and the orbit ellipse are decorative. At this height
     they consume more space than the roster they decorate. */
  .hero-agent-map::before,
  .ops-map-panel::before {
    display: none;
  }

  /* Full node cards are 77px; two rows plus a header cannot fit beside the
     event stream at this height. Compact them to a single line each — name and
     state is what the topology is read for at a glance. */
  .hero-agent-map {
    grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
    gap: 0.3rem;
  }

  .hero-agent-map .hero-agent-node {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    padding: 0.28rem 0.5rem 0.28rem 1.9rem;
    line-height: 1.2;
  }

  .hero-agent-map .hero-agent-node .row-kicker {
    display: none;
  }

  .hero-agent-map .hero-agent-node strong {
    font-size: 0.78rem;
  }

  .hero-agent-map .hero-agent-node .row-detail {
    margin: 0;
    font-size: 0.66rem;
  }

  .hero-agent-map .node-icon {
    left: 0.4rem;
    width: 1.15rem;
    height: 1.15rem;
    padding: 0.2rem;
  }

  .hero-agent-map .hero-agent-node,
  .hero-agent-map .hero-agent-node:nth-child(1),
  .hero-agent-map .hero-agent-node:nth-child(2),
  .hero-agent-map .hero-agent-node:nth-child(3),
  .hero-agent-map .hero-agent-node:nth-child(4),
  .hero-agent-map .hero-agent-node:nth-child(5),
  .hero-agent-map .hero-agent-node:nth-child(6) {
    /* relative, not static: .node-icon is absolutely positioned and would
       otherwise resolve against the map and stack every icon in one spot. */
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    width: auto;
  }

  /* Connector lines only make sense radiating from the kernel. */
  .hero-agent-map .hero-agent-node::after {
    display: none;
  }
}

.hero-agent-node:nth-child(1)::after,
.hero-agent-node:nth-child(3)::after,
.hero-agent-node:nth-child(5)::after {
  right: calc(-1 * clamp(2.2rem, 6vw, 5rem));
}

.hero-agent-node:nth-child(2)::after,
.hero-agent-node:nth-child(4)::after,
.hero-agent-node:nth-child(6)::after {
  left: calc(-1 * clamp(2.2rem, 6vw, 5rem));
}

.hero-agent-node:nth-child(5)::after,
.hero-agent-node:nth-child(6)::after {
  border-color: rgba(142, 240, 176, 0.32);
}

.hero-agent-node[data-state="active"],
.hero-agent-node[data-state="running"],
.hero-agent-node[data-state="ready"],
.hero-agent-node[data-state="healthy"] {
  border-color: rgba(142, 240, 176, 0.36);
}

.hero-agent-node[data-state="paused"],
.hero-agent-node[data-state="degraded"],
.hero-agent-node[data-state="pending"] {
  border-color: rgba(255, 198, 109, 0.36);
}

.hero-agent-node[data-state="failed"],
.hero-agent-node[data-state="blocked"],
.hero-agent-node[data-state="error"] {
  border-color: rgba(255, 122, 149, 0.42);
}

.compact-proof-chip {
  min-width: 0;
  border: 1px solid rgba(72, 211, 255, 0.18);
  border-radius: 8px;
  padding: 0.48rem;
  background: rgba(6, 20, 32, 0.72);
}

.compact-proof-chip span,
.compact-proof-chip strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-proof-chip span {
  color: var(--muted);
  font-size: 0.66rem;
}

.compact-proof-chip strong {
  margin-top: 0.12rem;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.compact-proof-chip[data-state="blocked"] {
  border-color: rgba(255, 183, 77, 0.36);
  background: rgba(255, 183, 77, 0.08);
}

.compact-composer .row-detail {
  display: none;
}

.dashboard-focus-panel .panel-head {
  align-items: start;
  gap: 0.55rem;
}

.dashboard-focus-item {
  max-width: 100%;
  border: 1px solid rgba(72, 211, 255, 0.18);
  border-radius: 999px;
  padding: 0.32rem 0.55rem;
  background: rgba(6, 20, 32, 0.72);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  overflow-wrap: anywhere;
}

.metric-grid div,
.service-row,
.integration-row,
.linkage-row,
.decision-row,
.invariant-row,
.action-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.8rem;
  background: rgba(255, 255, 255, 0.04);
}

dt {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
}

dd {
  margin: 0.3rem 0 0;
  font-weight: 750;
}

.runtime-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-flow: row;
  grid-auto-columns: minmax(0, 1fr);
  gap: 1rem;
}

.panopticon-shell {
  display: none;
  height: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 1rem;
  margin-bottom: 0;
}

.observatory[data-dashboard-surface="agents"] > .hero {
  display: none;
}

.observatory[data-dashboard-surface="agents"] > .panopticon-shell {
  display: block;
}

/* --- Dashboard surface switching ---------------------------------------
   The nav rail selects one surface at a time. Every surface other than the
   overview hides the hero; panel surfaces reveal .runtime-grid and isolate
   the single matching panel so the rail actually navigates. */
.observatory[data-dashboard-surface]:not([data-dashboard-surface="runtime"]) > .hero {
  display: none;
}

.observatory[data-dashboard-surface="communication"] > .runtime-grid,
.observatory[data-dashboard-surface="csm-api"] > .runtime-grid,
.observatory[data-dashboard-surface="cloudwatch"] > .runtime-grid,
.observatory[data-dashboard-surface="runtime-events"] > .runtime-grid,
.observatory[data-dashboard-surface="governance"] > .runtime-grid {
  display: grid;
  width: 100%;
  justify-self: stretch;
  height: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 1rem;
}

.observatory[data-dashboard-surface="communication"] > .runtime-grid > .panel:not(#communication),
.observatory[data-dashboard-surface="csm-api"] > .runtime-grid > .panel:not(#csm-api),
.observatory[data-dashboard-surface="cloudwatch"] > .runtime-grid > .panel:not(#cloudwatch),
.observatory[data-dashboard-surface="runtime-events"] > .runtime-grid > .panel:not(#runtime-events),
.observatory[data-dashboard-surface="governance"] > .runtime-grid > .panel:not(#governance) {
  display: none;
}

.observatory[data-dashboard-surface="communication"] > .runtime-grid > #communication,
.observatory[data-dashboard-surface="csm-api"] > .runtime-grid > #csm-api,
.observatory[data-dashboard-surface="cloudwatch"] > .runtime-grid > #cloudwatch,
.observatory[data-dashboard-surface="runtime-events"] > .runtime-grid > #runtime-events,
.observatory[data-dashboard-surface="governance"] > .runtime-grid > #governance {
  grid-column: 1 / -1;
}

/* --- Inspector ----------------------------------------------------------
   The previous panel duplicated the stat cards and the rail and reported a
   retained "Owner Agent". Those blocks stay in the DOM because readApiBase()
   reads #dashboard-live-api-base from them, but they are hidden. */
.ops-sidecar > .legacy-inspector,
.ops-sidecar > .metric-grid,
.ops-sidecar > .inspector-stack,
.ops-sidecar > .mini-console,
.ops-sidecar > .dashboard-focus-panel {
  display: none;
}

.ops-sidecar {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
}

.inspector-shell {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 0.6rem;
  min-height: 0;
}

.inspector-head { align-items: flex-start; }

.inspector-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.25rem;
  padding: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(7, 9, 13, 0.55);
}

.inspector-tab {
  padding: 0.3rem 0.4rem;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.74rem;
}

.inspector-tab:hover { color: var(--text); }

.inspector-tab.active {
  background: rgba(110, 231, 249, 0.14);
  color: var(--cyan);
  font-weight: 600;
}

.inspector-pane[hidden] {
  display: none !important;
}

.inspector-pane {
  display: grid;
  align-content: start;
  gap: 0.75rem;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.2rem;
}

.insp-group {
  display: grid;
  gap: 0.45rem;
}

.insp-group h4 {
  margin: 0;
  color: var(--cyan);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.insp-facts {
  display: grid;
  gap: 0.4rem;
  margin: 0;
}

.insp-fact {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-left: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.025);
}

.insp-fact[data-tone="ok"] { border-left-color: var(--mint); }
.insp-fact[data-tone="warn"] { border-left-color: #ffc46a; }

.insp-fact dt {
  color: var(--muted);
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.insp-fact dd {
  margin: 0.12rem 0 0;
  font-size: 0.82rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.insp-detail {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.insp-empty {
  display: grid;
  gap: 0.4rem;
  padding: 1rem 0.2rem;
  color: var(--muted);
}

.insp-agent-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.3rem;
}

.insp-agent-pick,
.insp-agent-message {
  padding: 0.28rem 0.65rem;
  font-size: 0.73rem;
}

.insp-agent-message { margin-top: 0.5rem; }

.insp-activity {
  display: grid;
  grid-template-columns: 4.4rem minmax(0, 1fr);
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border-left: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.72rem;
}

.insp-activity[data-tone="ok"] { border-left-color: var(--mint); }
.insp-activity[data-tone="warn"] { border-left-color: #ffc46a; }

/* Agent-to-agent turns are the signal worth spotting in a feed that also
   carries operator turns, admissions and lifecycle changes. */
.insp-activity[data-kind="a2a"] {
  border-left-color: var(--violet);
  background: rgba(150, 130, 255, 0.06);
}

.insp-activity-badge {
  display: inline-block;
  margin-right: 0.35rem;
  padding: 0.02rem 0.3rem;
  border: 1px solid rgba(150, 130, 255, 0.5);
  border-radius: 999px;
  background: rgba(150, 130, 255, 0.14);
  color: #c3b6ff;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  vertical-align: 1px;
}

.insp-activity-time {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.66rem;
}

.agent-card { cursor: pointer; }

/* --- Chat surface -------------------------------------------------------
   The conversation is the point of this surface, so it gets the remaining
   height and scrolls internally. Operator access and the multi-agent /
   attention / signed-control panels collapse into disclosures so the
   transcript is not pushed thousands of pixels down the page. */
.observatory[data-dashboard-surface="communication"] > .runtime-grid > #communication {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  height: 100%;
}

/* A nested chain of 1fr tracks collapsed the transcript to zero whenever the
   auto rows over-subscribed their container. Size content naturally instead,
   give the transcript its own bounded scroll region, and let the panel scroll. */
.observatory[data-dashboard-surface="communication"] .communication-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.6rem;
}

.observatory[data-dashboard-surface="communication"] .conversation-surface:not(.room-surface):not(.operator-attention-surface) {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.5rem;
}

.chat-auth-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 0.75rem;
}

.chat-auth-bar strong { font-size: 0.78rem; }

.chat-auth-bar span:not(.chat-auth-dot) { color: var(--muted); }

.chat-auth-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

.chat-auth-bar[data-state="anonymous"] {
  border-color: rgba(255, 196, 106, 0.4);
  background: rgba(255, 196, 106, 0.09);
}

.chat-auth-bar[data-state="anonymous"] strong { color: #ffc46a; }
.chat-auth-bar[data-state="anonymous"] .chat-auth-dot { background: #ffc46a; }

.chat-auth-bar[data-state="operator"] {
  border-color: rgba(142, 240, 176, 0.4);
  background: rgba(142, 240, 176, 0.09);
}

.chat-auth-bar[data-state="operator"] strong { color: var(--mint); }
.chat-auth-bar[data-state="operator"] .chat-auth-dot { background: var(--mint); }

.chat-auth-action {
  margin-left: auto;
  padding: 0.26rem 0.7rem;
  font-size: 0.73rem;
}

.observatory[data-dashboard-surface="communication"] #agent-conversation-transcript {
  min-height: 11rem;
  max-height: 34vh;
  overflow-y: auto;
}

.observatory[data-dashboard-surface="communication"] > .runtime-grid > #communication {
  overflow-y: auto;
}

.chat-access-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  padding-top: 0.6rem;
}

.chat-access-body .field-wide,
.chat-access-body .communication-actions {
  grid-column: 1 / -1;
}

.chat-advanced-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.76rem;
  list-style: none;
}

.chat-advanced-summary::-webkit-details-marker { display: none; }

.chat-advanced-summary::before {
  content: "▸";
  margin-right: 0.15rem;
  color: var(--cyan);
  font-size: 0.7rem;
}

details[open] > .chat-advanced-summary::before { content: "▾"; }

.chat-advanced-summary:hover {
  border-color: rgba(110, 231, 249, 0.35);
  color: var(--text);
}

.chat-advanced > *:not(summary) {
  margin-top: 0.6rem;
}

/* --- Agent directory ----------------------------------------------------
   The Agents surface is a directory of who is in the polis. The duplicate
   surface nav, the operator control strip and the old map/roster/selection
   layout are hidden rather than removed: #live-api-base is still read by
   readApiBase(), so it must stay in the DOM. */
.panopticon-shell > .surface-nav,
.panopticon-shell > .live-control-strip,
.panopticon-shell > .panopticon-layout,
.panopticon-shell > .panel-head {
  display: none;
}

/* Scoped to the agents surface: .panopticon-shell is display:none by default
   and only revealed there, so this must not re-show it elsewhere. */
.observatory[data-dashboard-surface="agents"] > .panopticon-shell {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
}

.agent-directory {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0.7rem;
  min-height: 0;
}

.agent-directory-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.agent-directory-filter {
  min-width: 16rem;
  padding: 0.34rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(7, 9, 13, 0.7);
  color: var(--text);
  font-size: 0.76rem;
}

.agent-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(21rem, 1fr));
  gap: 0.75rem;
  align-content: start;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 0.5rem;
}

.agent-card {
  display: grid;
  gap: 0.55rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-left: 3px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(12, 18, 27, 0.72);
}

.agent-card[data-state="active"] { border-left-color: var(--mint); }
.agent-card[data-state="degraded"] { border-left-color: #ffc46a; }
.agent-card[data-state="failed"] { border-left-color: var(--rose); }

.agent-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
}

.agent-card-name {
  display: block;
  font-size: 1.02rem;
  line-height: 1.2;
}

.agent-card-id {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.agent-card-role {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.agent-card-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem 0.8rem;
  margin: 0;
  padding: 0.55rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.agent-card-facts div { min-width: 0; }

.agent-card-facts dt {
  color: var(--muted);
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.agent-card-facts dd {
  margin: 0.1rem 0 0;
  font-size: 0.8rem;
  font-weight: 600;
}

.agent-card-facts dd[data-tone="degraded"] { color: #ffc46a; }
.agent-card-facts dd[data-tone="active"] { color: var(--mint); }

.agent-card-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.5;
}

.agent-card-caps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.agent-cap {
  padding: 0.1rem 0.42rem;
  border: 1px solid rgba(110, 231, 249, 0.28);
  border-radius: 999px;
  background: rgba(110, 231, 249, 0.1);
  color: #8fd8e8;
  font-family: var(--font-mono);
  font-size: 0.66rem;
}

.agent-card-none {
  color: var(--muted);
  font-size: 0.72rem;
  font-style: italic;
}

.agent-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding-top: 0.15rem;
}

.agent-card-comm {
  font-size: 0.72rem;
}

.agent-card-comm[data-state="active"] { color: var(--mint); }
.agent-card-comm[data-state="degraded"] { color: #ffc46a; }

.agent-card-message {
  padding: 0.3rem 0.75rem;
  font-size: 0.74rem;
}

.agent-card-message[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.agent-card-empty {
  grid-column: 1 / -1;
  display: grid;
  gap: 0.35rem;
  padding: 1.5rem;
  color: var(--muted);
}

.infra-subhead {
  margin-top: 0.9rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--line);
}

.infra-subhead:first-of-type {
  margin-top: 0.4rem;
}

/* --- Logs surface ------------------------------------------------------- */
.observatory > .logs-shell {
  display: none;
}

.observatory[data-dashboard-surface="logs"] > .logs-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0.6rem;
  width: 100%;
  justify-self: stretch;
  height: 100%;
  min-height: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.logs-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.logs-filter {
  min-width: 18rem;
  padding: 0.34rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(7, 9, 13, 0.7);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.74rem;
}

.logs-follow {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

.logs-list {
  margin: 0;
  padding: 0;
  list-style: none;
  min-height: 0;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(7, 9, 13, 0.62);
}

.logs-row {
  display: grid;
  grid-template-columns: 5.5rem 4.5rem 11rem minmax(0, 1fr);
  gap: 0.7rem;
  padding: 0.3rem 0.7rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.45;
}

.logs-row:last-child {
  border-bottom: none;
}

.logs-time,
.logs-source {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logs-level {
  font-weight: 600;
  letter-spacing: 0.03em;
}

.logs-level[data-state="failed"] { color: var(--rose); }
.logs-level[data-state="degraded"] { color: #ffc46a; }
.logs-level[data-state="active"] { color: var(--cyan); }
.logs-level[data-state="quiet"] { color: var(--muted); }

.logs-message {
  color: #dbe6f5;
  overflow-wrap: anywhere;
}

.logs-row[data-state="failed"] { background: rgba(255, 122, 149, 0.07); }
.logs-row[data-state="degraded"] { background: rgba(255, 196, 106, 0.06); }

.logs-empty {
  display: grid;
  gap: 0.4rem;
  padding: 1.5rem;
  color: var(--muted);
}

.logs-empty code {
  padding: 0.06rem 0.3rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.07);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.observatory[data-dashboard-surface="evidence"] > .evidence-band {
  display: grid !important;
  width: 100%;
  justify-self: stretch;
  height: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

/* ── Component health grid ─────────────────────────────── */
.component-health-shell {
  margin-top: 1.25rem;
  padding: 1rem 1.25rem 1.25rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.component-grid {
  display: grid;
  /* Wide enough that subsystem names such as "curiosity intelligence theory of
     mind adapter" wrap rather than truncate. */
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.component-tile {
  width: 100%;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.2s;
}

.component-tile:hover {
  border-color: rgba(110, 231, 249, 0.45);
  background: rgba(110, 231, 249, 0.07);
}

.component-tile:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.component-tile .row-kicker {
  font-size: 0.6rem;
  letter-spacing: 0.04em;
  opacity: 0.7;
}

.component-tile strong {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.component-tile[data-state="running"] {
  border-color: rgba(142, 240, 176, 0.3);
  background: rgba(142, 240, 176, 0.06);
}

.component-tile[data-state="running"] strong {
  color: var(--ok, #8ef0b0);
}

.component-tile[data-state="starting"],
.component-tile[data-state="restarting"],
.component-tile[data-state="stopping"] {
  border-color: rgba(250, 204, 21, 0.3);
  background: rgba(250, 204, 21, 0.06);
}

.component-tile[data-state="starting"] strong,
.component-tile[data-state="restarting"] strong,
.component-tile[data-state="stopping"] strong {
  color: #facc15;
}

.component-tile[data-state="stopped"],
.component-tile[data-state="failed"],
.component-tile[data-state="error"] {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.06);
}

.component-tile[data-state="stopped"] strong,
.component-tile[data-state="failed"] strong,
.component-tile[data-state="error"] strong {
  color: #f87171;
}

/* ── Agent map ─────────────────────────────────────────── */

.agent-node {
  position: absolute;
  width: min(16rem, 48%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem;
  background: rgba(8, 12, 18, 0.86);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.26);
}

.agent-node[data-state="active"],
.agent-node[data-state="running"],
.agent-row[data-state="active"],
.agent-row[data-state="running"],
.signal-row[data-state="healthy"],
.signal-row[data-state="ready"] {
  border-color: rgba(142, 240, 176, 0.36);
}

.agent-node[data-state="paused"],
.agent-node[data-state="degraded"],
.agent-row[data-state="paused"],
.agent-row[data-state="degraded"],
.signal-row[data-state="degraded"],
.signal-row[data-state="not_ready"] {
  border-color: rgba(255, 198, 109, 0.36);
}

.agent-node[data-state="failed"],
.agent-row[data-state="failed"],
.signal-row[data-state="failed"],
.signal-row[data-state="error"] {
  border-color: rgba(255, 122, 149, 0.42);
}

.agent-node:nth-child(1) {
  left: 7%;
  top: 11%;
}

.agent-node:nth-child(2) {
  right: 7%;
  top: 18%;
}

.agent-node:nth-child(3) {
  left: 22%;
  top: 47%;
}

.agent-node:nth-child(4) {
  right: 14%;
  bottom: 7%;
}

.agent-node:nth-child(5) {
  left: 4%;
  bottom: 10%;
}

.roster-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(8rem, 0.7fr) minmax(7rem, 0.55fr);
  gap: 0.65rem;
  margin-top: 1rem;
}

.roster-controls .field span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.roster-row {
  width: 100%;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.roster-row[aria-pressed="true"] {
  border-color: var(--cyan);
  box-shadow: inset 3px 0 0 var(--cyan);
}

.roster-row:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.roster-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 0;
}

.roster-facts div {
  min-width: 0;
}

.roster-facts dt {
  color: var(--muted);
  font-size: 0.72rem;
}

.roster-facts dd {
  margin: 0.15rem 0 0;
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  .roster-controls,
  .roster-facts {
    grid-template-columns: 1fr;
  }
}

.agent-row,
.signal-row,
.metric-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.8rem;
  background: rgba(255, 255, 255, 0.04);
}

.metric-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
}

.metric-value {
  color: var(--green);
  font-family: var(--font-mono);
  font-weight: 800;
}

.panel {
  min-height: 21rem;
  min-width: 0;
  padding: 1rem;
}

.wide-panel {
  grid-column: span 2;
}

.orbit-map {
  min-height: 18rem;
  position: relative;
  margin-top: 1rem;
}

.orbit-center {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8rem;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(110, 231, 249, 0.32);
  background: rgba(110, 231, 249, 0.08);
  box-shadow: 0 0 80px rgba(110, 231, 249, 0.14);
  text-align: center;
}

.orbit-node {
  position: absolute;
  width: min(12rem, 42%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.72rem;
  background: var(--panel-strong);
}

.orbit-node:nth-child(2) {
  left: 0;
  top: 12%;
}

.orbit-node:nth-child(3) {
  right: 0;
  top: 24%;
}

.orbit-node:nth-child(4) {
  left: 12%;
  bottom: 4%;
}

.service-list,
.integration-list,
.linkage-list,
.decision-stack,
.invariant-list,
.action-list,
.trace-list {
  display: grid;
  gap: 0.65rem;
  margin: 1rem 0 0;
  padding: 0;
}

.communication-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 0.75rem;
  margin-top: 1rem;
}

.field {
  display: grid;
  gap: 0.4rem;
}

.field-wide,
.communication-actions,
.communication-proof-list,
.message-envelope {
  grid-column: 1 / -1;
}

input,
select,
textarea,
.message-envelope {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.045);
  color: var(--ink);
  font: inherit;
}

textarea,
.message-envelope {
  min-height: 6rem;
  resize: vertical;
}

.message-envelope {
  overflow: auto;
  color: #c8d4df;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  line-height: 1.55;
}

.communication-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.conversation-surface {
  display: grid;
  gap: 0.85rem;
  border-block: 1px solid var(--line);
  padding-block: 1rem;
}

.conversation-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.conversation-heading h3 {
  margin: 0.25rem 0 0;
  font-size: 1.05rem;
  letter-spacing: 0;
}

.conversation-transcript {
  display: grid;
  gap: 0.55rem;
  min-height: 7rem;
  max-height: 20rem;
  margin: 0;
  padding: 0.75rem;
  overflow: auto;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.16);
}

.conversation-turn {
  max-width: min(86%, 48rem);
  padding: 0.65rem 0.75rem;
  border-left: 3px solid var(--cyan);
  background: rgba(72, 211, 255, 0.07);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.conversation-turn[data-speaker="operator"] {
  justify-self: end;
  border-left: 0;
  border-right: 3px solid var(--mint);
  background: rgba(113, 247, 164, 0.07);
}

.conversation-turn-content {
  display: block;
}

.conversation-turn-speaker {
  display: block;
  margin-bottom: 0.18rem;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.conversation-turn[data-speaker="agent"] .conversation-turn-speaker { color: var(--cyan); }
.conversation-turn[data-speaker="operator"] .conversation-turn-speaker { color: var(--mint); }

.conversation-turn-status:empty {
  display: none;
}

.conversation-turn-status {
  display: inline-block;
  margin-top: 0.4rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.conversation-turn-cancel {
  margin-left: 0.65rem;
  border: 0;
  padding: 0;
  color: var(--cyan);
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.conversation-turn-cancel:disabled {
  color: var(--muted);
  cursor: default;
}

.conversation-empty {
  align-self: center;
  justify-self: center;
  color: var(--muted);
}

.operator-attention-surface {
  border-color: rgba(245, 158, 11, 0.28);
}

.operator-attention-list {
  display: grid;
  gap: 0.75rem;
  list-style: none;
  margin: 0;
  max-height: 18rem;
  overflow: auto;
  padding: 0;
}

.operator-attention-row {
  align-items: flex-start;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 1rem;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: auto minmax(0, 1fr) auto;
  padding: 0.8rem;
}

.operator-attention-row[data-priority="urgent"] {
  border-color: rgba(248, 113, 113, 0.42);
}

.operator-attention-row[data-read="false"] {
  box-shadow: inset 3px 0 0 rgba(245, 158, 11, 0.75);
}

.operator-attention-row[data-selected="true"] {
  outline: 2px solid rgba(72, 211, 255, 0.55);
}

.room-surface select[multiple] {
  min-height: 7rem;
}

.governed-room-participants {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.room-participant,
.room-participant-empty {
  display: inline-grid;
  gap: 0.15rem;
  border: 1px solid rgba(72, 211, 255, 0.22);
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  color: var(--muted);
  background: rgba(72, 211, 255, 0.06);
}

.room-participant strong {
  color: var(--text);
}

.room-participant[data-state="joined"] {
  border-color: rgba(142, 240, 176, 0.42);
}

.governed-room-delivery-list {
  display: grid;
  gap: 0.35rem;
  margin: 0.65rem 0 0;
  padding: 0;
  list-style: none;
}

.governed-room-delivery-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.35rem;
  color: var(--muted);
}

.governed-room-delivery-list li[data-state="delivered"],
.governed-room-delivery-list li[data-state="accepted"],
.governed-room-delivery-list li[data-state="prepared"] {
  color: var(--mint);
}

.governed-room-delivery-list li[data-state="refused"],
.governed-room-delivery-list li[data-state="timed_out"],
.governed-room-delivery-list li[data-state="unavailable"],
.governed-room-delivery-list li[data-state="revoked"] {
  color: var(--amber);
}

.communication-proof-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.communication-proof-row {
  min-width: 0;
  border: 1px solid rgba(72, 211, 255, 0.2);
  border-radius: 8px;
  padding: 0.7rem;
  background: linear-gradient(135deg, rgba(72, 211, 255, 0.08), rgba(84, 238, 139, 0.05));
}

.service-row,
.integration-row,
.linkage-row,
.communication-proof-row,
.agent-row,
.signal-row,
.decision-row,
.invariant-row,
.action-row {
  display: grid;
  gap: 0.35rem;
}

.row-kicker {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  overflow-wrap: anywhere;
}

.decision-row[data-decision="allow"] {
  border-color: rgba(142, 240, 176, 0.34);
}

.decision-row[data-decision="defer"] {
  border-color: rgba(255, 198, 109, 0.34);
}

.decision-row[data-decision="refuse"] {
  border-color: rgba(255, 122, 149, 0.34);
}

.integration-row[data-state="passed"],
.integration-row[data-state="closed"],
.linkage-row[data-state="closed"] {
  border-color: rgba(142, 240, 176, 0.34);
}

.integration-row[data-state="open"],
.linkage-row[data-state="open"] {
  border-color: rgba(255, 198, 109, 0.34);
}

.integration-row[data-state="blocked"],
.linkage-row[data-state="blocked"] {
  border-color: rgba(255, 122, 149, 0.34);
}

.trace-list {
  list-style: none;
}

.trace-row {
  display: grid;
  grid-template-columns: 3rem 1fr;
  gap: 0.8rem;
  border-bottom: 1px solid var(--line);
  padding: 0.7rem 0;
}

.dashboard-events .trace-list {
  gap: 0;
}

.event-table-header {
  display: grid;
  grid-template-columns: 6.5rem 4.5rem minmax(8rem, 1fr) minmax(9rem, 0.85fr) 5.5rem 4.5rem;
  gap: 0.8rem;
  padding: 0.52rem 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.64rem;
}

.event-table-row {
  grid-template-columns: 6.5rem 4.5rem minmax(8rem, 1fr) minmax(9rem, 0.85fr) 5.5rem 4.5rem;
  align-items: center;
}

/* On short viewports the events panel header was consuming most of the panel,
   leaving under one row visible. Compact it so the stream keeps the space. */
.dashboard-events {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}

.dashboard-events > .panel-head {
  margin-bottom: 0.2rem;
  padding-bottom: 0.35rem;
}

.dashboard-events h2 {
  font-size: clamp(0.95rem, 1.4vw, 1.2rem);
  line-height: 1.15;
}

.event-repeat {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.02rem 0.32rem;
  border: 1px solid rgba(110, 231, 249, 0.28);
  border-radius: 999px;
  background: rgba(110, 231, 249, 0.1);
  color: #8fd8e8;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  vertical-align: middle;
}

.event-source,
.event-state,
.event-tick {
  min-width: 0;
  color: #c8d7ec;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-state {
  justify-self: start;
  border: 1px solid rgba(142, 240, 176, 0.28);
  border-radius: 5px;
  padding: 0.18rem 0.34rem;
  color: var(--green);
  background: rgba(142, 240, 176, 0.08);
}

.event-state[data-state="failed"] {
  border-color: rgba(255, 122, 149, 0.36);
  color: var(--rose);
  background: rgba(255, 122, 149, 0.08);
}

.event-state[data-state="degraded"] {
  border-color: rgba(255, 198, 109, 0.34);
  color: var(--amber);
  background: rgba(255, 198, 109, 0.08);
}

.trace-seq {
  color: var(--cyan);
  font-family: var(--font-mono);
}

/* Uptime stamps must stay on one line so they never collide with Severity. */
.event-table-row .trace-seq {
  font-size: 0.68rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.api-mini-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 2.8rem;
  gap: 0.45rem;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.api-mini-row span {
  color: #cdd9e8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.api-mini-row strong {
  border: 1px solid rgba(142, 240, 176, 0.3);
  border-radius: 5px;
  padding: 0.15rem 0.28rem;
  color: var(--green);
  background: rgba(142, 240, 176, 0.08);
  font-size: 0.64rem;
}

.api-mini-row em {
  color: var(--muted);
  font-style: normal;
  text-align: right;
}

.runtime-test-actions .button {
  min-height: 1.95rem;
  padding: 0.38rem 0.44rem;
  font-size: 0.68rem;
}

.dashboard-statusbar {
  display: grid;
  grid-template-columns: minmax(9rem, 0.8fr) minmax(12rem, 1fr) minmax(10rem, 0.8fr) minmax(10rem, 0.85fr) minmax(16rem, 1.4fr) minmax(10rem, 0.8fr);
  align-items: center;
  gap: 0.65rem;
  min-height: 2.15rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.42rem 0.65rem;
  color: #c9d7e8;
  background: rgba(7, 13, 20, 0.84);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  overflow: hidden;
}

.dashboard-statusbar span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-statusbar b {
  display: inline-block;
  width: 0.48rem;
  height: 0.48rem;
  margin-right: 0.42rem;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 12px rgba(255, 198, 109, 0.42);
  vertical-align: 0.04rem;
}

.dashboard-statusbar b[data-state="live"] {
  background: var(--green);
  box-shadow: 0 0 12px rgba(142, 240, 176, 0.48);
}

.dashboard-statusbar b[data-state="published"] {
  background: var(--cyan);
  box-shadow: 0 0 12px rgba(110, 231, 249, 0.42);
}

.dashboard-statusbar b[data-state="fallback"],
.dashboard-statusbar b[data-state="partial"] {
  background: var(--amber);
}

.dashboard-statusbar strong {
  color: var(--green);
  font-weight: 700;
}

.evidence-band p,
.row-detail {
  color: var(--muted);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.service-row strong,
.integration-row strong,
.linkage-row strong,
.agent-row strong,
.signal-row strong,
.metric-row strong,
.decision-row strong,
.invariant-row strong,
.action-row strong,
.trace-row strong {
  overflow-wrap: anywhere;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(0.98);
    opacity: 0.78;
  }
  50% {
    transform: scale(1.04);
    opacity: 1;
  }
}

/* Hidden by default, except on the surface that owns each section. */
.observatory:not([data-dashboard-surface="communication"]):not([data-dashboard-surface="csm-api"]):not([data-dashboard-surface="cloudwatch"]):not([data-dashboard-surface="runtime-events"]):not([data-dashboard-surface="governance"]) > .runtime-grid,
.observatory:not([data-dashboard-surface="evidence"]) > .evidence-band {
  display: none !important;
}

@media (max-width: 980px) {
  html,
  body {
    height: auto;
    min-height: 100%;
  }

  body {
    overflow: auto;
  }

  .observatory {
    height: auto;
    min-height: 100vh;
    overflow: visible;
    grid-template-rows: auto auto auto;
  }

  .topbar,
  .dashboard-core,
  .live-control-strip,
  .panopticon-layout,
  .runtime-grid,
  .evidence-band {
    grid-template-columns: 1fr;
  }

  .topbar {
    position: static;
  }

  .ops-hero {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(31rem, auto) minmax(24rem, auto);
    height: auto;
    overflow: visible;
    gap: 0.55rem;
  }

  .ops-command {
    min-height: 31rem;
  }

  .ops-sidecar {
    display: grid;
    grid-template-rows: minmax(16rem, auto) auto;
    min-height: 24rem;
    padding: 0.55rem;
    overflow: auto;
  }

  .ops-sidecar > .panel-head,
  .ops-sidecar > .metric-grid,
  .ops-sidecar .agent-detail-card,
  .ops-sidecar .gauge-card,
  .ops-sidecar .compact-composer {
    display: none;
  }

  .ops-sidecar .inspector-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-height: 16rem;
    overflow: auto;
  }

  .ops-sidecar .inspector-stack article {
    min-height: 0;
  }

  .ops-sidecar .inspector-stack .row-detail,
  .ops-sidecar .api-mini-list {
    display: none;
  }

  .ops-sidecar .runtime-test-card {
    min-height: 8.7rem;
    padding: 0.5rem;
  }

  .ops-sidecar .runtime-test-card .row-detail {
    display: block;
    max-height: 2.1rem;
    overflow: hidden;
  }

  .ops-sidecar .runtime-test-card input {
    padding: 0.38rem 0.46rem;
  }

  .ops-sidecar .runtime-test-actions .button {
    min-height: 1.68rem;
    padding: 0.24rem 0.3rem;
    font-size: 0.62rem;
  }

  .dashboard-statusbar {
    grid-template-columns: 1fr 1fr;
    min-height: 2.6rem;
  }

  .dashboard-statusbar span:nth-child(n + 3) {
    display: none;
  }





  .wide-panel {
    grid-column: auto;
  }

  .communication-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: 0;
  }

  .dashboard-rail {
    display: flex;
    overflow-x: auto;
    gap: 0.35rem;
    padding: 0.45rem;
    min-height: 0;
  }

  .rail-telemetry {
    display: none;
  }

  .dashboard-rail a {
    min-width: 6.4rem;
    min-height: 2.15rem;
    padding-inline: 0.65rem;
  }





  .ops-status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-core {
    grid-template-rows: minmax(0, 1fr) minmax(8rem, 0.44fr);
  }

  .ops-command .lede {
    max-height: 2.8rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 640px) {
  .observatory {
    padding: 0.45rem;
    gap: 0.45rem;
  }

  .topbar {
    grid-template-columns: 1fr;
    gap: 0.4rem;
    padding: 0.42rem;
  }

  .topbar-controls {
    display: flex;
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
    padding-bottom: 0.2rem;
  }

  .brand-mark {
    width: 1.55rem;
    height: 1.55rem;
  }

  .dashboard-rail {
    padding: 0.28rem;
  }

  .ops-status-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.35rem;
  }

  .ops-stat {
    min-height: 3.7rem;
    padding: 0.42rem;
    gap: 0.22rem;
  }

  .ops-stat .row-detail {
    display: none;
  }

  .ops-stat strong {
    font-size: 0.88rem;
  }

  .ops-stat .row-kicker {
    font-size: 0.58rem;
  }

  .stat-icon {
    display: none;
  }

  h1 {
    font-size: clamp(2.35rem, 12vw, 3.6rem);
  }

  .ops-map-panel {
    min-height: 0;
  }

  .hero-agent-map {
    min-height: 0;
  }

  .hero-agent-map::before {
    width: 5.8rem;
    font-size: 0.58rem;
  }

  .hero-agent-node {
    width: min(10.5rem, 34%);
    padding: 0.42rem 0.48rem;
    font-size: 0.68rem;
  }

  .node-icon {
    display: none;
  }

  .hero-agent-node strong {
    font-size: 0.68rem;
  }

  .hero-agent-node .row-detail {
    display: none;
  }

  .dashboard-core {
    grid-template-rows: minmax(0, 1fr) minmax(5.8rem, 0.32fr);
  }

  .dashboard-events .panel-head {
    align-items: center;
  }

  .dashboard-events h2,
  .ops-map-panel h2 {
    font-size: 1rem;
  }

  .trace-row {
    grid-template-columns: 2.2rem 1fr;
    gap: 0.55rem;
    padding: 0.45rem 0;
    font-size: 0.72rem;
  }

  .event-table-header,
  .event-table-row .event-source,
  .event-table-row .event-state,
  .event-table-row .event-tick {
    display: none;
  }



  .orbit-node {
    position: static;
    width: auto;
    margin-top: 0.65rem;
  }

  .orbit-center {
    position: static;
    transform: none;
    margin: 1rem auto;
  }

  .agent-node {
    position: static;
    width: auto;
    margin-top: 0.65rem;
  }


}
