/**
 * Master MSP Dashboard — modern quiet operator visual system
 * Spec: quiet chrome, high density, chromatic restraint
 * baseline = modern (default) · hud_v0 = legacy SpaceX lab (A/B only)
 */

:root {
  --msp-bg: #0b0c0e;
  --msp-s1: #12141a;
  --msp-s2: #181b22;
  --msp-s3: #1f232c;
  --msp-border: rgba(255, 255, 255, 0.05);
  --msp-border-strong: rgba(255, 255, 255, 0.08);
  --msp-accent: #5b6af0;
  --msp-good: #3d9b6e;
  --msp-attention: #c9a227;
  --msp-critical: #d16b5b;
  --msp-text: #e8eaed;
  --msp-text-2: rgba(255, 255, 255, 0.55);
  --msp-text-3: rgba(255, 255, 255, 0.35);
  --msp-font: Inter, "Geist", system-ui, -apple-system, sans-serif;
  --msp-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

/* —— App / shell chrome (quiet) —— */
.hub-next-root {
  min-height: 100vh;
  background: var(--msp-bg);
  color: var(--msp-text);
  font-family: var(--msp-font);
}
.shell-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--msp-border);
  background: var(--msp-s1);
}
.shell-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.shell-brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--msp-accent);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
}
.shell-brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.shell-brand-text strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--msp-text);
}
.shell-brand-sub {
  font-size: 11px;
  color: var(--msp-text-2);
}
.shell-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.hub-next-pill {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--msp-border-strong);
  color: var(--msp-text-2);
  background: transparent;
  font-family: inherit;
}
.hub-next-pill--pack {
  border-color: rgba(91, 106, 240, 0.35);
  color: #a5b0f7;
}
.hub-next-pill--skin {
  cursor: pointer;
  border-color: var(--msp-border-strong);
  color: var(--msp-text-2);
  background: var(--msp-s2);
}
.hub-next-pill--skin:hover {
  background: var(--msp-s3);
  color: var(--msp-text);
}
button.hub-next-pill {
  cursor: pointer;
}
.shell-body {
  display: grid;
  grid-template-columns: 56px minmax(180px, 240px) 1fr minmax(220px, 300px);
  min-height: calc(100vh - 52px);
  background: var(--msp-bg);
}
.shell-pane {
  border-right: 1px solid var(--msp-border);
  min-height: 0;
  background: var(--msp-bg);
}
.shell-inspector {
  border-right: 0;
  border-left: 1px solid var(--msp-border);
  background: var(--msp-s1);
}
.shell-tab-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 6px;
  background: var(--msp-s1);
}
.shell-pane-label,
.shell-pane-head,
.shell-pane-body,
.shell-slot-empty,
.shell-ops-empty {
  /* product mounts replace chrome; hide leftover shell stubs */
}
.shell-workbench {
  background: var(--msp-s1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.shell-ops {
  padding: 0 !important;
  overflow: auto;
  background: var(--msp-bg);
}
.shell-workbench > .shell-pane-head,
.shell-workbench > .shell-pane-body,
.shell-workbench > .shell-pane-label,
.shell-inspector > .shell-pane-head,
.shell-inspector > .shell-pane-body {
  display: none;
}
.hub-next-tab {
  width: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--msp-text-2);
  cursor: pointer;
  font: inherit;
  font-size: 9px;
}
.hub-next-tab.is-active {
  background: var(--msp-s2);
  color: var(--msp-text);
  border-color: var(--msp-border-strong);
}
.hub-next-tab-icon {
  font-size: 14px;
}
.hub-next-rail-note {
  font-size: 9px;
  text-align: center;
  line-height: 1.25;
  margin: 8px 2px 0;
  color: var(--msp-text-3);
}
.hub-next-rail-mounted {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.muted {
  color: var(--msp-text-2);
  font-size: 12px;
}
code {
  font-family: var(--msp-mono);
  font-size: 10px;
  color: var(--msp-text-2);
}

/* Seed markers — quiet */
.msp-seed-tag {
  color: var(--msp-text-3);
  font-weight: 500;
  font-size: 11px;
}
.msp-seed-pill {
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--msp-border);
  color: var(--msp-text-3);
  background: transparent;
}
.msp-trend {
  font-style: normal;
  font-size: 11px;
  color: var(--msp-good);
  margin-left: 4px;
  font-weight: 500;
}

/* ===== Workbench HOT ===== */
.msp-wb {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: calc(100vh - 52px);
  background: var(--msp-s1);
}
.msp-wb-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--msp-border);
}
.msp-wb-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--msp-text);
}
.msp-wb-meta {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--msp-critical);
  font-weight: 600;
}
.msp-wb-list {
  flex: 1;
  overflow: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.msp-hot-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  text-align: left;
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  border-left: 2px solid transparent;
}
.msp-hot-row:hover {
  background: var(--msp-s2);
}
.msp-hot-row.is-selected {
  background: var(--msp-s2);
  border-left-color: var(--msp-accent);
}
.msp-hot-tag {
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 2px;
  background: transparent;
  border: 1px solid var(--msp-border);
  color: var(--msp-text-2);
}
.msp-hot-tag--hot,
.msp-hot-tag--critical,
.msp-hot-tag--alert {
  color: var(--msp-critical);
  border-color: rgba(209, 107, 91, 0.35);
}
.msp-hot-tag--gate {
  color: var(--msp-attention);
  border-color: rgba(201, 162, 39, 0.35);
}
.msp-hot-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.msp-hot-badge {
  font-size: 9px;
  color: var(--msp-text-3);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.msp-hot-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--msp-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msp-hot-sub {
  font-size: 11px;
  color: var(--msp-text-2);
}
.msp-ph-note {
  margin: 8px 12px;
  font-size: 9px;
  color: var(--msp-text-3);
  font-family: var(--msp-mono);
}

/* ===== Ops board ===== */
.msp-ops {
  min-height: 100%;
  background: var(--msp-bg);
}
.msp-ops-body {
  padding: 16px 18px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.msp-ops-titlebar h1 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 600;
  color: var(--msp-text);
}
.msp-ops-titlebar p {
  margin: 0;
  font-size: 12px;
  color: var(--msp-text-2);
}

/* Zones — surface elevation, almost no borders */
.msp-zone {
  border: none;
  border-radius: 10px;
  background: var(--msp-s1);
  padding: 14px 16px 16px;
}
.msp-zone-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.msp-zone-kicker {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--msp-text-3);
}
.msp-zone-meta,
.msp-zone-cmd {
  font-size: 10px;
  color: var(--msp-text-3);
  font-family: var(--msp-mono);
}
.msp-zone-cmd {
  margin-left: auto;
  opacity: 0.7;
}

/* A · Scoreboard headline */
.msp-headline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
  margin-bottom: 14px;
  padding: 4px 0 12px;
  border: none;
  border-radius: 0;
  background: transparent;
  border-bottom: 1px solid var(--msp-border);
  cursor: pointer;
}
.msp-headline:hover {
  background: transparent;
}
.msp-headline-main {
  font-size: 14px;
  font-weight: 500;
  color: var(--msp-text-2);
}
.msp-headline-score {
  font-family: var(--msp-font);
  font-size: 38px;
  font-weight: 500;
  color: var(--msp-text);
  letter-spacing: -0.03em;
  line-height: 1;
}
.msp-headline-status {
  font-size: 12px;
  font-weight: 500;
  color: var(--msp-good);
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(61, 155, 110, 0.12);
  border: none;
}
.msp-headline-split {
  width: 100%;
  font-size: 12px;
  color: var(--msp-text-2);
}

/* Primary tiles */
.msp-tiles {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.msp-tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  text-align: left;
  padding: 12px 12px 10px;
  border-radius: 8px;
  border: none;
  background: var(--msp-s1);
  box-shadow: inset 0 0 0 1px var(--msp-border);
  color: inherit;
  cursor: pointer;
  font: inherit;
  min-height: 84px;
  transition: background 0.12s ease;
}
.msp-tile:hover {
  background: var(--msp-s2);
  box-shadow: inset 0 0 0 1px var(--msp-border-strong);
}
.msp-tile-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--msp-text-3);
}
.msp-tile-value {
  font-family: var(--msp-font);
  font-size: 24px;
  font-weight: 500;
  color: var(--msp-text);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.msp-tile[data-dim="open_matters_critical"] .msp-tile-value {
  color: var(--msp-critical);
}
.msp-tile-dim {
  font-size: 9px;
  color: var(--msp-text-3);
  font-family: var(--msp-mono);
  opacity: 0.65;
  word-break: break-all;
}

/* Secondary metrics */
.msp-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.msp-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 11px;
  border-radius: 6px;
  border: none;
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--msp-border);
  color: inherit;
  cursor: pointer;
  font: inherit;
  min-width: 108px;
}
.msp-metric:hover {
  background: var(--msp-s2);
}
.msp-metric-label {
  font-size: 10px;
  color: var(--msp-text-3);
}
.msp-metric-value {
  font-family: var(--msp-font);
  font-size: 13px;
  font-weight: 500;
  color: var(--msp-text);
}

/* B · Quick Actions */
.msp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.msp-action {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 0 14px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--msp-border-strong);
  background: transparent;
  color: var(--msp-text-2);
  cursor: pointer;
}
.msp-action:hover {
  background: var(--msp-s2);
  color: var(--msp-text);
  border-color: var(--msp-border-strong);
}
.msp-action--primary {
  background: var(--msp-accent);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}
.msp-action--primary:hover {
  background: #6b79f2;
  color: #fff;
  border-color: transparent;
  filter: brightness(1.05);
}

/* C · Fact Scoreboard strips */
.msp-strips {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.msp-strip {
  padding: 12px 12px 10px;
  border-radius: 8px;
  border: none;
  background: var(--msp-bg);
  cursor: pointer;
}
.msp-strip:hover {
  background: var(--msp-s2);
}
.msp-strip-label {
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--msp-text-2);
  letter-spacing: 0.02em;
}
.msp-strip-label em {
  font-style: normal;
  font-size: 9px;
  color: var(--msp-text-3);
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.msp-strip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 13px;
  color: var(--msp-text-2);
}
.msp-strip-row b {
  color: var(--msp-text);
  font-family: var(--msp-font);
  font-weight: 500;
  margin-left: 4px;
}
.msp-strip-cmd {
  margin-top: 10px;
  font-size: 9px;
  color: var(--msp-text-3);
  font-family: var(--msp-mono);
  opacity: 0.7;
}

/* D · Fact Stream */
.msp-filter {
  margin-left: auto;
  font: inherit;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0 10px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--msp-border);
  background: transparent;
  color: var(--msp-text-3);
  cursor: pointer;
}
.msp-filter:hover {
  color: var(--msp-text-2);
  background: var(--msp-s2);
}
.msp-filter.is-on {
  border-color: rgba(209, 107, 91, 0.4);
  color: var(--msp-critical);
  background: rgba(209, 107, 91, 0.08);
}
.msp-stream {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 240px;
  overflow: auto;
}
.msp-stream-item {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 7px 8px 7px 10px;
  border-radius: 0;
  font-size: 13px;
  border-left: 2px solid transparent;
  background: transparent;
}
.msp-stream-item:hover {
  background: var(--msp-s2);
}
.msp-stream-item.is-hot {
  background: transparent;
  border-left-color: var(--msp-critical);
}
.msp-stream-item.is-hot:hover {
  background: var(--msp-s2);
}
.msp-stream-t {
  font-family: var(--msp-mono);
  font-size: 11px;
  color: var(--msp-text-3);
}
.msp-stream-text {
  color: var(--msp-text-2);
  line-height: 1.35;
}
.msp-stream-item.is-hot .msp-stream-text {
  color: var(--msp-text);
}
.msp-stream-hot {
  font-size: 9px;
  font-weight: 600;
  color: var(--msp-critical);
  letter-spacing: 0.06em;
  opacity: 0.85;
}
.msp-cmd-toast {
  position: sticky;
  bottom: 8px;
  align-self: center;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-family: var(--msp-mono);
  background: var(--msp-s3);
  border: 1px solid var(--msp-border-strong);
  color: var(--msp-text-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 5;
}
.msp-cmd-toast.is-on {
  opacity: 1;
}

/* Inspector */
.msp-insp {
  padding: 14px;
  height: 100%;
  overflow: auto;
  background: var(--msp-s1);
}
.msp-insp-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.msp-insp-kicker {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--msp-text-3);
  font-weight: 600;
}
.msp-insp-type {
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--msp-text-2);
  text-transform: uppercase;
}
.msp-insp-title {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
  color: var(--msp-text);
}
.msp-insp-sub {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--msp-text-2);
}
.msp-insp-dl {
  margin: 0 0 16px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}
.msp-insp-dl dt {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--msp-text-3);
  margin-top: 10px;
}
.msp-insp-dl dd {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--msp-text);
  font-weight: 500;
}
.msp-insp-run {
  width: 100%;
}

/* ===== Legacy hud_v0 (A/B only — SpaceX lab) ===== */
.msp-ops--hud_v0 {
  background:
    radial-gradient(ellipse 80% 40% at 50% 0%, rgba(14, 116, 144, 0.14), transparent 55%),
    linear-gradient(180deg, #030508 0%, #070b12 50%, #05070a 100%);
}
.msp-ops--hud_v0 .msp-zone {
  background: rgba(15, 23, 42, 0.28);
  border: 1px solid rgba(148, 163, 184, 0.12);
  backdrop-filter: blur(8px);
}
.msp-ops--hud_v0 .msp-tile {
  background: rgba(8, 12, 20, 0.4);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.16);
}
.msp-ops--hud_v0 .msp-tile-value {
  font-family: var(--msp-mono);
  text-shadow: 0 0 20px rgba(125, 211, 252, 0.2);
}
.msp-ops--hud_v0 .msp-headline-score {
  font-family: var(--msp-mono);
  text-shadow: 0 0 28px rgba(125, 211, 252, 0.25);
}
.msp-ops--hud_v0 .msp-zone-kicker {
  color: #7dd3fc;
  letter-spacing: 0.12em;
}
.msp-ops--hud_v0 .msp-action--primary {
  background: rgba(14, 116, 144, 0.45);
  border-color: rgba(56, 189, 248, 0.45);
}

.hud-strip {
  display: grid;
  grid-template-columns: 1fr minmax(220px, 1.2fr) 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 18px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  background: linear-gradient(180deg, rgba(8, 12, 20, 0.55), rgba(8, 12, 20, 0.2));
  backdrop-filter: blur(14px);
}
.hud-gauges {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.hud-gauge {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: radial-gradient(circle at 50% 45%, rgba(15, 23, 42, 0.2), rgba(2, 6, 12, 0.75));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.08);
}
.hud-gauge-label {
  font-size: 8px;
  letter-spacing: 0.12em;
  color: #94a3b8;
  font-weight: 600;
}
.hud-gauge-value {
  font-family: var(--msp-mono);
  font-size: 16px;
  font-weight: 600;
  color: #f8fafc;
}
.hud-gauge-unit {
  font-size: 8px;
  color: #64748b;
  letter-spacing: 0.08em;
}
.hud-center {
  text-align: center;
}
.hud-mission {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: #94a3b8;
  margin-bottom: 2px;
}
.hud-clock {
  font-family: var(--msp-mono);
  font-size: clamp(26px, 3.5vw, 36px);
  font-weight: 600;
  color: #f8fafc;
  letter-spacing: 0.04em;
  text-shadow: 0 0 36px rgba(125, 211, 252, 0.25);
}
.hud-phase-rail {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px auto 4px;
  max-width: 180px;
}
.hud-phase-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.4);
}
.hud-phase-dot.is-on {
  background: #7dd3fc;
  border-color: #7dd3fc;
  box-shadow: 0 0 10px rgba(125, 211, 252, 0.7);
}
.hud-phase-line {
  height: 1px;
  flex: 1;
  min-width: 24px;
  background: rgba(148, 163, 184, 0.25);
}
.hud-phase-label {
  font-size: 9px;
  letter-spacing: 0.14em;
  color: #64748b;
}
.hud-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.hud-badge {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #7dd3fc;
}
.hud-badge--dim {
  border-color: rgba(148, 163, 184, 0.2);
  color: #64748b;
}

.hub-next-root[data-dash-skin="hud_v0"] .shell-header,
.hub-next-root[data-dash-skin="hud_v0"] .shell-tab-rail,
.hub-next-root[data-dash-skin="hud_v0"] .shell-workbench,
.hub-next-root[data-dash-skin="hud_v0"] .shell-inspector {
  background: rgba(5, 8, 14, 0.55);
}

@media (max-width: 1200px) {
  .msp-tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .msp-strips {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 960px) {
  .shell-body {
    grid-template-columns: 48px 1fr;
  }
  .shell-workbench,
  .shell-inspector {
    display: none;
  }
  .hud-strip {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .hud-gauges,
  .hud-side {
    justify-content: center;
    align-items: center;
  }
}
