/* bosun panel — Phase 6 full UI mock implementation.
 *
 * Hand-crafted; not Tailwind/Bootstrap. Phase 3 baseline preserved (badge
 * `.b-<value>` classes + form layout) for backward-compat with existing
 * templates; Phase 6 layer extends with semantic classes (severity-*-*) +
 * layout primitives mirroring the design mock
 * (docs/sessions/design/260504-02-inventory-dashboard-mock/inventory-mock.html).
 *
 * CSS enum→class normalization (Phase 6 side-task #3):
 *   `.severity-impact-{minor,major,critical}`
 *   `.severity-criticality-{low,medium,high,critical}`
 *   `.severity-health-{healthy,degraded,offline,unknown}`  (mate enum reality
 *      — `ok` reserved for redundancy and rollout n-a fallback)
 *   `.severity-lifecycle-{new,bootstrapped,fleet-ready,failed,retired}`
 *   `.severity-rollout-{rolling-normally,rollout-stuck,not-ready-after-update,
 *                       config-drift,n-a}`
 *   `.severity-redundancy-{ok,spof,n-a}`
 *   `.severity-freshness-{fresh,stale,lost}`
 */

:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --surface-3: #e8eaee;
  --border: #e3e6eb;
  --border-strong: #c8cdd5;
  --text: #1d2330;
  --text-2: #5b6473;
  --text-3: #8b94a3;
  --accent: #2f5dff;
  --accent-bg: #e8efff;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --success: #15803d;
  --success-bg: #dcfce7;

  --c-healthy: #15803d;        --c-healthy-bg: #dcfce7;
  --c-degraded: #b45309;       --c-degraded-bg: #fef3c7;
  --c-offline: #b91c1c;        --c-offline-bg: #fee2e2;
  --c-unknown: #475569;        --c-unknown-bg: #e2e8f0;

  --c-crit: #991b1b;           --c-crit-bg: #fee2e2;
  --c-high: #c2410c;           --c-high-bg: #ffedd5;
  --c-med: #1e40af;            --c-med-bg: #dbeafe;
  --c-low: #475569;            --c-low-bg: #e2e8f0;

  --c-spof: #b91c1c;           --c-spof-bg: #fee2e2;
  --c-ok: #15803d;             --c-ok-bg: #dcfce7;

  --c-stuck: #b91c1c;          --c-stuck-bg: #fee2e2;
  --c-drift: #b45309;          --c-drift-bg: #fef3c7;
  --c-rolling: #1e40af;        --c-rolling-bg: #dbeafe;
  --c-not-ready: #b45309;      --c-not-ready-bg: #fef3c7;

  --c-fresh: #15803d;
  --c-stale: #b45309;
  --c-lost: #b91c1c;

  --shadow-sm: 0 1px 2px rgba(15,23,42,0.04);
  --shadow-md: 0 6px 18px rgba(15,23,42,0.10);
  --shadow-lg: 0 24px 60px rgba(15,23,42,0.22);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 13px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; }

/* --- Header / nav --- */
header.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 60;
}
header.topbar .brand { font-weight: 700; font-size: 15px; letter-spacing: 0.3px; }
header.topbar .brand .dot { color: var(--accent); }
header.topbar nav { display: flex; gap: 14px; }
header.topbar nav a { color: var(--text-2); }
header.topbar nav a.active { color: var(--text); font-weight: 600; }
header.topbar .spacer { flex: 1; }
header.topbar .actor {
  font-size: 11px; color: var(--text-3);
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 3px 9px; border-radius: 12px;
}

main { padding: 18px 20px 40px; }
h1 { font-size: 20px; font-weight: 700; margin: 0 0 16px; }
h2 { font-size: 14px; font-weight: 600; margin: 18px 0 8px; color: var(--text-2); }

/* --- Page header (with title + actions) --- */
.page-header {
  display: flex; align-items: center; gap: 16px; margin-bottom: 16px;
}
.page-header .page-title { font-size: 20px; font-weight: 700; margin: 0; }
.page-header .page-sub { color: var(--text-3); font-size: 12px; }
.page-header .spacer { flex: 1; }

/* --- Scope-switcher (namespace selector + actor display) --- */
.scope-switcher {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 4px 10px;
}
.scope-switcher label {
  color: var(--text-3); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.scope-switcher select {
  background: transparent; border: none; padding: 4px 4px;
  font-weight: 600; outline: none; color: var(--text);
  font-size: 12.5px;
}
.scope-switcher .ns-pill {
  background: var(--surface); border: 1px solid var(--border);
  padding: 3px 9px; border-radius: 12px; font-size: 12px; color: var(--text);
}

/* --- Summary strip (top metric tiles) --- */
.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.summary-tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; box-shadow: var(--shadow-sm);
  text-align: left; width: 100%;
}
.summary-tile .tile-title {
  text-transform: uppercase; letter-spacing: 0.6px; font-size: 10.5px;
  color: var(--text-3); font-weight: 600; margin-bottom: 8px;
}
.summary-tile .tile-big {
  font-size: 26px; font-weight: 700; line-height: 1; margin-bottom: 8px;
  display: flex; align-items: baseline; gap: 8px;
}
.summary-tile .tile-big .unit {
  font-size: 13px; color: var(--text-3); font-weight: 500;
}
.summary-tile .tile-breakdown {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.mini-stat {
  font-size: 11.5px; padding: 2px 8px; border-radius: 8px;
  background: var(--surface-2); color: var(--text-2);
  border: 1px solid var(--border);
}
.mini-stat strong { color: var(--text); font-weight: 600; }
.mini-stat.is-warn { background: var(--c-degraded-bg); color: var(--c-degraded); border-color: var(--c-degraded-bg); }
.mini-stat.is-bad  { background: var(--c-offline-bg);  color: var(--c-offline);  border-color: var(--c-offline-bg);  }
.mini-stat.is-good { background: var(--c-healthy-bg);  color: var(--c-healthy);  border-color: var(--c-healthy-bg);  }

/* --- Retired tab toggle --- */
.retired-tab {
  display: flex; gap: 4px; border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.retired-tab .tab {
  background: transparent; border: none; padding: 10px 14px;
  color: var(--text-2); font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  text-decoration: none;
}
.retired-tab .tab.is-active {
  color: var(--text); border-bottom-color: var(--accent);
}
.retired-tab .tab .tab-count {
  background: var(--surface-2); padding: 1px 7px; border-radius: 10px;
  font-size: 11px; margin-left: 4px; color: var(--text-2);
}

/* --- Filter bar + popovers (Alpine x-data driven) --- */
.filter-bar {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 12px; box-shadow: var(--shadow-sm);
  position: relative;
}
.filter-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.filter-popover-button {
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 8px; padding: 6px 10px;
  color: var(--text-2); font-size: 12px;
  display: inline-flex; align-items: center; gap: 6px;
  position: relative;
}
.filter-popover-button:hover {
  border-color: var(--border-strong); color: var(--text);
}
.filter-popover-button.is-active {
  background: var(--accent-bg); border-color: var(--accent); color: var(--accent);
}
.filter-popover-button .count {
  background: rgba(47,93,255,0.18); border-radius: 10px;
  padding: 0 6px; font-size: 11px; font-weight: 600; color: var(--accent);
}
.filter-popover-button .caret { color: var(--text-3); }

.filter-popover {
  position: absolute; top: calc(100% + 4px); left: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-md); padding: 6px; min-width: 220px; z-index: 30;
}
.filter-popover .pop-title {
  font-size: 10.5px; color: var(--text-3); padding: 6px 10px 4px;
  text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600;
}
.filter-popover label.opt-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px; border-radius: 6px; cursor: pointer;
  font-size: 12.5px;
}
.filter-popover label.opt-row:hover { background: var(--surface-2); }
.filter-popover .pop-foot {
  border-top: 1px solid var(--border); margin-top: 4px;
  padding: 6px 6px 2px; display: flex; justify-content: space-between;
}
.filter-popover .pop-foot button {
  background: transparent; border: none; color: var(--accent); font-size: 11.5px;
  padding: 4px 6px;
}
.filter-popover .pop-foot button:hover { text-decoration: underline; }

.active-chips {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; min-height: 0;
}
.active-chips:empty { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-bg); color: var(--accent);
  padding: 3px 4px 3px 10px; border-radius: 14px; font-size: 11.5px;
  border: 1px solid transparent;
}
.chip .x {
  background: rgba(47,93,255,0.18); color: var(--accent); border-radius: 50%;
  width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center;
  border: none; padding: 0; font-size: 11px; line-height: 1;
}
.chip .x:hover { background: var(--accent); color: #fff; }

/* Legacy filter form (Phase 3 baseline; kept for compatibility) */
form.filters {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 12px;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
form.filters label {
  font-size: 11.5px; color: var(--text-3);
  display: inline-flex; align-items: center; gap: 6px;
}
form.filters select, form.filters input[type=text] {
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 6px; padding: 5px 8px; font-size: 12px; color: var(--text);
  outline: none;
}
form.filters select:focus, form.filters input:focus { border-color: var(--accent); }
form.filters .spacer { flex: 1; }

/* --- Buttons --- */
.btn {
  border: 1px solid var(--border); background: var(--surface);
  padding: 6px 12px; border-radius: 8px; color: var(--text);
  font-size: 12px; font-weight: 500; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.btn-primary:hover { filter: brightness(1.05); background: var(--accent); }
.btn.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.btn-ghost:hover { background: var(--surface-2); }
.btn.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-bg); }
.btn.btn-danger:hover { background: #fcd1d1; }
.btn.disabled {
  background: var(--surface-2); color: var(--text-3); border-color: var(--border);
  cursor: not-allowed; filter: none;
}
.btn .lock {
  margin-left: 6px; font-size: 10px; color: var(--text-3); background: var(--surface);
  padding: 0 5px; border-radius: 4px; border: 1px solid var(--border);
}
.btn.btn-primary:not(.disabled) .lock {
  background: rgba(255,255,255,0.18); color: rgba(255,255,255,0.85); border-color: transparent;
}

/* --- Bulk-action bar --- */
.bulk-action-bar {
  align-items: center; gap: 10px;
  background: var(--text); color: #fff; padding: 10px 14px;
  border-radius: 10px; margin-bottom: 10px;
  box-shadow: var(--shadow-md);
  display: flex;
}
.bulk-action-bar .count {
  font-weight: 700; padding-right: 8px;
  border-right: 1px solid rgba(255,255,255,0.2); margin-right: 4px;
}
.bulk-action-bar .bulk-btn {
  background: rgba(255,255,255,0.12); color: #fff; border: none;
  padding: 5px 12px; border-radius: 6px; font-size: 12px;
}
.bulk-action-bar .bulk-btn:hover { background: rgba(255,255,255,0.22); }
.bulk-action-bar .bulk-btn.disabled { opacity: 0.4; cursor: not-allowed; }
.bulk-action-bar .spacer { flex: 1; }
.bulk-action-bar .x-clear {
  background: transparent; color: #fff;
  border: 1px solid rgba(255,255,255,0.3); padding: 4px 10px;
  border-radius: 6px; font-size: 12px;
}

/* --- Inventory grid (table) --- */
.inventory-grid, .table-wrap {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  overflow: visible; box-shadow: var(--shadow-sm);
}
table.inv { width: 100%; border-collapse: collapse; }
table.inv th, table.inv td {
  text-align: left; padding: 10px 12px; vertical-align: middle;
  border-bottom: 1px solid var(--border); font-size: 12.5px;
}
table.inv thead th {
  background: var(--surface-2); color: var(--text-3);
  font-weight: 600; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: 0.5px; white-space: nowrap;
}
table.inv tbody tr { cursor: pointer; }
table.inv tbody tr:hover { background: #fafbfd; }
table.inv tbody tr:hover .row-quick-actions { opacity: 1; }
table.inv tbody tr.is-selected { background: var(--accent-bg); }
table.inv tbody tr.is-suppressed { opacity: 0.62; }
table.inv tbody tr:last-child td { border-bottom: none; }
table.inv th.col-check, table.inv td.col-check { width: 30px; padding-right: 0; }
table.inv th.col-actions, table.inv td.col-actions { width: 110px; text-align: right; }
table.inv td.caption-cell { font-weight: 600; }
table.inv td.caption-cell a { color: var(--text); }
table.inv td.caption-cell a:hover { color: var(--accent); }
table.inv td.muted { color: var(--text-3); }
table.inv td.dim { color: var(--text-3); font-family: ui-monospace, monospace; font-size: 11.5px; }
.row-checkbox { transform: translateY(1px); cursor: pointer; }

/* Component cell — caption + meta */
.comp-cell { min-width: 220px; }
.comp-name {
  font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.comp-meta {
  font-size: 11px; color: var(--text-3); margin-top: 2px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.comp-meta .ns { color: var(--text-2); font-weight: 500; }

/* --- Action menu (per-row) --- */
.action-menu-anchor { position: relative; display: inline-block; }
.action-menu-button {
  border: none; background: transparent; color: var(--text-3);
  width: 28px; height: 28px; border-radius: 6px;
  font-size: 18px; line-height: 1;
}
.action-menu-button:hover { background: var(--surface-2); color: var(--text); }
.action-menu {
  position: absolute; right: 4px; top: 32px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-md); padding: 6px; min-width: 240px; z-index: 30;
}
.action-menu .menu-section {
  font-size: 10.5px; color: var(--text-3); padding: 6px 10px 4px;
  text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600;
}
.action-menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: transparent; border: none;
  padding: 6px 10px; border-radius: 6px;
  color: var(--text); font-size: 12.5px; text-align: left;
  text-decoration: none;
}
.action-menu-item:hover { background: var(--surface-2); text-decoration: none; }
.action-menu-item.disabled { color: var(--text-3); cursor: not-allowed; }
.action-menu-item.disabled:hover { background: transparent; }
.action-menu-item.danger { color: var(--c-offline); }
.action-menu-item.danger.disabled { color: var(--text-3); }
.action-menu-item .lock {
  margin-left: auto; font-size: 10px; color: var(--text-3);
  background: var(--surface-2); padding: 0 6px; border-radius: 4px;
}
.action-menu .divider { height: 1px; background: var(--border); margin: 4px 0; }

/* --- Side panel (htmx swap target) --- */
.side-panel-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,0.28);
  z-index: 40;
}
.side-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 580px; max-width: 100vw;
  background: var(--surface); box-shadow: -8px 0 32px rgba(15,23,42,0.18);
  display: flex; flex-direction: column;
  z-index: 50;
  overflow-y: auto;
}
.side-panel.is-empty { display: none; }
.side-panel .panel-head {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; gap: 12px;
}
.side-panel .panel-title { font-size: 16px; font-weight: 700; }
.side-panel .panel-sub { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.side-panel .panel-close {
  margin-left: auto; background: transparent; border: none;
  width: 30px; height: 30px; font-size: 18px; color: var(--text-3); border-radius: 6px;
}
.side-panel .panel-close:hover { background: var(--surface-2); color: var(--text); }
.side-panel .panel-body { padding: 0; flex: 1; }
.side-panel .panel-actions {
  padding: 14px 18px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; flex-wrap: wrap; background: var(--surface);
  align-items: center;
}

/* --- Section blocks (used in detail page + side panel) --- */
.section {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px 18px; margin-bottom: 14px;
}
.side-panel .section {
  border: none; border-radius: 0; border-bottom: 1px solid var(--border);
  margin-bottom: 0; padding: 14px 18px;
}
.section .section-title {
  font-size: 10.5px; color: var(--text-3); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.7px; margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.section .section-title .private-tag,
.private-tag {
  display: inline-block; margin-left: 4px;
  background: var(--surface-2); color: var(--text-3); border-radius: 4px;
  padding: 0 5px; font-size: 10px; font-weight: 600; letter-spacing: 0.4px;
  text-transform: uppercase;
}
.section .section-title .inline-action {
  margin-left: auto; font-size: 11px;
  border: 1px solid var(--border); background: var(--surface);
  padding: 3px 8px; border-radius: 6px; color: var(--text); font-weight: 600;
  text-transform: none; letter-spacing: 0;
}

/* --- KV grid (used in detail + side panel) --- */
.detail-grid, .kv {
  display: grid; grid-template-columns: 132px 1fr;
  gap: 4px 12px; font-size: 12.5px;
  margin-bottom: 18px;
}
.kv { margin-bottom: 0; }
.detail-grid .k, .kv .k { color: var(--text-3); padding: 3px 0; }
.detail-grid .v, .kv .v { color: var(--text); padding: 3px 0; word-break: break-word; }
.detail-grid .v.muted, .kv .v.muted { color: var(--text-3); font-style: italic; }
.detail-grid .v code, .kv .v code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11.5px; background: var(--surface-2);
  padding: 1px 5px; border-radius: 4px;
}

/* --- Audit timeline (detail page) --- */
.timeline { margin: 0; padding: 0; list-style: none; font-size: 12px; }
.timeline li {
  display: flex; gap: 10px; padding: 5px 0;
  border-bottom: 1px dashed var(--border);
}
.timeline li:last-child { border-bottom: none; }
.timeline .when {
  color: var(--text-3); font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px; min-width: 95px;
}
.timeline .what { color: var(--text-2); }
.timeline .what code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px; background: var(--surface-2);
  padding: 1px 5px; border-radius: 4px;
}

/* --- Form rows (severity PATCH; also used inside modals) --- */
form.severity-form .form-row,
.form-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px 12px;
  margin-bottom: 10px;
  align-items: center;
}
form.severity-form label,
.form-row > label {
  color: var(--text-2); font-size: 12.5px; font-weight: 500;
}
form.severity-form .opt,
.form-row > label .opt {
  color: var(--text-3); font-weight: 400; font-size: 11px;
}
form.severity-form input,
form.severity-form select,
.form-control {
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 6px; padding: 6px 10px; font-size: 12.5px;
  outline: none;
}
form.severity-form input:focus,
form.severity-form select:focus,
.form-control:focus {
  border-color: var(--accent);
}
form.severity-form .form-actions { margin-top: 12px; }

#patch-result {
  margin-top: 10px; font-size: 12px; padding: 8px 10px; border-radius: 6px;
  display: none;
}
#patch-result.ok  { display: block; background: var(--c-healthy-bg); color: var(--c-healthy); }
#patch-result.err { display: block; background: var(--c-offline-bg); color: var(--c-offline); }

/* --- Badges (Phase 3 legacy `.b-<value>` aliases preserved) --- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 12px;
  background: var(--surface-2); color: var(--text-2); white-space: nowrap;
}
.badge .dot {
  width: 6px; height: 6px; border-radius: 50%; display: inline-block;
  background: currentColor;
}

/* health (Phase 3 legacy) */
.badge.b-healthy   { background: var(--c-healthy-bg);   color: var(--c-healthy); }
.badge.b-degraded  { background: var(--c-degraded-bg);  color: var(--c-degraded); }
.badge.b-offline   { background: var(--c-offline-bg);   color: var(--c-offline); }
.badge.b-unknown   { background: var(--c-unknown-bg);   color: var(--c-unknown); }

/* criticality (Phase 3 legacy) */
.badge.b-critical  { background: var(--c-crit-bg);      color: var(--c-crit); }
.badge.b-high      { background: var(--c-high-bg);      color: var(--c-high); }
.badge.b-medium    { background: var(--c-med-bg);       color: var(--c-med); }
.badge.b-low       { background: var(--c-low-bg);       color: var(--c-low); }

/* rollout_verdict (Phase 3 legacy) */
.badge.b-rolling-normally       { background: var(--c-rolling-bg);   color: var(--c-rolling); }
.badge.b-rollout-stuck          { background: var(--c-stuck-bg);     color: var(--c-stuck); }
.badge.b-not-ready-after-update { background: var(--c-not-ready-bg); color: var(--c-not-ready); }
.badge.b-config-drift           { background: var(--c-drift-bg);     color: var(--c-drift); }

/* redundancy (Phase 3 legacy) */
.badge.b-ok    { background: var(--c-ok-bg);    color: var(--c-ok); }
.badge.b-spof  { background: var(--c-spof-bg);  color: var(--c-spof); }

/* telemetry_freshness (Phase 3 legacy) */
.badge.b-fresh { background: var(--c-healthy-bg);  color: var(--c-healthy); }
.badge.b-stale { background: var(--c-degraded-bg); color: var(--c-degraded); }
.badge.b-lost  { background: var(--c-offline-bg);  color: var(--c-offline); }

/* `n-a` enum value renders as class `b-n-a` (Jinja drops dashes verbatim);
   we keep `b-na` for literal "na" usage and add `b-n-a` alias for enum. */
.badge.b-na, .badge.b-n-a { background: var(--surface-2);  color: var(--text-3); }

/* --- Phase 6 semantic enum→class normalization (side-task #3) --- */

/* severity-impact-{minor,major,critical} (operator-private free-form
   text, but operators may use these informal tags). */
.severity-impact-minor    { background: var(--c-low-bg);  color: var(--c-low);  border-radius: 12px; padding: 2px 8px; font-size: 11.5px; font-weight: 600; }
.severity-impact-major    { background: var(--c-high-bg); color: var(--c-high); border-radius: 12px; padding: 2px 8px; font-size: 11.5px; font-weight: 600; }
.severity-impact-critical { background: var(--c-crit-bg); color: var(--c-crit); border-radius: 12px; padding: 2px 8px; font-size: 11.5px; font-weight: 600; }

/* severity-criticality-* */
.severity-criticality-low      { background: var(--c-low-bg);  color: var(--c-low);  border-radius: 12px; padding: 2px 8px; font-size: 11.5px; font-weight: 600; }
.severity-criticality-medium   { background: var(--c-med-bg);  color: var(--c-med);  border-radius: 12px; padding: 2px 8px; font-size: 11.5px; font-weight: 600; }
.severity-criticality-high     { background: var(--c-high-bg); color: var(--c-high); border-radius: 12px; padding: 2px 8px; font-size: 11.5px; font-weight: 600; }
.severity-criticality-critical { background: var(--c-crit-bg); color: var(--c-crit); border-radius: 12px; padding: 2px 8px; font-size: 11.5px; font-weight: 600; }

/* severity-health-* */
.severity-health-healthy  { background: var(--c-healthy-bg);  color: var(--c-healthy);  border-radius: 12px; padding: 2px 8px; font-size: 11.5px; font-weight: 600; }
.severity-health-degraded { background: var(--c-degraded-bg); color: var(--c-degraded); border-radius: 12px; padding: 2px 8px; font-size: 11.5px; font-weight: 600; }
.severity-health-offline  { background: var(--c-offline-bg);  color: var(--c-offline);  border-radius: 12px; padding: 2px 8px; font-size: 11.5px; font-weight: 600; }
.severity-health-unknown  { background: var(--c-unknown-bg);  color: var(--c-unknown);  border-radius: 12px; padding: 2px 8px; font-size: 11.5px; font-weight: 600; }

/* severity-lifecycle-* (D-002 enum: new, bootstrapped, fleet-ready, failed, retired) */
.severity-lifecycle-new          { background: var(--surface-2);     color: var(--text-2);    border-radius: 12px; padding: 2px 8px; font-size: 11.5px; font-weight: 600; }
.severity-lifecycle-bootstrapped { background: var(--c-rolling-bg);  color: var(--c-rolling); border-radius: 12px; padding: 2px 8px; font-size: 11.5px; font-weight: 600; }
.severity-lifecycle-fleet-ready  { background: var(--c-healthy-bg);  color: var(--c-healthy); border-radius: 12px; padding: 2px 8px; font-size: 11.5px; font-weight: 600; }
.severity-lifecycle-failed       { background: var(--c-offline-bg);  color: var(--c-offline); border-radius: 12px; padding: 2px 8px; font-size: 11.5px; font-weight: 600; }
.severity-lifecycle-retired      { background: var(--surface-3);     color: var(--text-3);    border-radius: 12px; padding: 2px 8px; font-size: 11.5px; font-weight: 600; }

/* severity-rollout-* (closed enum from compute_rollout_verdict) */
.severity-rollout-rolling-normally       { background: var(--c-rolling-bg);   color: var(--c-rolling);   border-radius: 12px; padding: 2px 8px; font-size: 11.5px; font-weight: 600; }
.severity-rollout-rollout-stuck          { background: var(--c-stuck-bg);     color: var(--c-stuck);     border-radius: 12px; padding: 2px 8px; font-size: 11.5px; font-weight: 600; }
.severity-rollout-not-ready-after-update { background: var(--c-not-ready-bg); color: var(--c-not-ready); border-radius: 12px; padding: 2px 8px; font-size: 11.5px; font-weight: 600; }
.severity-rollout-config-drift           { background: var(--c-drift-bg);     color: var(--c-drift);     border-radius: 12px; padding: 2px 8px; font-size: 11.5px; font-weight: 600; }
.severity-rollout-n-a                    { background: var(--surface-2);      color: var(--text-3);      border-radius: 12px; padding: 2px 8px; font-size: 11.5px; font-weight: 600; }

/* severity-redundancy-* */
.severity-redundancy-ok   { background: var(--c-ok-bg);    color: var(--c-ok);     border-radius: 12px; padding: 2px 8px; font-size: 11.5px; font-weight: 600; }
.severity-redundancy-spof { background: var(--c-spof-bg);  color: var(--c-spof);   border-radius: 12px; padding: 2px 8px; font-size: 11.5px; font-weight: 600; }
.severity-redundancy-n-a  { background: var(--surface-2);  color: var(--text-3);   border-radius: 12px; padding: 2px 8px; font-size: 11.5px; font-weight: 600; }

/* severity-freshness-* (telemetry) */
.severity-freshness-fresh { background: var(--c-healthy-bg);  color: var(--c-healthy);  border-radius: 12px; padding: 2px 8px; font-size: 11.5px; font-weight: 600; }
.severity-freshness-stale { background: var(--c-degraded-bg); color: var(--c-degraded); border-radius: 12px; padding: 2px 8px; font-size: 11.5px; font-weight: 600; }
.severity-freshness-lost  { background: var(--c-offline-bg);  color: var(--c-offline);  border-radius: 12px; padding: 2px 8px; font-size: 11.5px; font-weight: 600; }

/* --- Role chip --- */
.role-chip {
  font-size: 10px; padding: 1px 6px; border-radius: 4px;
  background: var(--surface-2); color: var(--text-2); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.role-chip.role-main   { background: #ede9fe; color: #6d28d9; }
.role-chip.role-bridge { background: #cffafe; color: #0e7490; }
.role-chip.role-exit   { background: #fef3c7; color: #92400e; }

/* --- Empty state --- */
.empty {
  padding: 60px 20px; text-align: center; color: var(--text-3);
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}

/* --- Tooltip helper (CSS-only) — used for derived-field explanations --- */
.tooltip-anchor {
  position: relative; display: inline-block; cursor: help;
  border-bottom: 1px dotted var(--text-3);
}
.tooltip-anchor .tooltip-body {
  position: absolute; left: 0; top: calc(100% + 4px);
  background: var(--text); color: #fff;
  padding: 6px 10px; border-radius: 6px; font-size: 11px;
  white-space: nowrap; z-index: 70;
  opacity: 0; pointer-events: none; transition: opacity 0.12s;
}
.tooltip-anchor:hover .tooltip-body {
  opacity: 1; pointer-events: auto;
}

/* --- Phase 6 Implementer #3 — Modals (Add-node / set-deployment-ref) --- */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 0;
  width: min(560px, 92vw); max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.modal-head .panel-close {
  margin-left: auto; background: transparent; border: none;
  font-size: 22px; line-height: 1; cursor: pointer; color: var(--text-3);
}
.modal-head .panel-close:hover { color: var(--text); }
.modal-body {
  padding: 18px; overflow-y: auto;
}
.modal-result {
  margin-top: 14px; padding: 10px 12px; border-radius: 6px; font-size: 12.5px;
}
.modal-result.ok  { background: var(--c-healthy-bg); color: var(--c-healthy); }
.modal-result.err { background: var(--c-offline-bg); color: var(--c-offline); }
.modal-result pre {
  background: rgba(255,255,255,0.4); border: 1px solid var(--border);
  padding: 8px; border-radius: 6px; overflow-x: auto; font-size: 11.5px;
  white-space: pre-wrap; word-break: break-all;
}
.visible-once {
  background: var(--c-stuck-bg); color: var(--c-stuck);
  border: 1px dashed var(--c-stuck);
  padding: 8px; border-radius: 6px; font-family: monospace;
  font-size: 12px; word-break: break-all; user-select: all;
}

/* --- RPC results table (207 Multi-Status display) --- */
.rpc-results {
  margin: 14px 0; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
}
.rpc-results-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 8px; font-size: 12.5px;
}
.rpc-results-summary {
  display: flex; gap: 10px; margin-bottom: 8px; font-size: 12px;
}
.rpc-results-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
}
.rpc-results-table th, .rpc-results-table td {
  text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border);
}
.rpc-results-table th { font-weight: 600; color: var(--text-2); }

/* --- Registry management UI (Phase 6) --- */
.registry-section { margin-bottom: 28px; }
.registry-section .section-title { font-weight: 600; margin-bottom: 8px; }
.registry-section .registry-table {
  width: 100%; border-collapse: collapse; font-size: 12.5px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
}
.registry-section .registry-table th,
.registry-section .registry-table td {
  text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border);
}
.registry-section .registry-table th {
  font-weight: 600; color: var(--text-2); background: var(--surface-2);
}
.promote-mode-toggle {
  display: inline-flex; gap: 0;
  border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
}
.promote-mode-toggle button {
  background: var(--surface); border: none; padding: 4px 10px;
  font-size: 11.5px; cursor: pointer; color: var(--text-2);
}
.promote-mode-toggle button.is-active {
  background: var(--accent); color: #fff;
}
.promote-mode-toggle button:disabled {
  opacity: 0.5; cursor: not-allowed;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .summary-strip { grid-template-columns: repeat(2, 1fr); }
  .side-panel { width: 100vw; }
  .filter-row { gap: 6px; }
  .scope-switcher { padding: 3px 6px; }
  .scope-switcher label { display: none; }
}
