/* ============================================================
   DEEP-DIVE (Screen B) + CONFIG (Screen C) styles
   ============================================================ */

/* ---------------- DEEP-DIVE ---------------- */
#dd-wrap {
  position: absolute;
  inset: 0;
  /* top clears the topbar (60 + 96 = ends at 156px); fill the rest, no dead band */
  padding: 196px 130px 96px;
  display: flex;
  flex-direction: column;
  gap: 48px;
}
.dd-mid {
  display: flex;
  gap: 56px;
  flex: 1 1 auto;
  min-height: 0;
}

/* header strip spans both cols */
#dd-header {
  display: flex;
  align-items: center;
  gap: 30px;
  animation: hud-in 0.5s both;
}
#dd-back {
  font-family: var(--mono);
  font-size: 30px;
  letter-spacing: 0.12em;
  color: var(--info-cyan);
  cursor: pointer;
  padding: 14px 28px;
  border: 1px solid color-mix(in srgb, var(--edge) 35%, transparent);
  display: inline-flex;
  gap: 16px;
  align-items: center;
}
#dd-back:hover {
  background: rgba(45, 226, 230, 0.08);
}
#dd-header .dd-head-titles {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
#dd-header .dd-title {
  font-family: var(--mono);
  font-size: 52px;
  letter-spacing: 0.06em;
  color: var(--text);
}
/* plain-English "what this service does" under the title — sized to read from
   across the room on the wall TV. Clamped to 2 lines so a long description can
   never inflate the header and squeeze the panels below it (the full text shows
   on hover via the title attribute). */
#dd-header .dd-desc {
  font-family: var(--body, sans-serif);
  font-size: 31px;
  line-height: 1.4;
  letter-spacing: 0.01em;
  color: color-mix(in srgb, var(--text) 68%, transparent);
  max-width: 1500px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
#dd-header .dd-status {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: var(--mono);
  font-size: 30px;
  letter-spacing: 0.1em;
  color: var(--nominal);
}
#dd-header .dd-status .dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--nominal);
  box-shadow: 0 0 18px var(--nominal);
}
#dd-header .spacer {
  flex: 1;
}

/* left column: planet viz */
#dd-planet {
  flex: 0 0 1180px;
  width: 1180px;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: hud-in 0.6s both 0.1s;
}
#dd-planet canvas {
  width: 100%;
  height: 100%;
  display: block;
}
#dd-planet .pl-cap {
  position: absolute;
  bottom: 18px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--mono);
  font-size: 26px;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

/* right column: readouts — scrolls if the metric set outgrows the panel, so a
   value can never be cut off by its container */
#dd-readouts {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 56px 60px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0;
  animation: hud-in 0.6s both 0.18s;
  overflow-y: auto;
}
.dd-metric {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 30px;
  padding: 24px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--edge) 12%, transparent);
}
/* a text value (e.g. a project name) must truncate with an ellipsis instead of
   being clipped by the panel edge — numbers are unaffected */
.dd-metric > div {
  min-width: 0;
}
.dd-metric .m-val {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dd-metric:last-child {
  border-bottom: 0;
}
.dd-metric .m-lab {
  font-family: var(--sans);
  font-size: 28px;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  text-transform: uppercase;
}
.dd-metric .m-val {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 64px;
  font-weight: 500;
  line-height: 1;
  color: var(--text);
}
.dd-metric .m-val.gold {
  color: var(--value-gold);
  text-shadow: 0 0 32px rgba(255, 194, 75, 0.45);
}
.dd-metric .m-val.amber {
  color: var(--warn);
  text-shadow: 0 0 26px rgba(255, 176, 0, 0.35);
}
.dd-spark {
  width: 200px;
  height: 56px;
}
.delta {
  font-family: var(--mono);
  font-size: 30px;
  padding: 6px 16px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  letter-spacing: 0.04em;
}
.delta.up {
  color: var(--nominal);
}
.delta.down {
  color: var(--alert);
}

.gauge-wrap {
  display: flex;
  align-items: center;
  gap: 24px;
}
.gauge {
  width: 96px;
  height: 96px;
}
.gauge-val {
  font-family: var(--mono);
  font-size: 50px;
}

/* bottom row: activity + recent. min-height:0 makes the 440px basis a REAL cap
   (flexbox's min-height:auto otherwise lets long content inflate the band and
   spill off the stage) — combined with .dd-sub's overflow-y this is what makes
   long feeds scroll inside their frame. */
#dd-bottom {
  display: flex;
  gap: 56px;
  flex: 0 0 440px;
  min-height: 0;
  max-height: 440px;
  animation: hud-in 0.6s both 0.26s;
}
#dd-activity {
  flex: 1;
  min-width: 0;
}
#dd-recent {
  flex: 1;
  min-width: 0;
}
.dd-sub {
  padding: 40px 48px;
  min-width: 0;
  /* every bottom panel is a real scroll container: long feeds (25 skills, model
     mixes, project lists) scroll inside their frame instead of spilling off the
     stage — this is what makes the pop-ups scrollable on TV and desktop alike */
  overflow-y: auto;
}

/* thin themed scrollbar for every scrollable panel (deep-dive panels, Sheet,
   Config) — visible enough to invite scrolling, quiet enough for the wall */
.dd-sub::-webkit-scrollbar,
#dd-readouts::-webkit-scrollbar,
#sheet-tablewrap::-webkit-scrollbar,
#cfg-wrap::-webkit-scrollbar {
  width: 12px;
}
.dd-sub::-webkit-scrollbar-thumb,
#dd-readouts::-webkit-scrollbar-thumb,
#sheet-tablewrap::-webkit-scrollbar-thumb,
#cfg-wrap::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--info-cyan) 28%, transparent);
  border-radius: 6px;
}
.dd-sub::-webkit-scrollbar-track,
#dd-readouts::-webkit-scrollbar-track,
#sheet-tablewrap::-webkit-scrollbar-track,
#cfg-wrap::-webkit-scrollbar-track {
  background: transparent;
}
.dd-sub .sub-h {
  font-family: var(--sans);
  font-size: 26px;
  letter-spacing: 0.2em;
  color: var(--info-cyan);
  text-transform: uppercase;
  margin-bottom: 26px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.dd-sub .sub-h::after {
  content: "";
  flex: 1;
  height: 1px;
  background: color-mix(in srgb, var(--edge) 18%, transparent);
}
#dd-activity .act-bars {
  width: 100%;
  height: 116px;
}
/* real 30-day trend (warehouse /series) — direction, not just current value */
.dd-trend {
  margin-top: 44px; /* clear gap below the 24h bar chart so they don't collide (#16) */
}
.dd-trend:empty {
  display: none; /* #17: no series → no empty trend block at all */
}
.dd-trend .trend-h {
  font-family: var(--mono);
  font-size: 22px;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}
.dd-trend .trend-win {
  display: inline-flex;
  gap: 8px;
}
.dd-trend .trend-win button {
  font-family: var(--mono);
  font-size: 20px;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--edge) 30%, transparent);
  border-radius: 4px;
  padding: 4px 12px;
  cursor: pointer;
}
.dd-trend .trend-win button:hover {
  color: var(--info-cyan);
  border-color: var(--info-cyan);
}
.dd-trend .trend-win button.on {
  color: var(--void, #0a0e14);
  background: var(--info-cyan);
  border-color: var(--info-cyan);
}
.dd-trend .trend-spark {
  width: 100%;
  height: 80px;
}
.dd-trend .trend-up {
  color: var(--ok-green, #4cd964);
  font-weight: 600;
}
.dd-trend .trend-down {
  color: var(--warn-amber, #ffb000);
  font-weight: 600;
}
.dd-trend .trend-flat,
.dd-trend .trend-empty,
.dd-trend .trend-load {
  color: var(--text-muted);
}
#dd-activity .act-foot {
  display: flex;
  gap: 50px;
  margin-top: 26px;
  font-family: var(--mono);
  font-size: 24px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}
#dd-activity .act-foot b {
  color: var(--text);
  font-weight: 500;
}
.feed-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 26px;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--edge) 10%, transparent);
  font-family: var(--mono);
  font-size: 28px;
}
.feed-row:last-child {
  border-bottom: 0;
}
.feed-row .ftag {
  font-weight: 600;
  letter-spacing: 0.08em;
}
.feed-row.red .ftag {
  color: var(--alert);
}
.feed-row.yel .ftag {
  color: var(--warn);
}
.feed-row.ok .ftag {
  color: var(--nominal);
}
.feed-row .fven {
  color: var(--text);
}
.feed-row .famt {
  color: var(--value-gold);
}
.feed-row .ftime {
  color: var(--text-muted);
}

.b2-note {
  font-family: var(--sans);
  font-size: 28px;
  line-height: 1.55;
  color: var(--text-muted);
  max-width: 900px;
}
.b2-note b {
  color: var(--info-cyan);
  font-weight: 500;
}

/* ---------------- CONFIG ---------------- */
#cfg-wrap {
  position: absolute;
  inset: 0;
  /* fill the stage like the deep-dive popup so everything is large + readable (#1) */
  padding: 90px 110px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* the Config panel grows with the fleet (planet/name lists) — scroll inside
     the frame instead of running off the stage */
  overflow-y: auto;
}
#cfg-panel {
  width: 100%;
  max-width: 3520px;
  padding: 48px 70px;
  animation: hud-in 0.5s both;
}
#cfg-panel .cfg-h {
  display: flex;
  align-items: center;
  gap: 26px;
  margin-bottom: 26px;
}
#cfg-panel .cfg-h .ct {
  font-family: var(--mono);
  font-size: 46px;
  letter-spacing: 0.12em;
  color: var(--text);
}
#cfg-panel .cfg-h .spacer {
  flex: 1;
}
#cfg-close {
  font-family: var(--mono);
  font-size: 28px;
  color: var(--info-cyan);
  cursor: pointer;
  padding: 12px 26px;
  border: 1px solid color-mix(in srgb, var(--edge) 35%, transparent);
}
#cfg-close:hover {
  background: rgba(45, 226, 230, 0.08);
}

.cfg-row {
  display: grid;
  grid-template-columns: 420px 1fr;
  align-items: center;
  gap: 40px;
  padding: 20px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--edge) 12%, transparent);
}
.cfg-row .cfg-lab {
  font-family: var(--sans);
  font-size: 30px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.cfg-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
}
/* per-planet on/off chips — wrap, NO scroll (everything visible, #3) */
.cfg-controls.cfg-planets {
  align-items: flex-start;
  gap: 10px 14px;
}
.cfg-controls.cfg-planets .chip {
  font-size: 22px;
  padding: 8px 14px;
}
.cfg-lab .cfg-sub {
  display: block;
  font-size: 18px;
  letter-spacing: 0.05em;
  text-transform: none;
  color: var(--text-dim);
  margin-top: 6px;
}
/* display-name overrides — multi-column grid, NO scroll (everything visible, #3) */
.cfg-controls.cfg-names {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 28px;
  align-items: center;
}
.cfg-name-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 14px;
  align-items: center;
}
.cfg-name-id {
  font-family: var(--mono);
  font-size: 27px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cfg-name-in {
  font-family: var(--mono);
  font-size: 27px;
  padding: 9px 14px;
  background: color-mix(in srgb, var(--edge) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--edge) 30%, transparent);
  border-radius: 6px;
  color: var(--text);
  min-width: 0;
}
.cfg-name-in:focus {
  outline: none;
  border-color: var(--info-cyan);
}

/* pipeline hours-saved baselines: service · minutes/run input · save status */
.cfg-savings .cfg-name-row {
  grid-template-columns: minmax(0, 1fr) 130px 84px;
}
.cfg-sav-in {
  font-family: var(--mono);
  font-size: 27px;
  padding: 9px 14px;
  background: color-mix(in srgb, var(--edge) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--edge) 30%, transparent);
  border-radius: 6px;
  color: var(--text);
  min-width: 0;
  width: 100%;
}
.cfg-sav-in:focus {
  outline: none;
  border-color: var(--info-cyan);
}
.cfg-sav-stat {
  font-family: var(--mono);
  font-size: 19px;
  color: var(--text-dim);
  white-space: nowrap;
}
.cfg-sav-stat.ok {
  color: #4cd964;
}
.cfg-sav-stat.err {
  color: #ff3b30;
}

.chip {
  font-family: var(--mono);
  font-size: 28px;
  letter-spacing: 0.05em;
  padding: 14px 28px;
  cursor: pointer;
  user-select: none;
  border: 1px solid color-mix(in srgb, var(--edge) 22%, transparent);
  color: var(--text-muted);
  display: inline-flex;
  gap: 14px;
  align-items: center;
  transition: all 0.15s ease;
}
.chip .box {
  width: 22px;
  height: 22px;
  border: 2px solid var(--text-dim);
  display: grid;
  place-items: center;
  font-size: 18px;
}
.chip.on {
  color: var(--text);
  border-color: var(--edge);
  background: rgba(45, 226, 230, 0.08);
}
.chip.on .box {
  border-color: var(--edge);
  color: var(--edge);
  background: rgba(45, 226, 230, 0.12);
}
.chip:hover {
  border-color: var(--edge);
}

.cfg-select {
  font-family: var(--mono);
  font-size: 28px;
  letter-spacing: 0.05em;
  background: var(--void);
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--edge) 30%, transparent);
  padding: 14px 26px;
  cursor: pointer;
}
.radio-group {
  display: inline-flex;
  border: 1px solid color-mix(in srgb, var(--edge) 22%, transparent);
}
.radio-group .ro {
  font-family: var(--mono);
  font-size: 28px;
  padding: 14px 30px;
  cursor: pointer;
  color: var(--text-muted);
  border-right: 1px solid color-mix(in srgb, var(--edge) 18%, transparent);
}
.radio-group .ro:last-child {
  border-right: 0;
}
.radio-group .ro.on {
  background: rgba(45, 226, 230, 0.12);
  color: var(--edge);
}

.cfg-slider {
  display: flex;
  align-items: center;
  gap: 26px;
  font-family: var(--mono);
  font-size: 28px;
  color: var(--text-muted);
}
.cfg-slider input[type="range"] {
  width: 420px;
  accent-color: var(--info-cyan);
  height: 6px;
}
.cfg-slider .sv {
  color: var(--info-cyan);
  min-width: 90px;
}

/* ---------------- SHEET (operator scoreboard) ---------------- */
#sheet-wrap {
  position: absolute;
  inset: 64px 96px;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: hud-in 0.4s both;
}
#sheet-head {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 40px 52px 28px;
  flex: 0 0 auto;
  border-bottom: 1px solid color-mix(in srgb, var(--edge) 14%, transparent);
}
#sheet-head .spacer {
  flex: 1;
}
#sheet-head .sheet-title {
  font-family: var(--mono);
  font-size: 40px;
  letter-spacing: 0.08em;
  color: var(--text);
}
#sheet-back {
  font-family: var(--mono);
  font-size: 28px;
  letter-spacing: 0.12em;
  color: var(--info-cyan);
  cursor: pointer;
  padding: 12px 26px;
  border: 1px solid color-mix(in srgb, var(--edge) 35%, transparent);
}
#sheet-back:hover {
  background: rgba(45, 226, 230, 0.08);
}
#sheet-q {
  font-family: var(--mono);
  font-size: 26px;
  background: var(--void);
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--edge) 30%, transparent);
  padding: 12px 22px;
  width: 360px;
  outline: none;
}
#sheet-q:focus {
  border-color: var(--edge);
}

#sheet-summary {
  display: flex;
  gap: 50px;
  flex-wrap: wrap;
  align-items: center;
  padding: 24px 52px;
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 30px;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
#sheet-summary b {
  color: var(--text);
  font-weight: 600;
}
#sheet-summary .warn b {
  color: var(--warn);
}
#sheet-summary .dim {
  color: var(--text-dim);
  font-size: 24px;
}

#sheet-legend {
  padding: 0 52px 22px;
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 22px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}
.gkey {
  display: inline-block;
  margin-top: 8px;
}
.gdot {
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  vertical-align: middle;
  margin: 0 6px 0 16px;
}

#sheet-tablewrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 52px 40px;
}
#sheet-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
#sheet-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel);
  font-family: var(--sans);
  font-size: 22px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: right;
  padding: 20px 18px;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 1px solid color-mix(in srgb, var(--edge) 30%, transparent);
}
#sheet-table thead th.left {
  text-align: left;
}
#sheet-table thead th:hover {
  color: var(--info-cyan);
}
#sheet-table td {
  font-size: 27px;
  padding: 16px 18px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid color-mix(in srgb, var(--edge) 8%, transparent);
  color: var(--text);
}
#sheet-table td.left {
  text-align: left;
}
#sheet-table tr.row {
  cursor: pointer;
}
#sheet-table tr.row:hover td {
  background: rgba(45, 226, 230, 0.05);
}

#sheet-table tr.grp td {
  font-family: var(--sans);
  font-size: 24px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--info-cyan);
  padding: 26px 18px 14px;
  cursor: pointer;
  border-bottom: 1px solid color-mix(in srgb, var(--edge) 22%, transparent);
}
#sheet-table tr.grp td .caret {
  color: var(--text-muted);
  margin-right: 12px;
}
#sheet-table tr.grp:hover td {
  color: var(--text);
}
/* per-group column header (lives in tbody now; each archetype labels its own metrics) */
#sheet-table tr.grp-cols th {
  font-family: var(--sans);
  font-size: 20px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: right;
  padding: 6px 18px 12px;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 1px solid color-mix(in srgb, var(--edge) 18%, transparent);
}
#sheet-table tr.grp-cols th.left {
  text-align: left;
}
#sheet-table tr.grp-cols th:hover {
  color: var(--info-cyan);
}
#sheet-table td .warn {
  color: var(--warn, #ffb000);
}

#sheet-table .svc {
  color: var(--text);
}
#sheet-table .svc.flag {
  color: var(--text); /* service names always white (flagship shown via the scene's Saturn ring) */
}
#sheet-table .self {
  font-size: 18px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}
#sheet-table .dim {
  color: var(--text-muted);
}
#sheet-table .st {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
#sheet-table .st .dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
}
#sheet-table .hard {
  color: var(--value-gold);
}
#sheet-table .soft {
  color: color-mix(in srgb, var(--value-gold) 70%, var(--void));
}

/* source / freshness badges — the live-vs-seed audit */
.src {
  font-size: 20px;
  letter-spacing: 0.1em;
  padding: 4px 12px;
  border: 1px solid currentColor;
  border-radius: 2px;
}
.src-live {
  color: var(--nominal);
}
.src-stale {
  color: var(--info-cyan);
}
.src-render {
  color: #7fb2ff;
}
.src-seed {
  color: var(--text-dim);
}
.src-unknown {
  color: var(--text-dim);
}
/* warehouse data layers (richest → baseline) */
.src-snapshot {
  color: var(--value-gold);
} /* pushed business KPIs (real $/volume) */
.src-usage {
  color: #7fb2ff;
} /* MCP tool-call usage */
.src-pageview {
  color: #7fb2ff;
} /* web adoption */
.src-cron {
  color: var(--nominal);
} /* cron runs */
.src-platform {
  color: var(--text-muted);
} /* Render baseline only */

#sheet-head .chip {
  font-size: 24px;
  padding: 12px 22px;
}

/* date-range selector for activity counts (connector CALLS + pipeline RUNS) */
#sheet-window {
  display: inline-flex;
  align-items: center;
  margin-right: 10px;
}
#sheet-window .winlab {
  font-family: var(--mono);
  font-size: 18px;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  margin-right: 12px;
}
#sheet-window .winchip {
  font-family: var(--mono);
  font-size: 22px;
  padding: 10px 18px;
  color: var(--text-muted);
  border: 1px solid color-mix(in srgb, var(--edge) 28%, transparent);
  border-left: 0;
  cursor: pointer;
  user-select: none;
}
#sheet-window .winchip:first-of-type {
  border-left: 1px solid color-mix(in srgb, var(--edge) 28%, transparent);
}
#sheet-window .winchip:hover {
  color: var(--text);
}
#sheet-window .winchip.on {
  color: var(--void);
  background: var(--info-cyan);
  border-color: var(--info-cyan);
}
