/* ==========================================================================
   Cloud Incident Commander — readability system (ported from the design canvas)

   Type: Plus Jakarta Sans 15px body / 14px secondary / 13px labels /
   16–18 headings / 20–24 titles. JetBrains Mono only for identifiers,
   digests, service names. Nothing below 12px. Muted text keeps ~8:1 on the
   panel colour. Surfaces are opaque — no translucent panels, no blur.

   Theme: dark is the default; `html[data-theme="light"]` swaps the tokens.
   Every colour used by the new components comes from a token below.
   ========================================================================== */

body.commander-mode {
  --ic-page: #070b14;
  --ic-rail: #0b111c;
  --ic-panel: #0e1522;
  --ic-card: #131c2c;
  --ic-border: rgba(255, 255, 255, 0.12);
  --ic-border-soft: rgba(255, 255, 255, 0.10);
  --ic-fg: #e6edf7;
  --ic-muted: #9fb0c7;
  --ic-accent: #5cc8ff;
  --ic-accent-fg: #07131f;
  --ic-accent-soft: rgba(92, 200, 255, 0.16);
  --ic-green: #4ade80;
  --ic-green-fg: #052e12;
  --ic-green-soft: rgba(74, 222, 128, 0.14);
  --ic-amber: #fbbf24;
  --ic-amber-soft: rgba(251, 191, 36, 0.16);
  --ic-red: #fb7185;
  --ic-red-fg: #1a0509;
  --ic-red-soft: rgba(251, 113, 133, 0.16);
  --ic-violet: #a78bfa;
  --ic-violet-soft: rgba(167, 139, 250, 0.14);
  --ic-nav-active-bg: rgba(92, 200, 255, 0.16);
  --ic-nav-active-fg: #e6edf7;
  --ic-nav-active-bar: #5cc8ff;
  --ic-toggle-on-bg: #5cc8ff;
  --ic-toggle-on-fg: #07131f;
  --ic-chaos-border: rgba(251, 113, 133, 0.5);
  --ic-chaos-glow: rgba(251, 113, 133, 0.08);
  --ic-chaos-bg: #0e1522;
  --ic-font: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
  --ic-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  background: var(--ic-page);
  color: var(--ic-fg);
  font-family: var(--ic-font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  margin: 0;
  padding: 0;
  height: auto;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
}

html[data-theme="light"] body.commander-mode {
  --ic-page: #f4f5f7;
  --ic-rail: #ffffff;
  --ic-panel: #ffffff;
  --ic-card: #f4f6fa;
  --ic-border: #d9dee7;
  --ic-border-soft: #e4e8ef;
  --ic-fg: #172033;
  --ic-muted: #5b6b82;
  --ic-accent: #0369a1;
  --ic-accent-fg: #ffffff;
  --ic-accent-soft: rgba(3, 105, 161, 0.12);
  --ic-green: #15803d;
  --ic-green-fg: #ffffff;
  --ic-green-soft: rgba(21, 128, 61, 0.12);
  --ic-amber: #b45309;
  --ic-amber-soft: rgba(180, 83, 9, 0.12);
  --ic-red: #dc2626;
  --ic-red-fg: #ffffff;
  --ic-red-soft: rgba(220, 38, 38, 0.10);
  --ic-violet: #6d28d9;
  --ic-violet-soft: rgba(109, 40, 217, 0.10);
  --ic-nav-active-bg: #172033;
  --ic-nav-active-fg: #ffffff;
  --ic-nav-active-bar: #172033;
  --ic-toggle-on-bg: #172033;
  --ic-toggle-on-fg: #ffffff;
  --ic-chaos-border: #dc2626;
  --ic-chaos-glow: rgba(220, 38, 38, 0.08);
  --ic-chaos-bg: #fff7f7;
}

body.commander-mode a { color: var(--ic-accent); }
body.commander-mode code,
body.commander-mode .mono { font-family: var(--ic-mono); font-size: 0.93em; }
body.commander-mode code { background: none; padding: 0; color: inherit; }
body.commander-mode ::selection { background: var(--ic-accent-soft); }

#root, .incident-commander-app { display: block; width: 100%; }

/* --------------------------------------------------------------------------
   Shell: full-height rail + content column
   -------------------------------------------------------------------------- */

.ic-shell { display: flex; flex-direction: row; align-items: stretch; min-height: 100vh; }

/* The rail column runs the full height of the page (it stretches with the
   content); what it holds stays pinned to the viewport inside it. */
.ic-rail {
  width: 264px;
  flex-shrink: 0;
  align-self: stretch;
  background: var(--ic-rail);
  border-right: 1px solid var(--ic-border);
}
.ic-rail-inner {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.ic-rail-brand {
  display: flex; align-items: center; gap: 12px;
  height: 64px; padding: 0 16px; flex-shrink: 0;
  border-bottom: 1px solid var(--ic-border);
}
.ic-rail-logo {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  background: var(--ic-accent); color: var(--ic-accent-fg);
  display: flex; align-items: center; justify-content: center;
}
.ic-rail-title { font-size: 15px; font-weight: 700; color: var(--ic-fg); line-height: 1.2; }
.ic-rail-sub { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ic-muted); }

.ic-nav { display: flex; flex-direction: column; gap: 4px; padding: 16px 12px 16px 0; margin: 0; list-style: none; }
.ic-nav-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; height: 44px; padding: 0 12px 0 13px;
  border: none; border-left: 3px solid transparent; border-radius: 0 8px 8px 0;
  background: transparent; color: var(--ic-muted);
  font: inherit; font-size: 15px; font-weight: 600; text-align: left; cursor: pointer;
}
.ic-nav-item:hover { color: var(--ic-fg); background: var(--ic-accent-soft); }
.ic-nav-item.active { border-left-color: var(--ic-nav-active-bar); background: var(--ic-nav-active-bg); color: var(--ic-nav-active-fg); font-weight: 700; }
.ic-nav-item.active .ic-nav-count { color: inherit; }
.ic-nav-main { display: flex; align-items: center; gap: 10px; min-width: 0; white-space: nowrap; overflow: hidden; }
.ic-nav-main > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.ic-nav-icon { display: flex; flex-shrink: 0; }
.ic-nav-count { font-family: var(--ic-mono); font-size: 12px; white-space: nowrap; color: var(--ic-muted); flex-shrink: 0; }
.ic-nav-count.count-amber { color: var(--ic-amber); }
.ic-nav-count.count-green { color: var(--ic-green); }
.ic-nav-item.active .ic-nav-count.count-amber { color: var(--ic-amber); }
html[data-theme="light"] body.commander-mode .ic-nav-item.active .ic-nav-count { color: #ffffff; }

.ic-rail-section { padding: 16px 12px; border-top: 1px solid var(--ic-border); }
.ic-rail-bottom { margin-top: auto; padding: 16px 12px 16px 0; border-top: 1px solid var(--ic-border); }

.ic-content { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; }

.ic-titlebar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 64px; padding: 0 28px;
  background: var(--ic-rail); border-bottom: 1px solid var(--ic-border);
}
.ic-titlebar-left { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.ic-app-line { font-size: 14px; line-height: 1.35; color: var(--ic-muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ic-app-line strong { color: var(--ic-fg); font-weight: 700; font-size: 15px; }
.ic-page-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 2px 0 4px; }
.ic-page-head .ic-subtitle { white-space: normal; }
.ic-title { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.ic-subtitle { font-size: 14px; color: var(--ic-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ic-titlebar-right { display: flex; align-items: center; gap: 20px; flex-shrink: 0; }

.ic-theme-toggle {
  display: inline-flex; align-items: center; padding: 3px; border-radius: 8px;
  background: var(--ic-card); border: 1px solid var(--ic-border);
}
.ic-theme-opt {
  display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
  border: none; border-radius: 6px; background: transparent; color: var(--ic-muted);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.ic-theme-opt.active { background: var(--ic-toggle-on-bg); color: var(--ic-toggle-on-fg); font-weight: 700; }

.ic-agent-status { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.ic-agent-status .mono { font-weight: 500; color: var(--ic-fg); }
.ic-agent-status.st-ok { color: var(--ic-green); }
.ic-agent-status.st-warn { color: var(--ic-amber); }
.ic-agent-status.st-down { color: var(--ic-red); }
.ic-agent-status.st-muted { color: var(--ic-muted); }
.ic-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

.ic-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 18px 28px 32px; flex-grow: 1; align-items: start; }
.ic-body.ic-body-split { grid-template-columns: minmax(0, 1fr) 404px; }
.ic-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ic-side { position: sticky; top: 84px; margin-top: 44px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (max-width: 1100px) {
  .ic-body.ic-body-split { grid-template-columns: minmax(0, 1fr); }
  .ic-side { position: static; }
}

/* --------------------------------------------------------------------------
   Shared primitives
   -------------------------------------------------------------------------- */

.ic-panel { display: flex; flex-direction: column; gap: 12px; padding: 20px 22px; border-radius: 12px; background: var(--ic-panel); border: 1px solid var(--ic-border); min-width: 0; }
.ic-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ic-panel-title { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; }
.ic-card { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 10px; background: var(--ic-card); border: 1px solid var(--ic-border-soft); min-width: 0; }
.ic-label { font-size: 13px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ic-muted); }
.ic-muted { color: var(--ic-muted); }
.ic-small { font-size: 13px; }
.ic-secondary { font-size: 14px; }
.ic-note { font-size: 14px; color: var(--ic-muted); }
.ic-prose { font-size: 15px; line-height: 1.55; text-wrap: pretty; max-width: 820px; }
.ic-two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ic-three-col { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1100px) { .ic-two-col, .ic-three-col { grid-template-columns: minmax(0, 1fr); } }

.ic-kv { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 8px 16px; font-size: 14px; align-items: baseline; margin: 0; }
.ic-kv dt { color: var(--ic-muted); margin: 0; }
.ic-kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; }
.ic-kv dd em { color: var(--ic-muted); font-style: normal; }

.ic-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; white-space: nowrap; line-height: 1.3; }
.ic-tag.tag-adk, .ic-tag.tag-violet { background: var(--ic-violet-soft); color: var(--ic-violet); }
.ic-tag.tag-declared, .ic-tag.tag-accent { background: var(--ic-accent-soft); color: var(--ic-accent); }
.ic-tag.tag-live, .ic-tag.tag-green { background: var(--ic-green-soft); color: var(--ic-green); }
.ic-tag.tag-registry, .ic-tag.tag-amber { background: var(--ic-amber-soft); color: var(--ic-amber); }
.ic-tag.tag-red { background: var(--ic-red-soft); color: var(--ic-red); }
.ic-tag.tag-pack, .ic-tag.tag-muted { background: var(--ic-card); color: var(--ic-muted); border: 1px solid var(--ic-border); }
.ic-tag.tag-mono { font-family: var(--ic-mono); font-weight: 600; text-transform: none; letter-spacing: 0; }

.ic-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 8px; border: 1px solid transparent;
  font: inherit; font-size: 14px; font-weight: 700; line-height: 1.2; cursor: pointer; white-space: nowrap;
  background: var(--ic-card); color: var(--ic-fg);
}
.ic-btn:hover { filter: brightness(1.08); }
.ic-btn:disabled { opacity: 0.55; cursor: not-allowed; filter: none; }
.ic-btn-success { background: var(--ic-green); color: var(--ic-green-fg); }
.ic-btn-danger { background: var(--ic-red); color: var(--ic-red-fg); }
.ic-btn-outline-danger { background: transparent; border-color: var(--ic-red); color: var(--ic-red); }
.ic-btn-ghost { background: transparent; border-color: var(--ic-border); color: var(--ic-fg); }
.ic-btn-block { width: 100%; }
.ic-btn-sm { padding: 7px 12px; font-size: 13px; }

.ic-select {
  width: 100%; height: 36px; padding: 0 30px 0 10px; border-radius: 8px;
  background: var(--ic-card); border: 1px solid var(--ic-border); color: var(--ic-fg);
  font: inherit; font-size: 13px; appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239fb0c7' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center;
  text-overflow: ellipsis; white-space: nowrap; overflow: hidden;
}
.ic-select.mono { font-family: var(--ic-mono); }
.ic-select:disabled { opacity: 0.6; cursor: not-allowed; }
.ic-select option { background: var(--ic-panel); color: var(--ic-fg); }
.ic-field { display: flex; flex-direction: column; gap: 4px; }
.ic-field-label { font-size: 12px; color: var(--ic-muted); }

.ic-error {
  font-size: 14px; color: var(--ic-red); padding: 10px 12px; border-radius: 8px;
  background: var(--ic-red-soft); border: 1px solid var(--ic-chaos-border); overflow-wrap: anywhere;
}
.ic-empty { padding: 28px 22px; border-radius: 12px; background: var(--ic-panel); border: 1px dashed var(--ic-border); font-size: 15px; color: var(--ic-muted); text-wrap: pretty; }
.ic-pre { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--ic-card); border: 1px solid var(--ic-border-soft); font-family: var(--ic-mono); font-size: 13px; line-height: 1.5; color: var(--ic-fg); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 360px; overflow: auto; }
.ic-linkbtn { background: none; border: none; padding: 0; font: inherit; font-size: 14px; color: var(--ic-accent); cursor: pointer; }
.ic-linkbtn:hover { text-decoration: underline; }

/* --------------------------------------------------------------------------
   Chaos card (rail)
   -------------------------------------------------------------------------- */

.ic-chaos {
  display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 12px;
  background: var(--ic-chaos-bg); border: 1px solid var(--ic-chaos-border); box-shadow: 0 0 0 3px var(--ic-chaos-glow);
}
.ic-chaos-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ic-chaos-hint { font-size: 12px; color: var(--ic-muted); white-space: nowrap; }
.ic-chaos-note { font-size: 12px; color: var(--ic-muted); line-height: 1.4; }
.ic-chaos-result { font-size: 12px; color: var(--ic-fg); line-height: 1.4; overflow-wrap: anywhere; }
.ic-chaos-result code { color: var(--ic-accent); }
.ic-chaos .ic-error { font-size: 12px; padding: 8px 10px; }

/* --------------------------------------------------------------------------
   Incidents
   -------------------------------------------------------------------------- */

.ic-incident {
  display: flex; flex-direction: column; gap: 12px; padding: 18px 20px; border-radius: 12px;
  background: var(--ic-panel); border: 1px solid var(--ic-border); cursor: pointer;
}
.ic-incident.status-resolved { border-color: rgba(74, 222, 128, 0.45); }
.ic-incident.status-pending_approval { border-color: rgba(251, 191, 36, 0.55); }
.ic-incident.status-open, .ic-incident.status-planner_failed, .ic-incident.status-run_failed { border-color: rgba(251, 113, 133, 0.5); }
.ic-incident.status-planning, .ic-incident.status-remediating { border-color: rgba(92, 200, 255, 0.45); }
.ic-incident.status-rejected { opacity: 0.9; }
html[data-theme="light"] body.commander-mode .ic-incident.status-resolved { border-color: #86efac; }
html[data-theme="light"] body.commander-mode .ic-incident.status-pending_approval { border-color: #fcd34d; }
html[data-theme="light"] body.commander-mode .ic-incident.status-open { border-color: #fca5a5; }
.ic-incident.focused { box-shadow: 0 0 0 2px var(--ic-accent); }
.ic-incident.expanded { gap: 16px; }
.ic-incident-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ic-incident-ids { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ic-sev { font-family: var(--ic-mono); font-size: 13px; font-weight: 600; padding: 3px 9px; border-radius: 6px; }
.ic-sev.sev1 { background: var(--ic-red-soft); color: var(--ic-red); }
.ic-sev.sev2 { background: var(--ic-amber-soft); color: var(--ic-amber); }
.ic-status { font-size: 13px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.ic-status.s-safe { color: var(--ic-green); }
.ic-status.s-pending { color: var(--ic-amber); }
.ic-status.s-info { color: var(--ic-accent); }
.ic-status.s-crit { color: var(--ic-red); }
.ic-status.s-muted { color: var(--ic-muted); }
.ic-id { font-family: var(--ic-mono); font-size: 14px; color: var(--ic-fg); }
.ic-incident-meta { display: flex; align-items: center; gap: 16px; font-size: 14px; color: var(--ic-muted); white-space: nowrap; }
.ic-incident-meta .mono { color: var(--ic-fg); }
.ic-chevron { display: flex; color: var(--ic-muted); }
.ic-symptom { font-size: 15px; }
.ic-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ic-proposal { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border-radius: 10px; background: var(--ic-card); border: 1px solid var(--ic-amber); cursor: default; }
.ic-proposal-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ic-proposal-main { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.ic-proposal-main .mono { color: var(--ic-accent); }
.ic-proposal-diff { font-size: 13px; color: var(--ic-muted); padding: 8px 10px; border-radius: 6px; background: var(--ic-panel); border: 1px solid var(--ic-border-soft); overflow-wrap: anywhere; white-space: pre-wrap; }
.ic-proposal-why { font-size: 14px; color: var(--ic-muted); line-height: 1.5; text-wrap: pretty; }
.ic-link { color: var(--ic-muted); text-decoration: none; }
.ic-link:hover { color: var(--ic-fg); text-decoration: underline; }
.ic-detail { display: flex; flex-direction: column; gap: 16px; cursor: default; }

.ic-stages { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1250px) { .ic-stages { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ic-stage { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 10px; background: var(--ic-card); border: 1px solid var(--ic-border-soft); min-width: 0; }
.ic-stage.stage-model { border-color: rgba(167, 139, 250, 0.45); background: var(--ic-violet-soft); }
.ic-stage .ic-label.model { color: var(--ic-violet); }
.ic-stage-main { font-size: 14px; overflow-wrap: anywhere; }
.ic-stage-main .mono { color: var(--ic-accent); }
.ic-stage-sub { font-size: 14px; color: var(--ic-muted); overflow-wrap: anywhere; }
.ic-stage-sub.mono { font-size: 13px; }
.ic-stage-error { font-size: 13px; color: var(--ic-red); overflow-wrap: anywhere; }

.ic-rationale { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-radius: 10px; background: var(--ic-card); border: 1px solid var(--ic-border-soft); }
.ic-rationale-text { font-size: 15px; line-height: 1.55; text-wrap: pretty; }

.ic-timeline { display: flex; flex-direction: column; gap: 10px; }
.ic-timeline-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ic-timeline-grid { display: grid; grid-template-columns: 68px 168px minmax(0, 1fr); gap: 6px 14px; font-size: 14px; align-items: baseline; }
.ic-timeline-grid > span { min-width: 0; overflow-wrap: anywhere; }
.ic-time { font-family: var(--ic-mono); color: var(--ic-muted); white-space: nowrap; }
.ic-by { font-family: var(--ic-mono); font-size: 13px; color: var(--ic-accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ic-by.by-model { color: var(--ic-violet); }
.ic-by.by-human { color: var(--ic-green); }
.ic-by.by-error { color: var(--ic-red); }
.ic-event.ev-error { color: var(--ic-red); }
.ic-event .mono { color: var(--ic-fg); }
.ic-toggle-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   Fleet (right sidebar on Incidents)
   -------------------------------------------------------------------------- */

.ic-fleet { display: flex; flex-direction: column; gap: 14px; padding: 18px; border-radius: 12px; background: var(--ic-panel); border: 1px solid var(--ic-border); }
.ic-fleet-head { display: flex; flex-direction: column; gap: 4px; }
.ic-fleet-title { font-size: 16px; font-weight: 700; }
.ic-fleet-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.ic-pod { display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-radius: 8px; background: var(--ic-card); border: 1px solid var(--ic-border-soft); min-width: 0; cursor: default; }
.ic-pod-name { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; min-width: 0; }
.ic-pod-name .ic-dot { color: var(--ic-green); }
.ic-pod-name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ic-pod-meta { font-size: 13px; color: var(--ic-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ic-pod.warn { background: var(--ic-amber-soft); border-color: rgba(251, 191, 36, 0.55); }
.ic-pod.warn .ic-dot, .ic-pod.warn .ic-pod-meta { color: var(--ic-amber); }
.ic-pod.crit { background: var(--ic-red-soft); border-color: var(--ic-chaos-border); }
.ic-pod.crit .ic-dot, .ic-pod.crit .ic-pod-meta { color: var(--ic-red); }
.ic-pod.selected { box-shadow: 0 0 0 2px var(--ic-accent); }

/* --------------------------------------------------------------------------
   Agents
   -------------------------------------------------------------------------- */

.ic-agent-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 20px 22px; border-radius: 12px; background: var(--ic-panel); border: 1px solid var(--ic-border); }
.ic-agent-hero-left { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ic-agent-name-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ic-agent-name { font-family: var(--ic-mono); font-size: 22px; font-weight: 600; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.ic-agent-hero-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; white-space: nowrap; flex-shrink: 0; }
.ic-sources { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 4px; }

.ic-comp-root { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 10px; background: var(--ic-card); border: 1px solid rgba(92, 200, 255, 0.35); }
.ic-comp-root-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ic-comp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.ic-comp-node { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 10px; background: var(--ic-card); border: 1px solid var(--ic-border-soft); min-width: 0; }
.ic-comp-node.model { background: var(--ic-violet-soft); border-color: rgba(167, 139, 250, 0.45); }
.ic-comp-node.model .ic-label { color: var(--ic-violet); }
.ic-comp-name { font-family: var(--ic-mono); font-size: 15px; letter-spacing: -0.01em; font-weight: 600; overflow-wrap: anywhere; }

.ic-skill { display: flex; flex-direction: column; gap: 4px; padding: 12px 0; border-top: 1px solid var(--ic-border-soft); }
.ic-skill:first-of-type { border-top: none; padding-top: 0; }
.ic-skill-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 15px; font-weight: 600; }
.ic-tool-list { margin: 4px 0 0; padding-left: 18px; font-size: 14px; }
.ic-tool-list li { margin: 2px 0; }
.ic-tool-list span { color: var(--ic-muted); }
.ic-chips { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 14px; }
.ic-run-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; width: 100%; text-align: left;
  padding: 8px 12px; border-radius: 8px; background: var(--ic-card); border: 1px solid var(--ic-border-soft);
  color: inherit; font: inherit; font-size: 14px; cursor: pointer;
}
.ic-run-row:hover { border-color: var(--ic-accent); }
.ic-run-row .ic-run-open { margin-left: auto; color: var(--ic-accent); font-size: 13px; }
.ic-run-rows { display: flex; flex-direction: column; gap: 6px; }
.ic-details { border: none; padding: 0; }
.ic-details summary { cursor: pointer; font-size: 16px; font-weight: 700; list-style: none; display: flex; align-items: center; gap: 10px; }
.ic-details summary::-webkit-details-marker { display: none; }
.ic-details summary::before { content: '▸'; color: var(--ic-muted); font-size: 13px; }
.ic-details[open] summary::before { content: '▾'; }
.ic-details > *:not(summary) { margin-top: 12px; }

/* --------------------------------------------------------------------------
   Memory bank
   -------------------------------------------------------------------------- */

.ic-mem-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1100px) { .ic-mem-cards { grid-template-columns: minmax(0, 1fr); } }
.ic-mem-card { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; border-radius: 12px; background: var(--ic-panel); border: 1px solid var(--ic-border); min-width: 0; }
.ic-mem-card-main { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.ic-mem-table-wrap { overflow-x: auto; }
.ic-mem-table { display: grid; grid-template-columns: 150px 140px minmax(200px, 1.3fr) minmax(200px, 1.3fr) 150px 110px; gap: 0 16px; font-size: 14px; min-width: 960px; }
.ic-mem-th { font-size: 13px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ic-muted); padding: 0 0 8px; border-bottom: 1px solid var(--ic-border); }
.ic-mem-row { display: contents; cursor: pointer; }
.ic-mem-td { padding: 12px 0; border-bottom: 1px solid var(--ic-border-soft); text-wrap: pretty; min-width: 0; overflow-wrap: anywhere; }
.ic-mem-row.last .ic-mem-td { border-bottom: none; }
.ic-mem-row:hover .ic-mem-td { background: var(--ic-accent-soft); }
.ic-mem-td .ic-small { color: var(--ic-muted); }
.ic-mem-lesson { color: var(--ic-muted); }

/* --------------------------------------------------------------------------
   About
   -------------------------------------------------------------------------- */

.ic-about-hero { display: flex; flex-direction: column; gap: 10px; padding: 22px 24px; border-radius: 12px; background: var(--ic-panel); border: 1px solid var(--ic-border); }
.ic-about-title { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.ic-list { display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.ic-list strong { font-weight: 700; }

/* --------------------------------------------------------------------------
   Buttons used outside the ic- primitives (slot inspector, swarm panel).
   -------------------------------------------------------------------------- */
.btn {
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 8px 16px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-primary {
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  color: #0f172a;
}

.btn-primary:hover {
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
}

.btn-danger:hover {
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.4);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, #34d399, #059669);
  color: #0f172a;
}

.btn-success:hover {
  box-shadow: 0 0 16px rgba(52, 211, 153, 0.4);
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-sm {
  padding: 4px 8px;
  font-size: 0.72rem;
}

/* ==========================================================================
   5. Live Incident Agent Loop Panel (real /api/incidents IncidentRecords)
   ========================================================================== */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}


/* Memory bank: derived kinds (lesson / triage / decision) */
.ic-fact-list { display: flex; flex-direction: column; gap: 10px; }
.ic-fact { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 10px; background: var(--ic-card); border: 1px solid var(--ic-border-soft); }
.ic-fact-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ic-fact-body { font-size: 15px; line-height: 1.5; text-wrap: pretty; overflow-wrap: anywhere; }
.ic-fact-head .ic-tag { white-space: normal; line-height: 1.4; }

/* Memory bank tabs */
.ic-tabs { display: flex; gap: 4px; width: 100%; border-bottom: 2px solid var(--ic-border); overflow-x: auto; }
.ic-tab { position: relative; display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px; margin-bottom: -2px; border: none; border-bottom: 3px solid transparent; border-radius: 0; background: transparent; color: var(--ic-muted); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.ic-tab:hover { color: var(--ic-fg); border-bottom-color: var(--ic-border); }
.ic-tab.active { color: var(--ic-fg); border-bottom-color: var(--ic-accent); font-weight: 700; }
.ic-tab-count { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 10px; background: var(--ic-panel); border: 1px solid var(--ic-border); font-size: 12px; color: var(--ic-muted); }
.ic-tab.active .ic-tab-count { color: var(--ic-accent); border-color: var(--ic-accent); }

/* --------------------------------------------------------------------------
   Slot-machinery UI: the injected-widget container (index.tsx) and the
   customizer studio's own controls.
   -------------------------------------------------------------------------- */

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
  display: inline-block;
}

.warroom-injected-slot {
  transition: all 0.3s ease;
}

.customizer-studio-panel {
  background: var(--ic-panel);
  border: 1px solid var(--ic-border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.customizer-input-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.customizer-input {
  background: rgba(2, 6, 23, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 10px;
  color: #fff;
  font-family: inherit;
  font-size: 0.8rem;
  resize: none;
  outline: none;
}

.customizer-input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.2);
}

.prompt-presets-title {
  font-size: 0.7rem;
  color: #94a3b8;
  font-weight: 700;
  text-transform: uppercase;
  margin-top: 4px;
}

.chips-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chip-btn {
  background: rgba(2, 6, 23, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.chip-btn:hover {
  border-color: #38bdf8;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.05);
}

.tsx-preview-box {
  background: #020617;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: #38bdf8;
  max-height: 180px;
  overflow-y: auto;
  white-space: pre-wrap;
}

/* ==========================================================================
   Modal chrome — the app pack's one modal, the declared-slot inspector.
   Themed from the same tokens as the rest of the pack (app.css), so it
   follows the light/dark switch instead of pinning its own dark palette.
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.modal-backdrop.active { display: flex; }

.modal-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 680px;
  max-height: 88vh;
  overflow: hidden;
  border-radius: 12px;
  background: var(--ic-panel);
  border: 1px solid var(--ic-border);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  animation: modalSlideUp 0.25s ease;
}

@keyframes modalSlideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  padding: 16px 20px;
  background: var(--ic-card);
  border-bottom: 1px solid var(--ic-border-soft);
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--ic-fg);
}

.modal-body {
  padding: 20px;
  overflow: auto;
  color: var(--ic-fg);
}

.modal-footer {
  padding: 14px 20px;
  background: var(--ic-card);
  border-top: 1px solid var(--ic-border-soft);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
