/*
  styles-shell.css
  New layout shell for Field Path Engine.
  Loaded after styles.css — overrides layout only, never card/form/utility classes.
  All existing card, input, button, table, badge styles remain in styles.css untouched.
*/

/* ── FONT IMPORT ─────────────────────────────────────────── */
/* IBM Plex Sans + Mono loaded via <link> in HTML */
:root {
  --shell-font: 'IBM Plex Sans', var(--font-sans);
  --shell-mono: 'IBM Plex Mono', var(--font-mono);

  /* Layout dimensions */
  --topbar-h:    52px;
  --nav-w:       240px;
  --sidebar-w:   clamp(260px, 22vw, 340px);

  /* New shell tokens (map to existing theme tokens) */
  --s-bg:        var(--bg);
  --s-panel:     var(--panel);
  --s-rule:      var(--rule);
  --s-text:      var(--text);
  --s-muted:     var(--text-muted);
  --s-accent:    var(--accent);
  --s-accent-dim: color-mix(in srgb, var(--accent) 12%, transparent);
  --s-ok:        var(--ok-fg);
  --s-ok-dim:    var(--ok-bg);
  --s-warn:      var(--warn-fg);
  --s-warn-dim:  var(--warn-bg);
  --s-bad:       var(--bad-fg);
  --s-bad-dim:   var(--bad-bg);
  --s-train:     #8b5cf6;
  --s-train-dim: rgba(139,92,246,0.1);
  --s-train-border: rgba(139,92,246,0.28);
  --s-surface-gray: color-mix(in srgb, var(--s-rule) 24%, var(--s-panel));
  --s-module-strip-bg: color-mix(in srgb, var(--s-accent) 14%, var(--s-panel));
  --s-module-strip-border: color-mix(in srgb, var(--s-accent) 38%, var(--s-rule));
  --s-module-strip-text: color-mix(in srgb, var(--s-accent) 78%, var(--s-text));
  --s-module-strip-muted: color-mix(in srgb, var(--s-module-strip-text) 62%, var(--s-muted));
  --s-module-divider: color-mix(in srgb, var(--s-rule) 78%, transparent);
}

/* ── RESET BODY FOR NEW LAYOUT ───────────────────────────── */
html, body { height: 100%; overflow: hidden; }
body { font-family: var(--shell-font); }

/* ── TOPBAR ──────────────────────────────────────────────── */
.topbar-new {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--s-panel);
  border-bottom: 1px solid var(--s-rule);
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 12px;
  z-index: 200;
  font-family: var(--shell-font);
}

.brand-new {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}
.brand-name-new {
  font-size: 13px;
  font-weight: 600;
  color: var(--s-text);
  white-space: nowrap;
}
.chip-new {
  font-family: var(--shell-mono);
  font-size: 10px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--s-rule) 60%, var(--s-panel));
  border: 1px solid var(--s-rule);
  color: var(--s-muted);
}
.chip-new.chip-status { cursor: default; }
.chip-new.chip-persist {
  color: var(--s-bad);
  border-color: color-mix(in srgb, var(--s-bad) 38%, var(--s-rule));
  background: color-mix(in srgb, var(--s-bad) 14%, var(--s-panel));
}

.topbar-center {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: 380px;
}
.scenario-label-new {
  font-size: 11px;
  color: var(--s-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.scenario-input-new {
  flex: 1;
  background: var(--s-bg);
  border: 1px solid var(--s-rule);
  border-radius: 5px;
  color: var(--s-text);
  font-family: var(--shell-font);
  font-size: 12px;
  padding: 5px 8px;
  outline: none;
  transition: border-color 0.15s;
}
.scenario-input-new:focus { border-color: var(--s-accent); }

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  max-width: 62vw;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

/* Training toggle pill */
.toggle-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 5px;
  border: 1px solid var(--s-rule);
  background: var(--s-bg);
  cursor: pointer;
  font-size: 12px;
  color: var(--s-muted);
  transition: all 0.15s;
  user-select: none;
  white-space: nowrap;
}
.toggle-pill:hover { border-color: color-mix(in srgb, var(--s-rule) 60%, var(--s-text)); color: var(--s-text); }
.toggle-dot-new {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--s-muted);
  transition: background 0.15s;
  flex-shrink: 0;
}

/* When training checkbox is checked → sibling .toggle-dot-new and parent .toggle-pill change */
body.training .toggle-pill:has(#toggleTraining) {
  border-color: var(--s-train-border);
  color: var(--s-train);
  background: var(--s-train-dim);
}
body.training .toggle-pill:has(#toggleTraining) .toggle-dot-new {
  background: var(--s-train);
}

/* Strict-import toggle visual state */
body.strict-import .toggle-pill:has(#toggleStrictImport) {
  border-color: color-mix(in srgb, var(--s-warn) 45%, var(--s-rule));
  color: var(--s-warn);
  background: color-mix(in srgb, var(--s-warn) 10%, transparent);
}
body.strict-import .toggle-pill:has(#toggleStrictImport) .toggle-dot-new {
  background: var(--s-warn);
}

.import-feedback-strip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0 10px;
}

.import-feedback-strip .banner {
  margin: 0;
  border-radius: 8px;
  padding: 8px 12px;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
}

.banner.module-feedback {
  margin: 10px 0 0;
  border-radius: 8px;
  padding: 8px 12px;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
}

.btn-top-new {
  padding: 5px 10px;
  border-radius: 5px;
  border: 1px solid var(--btn-border, #8f1d14);
  background: var(--btn-bg, #b42318);
  color: #fff;
  font-family: var(--shell-font);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-top-new:hover {
  border-color: var(--btn-hover, #8f1d14);
  background: var(--btn-hover, #8f1d14);
  color: #fff;
}
.btn-top-new.active-view {
  border-color: var(--btn-active, #7a1710);
  background: var(--btn-active, #7a1710);
  color: #fff;
}
.btn-top-new.btn-top-danger {
  color: #fff;
  border-color: var(--btn-border, #8f1d14);
}
.btn-top-new.btn-top-danger:hover {
  background: var(--btn-hover, #8f1d14);
}

.divider-new {
  width: 1px; height: 20px;
  background: var(--s-rule);
  flex-shrink: 0;
}

/* ── APP SHELL ───────────────────────────────────────────── */
.app-shell {
  display: flex;
  height: calc(100dvh - var(--topbar-h));
  height: calc(100vh - var(--topbar-h));
  margin-top: var(--topbar-h);
  overflow: hidden;
}

/* Kill the old shell layout */
.shell { display: contents; }

/* ── STAGE NAV (LEFT RAIL) ───────────────────────────────── */
.stage-nav-new {
  width: var(--nav-w);
  flex-shrink: 0;
  background: var(--s-panel);
  border-right: 1px solid var(--s-rule);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 10px 0 16px;
}

.nav-group-label-new {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--s-muted) 60%, transparent);
  padding: 10px 14px 4px;
}

.nav-item-new {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px 7px 14px;
  cursor: pointer;
  border: none;
  background: transparent;
  border-left: 2px solid transparent;
  text-align: left;
  width: 100%;
  transition: background 0.1s;
  font-family: var(--shell-font);
  text-decoration: none;
  color: inherit;
}
.nav-item-new:hover { background: color-mix(in srgb, var(--s-rule) 40%, transparent); }
.nav-item-new.active {
  background: var(--s-accent-dim);
  border-left-color: var(--s-accent);
}
.nav-item-new.active .nav-label-new { color: var(--s-accent); font-weight: 500; }

/* status variants */
.nav-item-new.nav-ok   .nav-num-new { background: var(--s-ok-dim);   color: var(--s-ok);   border-color: color-mix(in srgb, var(--s-ok)  30%, transparent); }
.nav-item-new.nav-warn .nav-num-new { background: var(--s-warn-dim); color: var(--s-warn); border-color: color-mix(in srgb, var(--s-warn) 30%, transparent); }
.nav-item-new.nav-bad  .nav-num-new { background: var(--s-bad-dim);  color: var(--s-bad);  border-color: color-mix(in srgb, var(--s-bad)  30%, transparent); }

.nav-num-new {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1px solid var(--s-rule);
  background: var(--s-bg);
  color: color-mix(in srgb, var(--s-muted) 70%, transparent);
  font-family: var(--shell-mono);
  font-size: 9px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}
.nav-label-new {
  font-size: 12px;
  color: var(--s-muted);
  flex: 1;
  transition: color 0.1s;
}
.nav-sep-new {
  height: 1px;
  background: var(--s-rule);
  margin: 8px 0;
}

/* ── MAIN CONTENT AREA ───────────────────────────────────── */
.stage-main-new {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--s-bg);
}

/* Each stage is a full-height scrollable panel */
.stage-new {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}
.stage-new.active-stage {
  display: flex;
}

/* Stage header (sticky) */
.stage-header-new {
  flex-shrink: 0;
  padding: 18px 24px 14px;
  background: var(--s-panel);
  border-bottom: 1px solid var(--s-rule);
}
.stage-meta-new {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 3px;
}
.stage-tag-new {
  font-family: var(--shell-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--s-muted);
  background: color-mix(in srgb, var(--s-rule) 50%, transparent);
  padding: 2px 7px;
  border-radius: 3px;
}
.stage-title-new {
  font-size: 15px;
  font-weight: 600;
  color: var(--s-text);
}
.stage-sub-new {
  font-size: 12px;
  color: var(--s-muted);
  margin: 0 0 14px;
  line-height: 1.5;
}

/* Stage body — scrollable */
.stage-body-new {
  flex: 1;
  overflow-y: auto;
  padding: 22px 24px 38px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  scroll-padding-top: 12px;
}

.stage-body-new .grid2,
.stage-body-new .grid3,
.stage-body-new .grid4 {
  gap: 14px;
}

.checks-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.setup-divider {
  width: 100%;
  margin: 4px 0 8px;
  border: 0;
  border-top: 1px solid color-mix(in srgb, var(--s-rule) 78%, transparent);
}

/* Module separation now uses spacing only (no horizontal rules). */
.setup-divider,
.sectionRule {
  display: none !important;
}

.no-dropdown-details > summary {
  display: none;
}

.no-dropdown-details {
  border: 0;
  padding: 0;
  margin: 0;
}

#setupBallotModule .table-wrap {
  overflow-x: auto;
}

#setupBallotModule .table {
  width: 100%;
}

#setupBallotModule .table th:nth-child(1),
#setupBallotModule .table td:nth-child(1) {
  min-width: 200px;
}

#setupBallotModule .table th:nth-child(2),
#setupBallotModule .table td:nth-child(2) {
  min-width: 160px;
}

.phase-candidates:empty,
.phase-persuasion:empty {
  display: none;
}

.integrity-stage-body > .card {
  max-width: none;
}

.integrity-policy-grid .help-text {
  margin-top: 8px;
}

.integrity-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.integrity-actions .btn {
  flex: 0 0 auto;
}

.stage-body-new .card > .validation,
.stage-body-new .card > .guardrails,
.stage-body-new .card > .assumptions {
  padding: 12px 14px 14px;
}

/* Cards inside stage body use spacing-only module separation. */
.stage-body-new .card {
  margin-top: 0;
}

/* Top-level cards touching page background use gray surface; nested cards stay panel/white. */
.stage-body-new > .card {
  background: var(--s-surface-gray);
  width: 100%;
  max-width: none;
  align-self: stretch;
  position: relative;
}
.stage-body-new > .card .card {
  background: var(--s-panel);
}

/* Standard module template: full-width cards, blue title strip, and clear module boundaries. */
.stage-body-new > .card + .card {
  margin-top: 18px;
}

.stage-body-new > .panel > .card + .card {
  margin-top: 18px;
}

/* Safety: hide accidental placeholder cards that have no content. */
.stage-body-new > .card:empty,
.stage-body-new > .panel > .card:empty {
  display: none !important;
}

.stage-body-new .card-head.card-header {
  min-height: 52px;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 12px;
  padding: 12px 16px 11px;
  background: var(--s-module-strip-bg);
  border: 1px solid var(--s-module-strip-border);
  border-bottom: 1px solid color-mix(in srgb, var(--s-module-strip-border) 70%, var(--s-rule));
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
}

.stage-body-new .card-head.card-header .card-title {
  grid-column: 1;
  color: var(--s-module-strip-text);
  font-size: 14px;
  font-weight: 650;
}

.stage-body-new .card-head.card-header .card-actions {
  grid-column: 2;
  justify-self: end;
}

.stage-body-new .card-head.card-header .help-text {
  display: none;
}

.stage-body-new .card > .help-text,
.stage-body-new .card > .module-desc {
  margin: 0;
  padding: 10px 16px 11px;
  border-bottom: 1px solid color-mix(in srgb, var(--s-rule) 70%, transparent);
  background: color-mix(in srgb, var(--s-module-strip-bg) 45%, var(--s-panel));
  min-height: 38px;
  display: flex;
  align-items: center;
  color: var(--s-muted);
  font-size: 12px;
  line-height: 1.45;
}

.stage-body-new .card .card-actions,
.stage-body-new .card .integrity-actions,
.stage-body-new .card .scm-actions {
  row-gap: 10px;
}

.stage-body-new .card .note,
.stage-body-new .card .muted,
.stage-body-new .card .help-text {
  line-height: 1.45;
}

.stage-body-new .card {
  display: flex;
  flex-direction: column;
}

/* Consistent internal rhythm: keep breathing room between every direct module element. */
.stage-body-new .card > * + * {
  margin-top: 12px;
}

/* Keep title strip + description visually paired. */
.stage-body-new .card > .card-head + .module-desc,
.stage-body-new .card > .card-head + .help-text {
  margin-top: 0;
}

.stage-body-new .card > :not(.card-head):not(.help-text):not(.module-desc):not(.setup-divider) {
  margin-left: 12px;
  margin-right: 12px;
}

.stage-body-new > .card {
  padding-bottom: 14px;
}

.stage-body-new > .card > :not(.card-head):not(.help-text):not(.module-desc):not(.setup-divider) {
  margin-left: 18px;
  margin-right: 18px;
}

.stage-body-new > .card > .setup-divider {
  margin-left: 18px;
  margin-right: 18px;
}

/* Shared 3-up output grid used across Field capacity and planning metric modules. */
.subgrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

/* Execution & uncertainty uses a nested wrapper; enforce same spacing rhythm inside it. */
#phase3Card .mc-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 4px;
}

#phase3Card .mc-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--s-rule) 70%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--s-panel) 92%, var(--s-bg));
}

#phase3Card .mc-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#phase3Card .mc-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}

#decisionIntelCard .grid3 {
  margin-bottom: 14px;
}

@media (max-width: 1180px) {
  .subgrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .subgrid {
    grid-template-columns: 1fr;
  }
}

/* Keep the old left/right/rail sections from affecting layout */
.left, .right { display: contents; }
.rail { display: contents; }


/* Keep card containers intact for consistent visual grouping. */
.stage-main-new .card {
  overflow: visible;
}

/* ── TRAINING PANEL ──────────────────────────────────────── */
.training-panel-new {
  background: var(--s-train-dim);
  border: 1px solid var(--s-train-border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 2px;
}

/* Hidden by default — shown when body.training is active */
.training-panel-new { display: none; }
body.training .training-panel-new { display: block; }

.training-hd-new {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  cursor: pointer;
  user-select: none;
}
.training-title-new {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--s-train);
  flex: 1;
}
.training-chev-new {
  color: var(--s-train);
  opacity: 0.6;
  font-size: 10px;
  transition: transform 0.2s;
}
.training-panel-new.collapsed .training-chev-new { transform: rotate(-90deg); }
.training-panel-new.collapsed .training-bd-new { display: none; }

.training-bd-new {
  padding: 0 13px 13px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.training-col-new {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.training-sec-title-new {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--s-train);
  opacity: 0.75;
}
.training-bd-new p,
.training-bd-new li {
  font-size: 12px;
  color: var(--s-muted);
  line-height: 1.55;
}
.training-bd-new ul {
  padding-left: 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 0;
}
.training-bd-new strong { color: var(--s-train); font-weight: 500; }
.training-rule-new {
  background: color-mix(in srgb, var(--s-panel) 80%, var(--s-bg));
  border: 1px solid var(--s-rule);
  border-radius: 5px;
  padding: 7px 10px;
  font-size: 11px;
  color: var(--s-muted);
  font-family: var(--shell-mono);
  line-height: 1.55;
  white-space: pre-line;
}
.training-caution-new {
  background: var(--s-warn-dim);
  border: 1px solid color-mix(in srgb, var(--s-warn) 30%, transparent);
  border-radius: 5px;
  padding: 7px 10px;
  font-size: 11.5px;
  color: var(--s-warn);
  line-height: 1.45;
}
.training-caution-new::before { content: "⚠  "; }

/* ── RESULTS SIDEBAR (RIGHT) ─────────────────────────────── */
.results-sidebar-new {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--s-panel);
  border-left: 1px solid var(--s-rule);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

body.focus-view .results-sidebar-new {
  display: none;
}
body.focus-view .stage-main-new {
  max-width: none;
}
body.focus-view .stage-body-new {
  padding-right: 26px;
}


.sidebar-section-new {
  padding: 13px 14px;
  border-bottom: 1px solid var(--s-rule);
  flex-shrink: 0;
}
.sidebar-label-new {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--s-muted) 70%, transparent);
  margin-bottom: 9px;
  display: block;
}

/* Win stats */
.win-stat-new {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 7px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--s-rule) 50%, transparent);
}
.win-stat-new:last-child { border-bottom: none; }
.win-stat-label-new { font-size: 10px; color: var(--s-muted); }
.win-stat-val-new {
  font-family: var(--shell-mono);
  font-size: 19px;
  font-weight: 500;
  color: var(--s-text);
  line-height: 1.15;
}
.win-stat-sub-new { font-size: 10px; color: color-mix(in srgb, var(--s-muted) 70%, transparent); }

/* MC probability */
.mc-prob-row-new {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-bottom: 6px;
}
.mc-prob-val-new {
  font-family: var(--shell-mono);
  font-size: 26px;
  font-weight: 500;
  color: var(--s-text);
  line-height: 1;
}
.mc-prob-sub-new { font-size: 11px; color: var(--s-muted); }
.prob-bar-new {
  height: 5px;
  background: color-mix(in srgb, var(--s-rule) 80%, transparent);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 5px;
}
.prob-fill-new {
  height: 100%;
  border-radius: 3px;
  background: var(--s-accent);
  transition: width 0.5s ease;
}

.viz-track{fill: color-mix(in srgb, var(--s-rule) 80%, transparent)}
.viz-marker{fill: var(--s-accent)}
.viz-zero{stroke: color-mix(in srgb, var(--s-muted) 55%, transparent); stroke-width: 1; stroke-dasharray: 3 3}
.viz-bar{fill: color-mix(in srgb, var(--s-text) 16%, transparent)}
.viz-winshade{fill: color-mix(in srgb, var(--s-accent) 10%, transparent)}
.prob-range-new {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--s-muted);
  margin-bottom: 6px;
}
.mc-meta-new { font-size: 10px; color: color-mix(in srgb, var(--s-muted) 65%, transparent); margin-top: 4px; }

/* KV mini rows in sidebar */
.kv-mini-new {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--s-rule) 40%, transparent);
  font-size: 11px;
}
.kv-mini-new:last-child { border-bottom: none; }
.kv-mini-new span:first-child { color: var(--s-muted); }
.kv-mini-new span:last-child {
  font-family: var(--shell-mono);
  font-size: 11px;
  color: var(--s-text);
  text-align: right;
}
.dim-text { color: color-mix(in srgb, var(--s-muted) 60%, transparent) !important; font-size: 10px !important; }

/* Assumptions / Guardrails blocks (sidebar + center) */
.assump-block {
  border: 1px solid color-mix(in srgb, var(--s-rule) 70%, transparent);
  border-radius: 10px;
  padding: 10px 10px;
  margin-bottom: 10px;
  background: color-mix(in srgb, var(--s-panel) 70%, transparent);
}
.assump-block:last-child { margin-bottom: 0; }
.assump-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--s-text);
  margin-bottom: 7px;
}
.assump-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kv {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.kv .k {
  font-size: 10.5px;
  color: var(--s-muted);
  flex: 1 1 auto;
  min-width: 0;
}
.kv .v {
  font-family: var(--shell-mono);
  font-size: 11px;
  color: var(--s-text);
  text-align: right;
  flex: 0 0 auto;
  max-width: 60%;
  overflow-wrap: anywhere;
}

.results-sidebar-new .assump-block {
  background: var(--s-surface-gray);
  border-color: color-mix(in srgb, var(--s-rule) 78%, transparent);
}
.results-sidebar-new .kv .v { max-width: 58%; }

.results-sidebar-new .sidebar-section-new.sidebar-win-expected {
  background: #ffa500;
}

.results-sidebar-new .sidebar-section-new.sidebar-win-expected .sidebar-label-new,
.results-sidebar-new .sidebar-section-new.sidebar-win-expected .win-stat-label-new,
.results-sidebar-new .sidebar-section-new.sidebar-win-expected .win-stat-sub-new {
  color: #5a2a17;
}

.results-sidebar-new .sidebar-section-new.sidebar-win-expected .win-stat-val-new {
  color: #2f1a12;
}

.results-sidebar-new .sidebar-section-new.sidebar-win-expected .win-stat-new {
  border-bottom-color: rgba(90, 42, 23, 0.18);
}

.results-sidebar-new .sidebar-section-new.sidebar-early-split {
  background: #ffbf00;
}

.results-sidebar-new .sidebar-section-new.sidebar-early-split .sidebar-label-new,
.results-sidebar-new .sidebar-section-new.sidebar-early-split .kv-mini-new span:first-child {
  color: #5a2a17;
}

.results-sidebar-new .sidebar-section-new.sidebar-early-split .kv-mini-new span:last-child {
  color: #2f1a12;
}

.results-sidebar-new .sidebar-section-new.sidebar-early-split .kv-mini-new {
  border-bottom-color: rgba(90, 42, 23, 0.18);
}

/* Stress list */
.stress { display: flex; flex-direction: column; gap: 6px; }
.stress-item {
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--s-rule) 60%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--s-panel) 70%, transparent);
  font-size: 11px;
  color: var(--s-text);
  line-height: 1.35;
}

.results-sidebar-new .stress-item {
  background: color-mix(in srgb, var(--s-rule) 24%, var(--s-panel));
  border-color: color-mix(in srgb, var(--s-rule) 78%, transparent);
}

/* ── CARD-HEAD VISIBILITY FIX ────────────────────────────── */
/* Original styles.css sets .card-head { display:none } as a legacy alias.
   We want card headers visible in new layout. */
.stage-body-new .card-head { display: flex !important; }

/* Rewrite card-header padding to fit tighter stage layout */
.stage-body-new .card-header {
  padding: 12px 16px 11px;
}
.stage-body-new .card-body,
.stage-body-new .card-body-inner {
  padding: 14px 16px;
}

/* ── SCROLLBARS ──────────────────────────────────────────── */
.stage-nav-new::-webkit-scrollbar,
.stage-body-new::-webkit-scrollbar,
.results-sidebar-new::-webkit-scrollbar { width: 5px; }
.stage-nav-new::-webkit-scrollbar-track,
.stage-body-new::-webkit-scrollbar-track,
.results-sidebar-new::-webkit-scrollbar-track { background: transparent; }
.stage-nav-new::-webkit-scrollbar-thumb,
.stage-body-new::-webkit-scrollbar-thumb,
.results-sidebar-new::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--s-rule) 80%, transparent);
  border-radius: 3px;
}

/* ── RESPONSIVE ─────────────────────────────────────────── */
/* Never hide the right sidebar. On narrow viewports it remains visible. */
@media (max-width: 780px) {
  .topbar-right { max-width: 46vw; }
  .stage-nav-new { width: 48px; }
  .nav-label-new, .nav-group-label-new, .nav-sep-new + .nav-group-label-new { display: none; }
  .results-sidebar-new { width: min(48vw, 280px); }
}

@media (max-width: 1080px) {
  .checks-grid {
    grid-template-columns: 1fr;
  }
}
