:root {
  /* ===== Build Order 012A Stage P1 — visual design system tokens ===== */
  --bg-main: #f7f6f4;
  --bg-sidebar: #eeede9;
  --bg-card: #ffffff;
  --border: #dddcd6;
  --border-light: #ebeae5;
  --border-strong: #c7c6bf;
  /* Text hierarchy (primary = body default; secondary/muted are subordinate) */
  --text: #1f1f1f;
  --text-primary: var(--text);
  --text-body: var(--text);
  --text-secondary: #5c5c5c;
  --text-muted: #6e6e69;
  --blue: #2563eb;
  --blue-soft: #eff6ff;
  --green: #15803d;
  --green-soft: #ecfdf3;
  --amber: #b45309;
  --amber-soft: #fffbeb;
  --red: #b91c1c;
  --red-soft: #fef2f2;
  --grey-soft: #f3f3f1;
  /* Status semantics (alias existing palette) */
  --status-good: var(--green);
  --status-warning: var(--amber);
  --status-error: var(--red);

  /* Surfaces / elevation — calm, mostly flat; shadow is a rare accent, not decoration */
  --surface: var(--bg-card);
  --surface-sunken: #fafaf8;
  --surface-muted: #f3f3f1;
  --surface-overlay: rgba(28, 25, 23, 0.4);
  --shadow-xs: 0 1px 2px rgba(20, 18, 16, 0.05);
  --shadow-sm: 0 1px 3px rgba(20, 18, 16, 0.08), 0 1px 2px rgba(20, 18, 16, 0.05);
  --shadow-md: 0 6px 20px rgba(20, 18, 16, 0.10), 0 2px 6px rgba(20, 18, 16, 0.06);
  --shadow-lg: 0 16px 40px rgba(20, 18, 16, 0.16);

  /* Typography scale — one deliberate step per hierarchy level, not a font-size free-for-all */
  --fs-display: 17px;   /* application identity (brand) */
  --fs-page: 18px;       /* primary destination heading (Fleet / System) */
  --fs-identity: 17px;   /* Environment identity (arrived-at) */
  --fs-heading: 13px;    /* card / panel heading */
  --fs-body: 13px;       /* body text */
  --fs-body-sm: 12px;    /* dense body / secondary text */
  --fs-meta: 11px;       /* metadata, timestamps, freshness */
  --fs-label: 10px;      /* uppercase labels */
  --fs-mono: 12px;       /* table / evidence mono text */
  --fs-mono-sm: 11px;    /* dense mono (console, evidence) */
  --lh-tight: 1.25;
  --lh-normal: 1.45;
  --lh-relaxed: 1.55;

  /* Metric typography (Fleet) */
  --metric-value-size: 22px;
  --metric-label-size: 10px;

  /* Spacing scale — 4px base unit; structural gaps use larger steps, dense areas use smaller */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;

  /* Card spacing */
  --card-padding: 14px 16px;
  --card-gap: 14px;
  --sidebar-width: 200px;
  --activity-width: 300px;

  /* Radius scale */
  --radius-sm: 6px;
  --radius: 9px;
  --radius-lg: 12px;
  --radius-pill: 999px;

  /* Motion — subtle, fast, purposeful; honored only when motion is not reduced */
  --duration-fast: 120ms;
  --duration-base: 180ms;
  --duration-slow: 320ms;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);

  /* Focus */
  --focus-ring-color: #2563eb;
  --focus-ring: 0 0 0 2px var(--bg-card), 0 0 0 4px var(--focus-ring-color);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  color: var(--text-body);
  background: var(--bg-main);
}

/* ===== Accessibility: keyboard focus ===== */
/* Visible, consistent focus affordance across every interactive element; never removed. */
:focus-visible {
  outline: 2px solid var(--focus-ring-color);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
.btn:focus-visible,
.nav-item:focus-visible,
.detail-tab:focus-visible,
.activity-row:focus-visible,
.console-filter:focus-visible,
.ops-step-toggle:focus-visible {
  outline: 2px solid var(--focus-ring-color);
  outline-offset: 2px;
}
a:focus-visible,
.linkish:focus-visible {
  outline: 2px solid var(--focus-ring-color);
  outline-offset: 2px;
  border-radius: 2px;
}
/* Fallback for browsers/tests without :focus-visible support parity */
input:focus,
select:focus,
textarea:focus,
button:focus {
  outline-color: var(--focus-ring-color);
}

/* ===== Accessibility: reduced motion ===== */
/* Decorative motion (pulses, glows, banner slide-ins, spinners) is never the only way to
   perceive state; honoring this preference must not remove any information. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* Reusable text / status utilities */
.text-secondary {
  color: var(--text-secondary);
  font-size: var(--fs-body-sm);
  font-weight: 400;
  line-height: 1.4;
}
.text-muted {
  color: var(--text-muted);
  font-size: var(--fs-meta);
  font-weight: 400;
  line-height: 1.4;
}
.status-good { color: var(--status-good); font-weight: 700; }
.status-warning { color: var(--status-warning); font-weight: 700; }
.status-error { color: var(--status-error); font-weight: 700; }

/* Freshness / timestamp text (P2 — every fact carries its age).
   Quiet, monospace-leaning register so a date never competes with the fact it dates. */
.freshness {
  font-family: var(--mono);
  font-size: var(--fs-meta);
  color: var(--text-muted);
}

.app { display: flex; min-height: 100vh; }

/* Activity Pane — persistent operational furniture (O1), not a nav destination and not a
   modal. A soft shadow (instead of a hard border) separates it from the shell so it reads as
   attached-but-distinct, the same way a sidebar does; it must remain easy to glance at without
   dominating Fleet/System/Environment beside it. */
.activity-pane {
  width: var(--activity-width);
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  background: var(--surface-sunken);
  display: flex;
  flex-direction: column;
  max-height: 100vh;
  position: sticky;
  top: 0;
  align-self: flex-start;
  transition: opacity var(--duration-base) var(--ease-standard);
}
.activity-pane.is-collapsed {
  display: none;
}
.activity-pane-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  align-items: stretch;
  padding: var(--space-3) var(--space-3) var(--space-2);
  border-bottom: 1px solid var(--border-light);
  background: var(--surface);
}
.activity-pane-title {
  min-width: 0;
}
.activity-pane-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}
.activity-pane-actions .btn {
  flex: 1 1 auto;
  min-width: 0;
}
.activity-list {
  overflow-y: auto;
  padding: var(--space-2);
  flex: 1;
}
.activity-row {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--border-light);
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: var(--space-2);
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color var(--duration-fast) var(--ease-standard), background var(--duration-fast) var(--ease-standard);
}
.activity-row:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
}
.activity-row.is-inflight {
  border-color: #93c5fd;
}
.activity-row.is-waiting {
  border-color: #fcd34d;
}
.activity-row.is-failed {
  border-color: #fca5a5;
}
.activity-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.activity-action {
  font-weight: 700;
  font-size: var(--fs-body-sm);
  text-transform: lowercase;
}
.activity-target {
  font-size: var(--fs-body-sm);
  font-weight: 600;
}
.activity-guid {
  margin-left: 6px;
  font-weight: 400;
  color: var(--text-muted);
  font-size: var(--fs-meta);
}
.activity-meta {
  margin-top: 4px;
  font-size: var(--fs-meta);
}
.activity-message {
  margin-top: 4px;
  font-size: var(--fs-meta);
}
.activity-empty {
  padding: 16px 10px;
  font-size: var(--fs-body-sm);
  color: var(--text-muted);
}
.activity-error {
  color: var(--red);
  border: 1px solid #fecaca;
  background: var(--red-soft);
  border-radius: var(--radius-sm);
}
#activity-status[data-state="error"] {
  color: var(--red);
}
#activity-status[data-state="unmarked"],
#activity-status[data-state="new"] {
  color: var(--text-secondary);
}
.activity-row.is-new {
  border-color: #93c5fd;
  box-shadow: inset 3px 0 0 var(--blue);
}
.activity-new-dot {
  margin-left: 6px;
  color: var(--blue);
  font-weight: 700;
}

.fleet-views-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 0 16px 10px;
}
.fleet-view-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}
#fleet-view-select {
  min-width: 160px;
  max-width: 220px;
}
#fleet-activity-new[data-state="new"],
#fleet-activity-new[data-state="unmarked"] {
  color: var(--text-secondary);
  font-weight: 600;
}

.detail-identity-line {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: baseline;
  margin-top: 2px;
}
.detail-guid-short {
  font-size: var(--fs-body-sm);
  color: var(--text-muted);
}
.detail-status-pair {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: center;
  margin-top: var(--space-2);
  font-size: var(--fs-body-sm);
}
.detail-status-pair .status-chip {
  margin-left: 4px;
}
#detail-status-chip,
#detail-confidence-chip {
  display: inline-flex;
  vertical-align: middle;
}
.infra-element-context {
  margin: 0 0 10px;
  padding: 8px 10px;
  background: var(--blue-soft);
  border-radius: 6px;
}
.linkish {
  background: none;
  border: none;
  color: var(--blue);
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-decoration: underline;
}
#detail-infra-table tr.is-selected,
#detail-networks-table tr.is-selected,
#detail-attachments-table tr.is-selected {
  outline: 2px solid var(--blue);
  background: var(--blue-soft);
}
.zone-box.is-focused,
.node-box.is-focused,
.topo-node.is-focused .node-box {
  stroke: var(--blue);
  stroke-width: 2;
}
.fleet-selection-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--blue-soft);
  border-bottom: 1px solid var(--border-light);
  animation: panel-in var(--duration-fast) var(--ease-standard);
}
.fleet-extract-secrets {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}
.col-select {
  width: 32px;
}
#fleet-extraction-panel {
  margin: 0 16px 12px;
}

/* Sidebar — primary navigation. Exactly two destinations (Fleet, System); the shell must make
   that fact obvious rather than looking like an arbitrary list. */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: var(--space-4) var(--space-2);
}
.sidebar-brand { padding: var(--space-1) var(--space-2) var(--space-5); }
.brand-title { font-size: var(--fs-display); font-weight: 700; letter-spacing: -0.01em; }
.brand-sub { font-size: var(--fs-meta); color: var(--text-muted); margin-top: 2px; }
.nav-group-label {
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: var(--space-3) var(--space-2) var(--space-2);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 10px;
  margin: 1px 0;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--fs-body);
  font-weight: 500;
  transition: background var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard);
}
.nav-item:hover { background: #e6e4de; color: var(--text); }
.nav-item.active {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 700;
  box-shadow: var(--shadow-xs);
}
.nav-icon { width: 16px; height: 16px; flex-shrink: 0; }

/* Role-based UI (worker vs admin containers) */
[hidden] { display: none !important; }

body.is-admin .nav-worker-only,
body.is-admin .view-worker-only,
body.is-admin #worker-lifecycle-card {
  display: none !important;
}

body.is-worker .nav-admin-only,
body.is-worker .view-admin-only {
  display: none !important;
}

/* Main */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  background: #fff;
  border-bottom: 1px solid var(--border);
  gap: var(--space-3);
}
.topbar-left { display: flex; align-items: baseline; gap: var(--space-3); flex-wrap: wrap; }
/* Primary destination heading — the single largest heading on screen; everything else is
   subordinate to "where am I". */
.page-title { font-size: var(--fs-page); font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.topbar-right { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.content { padding: var(--space-4) var(--space-5) var(--space-6); flex: 1; overflow: auto; }

/* Cards — the default panel surface. Elevation is a rare accent (sticky header, dialog,
   activity furniture), not a universal card treatment; most cards stay flat + bordered so a
   healthy screen stays calm rather than looking like stacked tiles. */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--card-padding);
  margin-bottom: var(--card-gap);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.card-title { font-size: var(--fs-heading); font-weight: 700; }
/* Section label — quiet uppercase heading used inside cards/panels; never the loudest thing
   on screen. */
.section-label {
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.helper-text { font-size: var(--fs-meta); color: var(--text-muted); font-weight: 400; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--card-gap);
  margin-bottom: var(--card-gap);
}
.grid-2 > .card {
  margin-bottom: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.grid-2-paired > .card {
  min-height: 240px;
}
.card-body-fill {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.card-body-fill .empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px 16px;
}
.grid-2-paired .card-header {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.grid-2-paired .kv-row {
  grid-template-columns: minmax(88px, 110px) 1fr;
  gap: 8px;
}
@media (max-width: 960px) {
  .grid-2 { grid-template-columns: 1fr; }
}

/* Badges & pills */
.badge, .status-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.badge-green, .status-pill.state-running { background: var(--green-soft); color: var(--green); }
.badge-amber, .status-pill.state-in_progress { background: var(--amber-soft); color: var(--amber); }
.badge-red, .status-pill.state-stopped { background: var(--red-soft); color: var(--red); }
.badge-grey, .status-pill.state-unknown { background: var(--grey-soft); color: var(--text-muted); }
.operation-banner.is-interrupted { border-color: #fcd34d; }
.operation-banner-warn {
  font-size: 11px;
  color: var(--amber);
  background: var(--amber-soft);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 8px;
  line-height: 1.45;
}
.operation-banner-info { color: var(--blue); background: var(--blue-soft); }
.badge-blue { background: var(--blue-soft); color: var(--blue); }

/* Buttons — sized for a comfortable pointer target (32px default / 28px compact, both above
   common touch-target minimums); one accent (dark) for primary action, blue reserved for
   navigational/affirmative acts, outline for everything routine. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-body-sm);
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity var(--duration-fast) var(--ease-standard), background var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard);
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-sm { height: 28px; padding: 0 10px; font-size: var(--fs-meta); }
.btn-dark { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }
.btn-dark:hover:not(:disabled) { background: #333; }
.btn-blue { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-blue:hover:not(:disabled) { background: #1d4ed8; }
.btn-outline { background: #fff; color: var(--text); border-color: var(--border); }
.btn-outline:hover:not(:disabled) { background: var(--grey-soft); border-color: var(--border-strong); }
/* Reserved for genuinely irreversible actions (e.g. a future Destroy). Never used for
   Start/Stop/Restart or other recoverable acts — see confirmation hierarchy below. */
.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn-danger:hover:not(:disabled) { background: #991b1b; }

.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.action-bar-buttons { display: flex; gap: 8px; flex-wrap: wrap; }

/* Metrics & KV — label → value hierarchy (value is the visual focus). Metrics support the
   Fleet inventory; they never compete with it for attention, so they stay flat and compact
   rather than becoming decorative dashboard tiles. */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-2);
}
.metric {
  padding: 8px 10px 9px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  display: flex;
  flex-direction: column;
  min-height: 0;
  transition: border-color var(--duration-fast) var(--ease-standard);
}
.metric-label {
  font-size: var(--metric-label-size);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
  line-height: 1.2;
}
.metric-value {
  font-size: var(--metric-value-size);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-top: 6px;
  padding-bottom: 2px;
}
.metric-support {
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.35;
}
.metric-note {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 400;
  line-height: 1.35;
}

.kv-list { display: flex; flex-direction: column; gap: 0; }
.kv-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: var(--space-3);
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  align-items: start;
}
.kv-row:last-child { border-bottom: none; }
.kv-key { font-size: var(--fs-meta); color: var(--text-muted); font-weight: 600; }
.kv-val { font-family: var(--mono); font-size: var(--fs-mono); word-break: break-all; }
.kv-val-warn { color: var(--amber, #b45309); font-weight: 600; }
.kv-val code.inline-ip { font-family: var(--mono); font-size: 12px; background: var(--grey-soft); padding: 1px 5px; border-radius: 4px; }

.aws-creds-banner {
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.45;
}
.aws-creds-banner[hidden] { display: none !important; }
.aws-creds-banner strong { display: block; margin-bottom: 4px; }
.aws-creds-banner-fail {
  border: 1px solid #fecaca;
  background: linear-gradient(135deg, #fef2f2 0%, #fff 70%);
  color: var(--red, #b91c1c);
}
.aws-creds-banner-fail strong { color: #991b1b; }
.aws-creds-banner-ok {
  border: 1px solid #bbf7d0;
  background: linear-gradient(135deg, #f0fdf4 0%, #fff 70%);
  color: #166534;
}
.aws-creds-banner-ok strong { color: #14532d; }
.aws-creds-banner-ok code {
  font-family: var(--mono);
  font-size: 12px;
  background: #dcfce7;
  padding: 1px 5px;
  border-radius: 4px;
}

.aws-qm-panel {
  margin: 12px 0 4px;
  padding: 12px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: #fafaf8;
}
.aws-vmid-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.aws-vmid-input {
  width: 110px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 12px;
}
.aws-qm-hint { margin: 0 0 8px; }
.aws-qm-command-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.aws-qm-command {
  flex: 1;
  display: block;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.4;
  white-space: nowrap;
  overflow-x: auto;
  word-break: normal;
}

/* Secret popover styles removed — Connection Details uses explicit Reveal/Copy (012A G1). */

.segment-divider { stroke: #b8b7b0; stroke-width: 1.5; stroke-dasharray: 8 5; }
.cloud-shape { fill: #f0f4f8; stroke: #94a3b8; stroke-width: 1.2; }
.cloud-label { font: 600 10px var(--font); fill: var(--text-muted); letter-spacing: 0.04em; }

.credential-block {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}
.credential-block:last-child { border-bottom: none; padding-bottom: 0; }
.credential-block-title {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text);
}
a.ext-link {
  color: var(--blue);
  font-weight: 600;
  text-decoration: none;
  font-family: var(--mono);
  font-size: 12px;
}
a.ext-link:hover { text-decoration: underline; }

.topo-node-link { cursor: pointer; }
.topo-node-link:hover rect { stroke: var(--blue); stroke-width: 2; }
.node-link-hint { font: 600 9px var(--font); fill: var(--blue); }

/* Table — dense by default (technical metadata density); rows are the primary reading unit,
   headers stay quiet so they never compete with the data underneath. */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
  font-size: var(--fs-mono);
}
.data-table td.mono { font-family: var(--mono); font-size: var(--fs-mono-sm); }

/* Connection Details — the canonical Consumption surface (P12). Values must scan easily;
   credentials are distinct without being alarming; masked vs revealed must be unmistakable
   at a glance, never inferable only from the Reveal/Hide button label. */
#detail-connection-table td.field-value {
  font-family: var(--mono);
  font-size: var(--fs-mono);
  word-break: break-all;
}
#detail-connection-table tr[data-revealable="true"] td:first-child {
  font-weight: 600;
}
#detail-connection-table tr[data-masked="true"] td.field-value {
  color: var(--text-muted);
  letter-spacing: 0.12em;
}
#detail-connection-table tr[data-revealable="true"][data-masked="false"] td.field-value {
  display: inline-block;
  background: var(--amber-soft);
  color: #92400e;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  letter-spacing: normal;
}
.field-actions .btn { margin-left: 4px; }

/* Topology */
.topology-wrap {
  overflow-x: auto;
  padding: 8px 4px 4px;
}
.topology-wrap-lg { min-height: 320px; }
.topology-svg { display: block; margin: 0 auto; max-width: 100%; }

.node-box {
  fill: #fafaf8;
  stroke: #c8c7c1;
  stroke-width: 1.2;
}
.node-box.active { fill: var(--blue-soft); stroke: var(--blue); }
.node-box.healthy { fill: var(--green-soft); stroke: var(--green); }
.node-box.inactive { fill: var(--grey-soft); stroke: #bbb; }
.node-title { font: 600 11px var(--font); fill: var(--text); }
.node-sub { font: 11px var(--mono); fill: var(--text-secondary); }
.node-caption { font: 10px var(--font); fill: var(--text-muted); }
.link { fill: none; stroke-width: 1.5; stroke-dasharray: 5 4; }
.link-blue { stroke: var(--blue); opacity: 0.85; }
.link-green { stroke: var(--green); opacity: 0.75; }
.link-grey { stroke: #aaa; opacity: 0.6; }
.zone-box { fill: none; stroke: var(--border); stroke-width: 1; stroke-dasharray: 4 3; rx: 10; }
.zone-label { font: 600 9px var(--font); fill: var(--text-muted); letter-spacing: 0.08em; text-transform: uppercase; }

.legend { display: flex; gap: 16px; margin-top: 12px; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-muted); }
.legend-line { width: 28px; height: 0; border-top: 2px dashed; }
.legend-blue { border-color: var(--blue); }
.legend-green { border-color: var(--green); }
.legend-grey { border-color: #aaa; }

/* Terminal */
.terminal-card { padding: 0; overflow: hidden; }
.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: #fafaf8;
}
.terminal {
  margin: 0;
  padding: 12px 14px;
  min-height: 220px;
  max-height: 420px;
  overflow: auto;
  background: #111;
  color: #6ee7a0;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Views */
.view { display: none; }
.view.active { display: block; }

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #1a1a1a;
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12px;
  max-width: 360px;
  z-index: 100;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* Lab lifecycle UI */
.operation-banner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  margin-bottom: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
  animation: banner-in 0.35s ease-out;
}
.operation-banner[hidden] { display: none !important; }
.operation-banner.mode-deploy { border-color: #bfdbfe; background: linear-gradient(135deg, #eff6ff 0%, #fff 60%); }
.operation-banner.mode-destroy { border-color: #fecaca; background: linear-gradient(135deg, #fef2f2 0%, #fff 60%); }
.status-pill.pill-job.is-busy {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}
.operation-banner-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mode-deploy .operation-banner-icon { background: var(--blue-soft); color: var(--blue); }
.mode-destroy .operation-banner-icon { background: var(--red-soft); color: var(--red); }
.operation-banner-body { flex: 1; min-width: 0; }
.operation-banner-title { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.operation-banner-sub { font-size: 12px; color: var(--text-secondary); margin-bottom: 10px; }
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes banner-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.deploy-steps { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.deploy-progress { margin-top: 4px; }
.deploy-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 11px;
}
.deploy-progress-label { color: var(--text-muted); font-weight: 600; }
.deploy-progress-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-secondary);
}
.deploy-elapsed { color: var(--text); font-weight: 700; }
.deploy-progress-pct { color: var(--blue); font-weight: 700; }
.mode-destroy .deploy-progress-pct { color: var(--red); }
.deploy-progress-track {
  height: 6px;
  background: #e8e7e2;
  border-radius: 999px;
  overflow: hidden;
}
.deploy-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), #60a5fa);
  border-radius: 999px;
  transition: width 0.6s ease;
}
.deploy-activity-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 8px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  min-height: 32px;
}
.deploy-activity-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  flex-shrink: 0;
}
.deploy-activity {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.mode-destroy .deploy-activity-row { background: rgba(255, 255, 255, 0.75); }
.mode-destroy .deploy-progress-fill {
  background: linear-gradient(90deg, var(--red), #f87171);
}
.deploy-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
  transition: color 0.2s;
}
.deploy-step-label { flex: 1; min-width: 0; }
.deploy-step-time {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 2.5em;
  text-align: right;
}
.deploy-step.active .deploy-step-time { color: var(--amber); font-weight: 600; }
.deploy-step.done .deploy-step-time { color: var(--green); }
.deploy-step-time-pending { color: var(--text-muted); }
.deploy-step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d4d4d0;
  flex-shrink: 0;
}
.deploy-step.active { color: var(--text); font-weight: 600; }
.deploy-step.active .deploy-step-dot {
  background: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-soft);
  animation: step-pulse 1.2s ease-in-out infinite;
}
.deploy-step.done { color: var(--green); }
.deploy-step.done .deploy-step-dot { background: var(--green); animation: none; box-shadow: none; }
@keyframes step-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.empty-state {
  text-align: center;
  padding: 36px 20px;
  color: var(--text-muted);
  animation: banner-in 0.4s ease-out;
}
.empty-state-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border-radius: 12px;
  background: var(--grey-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.empty-state-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin: 0 0 4px; }
.empty-state-sub { font-size: 12px; margin: 0; }

.topology-wrap.is-transitioning { opacity: 0.85; }
.topology-wrap.is-destroying { animation: topo-fade 2s ease-in-out infinite alternate; }
@keyframes topo-fade {
  from { opacity: 1; }
  to { opacity: 0.45; }
}
.topology-svg .node-box.node-pending {
  stroke-dasharray: 4 3;
  animation: node-pulse 1.5s ease-in-out infinite;
}
@keyframes node-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}
.status-pill.is-busy { animation: pill-glow 1.5s ease-in-out infinite; }
@keyframes pill-glow {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  50% { box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.15); }
}
.card.is-dimmed { opacity: 0.72; pointer-events: none; }
.admin-license-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 16px;
}

/* Loading / sync indicators */
.sync-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 12px;
  font-weight: 600;
}
.sync-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: sync-spin 0.75s linear infinite;
  flex-shrink: 0;
}
@keyframes sync-spin {
  to { transform: rotate(360deg); }
}
.loading-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid #fde68a;
  background: linear-gradient(135deg, #fffbeb 0%, #fff 70%);
  color: var(--amber);
  font-size: 13px;
  font-weight: 600;
  animation: banner-in 0.35s ease-out;
}
.inline-loading {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 13px;
}
.block-loading {
  display: flex;
  padding: 8px 0;
}
tr.loading-row td {
  padding: 20px 16px !important;
  color: var(--text-muted);
}
body.is-initial-load .content {
  opacity: 0.92;
}
.metric-loading {
  grid-column: 1 / -1;
  padding: 8px 0;
}
#btn-admin-refresh-labs:disabled {
  opacity: 0.65;
  cursor: wait;
}

.admin-fleet-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 16px;
}
.admin-fleet-summary .status-pill { cursor: default; }
.card-header-sub {
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.data-table tr.admin-lab-row { cursor: pointer; }
.data-table tr.admin-lab-row:hover td { background: var(--grey-soft); }
.data-table tr.admin-lab-row.is-selected td { background: var(--blue-soft); }
#admin-lab-detail .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ===== UX Checkpoint 006A — fleet dashboard ===== */
.ux-demo-banner {
  border: 1px solid #fcd34d;
  background: linear-gradient(135deg, #fffbeb 0%, #fff 75%);
  color: #92400e;
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 12px;
  line-height: 1.45;
}
.ux-demo-banner strong { display: block; margin-bottom: 2px; color: #78350f; }
.ux-demo-banner code { font-family: var(--mono); font-size: 11px; }
.ux-mock-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.metric.metric-ok { border-color: #bbf7d0; background: var(--green-soft); }
.metric.metric-info { border-color: #bfdbfe; background: var(--blue-soft); }
.metric.metric-wait { border-color: #fde68a; background: var(--amber-soft); }
.metric.metric-bad { border-color: #fecaca; background: var(--red-soft); }

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--card-gap);
  margin-bottom: var(--card-gap);
}
@media (max-width: 960px) {
  .grid-3 { grid-template-columns: 1fr; }
}
.health-card .health-state {
  font-size: 14px;
  font-weight: 700;
  margin-top: 4px;
  line-height: 1.25;
  color: var(--text-primary);
}
.health-card .health-detail {
  margin-top: 6px;
}
.health-card.is-ok .health-state { color: var(--status-good); }
.health-card.is-bad .health-state { color: var(--status-error); }
.health-card.is-warn .health-state { color: var(--status-warning); }

.deploy-panel .deploy-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}
.field { display: flex; flex-direction: column; gap: 4px; min-width: 160px; }
.field.field-count { min-width: 80px; max-width: 100px; }
.field-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.field-control {
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0 10px;
  font-size: 12px;
  background: #fff;
  color: var(--text);
  font-family: var(--font);
}
.field-control.filter-search { min-width: 220px; flex: 1; }

.graph-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
@media (max-width: 1100px) {
  .graph-grid { grid-template-columns: 1fr; }
}
.graph-card { margin-bottom: 0; }
.graph-body { min-height: 160px; }
.graph-body svg { width: 100%; height: auto; display: block; }
.graph-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 8px;
  font-size: 10px;
  color: var(--text-secondary);
}
.graph-legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: middle;
}

.dense-table-wrap { max-height: 520px; overflow: auto; }
.dense-table th, .dense-table td {
  padding: 5px 8px;
  font-size: 11px;
  white-space: nowrap;
}
.dense-table td.wrap, .dense-table td.error-cell {
  white-space: normal;
  max-width: 280px;
  word-break: break-word;
}
.dense-table tbody tr { cursor: pointer; }
.dense-table tbody tr:hover td { background: var(--grey-soft); }
.dense-table tbody tr.is-selected td { background: var(--blue-soft); }
.dense-table th[data-sort] { cursor: pointer; user-select: none; }
.dense-table th[data-sort]:hover { color: var(--blue); }
.dense-table th.sort-asc::after { content: " ▲"; font-size: 9px; }
.dense-table th.sort-desc::after { content: " ▼"; font-size: 9px; }

/* Status vocabulary (G1 LMStatus, single owner). Colour reinforces meaning but is never the
   only signal — every chip also carries its own text label, so it remains legible without
   colour perception. Lifecycle uses a solid soft fill (the primary operational axis);
   Confidence uses an outlined/quieter treatment (a secondary, derived axis) so the two never
   look like one status system even when shown side by side. */
.status-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-label);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.6;
}
/* Lifecycle (solid fill — the primary, always-shown axis) */
.status-chip.RUNNING, .status-chip.READY { background: var(--green-soft); color: var(--green); }
.status-chip.DEPLOYING, .status-chip.PROVISIONING,
.status-chip.STARTING, .status-chip.STOPPING, .status-chip.RESTARTING { background: var(--blue-soft); color: var(--blue); }
.status-chip.WAITING { background: var(--amber-soft); color: var(--amber); border: 1px solid #fcd34d; }
.status-chip.FAILED, .status-chip.STATE_MISSING { background: var(--red-soft); color: var(--red); }
.status-chip.STOPPED, .status-chip.CANCELLED { background: var(--grey-soft); color: var(--text-muted); }
.status-chip.INTERRUPTED, .status-chip.ORPHANED { background: #fff7ed; color: #c2410c; border: 1px solid #fdba74; }
.status-chip.CREATED { background: var(--grey-soft); color: var(--text-secondary); }
.status-chip.UNKNOWN { background: var(--grey-soft); color: var(--text-muted); }
/* Step (nested execution state; same vocabulary, shown inside Operation investigation) */
.status-chip.SUCCESS { background: var(--green-soft); color: var(--green); }
.status-chip.PENDING { background: var(--grey-soft); color: var(--text-secondary); }
.status-chip.SKIPPED { background: var(--grey-soft); color: var(--text-secondary); border: 1px solid var(--border); }

/* Confidence / reconciliation — a derived agreement axis, deliberately quieter than lifecycle
   even when the news is bad, and deliberately near-invisible when it is good (CONSISTENT). */
.status-chip[data-status-kind="confidence"] {
  background: #fff;
  border: 1px solid var(--border-strong);
  box-shadow: none;
}
.status-chip.CONSISTENT {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-light);
  font-weight: 600;
}
.status-chip.PARTIAL,
.status-chip.DRIFTED { background: var(--amber-soft); color: var(--amber); border: 1px solid #fcd34d; }
.status-chip.RESOURCE_MISSING, .status-chip.DISCOVERY_FAILED { background: var(--red-soft); color: var(--red); border: 1px solid #fca5a5; }
.status-chip.LEGACY_MANAGED { background: #fff7ed; color: #c2410c; border: 1px solid #fdba74; }

.fleet-confidence-exception {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  max-width: 16rem;
}
.fleet-confidence-exception .status-chip {
  align-self: flex-start;
}
.fleet-confidence-reason {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.25;
}
.fleet-confidence-freshness {
  font-size: 0.72rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.fleet-confidence-quiet {
  color: var(--text-muted);
}
.fleet-lifecycle-cell .status-chip[data-status-kind="lifecycle"] {
  /* lifecycle remains the primary fleet axis */
}
tr.is-degraded {
  background: #fffaf5;
}
.detail-degraded-banner {
  margin-top: 0.5rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid #fdba74;
  background: #fff7ed;
  color: #9a3412;
  font-size: 0.85rem;
  border-radius: 4px;
}
.fleet-actions-cell {
  white-space: nowrap;
}
.fleet-attn-confidence .status-chip {
  font-size: 0.72rem;
}

/* O5 graduated confirmation (PT-13.2). Visual weight is proportional to consequence, not to
   the fact that a dialog exists: a "simple" (disruptive-but-recoverable) confirmation stays
   neutral; "destructive" and "type" (irreversible) earn a warning accent and a red primary
   action. Target, consequence, action and cancel path are always in the same reading order. */
.lm-confirm {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background: var(--surface-overlay);
}
.lm-confirm[hidden] {
  display: none !important;
}
.lm-confirm-panel {
  width: min(28rem, 100%);
  background: #fff;
  border: 1px solid var(--border);
  border-top: 3px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.2rem 1rem;
  box-shadow: var(--shadow-lg);
  animation: confirm-in var(--duration-base) var(--ease-standard);
}
@keyframes confirm-in {
  from { opacity: 0; transform: translateY(-4px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
/* Irreversible levels: the panel itself carries the warning, not just the button. */
.lm-confirm[data-level="destructive"] .lm-confirm-panel,
.lm-confirm[data-level="type"] .lm-confirm-panel {
  border-top-color: var(--red);
}
.lm-confirm[data-level="destructive"] .lm-confirm-title,
.lm-confirm[data-level="type"] .lm-confirm-title {
  color: #7f1d1d;
}
.lm-confirm[data-level="destructive"] #lm-confirm-accept,
.lm-confirm[data-level="type"] #lm-confirm-accept {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.lm-confirm[data-level="destructive"] #lm-confirm-accept:hover:not(:disabled),
.lm-confirm[data-level="type"] #lm-confirm-accept:hover:not(:disabled) {
  background: #991b1b;
}
.lm-confirm-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 650;
  color: var(--text);
}
.lm-confirm-target {
  margin: 0 0 0.5rem;
}
.lm-confirm-body {
  margin: 0 0 1rem;
  white-space: pre-line;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.4;
}
.lm-confirm-type-block {
  margin: 0 0 1rem;
  padding: 0.6rem 0.7rem;
  background: var(--red-soft);
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
}
.lm-confirm-type-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.lm-confirm-discriminator {
  font-size: 0.85rem;
  color: var(--text);
  font-weight: 700;
  user-select: all;
}
.lm-confirm-input:focus,
.lm-confirm-actions .btn:focus {
  outline: 2px solid var(--focus-ring-color);
  outline-offset: 2px;
}
.lm-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}
.lm-confirm-pending {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.lm-confirm-pending[hidden] { display: none !important; }

/* Fleet initial-load state (Phase 1 responsiveness). A page-level overlay,
   not a small banner: it covers the Fleet content area (not the sidebar/
   header, which stay visible and usable) so the underlying Fleet dashboard
   is visibly not yet ready/interactable. Visible by default in markup so
   it appears before any fetch begins; JS hides it on success or switches
   to .is-error if the initial load fails. Never shown again once Fleet has
   successfully loaded at least once — ordinary polling/refresh must never
   re-cover already-rendered data with this overlay. */
#view-fleet {
  position: relative;
}
.fleet-loading-overlay {
  position: absolute;
  inset: 0;
  min-height: 60vh;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(1px);
}
.fleet-loading-overlay[hidden] { display: none !important; }
.fleet-loading-overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  padding: 1.75rem 2.25rem;
  text-align: center;
}
.fleet-loading-overlay .spinner {
  width: 34px;
  height: 34px;
  border-width: 3px;
}
.fleet-loading-overlay-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}
.fleet-loading-overlay-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.fleet-loading-overlay.is-error {
  background: rgba(254, 242, 242, 0.92);
}
.fleet-loading-overlay.is-error .spinner { display: none; }
.fleet-loading-overlay.is-error .fleet-loading-overlay-title { color: var(--red); }
.fleet-actions-cell .fleet-lifecycle {
  margin-right: 0.25rem;
  margin-bottom: 0.2rem;
}

.copy-ack {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--green);
  animation: copy-ack-fade 1.6s ease forwards;
}
@keyframes copy-ack-fade {
  0% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; }
}

.route-notice {
  margin: 0 0 12px;
  padding: 8px 12px;
  border: 1px solid #fcd34d;
  background: var(--amber-soft);
  color: #92400e;
  font-size: 12px;
  border-radius: 6px;
}
.route-notice[hidden] { display: none !important; }

/* System — the platform-administration destination. Generous whitespace between sections
   (credentials / shared services / lab definitions / diagnostics) makes clear these are
   distinct concerns grouped under one roof, not a second Fleet page. */
.system-section {
  margin-bottom: var(--space-7);
}
.system-section + .system-section {
  padding-top: var(--space-2);
  border-top: 1px solid var(--border-light);
}
.system-section-title {
  font-size: var(--fs-heading);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 var(--space-3);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.detail-header-card { padding-bottom: 0; }
.detail-header-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}
.detail-guid { font-size: 15px; font-weight: 700; margin-top: 2px; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.detail-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  border-top: 1px solid var(--border-light);
  margin: 0 -16px;
  padding: 0 12px;
}
.detail-tab {
  appearance: none;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 12px;
  font-size: var(--fs-body-sm);
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard);
}
.detail-tab:hover { color: var(--text); }
.detail-tab.active { color: var(--text); border-bottom-color: var(--blue); }
.detail-panel { display: none; }
.detail-panel.active { display: block; animation: panel-in var(--duration-base) var(--ease-standard); }
@keyframes panel-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.error-panel {
  margin: 8px 0 0;
  padding: 10px 12px;
  background: var(--red-soft);
  border: 1px solid #fecaca;
  border-radius: 7px;
  font-family: var(--mono);
  font-size: 11px;
  white-space: pre-wrap;
  color: #7f1d1d;
  min-height: 72px;
}
.error-panel.is-waiting {
  background: var(--amber-soft);
  border-color: #fcd34d;
  color: #92400e;
}
.error-panel.is-ok {
  background: var(--green-soft);
  border-color: #bbf7d0;
  color: var(--green);
}

.step-list { display: flex; flex-direction: column; gap: 6px; }
.step-row {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 8px 10px;
  border: 1px solid var(--border-light);
  border-radius: 7px;
  background: #fafaf8;
}
.step-row.is-waiting { border-color: #fcd34d; background: var(--amber-soft); }
.step-row.is-failed { border-color: #fecaca; background: var(--red-soft); }
.step-row.is-running { border-color: #bfdbfe; background: var(--blue-soft); }
.step-row.is-success { opacity: 0.92; }
.step-meta { font-size: 11px; color: var(--text-secondary); line-height: 1.4; }
.step-meta strong { color: var(--text); font-weight: 600; }
.step-name { font-weight: 600; font-size: 12px; }
.step-timing { font-family: var(--mono); font-size: 10px; color: var(--text-muted); text-align: right; }

.topology {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 8px 0;
}
.topo-node {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: #fafaf8;
  min-height: 72px;
}
.topo-node .topo-title { font-weight: 700; font-size: 12px; }
.topo-node .topo-role { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.topo-node .topo-ip { font-family: var(--mono); font-size: 11px; margin-top: 6px; }
.topo-net {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.topo-net span {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--blue-soft);
  color: var(--blue);
  font-family: var(--mono);
}

.console-filter-bar { flex-wrap: wrap; gap: 8px; }
.console-filters { display: flex; flex-wrap: wrap; gap: 4px; }
.console-filter {
  appearance: none;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  color: var(--text-secondary);
}
.console-filter.active { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }

.mono-block {
  font-family: var(--mono);
  font-size: 11px;
  margin: 8px 0 0;
  padding: 10px;
  background: #fafaf8;
  border: 1px solid var(--border-light);
  border-radius: 7px;
  white-space: pre-wrap;
  max-height: 220px;
  overflow: auto;
}

.progress-mini {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 72px;
}
.progress-mini-bar {
  width: 48px;
  height: 6px;
  border-radius: 999px;
  background: #e8e7e2;
  overflow: hidden;
}
.progress-mini-fill {
  height: 100%;
  background: var(--blue);
}
.progress-mini-fill.is-failed { background: var(--red); }
.progress-mini-fill.is-waiting { background: var(--amber); }
.progress-mini-fill.is-ok { background: var(--green); }

.fleet-activity-cell { display: flex; flex-direction: column; gap: 4px; }
.fleet-activity-label { font-size: 12px; color: var(--text); white-space: nowrap; }

/* ===== 006A refinements ===== */
.metric.metric-attn { border-color: #fdba74; background: #fff7ed; }
.metric-reconcile { margin: 6px 0 12px; line-height: 1.35; }
.needs-attn-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.needs-attn-wrap { max-height: 280px; }
.card-compact { padding: 10px 12px; margin-bottom: 10px; }
.card-compact .card-header { margin-bottom: 8px; }
.health-strip .card { padding: 10px 12px; margin-bottom: 0; }
.deploy-panel { padding: 10px 12px; }
.graph-card { padding: 10px 12px; }
.graph-body { min-height: 140px; }

/* Environment header — the strongest anchor on any Environment-scope screen. Identity
   (label / lab name / lab type) is the single largest text on the card; lifecycle and
   confidence sit immediately beside it, always paired, never one without the other (P3). */
.detail-header-card { position: sticky; top: 0; z-index: 5; margin-bottom: var(--space-3); box-shadow: var(--shadow-xs); }
.detail-header-main { min-width: 0; flex: 1; }
.detail-title-line { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.detail-lab { font-size: var(--fs-identity); font-weight: 700; letter-spacing: -0.01em; }
.detail-guid { font-size: var(--fs-body-sm); font-weight: 600; font-family: var(--mono); margin: 2px 0 6px; word-break: break-all; color: var(--text-secondary); }
.detail-ops-strip {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  font-size: var(--fs-meta);
  color: var(--text-secondary);
}
.detail-ops-strip strong { color: var(--text-muted); font-weight: 600; margin-right: 4px; }
.detail-issue-line {
  margin-top: var(--space-2);
  font-size: var(--fs-meta);
  font-family: var(--mono);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  display: inline-block;
  max-width: 100%;
}
.detail-issue-line.is-bad { background: var(--red-soft); color: #7f1d1d; border: 1px solid #fecaca; }
.detail-issue-line.is-waiting { background: var(--amber-soft); color: #92400e; border: 1px solid #fcd34d; }

.overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
@media (max-width: 1100px) {
  .overview-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .overview-grid { grid-template-columns: 1fr; }
}
.kv-dense .kv-row {
  grid-template-columns: 96px 1fr;
  gap: 8px;
  padding: 4px 0;
}
.kv-dense .kv-key { font-size: 10px; }
.kv-dense .kv-val { font-size: 11px; }
.error-panel-compact {
  margin: 6px 0 0;
  padding: 8px 10px;
  min-height: 64px;
  font-size: 10px;
}
.mini-feed { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.mini-feed-row {
  font-size: 11px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 3px 0;
  border-bottom: 1px solid var(--border-light);
}
.mini-feed-row:last-child { border-bottom: none; }
.terminal-compact {
  max-height: 140px;
  margin: 6px 0 0;
  padding: 8px 10px;
  font-size: 10px;
  border-radius: 6px;
}
.step-row {
  grid-template-columns: 100px 1fr 88px;
  padding: 6px 8px;
  gap: 8px;
}
.step-name { font-size: 11px; }
.step-meta { font-size: 10px; }
.topology { gap: 8px; padding: 4px 0; }
.topo-node { padding: 8px; min-height: 60px; }
#detail-console { max-height: 420px; overflow: auto; }

/* Build Order 012 — live graph bars (functional; no visual redesign) */
.bar-row {
  display: grid;
  grid-template-columns: 110px 1fr 36px;
  gap: 8px;
  align-items: center;
  margin: 4px 0;
  font-size: 11px;
}
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track {
  height: 10px;
  background: var(--border-light, #e5e5e0);
  border-radius: 2px;
  overflow: hidden;
}
.bar-fill { display: block; height: 100%; }
.bar-count { text-align: right; font-variant-numeric: tabular-nums; }
.step-item { padding: 8px; border-bottom: 1px solid var(--border-light, #e5e5e0); }
.step-item.is-ok { border-left: 3px solid #15803d; }
.step-item.is-bad { border-left: 3px solid #b91c1c; }
.step-item.is-waiting { border-left: 3px solid #b45309; }
.step-item.is-run { border-left: 3px solid #2563eb; }

/* Operation investigation (O6, polished P1) — the flagship pattern. Hierarchy is carried by
   indentation, a continuous connecting rule, and whitespace, not just colour: Operation is the
   selector context; each Step is a row at one indentation level; expanded Evidence sits one
   level deeper again, so Operation → Step → Evidence reads as a single visual descent. */
.ops-investigation { display: flex; flex-direction: column; gap: var(--space-3); }
.ops-selector {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.ops-selector select { min-width: 220px; max-width: 420px; }
.ops-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(280px, 1.4fr);
  gap: var(--space-3);
}
@media (max-width: 1060px) {
  .ops-layout { grid-template-columns: 1fr; }
}
.ops-step-tree {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  padding-left: var(--space-3);
  border-left: 2px solid var(--border-light);
}
.ops-step-row {
  border: 1px solid var(--border-light, #e5e5e0);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  background: var(--surface, #fff);
  transition: background var(--duration-fast) var(--ease-standard);
}
/* Left accent bar carries state; the text label inside the chip (below) always restates it,
   so WAITING/FAILED/SKIPPED/RUNNING are never colour-only distinctions. */
.ops-step-row.is-failed { border-left: 3px solid var(--red); }
.ops-step-row.is-waiting { border-left: 3px solid var(--amber); }
.ops-step-row.is-running { border-left: 3px solid var(--blue); }
.ops-step-row.is-success { border-left: 3px solid var(--green); }
.ops-step-row.is-skipped { border-left: 3px solid #64748b; opacity: 0.85; }
.ops-step-row.is-expanded { background: var(--surface-muted, #f8f8f5); box-shadow: var(--shadow-xs); }
.ops-step-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  border: 0;
  background: transparent;
  padding: 2px 0;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  min-height: 24px;
}
.ops-step-main { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ops-step-row .step-meta {
  margin-top: 2px;
  color: var(--text-secondary, #666);
  font-family: var(--mono);
  font-size: var(--fs-meta);
}
/* Evidence is one deliberate indentation deeper than its Step, and stays dense/technical —
   progressive disclosure, not decoration. */
.ops-step-expansion {
  margin: 8px 0 2px var(--space-4);
  padding: var(--space-2) 0 2px var(--space-3);
  border-left: 2px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.ops-evidence-block .section-label { margin-bottom: 4px; }
.ops-evidence-table { font-size: var(--fs-mono-sm); }
.ops-console-pre {
  max-height: 220px;
  overflow: auto;
  margin: 6px 0 0;
  padding: 8px 10px;
  font-size: var(--fs-mono-sm);
  font-family: var(--mono);
  line-height: 1.5;
}
.ops-attribution-note {
  font-size: var(--fs-meta);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: var(--amber-soft, #fffbeb);
  border: 1px solid #fcd34d;
  color: #92400e;
}
.ops-console-cap { margin: 4px 0; }

/* ===== Build Order 012A Stage P1 — responsive shell rules =====
   Desktop-first; degrades intelligently rather than shrinking uniformly. Priority order at
   narrower widths: Fleet usability, Environment identity, Connection Details, Activity Pane,
   Operation investigation. No breakpoint below removes a primary action or hides identity —
   only spacing, furniture width, and (below all three reviewed widths) the nav label text
   adapt. Technical tables keep their own horizontal scroll via .table-wrap. */

/* Narrow desktop / tablet-width (~1024px and below): tighten furniture, not identity. */
@media (max-width: 1150px) {
  :root {
    --activity-width: 260px;
  }
  .content { padding: var(--space-3) var(--space-4) var(--space-5); }
  .topbar { padding: var(--space-3) var(--space-4); }
}

/* Below the three reviewed desktop widths: still a real desktop layout, just leaner. */
@media (max-width: 860px) {
  :root {
    --sidebar-width: 168px;
    --activity-width: 240px;
  }
  .metric-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

/* Small-screen fallback only (below any width this product targets). Primary navigation is
   never removed — it becomes an icon rail with accessible names preserved in the DOM — and
   the Activity Pane keeps its own scroll rather than covering the main content. */
@media (max-width: 620px) {
  :root {
    --sidebar-width: 56px;
  }
  .sidebar-brand,
  .nav-group-label {
    display: none;
  }
  .nav-item {
    justify-content: center;
    padding: 10px 0;
    gap: 0;
    font-size: 0;
  }
  .activity-pane { width: min(var(--activity-width), 90vw); }
}

/* ===== Lab Access (participant pools) ===== */
.access-pool-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.access-pool-metrics {
  margin-top: var(--space-3);
}
.access-row-actions {
  white-space: nowrap;
}
.field-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.field-checkbox .field-label {
  text-transform: none;
  letter-spacing: normal;
  font-size: var(--fs-body);
  font-weight: 500;
  color: var(--text);
}
.deploy-access-optin {
  margin-top: 8px;
}
#deploy-access-fields {
  margin-top: 8px;
}
.text-danger {
  color: var(--red);
}

