/* V1.9 Stacking Styles */
:root{
  /* Surfaces */
  --bg:#0b0f14;
  --panel:#111822;
  --panel2:#0f1620;
  --surface-tint:rgba(255,255,255,.02);

  /* Text */
  --text:#e6edf3;
  --text-strong:#ffffff;
  --muted:#9fb0c0;
  --muted2:#7f94a7;

  /* Lines + accents */
  --line:#223041;
  --accent:#5bd6ff;
  --accent-soft:rgba(91,214,255,.12);

  /* SPACESENSE brand tokens */
  --spacesense-yellow:#F2C12E;
  --spacesense-yellow-soft:rgba(242,193,46,.14);
  --spacesense-navy:#3F5A6C;
  --spacesense-navy-soft:rgba(63,90,108,.18);

  /* Status */
  --warn:#ffcc66;
  --bad:#ff6b6b;
  --good:#6bff95;
  --cmf:#ffd060;

  /* Shadow */
  --shadow: 0 10px 25px rgba(0,0,0,.35);

  /* Typography scale — 4 sizes that cover everything in this app. Stray
     font-sizes elsewhere in this file are legacy and being migrated as
     adjacent rules are touched; new rules MUST use these tokens. */
  --fs-caption:10px;   /* uppercase pill labels, sub-text under values */
  --fs-body:12px;      /* default; tables, ledger rows */
  --fs-body-l:13px;    /* slightly larger body for readability */
  --fs-subhead:14px;   /* tab labels, panel headers */
  --fs-heading:18px;   /* main panel titles */
  --fs-display:24px;   /* hero-level only (empty-state, banners) */

  /* Font weights */
  --fw-normal:400;
  --fw-medium:500;
  --fw-semibold:600;
  --fw-bold:700;

  /* Line heights — keep numbers tight, prose looser. */
  --lh-tight:1.15;
  --lh-snug:1.35;
  --lh-normal:1.5;

  /* Spacing — 4-px grid; use these for any new gap/padding/margin. */
  --space-1:4px;
  --space-2:8px;
  --space-3:12px;
  --space-4:16px;
  --space-5:20px;
  --space-6:24px;
}

*{box-sizing:border-box}
html, body{height:100%}
body{
  margin:0;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  /* tnum + ss01 + cv11 = tabular numbers + stylistic alternates that
     make digits align cleanly in tables and KPI dials. lnum keeps the
     non-old-style figures. Falls back gracefully if font lacks features. */
  font-feature-settings: 'tnum' on, 'lnum' on, 'cv11' on;
  font-size: var(--fs-body-l);
  line-height: var(--lh-snug);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  background:linear-gradient(180deg, #070a0f, #0b0f14);
  color:var(--text);
  display:flex;
  flex-direction:column;
  overflow:hidden;
}

/* Tables and number-heavy data also benefit from explicit tabular numbers
   on top of the body inheritance — guards against rules that re-set the
   font-family / features on td elements or table-specific containers. */
table, td, th, .kpi-value, .kpi-sub, .state-pill-value{
  font-variant-numeric: tabular-nums;
}

/* Form elements don't inherit body font in some browsers — re-assert. */
button, input, select, textarea{
  font-family: inherit;
  font-size: inherit;
}

/* Heading clamp — anything explicitly styled as h1/h2/h3 or .panel-title
   gets a consistent line-height. Prevents tall headings from pushing the
   layout around. */
h1, h2, h3, .panel-title, .scorecard-header h3{
  line-height: var(--lh-tight);
}

.topbar{
  /* Commit 36: z-index raised from 10 → 70 so it sits above the Reports
     overlay (z:60). Without this, the topbar carries its own stacking
     context (sticky+z-index), and inner .dropdown-menu items (z:200
     local to that context) get trapped beneath the overlay — clicking
     Project / Plan / View / Run while a report is open opens the menu
     invisibly underneath. 70 keeps it below the global modals (z:9000+)
     so dialogs still cover the topbar correctly. */
  position:sticky; top:0; z-index:70;
  display:flex; gap:12px; align-items:center; justify-content:space-between;
  /* Slim padding — PR 3 of layout system. Dropped from 12px→6px vertical
     to claw back ~12px of chrome height; combined with the brand-subtitle
     removal and the deleted note line below, this is ~70px gained back. */
  padding:6px 14px;
  background:rgba(11,15,20,.92);
  border-bottom:1px solid var(--line);
  backdrop-filter: blur(10px);
}

.note{
  padding:8px 12px;
  border-bottom:1px solid rgba(34,48,65,.6);
  color:var(--muted);
  font-size:12px;
}

.brand{
  font-weight:750;
  letter-spacing:.2px;
  font-size:20px;
  color:#ffffff;
  border-bottom:3px solid var(--spacesense-yellow);
  padding-bottom:4px;
}
.subtitle{color:var(--muted); font-size:12px; margin-top:2px}
.topbar-right{display:flex; gap:10px; align-items:center; flex-wrap:wrap; justify-content:flex-end}

.file-btn{display:inline-flex; align-items:center; cursor:pointer}
.file-btn input{display:none}
.file-btn span{
  padding:9px 12px; border:1px solid var(--line); border-radius:10px;
  background:linear-gradient(180deg, #141d28, #0f1620);
  box-shadow: var(--shadow);
}

.btn{
  padding:9px 12px;
  border:1px solid var(--line);
  border-radius:10px;
  background:linear-gradient(180deg, #141d28, #0f1620);
  color:var(--text-strong);
  cursor:pointer;
}
.btn-small{padding:6px 10px; border-radius:10px}
.btn:disabled, .seg:disabled{opacity:.45; cursor:not-allowed}
.btn:hover:not(:disabled), .seg:hover:not(:disabled){border-color:#2f4460}

.segmented{
  display:inline-flex;
  border:1px solid var(--line);
  border-radius:10px;
  overflow:hidden;
  box-shadow: var(--shadow);
}
.seg{
  padding:9px 10px;
  background:#0f1620;
  border:none;
  color:var(--muted);
  cursor:pointer;
}
.seg.active{background:#162233; color:var(--text-strong)}

.actions{display:flex; gap:10px; align-items:center; flex-wrap:wrap; justify-content:flex-end; flex:1 1 auto}
.btn-group{display:inline-flex; gap:8px; align-items:center}
.filebtn{display:inline-flex; align-items:center; cursor:pointer}
.filebtn input{display:none}
.tool-pack{
  display:flex;
  align-items:center;
  gap:6px;
  padding:4px 10px;
  border-right:1px solid rgba(34,48,65,.55);
}
.tool-pack:last-child{
  border-right:none;
  padding-right:4px;
}
/* Pack labels removed in Cat 2.5 IA pass — bordered packs + button labels
   are enough; the uppercase pack labels were visual noise. Rule kept for
   any stale markup, hidden by default. */
.tool-pack-title{display:none;}

.layout{
  display:grid;
  /* Layout: left navigator + center map. Reports are surfaced as a
     full-area overlay (#reportsOverlay) opened from the Reports menu —
     no longer occupies a grid row. */
  --left-w:   360px;
  grid-template-columns: var(--left-w) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap:12px;
  padding:12px;
  flex:1 1 auto;
  min-height:0;
}
.panel.left{grid-column:1; grid-row:1;}
.panel.center{grid-column:2; grid-row:1;}
.panel.ledger{grid-column:1 / span 2; grid-row:2;}
/* Collapsed = just the panel-title bar visible (44px). User can re-expand
   by clicking the toggle in the ledger header. */
.layout.ledger-collapsed{--ledger-h: 44px;}
.layout.ledger-collapsed #reportsOverlay .ledger-tabs,
.layout.ledger-collapsed #reportsOverlay .ledger-content,
.layout.ledger-collapsed #reportsOverlay .ledger-tools,
.layout.ledger-collapsed #reportsOverlay .ledger-stats,
.layout.ledger-collapsed #reportsOverlay .ledger-resize-handle{display:none;}
.layout.ledger-collapsed #reportsOverlay .panel-title{border-bottom:none;}
/* Fullscreen ledger — pops the panel out of the grid into a position:fixed
   overlay so a single ledger tab can take the entire viewport. Toggled by
   the ⤢ button in the ledger header. */
.layout.ledger-fullscreen #reportsOverlay{
  position:fixed; inset:0; z-index:9000;
  border-radius:0;
}
.layout.ledger-fullscreen .panel.left,
.layout.ledger-fullscreen .panel.center{visibility:hidden;}
/* No resize handle in fullscreen — height becomes a meaningless concept. */
.layout.ledger-fullscreen .ledger-resize-handle{display:none;}
.panel{
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  border:1px solid var(--line);
  border-radius:14px;
  box-shadow: var(--shadow);
  overflow:hidden;
  min-height:0;
  display:flex;
  flex-direction:column;
}

/* Allow inner sections to scroll within fixed-height panels */
.panel > .map,
.panel > .list,
.panel > .table-wrap{
  flex:1 1 auto;
  min-height:0;
}

.panel.left{grid-column:1; grid-row:1; position:relative;}
.panel.center{grid-column:2; grid-row:1}

.panel-title{
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 12px;
  border-bottom:1px solid var(--line);
  background:rgba(255,255,255,.02);
  font-weight:700;
  color:var(--text-strong);
}
.panel-title .small{font-weight:500; font-size:12px; color:var(--muted)}
.panel-actions{display:flex; align-items:center; gap:10px}

.search{
  width:180px;
  padding:7px 10px;
  border-radius:10px;
  border:1px solid var(--line);
  background:#0f1620;
  color:var(--text-strong);
}

.dropzone-note{
  padding:8px 12px;
  border-bottom:1px dashed rgba(34,48,65,.9);
  color:var(--muted);
  font-size:12px;
  background:rgba(0,0,0,.12);
}

.dealloc-hint{
  display:none;
  padding:8px 12px;
  border-top:1px dashed rgba(34,48,65,.9);
  color:var(--muted);
  font-size:12px;
  background:rgba(0,0,0,.10);
}
body.show-dealloc-hint .dealloc-hint{display:block;}


.list{padding:10px; overflow:auto;}

.card{
  border:1px solid var(--line);
  border-radius:12px;
  background:rgba(255,255,255,.02);
  padding:10px;
  margin-bottom: 8px;
}

.cluster{cursor:grab; user-select:none;}
.cluster:active{cursor:grabbing}
.cluster.dragging{opacity:.55}
.cluster.done{cursor:default; opacity:.92}

.row{display:flex; justify-content:space-between; gap:10px; align-items:center;}
.name{font-weight:750; color:var(--text-strong)}
.meta{color:var(--muted); font-size:12px}
.meta2{color:var(--muted2); font-size:11px}

.pill{
  font-size:12px;
  color:var(--text-strong);
  padding:4px 8px;
  border-radius:999px;
  border:1px solid var(--line);
  background:rgba(0,0,0,.18);
  white-space:nowrap;
}
.pill.good{border-color:rgba(107,255,149,.4); color:var(--good)}
.pill.warn{border-color:rgba(255,204,102,.4); color:var(--warn)}
.pill.bad{border-color:rgba(255,107,107,.4); color:var(--bad)}

.bar{
  margin-top:8px;
  height:10px;
  border-radius:999px;
  border:1px solid var(--line);
  background:rgba(0,0,0,.22);
  overflow:hidden;
}
.bar.dual{height:12px}
.fill{height:100%; width:0%;}
.fill.allocated{background:linear-gradient(90deg, rgba(107,255,149,.35), rgba(107,255,149,.9));}
.fill.remaining{background:linear-gradient(90deg, rgba(91,214,255,.22), rgba(91,214,255,.55));}

.cluster-actions{
  display:flex; gap:8px; align-items:center;
  margin-top:8px;
}
.chev{
  width:28px; height:28px;
  border:1px solid var(--line);
  border-radius:10px;
  background:rgba(0,0,0,.12);
  color:var(--muted);
  cursor:pointer;
}
.chev:hover{border-color:#2f4460; color:var(--text-strong)}
.deptlist{
  margin-top:8px;
  padding-top:8px;
  border-top:1px dashed rgba(34,48,65,.75);
  display:none;
}
.deptlist.open{display:block}
.deptrow{
  display:flex; justify-content:space-between; gap:8px;
  padding:4px 0;
  border-bottom:1px solid rgba(34,48,65,.35);
}
.deptrow:last-child{border-bottom:none}
.deptname{color:var(--text-strong); font-size:12px}
.deptmeta{color:var(--muted2); font-size:11px}
.deptarea{color:var(--text-strong); font-size:12px}

/* Map */
.map-shell{display:flex; gap:10px; padding:8px 10px; min-height:0; flex:1 1 auto;}
.map{padding:0; overflow:auto; flex:1 1 auto; min-width:0;}
.map.empty{display:flex; align-items:center; justify-content:center}

.map-legend{
  /* Width is a CSS custom property so the legend drag handle (PR 2) and
     the layout presets (PR 3) can resize it. Falls back to 240px. */
  width: var(--legend-w, 240px);
  flex: 0 0 var(--legend-w, 240px);
  position:relative;
  border:1px solid var(--line);
  border-radius:12px;
  background:rgba(0,0,0,.14);
  padding:8px;
  overflow:auto;
  transition: padding .18s ease;
}
.map-legend.empty{display:block}
.map-legend-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  font-weight:700;
  color:var(--text-strong);
  margin-bottom:8px;
  font-size:12px;
}
.map-legend-body{display:block}
.map-legend.collapsed{
  width:42px;
  flex-basis:42px;
  padding:8px 4px;
  overflow:hidden;
}
.map-legend.collapsed .map-legend-head{margin-bottom:0;}
.map-legend.collapsed #mapLegendTitle,
.map-legend.collapsed .map-legend-body{display:none;}
.legend-list{display:flex; flex-direction:column; gap:6px;}
.legend-item{
  border:1px solid rgba(34,48,65,.9);
  border-radius:8px;
  padding:6px 8px;
  display:flex;
  align-items:flex-start;
  gap:8px;
  cursor:pointer;
  background:rgba(255,255,255,.02);
  width:100%;
  text-align:left;
  color:inherit;
  font:inherit;
}
.legend-item:hover{border-color:#2f4460; background:rgba(255,255,255,.04)}
.legend-item.active{outline:2px solid rgba(91,214,255,.38); outline-offset:0;}
.legend-item .legend-name{font-size:12px; color:var(--text-strong); line-height:1.25}
.legend-item .legend-metrics{font-size:11px; color:var(--muted)}
.legend-item .swatch{width:16px; height:16px; border-radius:4px;}

@media (max-width: 1400px){
  .map-legend{width:210px; flex-basis:210px;}
}

@media print {
  @page {
    size: A3 landscape;
    margin: 8mm;
  }

  html, body {
    height: auto !important;
    overflow: visible !important;
    background: #fff !important;
  }

  .topbar,
  .note,
  #leftPanel,
  #reportsOverlay,
  #mapLegend,
  .panel.center .panel-title,
  .toast,
  .tooltip,
  .modal-backdrop {
    display: none !important;
  }

  .layout {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    gap: 0 !important;
  }

  .panel.center,
  .map-shell,
  #map {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #fff !important;
    overflow: visible !important;
  }

  .map-grid {
    gap: 1px;
  }
}

.map-grid{
  display:grid;
  gap:2px;
  align-items:stretch;
}

.header-cell{
  position:sticky; top:0;
  z-index:2;
  padding:8px 10px;
  border:1px solid var(--line);
  border-radius:0px;
    background:rgba(0,0,0,.18);
  text-align:center;
  font-weight:750;
  color:var(--text-strong);
}
.corner{z-index:3; background:rgba(0,0,0,.28);}

.floor-label{
  position:sticky; left:0;
  z-index:1;
  padding:5px 8px;
  border:1px solid var(--line);
  border-radius:0px;
  background:rgba(0,0,0,.14);
  color:var(--muted2);
  font-weight:650;
  font-size:11px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
}
.floor-label .toggle{
  width:24px; height:24px;
  border:1px solid rgba(34,48,65,.9);
  border-radius:9px;
  background:rgba(0,0,0,.12);
  color:var(--muted2);
  cursor:pointer;
}
.floor-label .toggle:hover{color:var(--text-strong); border-color:#2f4460}

.cell{
  border:1px solid var(--line);
  border-radius:0px;
  background:rgba(255,255,255,.02);
  padding:6px 6px 6px 6px;
  min-height:96px;
  display:flex;
  flex-direction:column;
  gap:6px;
  position:relative;
  border-bottom-style:dashed;
  border-bottom-color:rgba(34,48,65,.8);
}

.cell.emptycell{
  background:rgba(0,0,0,.10);
  border-style:dashed;
  opacity:.45;
}

.cell.drop-ok{border-color:rgba(91,214,255,.7)}
.cell.drop-bad{border-color:rgba(255,107,107,.7)}

.cell-top{display:flex; align-items:flex-start; justify-content:flex-end; gap:8px;} 
.cell-metric{font-size:12px}

.chips{display:flex; flex-wrap:wrap; gap:6px;}


/* Compact floor rows */
.cell.compact{
  min-height:30px;
  padding:0;
  gap:0;
  border-radius:0px;
  border-color: rgba(34,48,65,.35);
}
.cell.compact .cell-top{display:none;}
.cell.compact .bar{display:none;}
.cell.compact .chips{display:none;}
.compactbar{
  position:absolute;
  inset:1px;
  height:auto;
  border-radius:0px;
  border:none;
  background:rgba(0,0,0,.18);
  overflow:hidden;
  display:flex;
  align-items:stretch;
}
.compactbar.single{}
.segment{
  height:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:0 6px;
  font-size:12px;
  font-weight:750;
  color:#0b0f14;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  border-right:1px solid rgba(255,255,255,.12);
  cursor:grab;
}
.segment:active{cursor:grabbing}

.segment:last-child{border-right:none;}
.segment .label{mix-blend-mode:luminosity; color:rgba(255,255,255,.92); text-shadow:0 1px 2px rgba(0,0,0,.5);}
.segment.small .label{display:none;}

/* Zone overlay in Group lens */
.zone-band{outline:2px solid rgba(91,214,255,.18); outline-offset:-2px;}
.zone-band-strong{outline:2px solid rgba(91,214,255,.55); outline-offset:-2px; background:rgba(91,214,255,.04);}

.trash-wrap{
  display:none;
  position:absolute;
  left:0;
  right:0;
  bottom:0;
  padding:10px;
  border-top:1px solid var(--line);
  background:rgba(17,24,34,.92);
  backdrop-filter: blur(6px);
  z-index:5;
}
body.show-dealloc-hint .trash-wrap{display:block;}
body.show-dealloc-hint .panel.left .list{padding-bottom:64px;}
.trash{
  width:max-content;
  padding:8px 12px;
  border-radius:999px;
  border:1px dashed rgba(34,48,65,.9);
  color:var(--muted);
  background:rgba(0,0,0,.10);
}
.trash.drop-ok{border-color:rgba(255,204,102,.9); color:var(--warn)}

.table-wrap{overflow:auto; height:100%}
.layout.ledger-collapsed #reportsOverlay .panel-title{border-bottom:none}

table{width:100%; border-collapse:collapse}
thead th{
  position:sticky; top:0;
  background:#0f1620;
  border-bottom:1px solid var(--line);
  text-align:left;
  padding:8px 10px;
  font-size:12px;
  color:var(--muted);
}
tbody td{
  border-bottom:1px solid rgba(34,48,65,.6);
  padding:8px 10px;
  font-size:12px;
}
tbody tr:hover{background:rgba(255,255,255,.03)}

.empty-state{padding:20px; color:var(--muted); text-align:center;}

/* Hero empty state — shown in the main map area when no project is loaded.
   Replaces the previous one-line "upload your Excel" placeholder with a
   proper landing experience: icon, title, primary + secondary CTAs that
   delegate to the existing topbar handlers, and a hint about next steps. */
.hero-empty{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  padding:60px 24px;
  min-height:50vh;
  gap:14px;
}
.hero-empty-icon{
  font-size:64px;
  line-height:1;
  color:rgba(91,214,255,.55);
  margin-bottom:6px;
}
.hero-empty-title{
  margin:0;
  font-size:24px;
  font-weight:600;
  color:var(--text-strong);
}
.hero-empty-sub{
  margin:0;
  font-size:15px;
  color:var(--muted);
  max-width:480px;
}
.hero-empty-actions{
  display:flex;
  gap:12px;
  margin-top:8px;
  flex-wrap:wrap;
  justify-content:center;
}
.hero-empty-actions .btn{
  padding:10px 20px;
  font-size:14px;
}
.hero-empty-hint{
  margin:14px 0 0;
  font-size:12px;
  color:var(--muted);
  max-width:520px;
  line-height:1.5;
}
.hint{margin-top:8px; font-size:12px; color:var(--muted)}

.toast{
  position:fixed;
  left:50%;
  bottom:18px;
  transform:translateX(-50%);
  background:rgba(15,22,32,.92);
  border:1px solid var(--line);
  border-radius:999px;
  padding:10px 14px;
  box-shadow: var(--shadow);
  color:var(--text-strong);
  opacity:0;
  pointer-events:none;
  transition: opacity .18s ease, transform .18s ease;
  display:flex;
  align-items:center;
  gap:10px;
}
.toast.show{opacity:1; transform:translateX(-50%) translateY(-2px);}
.toast-msg{line-height:1.3}
.toast-action{
  border:1px solid rgba(91,214,255,.5);
  background:rgba(91,214,255,.12);
  color:var(--text-strong);
  border-radius:8px;
  font-size:12px;
  padding:4px 8px;
  cursor:pointer;
  pointer-events:auto;
}
.toast-action:hover{background:rgba(91,214,255,.2)}

/* Persistent error banner — pinned to top, sticks until dismissed (or
   auto-clears after 8s for warn level). Used for failures the user must
   notice and act on; transient toasts handle low-priority feedback. */
.error-banner{
  position:fixed;
  top:0;
  left:0;
  right:0;
  z-index:9999;
  padding:10px 16px;
  background:#5b1818;
  border-bottom:1px solid #b13434;
  color:#ffe9e9;
  font-size:13px;
  display:flex;
  align-items:center;
  gap:10px;
  box-shadow:0 2px 8px rgba(0,0,0,.4);
}
.error-banner[hidden]{display:none;}
.error-banner.warn{
  background:#5b3e18;
  border-bottom-color:#b1853a;
  color:#ffeed1;
}
.error-banner-icon{font-size:16px; flex:0 0 auto;}
.error-banner-msg{flex:1; line-height:1.4; white-space:pre-wrap;}
.error-banner-close{
  background:transparent;
  border:1px solid rgba(255,255,255,.25);
  color:inherit;
  border-radius:6px;
  cursor:pointer;
  font-size:18px;
  line-height:1;
  padding:2px 10px;
  flex:0 0 auto;
}
.error-banner-close:hover{background:rgba(255,255,255,.08);}

/* Demo walkthrough modal — opened from the topbar ⋯ menu. Four numbered
   steps with optional "Go" buttons that deep-link into the corresponding
   ledger tab. Uses the existing .modal-backdrop / .modal-card chrome. */
.walkthrough-card{
  width:600px;
  max-width:92vw;
  max-height:88vh;
  overflow-y:auto;
  padding:24px;
}
.walkthrough-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:12px;
}
.walkthrough-head h2{
  margin:0;
  font-size:var(--fs-heading);
  font-weight:var(--fw-semibold);
  color:var(--text-strong);
}
.walkthrough-head .btn{
  padding:4px 10px;
  font-size:14px;
}
.walkthrough-intro{
  color:var(--muted);
  margin:0 0 20px;
  font-size:var(--fs-body-l);
  line-height:var(--lh-normal);
}
.walkthrough-steps{
  list-style:none;
  padding:0;
  margin:0;
  display:flex;
  flex-direction:column;
  gap:14px;
}
.walkthrough-step{
  display:flex;
  gap:14px;
  padding:14px 16px;
  background:var(--accent-soft);
  border:1px solid rgba(91,214,255,.22);
  border-radius:10px;
}
.walkthrough-num{
  flex:0 0 32px;
  height:32px;
  border-radius:50%;
  background:rgba(91,214,255,.20);
  color:var(--accent);
  font-weight:var(--fw-bold);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:14px;
}
.walkthrough-body{flex:1;}
.walkthrough-title{
  font-weight:var(--fw-semibold);
  color:var(--text-strong);
  margin-bottom:4px;
  font-size:var(--fs-subhead);
}
.walkthrough-desc{
  color:var(--text);
  font-size:var(--fs-body-l);
  line-height:var(--lh-normal);
}
.walkthrough-desc strong{color:var(--text-strong);}
.walkthrough-desc em{color:var(--muted);font-style:normal;text-transform:uppercase;letter-spacing:0.8px;font-size:11px;}
.walkthrough-go{
  margin-top:10px;
  font-size:var(--fs-body);
  padding:5px 12px;
}

/* Save Plan dialog — Cat 7.5 expansion. Adds Name + optional Description
   inputs, char counter, overwrite warning, and the auto-captured-context
   read-only block (Scenario / OR run / Chip count). */
.save-plan-label{
  display:block;
  font-size:var(--fs-body);
  font-weight:var(--fw-medium);
  color:var(--text-strong);
  margin:14px 0 6px;
}
.save-plan-label:first-child{margin-top:0;}
.required-mark{color:var(--bad); font-weight:var(--fw-bold);}
.optional-mark{color:var(--muted); font-weight:var(--fw-normal); font-size:var(--fs-caption);}
.save-plan-input,
.save-plan-textarea{
  width:100%;
  background:rgba(15,22,32,.6);
  border:1px solid var(--line);
  color:var(--text-strong);
  border-radius:8px;
  padding:8px 12px;
  font-size:var(--fs-body-l);
  font-family:inherit;
}
.save-plan-textarea{
  resize:vertical;
  min-height:60px;
  line-height:var(--lh-snug);
}
.save-plan-char-count{
  text-align:right;
  font-size:var(--fs-caption);
  color:var(--muted);
  margin-top:2px;
}
.save-plan-warn{
  margin-top:10px;
  padding:8px 12px;
  background:rgba(255,204,102,.10);
  border:1px solid rgba(255,204,102,.35);
  border-radius:8px;
  color:var(--warn);
  font-size:var(--fs-body);
  line-height:var(--lh-snug);
}
.save-plan-warn[hidden]{display:none;}
.save-plan-context{
  margin-top:16px;
  padding:12px 14px;
  background:var(--accent-soft);
  border:1px solid rgba(91,214,255,.20);
  border-radius:8px;
}
.save-plan-context-title{
  font-size:var(--fs-caption);
  font-weight:var(--fw-bold);
  text-transform:uppercase;
  letter-spacing:1px;
  color:var(--muted);
  margin-bottom:8px;
}
.save-plan-context-grid{
  display:grid;
  grid-template-columns:auto 1fr;
  gap:6px 14px;
  font-size:var(--fs-body);
}
.save-plan-context-label{
  color:var(--muted);
  text-transform:uppercase;
  font-size:var(--fs-caption);
  letter-spacing:.5px;
  padding-top:1px;
}
.save-plan-context-value{
  color:var(--text-strong);
  font-family:'SF Mono', Menlo, Consolas, monospace;
  font-size:var(--fs-body);
}

/* Load Plan dialog — Cat 7.5 expansion. Card-per-plan with name,
   description, scenario/run context, saved-ago, and Load/Delete buttons.
   Scenario filter toggle in the header. */
.plan-list-filter{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:0 0 12px;
  border-bottom:1px solid var(--line);
  margin-bottom:12px;
  font-size:var(--fs-body);
}
.plan-list-filter .btn-small{font-size:var(--fs-body); padding:4px 12px;}
.plan-list-empty{
  padding:16px 0;
  font-size:var(--fs-body-l);
  color:var(--muted);
  line-height:var(--lh-normal);
}
.plan-list-empty strong{color:var(--text-strong);}
.plan-list-cards{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.plan-card{
  display:flex;
  gap:14px;
  padding:12px 14px;
  background:rgba(255,255,255,.02);
  border:1px solid var(--line);
  border-radius:10px;
  align-items:center;
}
.plan-card:hover{border-color:rgba(91,214,255,.30); background:rgba(91,214,255,.04);}
.plan-card.plan-card-active{
  border-color:rgba(91,214,255,.55);
  background:var(--accent-soft);
}
.plan-card-body{flex:1; min-width:0;}
.plan-card-title{
  font-weight:var(--fw-semibold);
  font-size:var(--fs-subhead);
  color:var(--text-strong);
  margin-bottom:2px;
}
.plan-card-desc{
  font-size:var(--fs-body);
  color:var(--text);
  margin-bottom:4px;
  line-height:var(--lh-snug);
}
.plan-card-meta{
  font-size:var(--fs-caption);
  color:var(--muted);
  font-family:'SF Mono', Menlo, Consolas, monospace;
}
.plan-card-actions{
  display:flex;
  flex-direction:column;
  gap:6px;
  flex:0 0 auto;
}

/* Auto-restore banner — top-of-page banner at startup when a recent
   non-empty backup is detected. Distinct from the error banner via
   accent-coloured border + restore-icon glyph. */
.restore-banner{
  position:fixed;
  top:0;
  left:0;
  right:0;
  z-index:9998;
  padding:10px 16px;
  background:rgba(15,40,55,.96);
  border-bottom:1px solid var(--accent);
  color:var(--text-strong);
  display:flex;
  align-items:center;
  gap:12px;
  font-size:var(--fs-body-l);
  box-shadow:0 2px 8px rgba(0,0,0,.4);
}
.restore-banner[hidden]{display:none;}
.restore-banner-icon{font-size:18px; color:var(--accent); flex:0 0 auto;}
.restore-banner-msg{flex:1; line-height:var(--lh-snug);}
.restore-banner-action{flex:0 0 auto; padding:4px 14px;}
.restore-banner-dismiss{
  background:transparent;
  border:1px solid rgba(255,255,255,.25);
  color:inherit;
  border-radius:6px;
  cursor:pointer;
  font-size:18px;
  line-height:1;
  padding:2px 10px;
  flex:0 0 auto;
}
.restore-banner-dismiss:hover{background:rgba(255,255,255,.08);}

/* ── Ledger resize handle + header actions (PR 1 of layout system) ──
   A thin grab strip at the top of the ledger panel, used to drag-resize
   the ledger height. Hidden when the ledger is collapsed (only the
   panel-title bar shows in that mode). */
.ledger-resize-handle{
  position:absolute;
  top:0; left:0; right:0;
  height:6px;
  cursor:ns-resize;
  z-index:5;
  background:transparent;
  transition: background 0.15s ease;
}
.ledger-resize-handle:hover,
.ledger-resize-handle:focus-visible,
.ledger-resize-handle.dragging{
  background: var(--accent-soft);
}
.ledger-resize-handle.dragging{
  background: rgba(91,214,255,.30);
}
.panel.ledger{position:relative;}

/* Header actions cluster — preset buttons + fullscreen + collapse. */
.ledger-header-actions{
  display:flex;
  gap:6px;
  align-items:center;
}
.ledger-preset-group{
  display:inline-flex;
  border:1px solid var(--line);
  border-radius:6px;
  overflow:hidden;
}
.ledger-preset-btn{
  border:none !important;
  border-radius:0 !important;
  padding:4px 10px !important;
  background:transparent !important;
  font-size:14px;
  line-height:1;
  color:var(--muted);
  cursor:pointer;
}
.ledger-preset-btn + .ledger-preset-btn{border-left:1px solid var(--line) !important;}
.ledger-preset-btn:hover{
  background:var(--accent-soft) !important;
  color:var(--text-strong);
}
.ledger-preset-btn.active{
  background:rgba(91,214,255,.18) !important;
  color:var(--accent);
}

/* While dragging, suppress text selection across the whole document so a
   slow drag doesn't accidentally highlight content. */
body.is-resizing-ledger,
body.is-resizing-ledger *{
  user-select:none !important;
  cursor:ns-resize !important;
}
body.is-resizing-horizontal,
body.is-resizing-horizontal *{
  user-select:none !important;
  cursor:ew-resize !important;
}

/* ── Horizontal panel resize handles (PR 2 of layout system) ──
   Thin vertical grab strips on the inner edge of the left panel
   (Portfolio Navigator) and the right panel (Cluster Legend). Same
   visual language as the ledger drag handle. */
.panel-resize-handle{
  position:absolute;
  top:0; bottom:0;
  width:6px;
  cursor:ew-resize;
  z-index:5;
  background:transparent;
  transition: background 0.15s ease;
}
.panel-resize-handle.right-edge{right:-3px;}    /* left panel: handle hangs off its right edge */
.panel-resize-handle.left-edge {left:-3px;}     /* legend: handle hangs off its left edge */
.panel-resize-handle:hover,
.panel-resize-handle:focus-visible,
.panel-resize-handle.dragging{
  background: var(--accent-soft);
}
.panel-resize-handle.dragging{
  background: rgba(91,214,255,.30);
}
.panel{position:relative;} /* anchor for left-panel handle */
/* Resize handles disappear when their panel is collapsed — resizing a
   collapsed panel makes no sense; collapse toggle is the way back. */
.layout.nav-collapsed .panel-resize-handle.right-edge,
.map-legend.collapsed .panel-resize-handle.left-edge,
.layout.ledger-fullscreen .panel-resize-handle{display:none;}

/* ── Layout presets + Focus mode (PR 3 of layout system, refined post-feedback) ──
   Focus mode = TRUE fullscreen map. The center panel takes the full
   viewport width by collapsing both side columns to 0; the bottom row
   collapses to 0 so the map fills vertically too. Navigator / Legend /
   Ledger are display:none rather than just collapsed-to-thin so there's
   nothing eating chrome. The map's own panel-title is hidden too; the
   topbar stays visible (Load Project / Run Optimizer / View / Lens
   remain reachable) and a floating "Exit focus (F)" pill in the top-
   right of the viewport gives a discoverable exit affordance. */
.focus-mode #stateStrip,
.focus-mode #kpiBar,
.focus-mode .panel.center > .panel-title,
.focus-mode .panel.left,
.focus-mode .map-legend,
.focus-mode #reportsOverlay{display:none !important;}
.focus-mode .layout{
  grid-template-columns: 0 minmax(0, 1fr) !important;
  grid-template-rows:    minmax(0, 1fr) 0 !important;
  padding:0 !important;
  gap:0 !important;
}
.focus-mode .panel.center{
  grid-column:1 / span 2 !important;
  border-radius:0 !important;
  box-shadow:none !important;
  border-left:none;
  border-right:none;
}

/* Floating Exit Focus pill — only visible while in focus mode. Top-right
   of viewport, accent-tinted, hover/focus to confirm exit. */
.focus-exit-pill{
  position:fixed;
  top:64px;
  right:14px;
  z-index:9500;
  padding:6px 14px;
  border-radius:999px;
  background:rgba(15,22,32,.92);
  border:1px solid rgba(91,214,255,.45);
  color:var(--accent);
  font-size:var(--fs-body);
  font-weight:var(--fw-semibold);
  cursor:pointer;
  display:none;
  align-items:center;
  gap:8px;
  backdrop-filter: blur(6px);
}
.focus-mode .focus-exit-pill{display:inline-flex;}
.focus-exit-pill:hover{
  background:rgba(91,214,255,.18);
  color:var(--text-strong);
}
.focus-exit-pill-key{
  display:inline-flex;
  padding:1px 6px;
  border:1px solid rgba(91,214,255,.5);
  border-radius:4px;
  font-family:'SF Mono', Menlo, Consolas, monospace;
  font-size:var(--fs-caption);
}

/* Active-preset highlight in the topbar overflow menu. */
.layout-preset-item.active{
  background:rgba(91,214,255,.18) !important;
  color:var(--accent);
}
.dropdown-item-hint{
  margin-left:auto;
  padding:1px 6px;
  border:1px solid var(--line);
  border-radius:4px;
  font-size:var(--fs-caption);
  color:var(--muted);
  font-family:'SF Mono', Menlo, Consolas, monospace;
}
.dropdown-section-label{
  font-size:var(--fs-caption);
  font-weight:var(--fw-bold);
  text-transform:uppercase;
  letter-spacing:1px;
  color:var(--muted);
  padding:8px 12px 4px;
}

/* Map ⛶ focus toggle — same look as other small panel-title buttons.
   When focus mode is active the button title flips (handled in JS). */
#mapFocusBtn{
  padding:3px 8px;
  font-size:14px;
  line-height:1;
}
.error-banner-action{
  background:rgba(255,255,255,.12);
  border:1px solid rgba(255,255,255,.35);
  color:inherit;
  border-radius:6px;
  cursor:pointer;
  font-size:12px;
  font-weight:600;
  padding:4px 12px;
  flex:0 0 auto;
}
.error-banner-action:hover{background:rgba(255,255,255,.22);}

/* No-data placeholder rows used in ledger tables (Allocations + OR
   Allocations) when the underlying dataset is empty. Spans all columns
   with a softened dotted-border container so it doesn't look like a
   real data row. */
.ledger-empty-row td.ledger-empty{
  text-align:center;
  padding:24px 16px;
  color:var(--muted);
  font-size:13px;
  font-style:italic;
  background:rgba(255,255,255,.015);
}
.ledger-empty-row td.ledger-empty strong{
  color:var(--text-strong);
  font-style:normal;
  font-weight:600;
}

/* Dropdown menus — used by topbar Save/Load consolidation. The toggle is
   a regular .btn; the menu floats below absolutely. One menu open at a
   time (handled in JS); click-outside or Esc closes. */
.dropdown{
  position: relative;
  display: inline-block;
}
.dropdown-toggle{
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.dropdown-caret{
  font-size: 10px;
  opacity: .8;
  margin-left: 2px;
}
.dropdown-menu{
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 200;
  min-width: 220px;
  background: rgba(18,26,36,.98);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dropdown-menu[hidden]{display: none;}
.dropdown-item{
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-strong);
  text-align: left;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  text-decoration: none;
  display: block;
}
.dropdown-item:hover:not(:disabled){
  background: rgba(91,214,255,.12);
  border-color: rgba(91,214,255,.3);
}
.dropdown-item:disabled{
  color: var(--muted);
  cursor: not-allowed;
  opacity: .55;
}
.dropdown-menu-right{
  left: auto;
  right: 0;
}
.dropdown-separator{
  height: 1px;
  background: var(--line);
  margin: 6px 4px;
}
/* Submenu — click-to-open accordion inside the dropdown. Avoids the
   right-edge clipping that a side-flyout would have on dropdown-menu-right. */
.dropdown-submenu{ position: relative; }
.dropdown-submenu > .dropdown-item{
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.dropdown-submenu > .dropdown-item::after{
  content: '▸';
  margin-left: 8px;
  color: var(--muted);
  font-size: 11px;
  transition: transform 0.15s ease;
}
.dropdown-submenu.open > .dropdown-item::after{
  transform: rotate(90deg);
}
.dropdown-submenu-content{
  display: none;
  padding: 2px 0 2px 8px;
  margin: 2px 0 2px 12px;
  border-left: 1px solid var(--line);
}
.dropdown-submenu.open > .dropdown-submenu-content{
  display: block;
}

/* ── Menubar (Phase 2D PR-F) — File/Edit/View-style top bar ─────────────── */
.menubar{
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1 1 auto;
  margin-left: 16px;
}
.menubar-entry{ position: relative; }
.menubar-btn{
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-strong);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: var(--fw-medium, 500);
  border-radius: 4px;
  cursor: pointer;
}
.menubar-btn:hover{
  background: rgba(91,214,255,.08);
  border-color: rgba(91,214,255,.18);
}
.menubar-btn[aria-expanded="true"]{
  background: rgba(91,214,255,.14);
  border-color: rgba(91,214,255,.32);
}
.menubar-btn .dropdown-toggle-arrow{ display: none; } /* clean wordmark only */
.menubar-entry > .dropdown-menu{
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 220px;
  z-index: 50;
}
.primary-action{
  display: flex;
  align-items: center;
  margin-left: 8px;
}

/* ── Open Scenario modal tabs ───────────────────────────────────────────── */
.open-scenario-tabs{
  display: flex;
  gap: 4px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}
.open-scenario-tab{
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  border-bottom: none;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
  margin-bottom: -1px;
}
.open-scenario-tab:hover{ color: var(--text-strong); }
.open-scenario-tab.active{
  color: var(--text-strong);
  background: rgba(91,214,255,.08);
  border-color: var(--line);
  border-bottom-color: rgba(91,214,255,.08);
}
.open-scenario-progress{
  font-size: var(--fs-caption);
  color: var(--muted);
  margin-top: 12px;
}
.open-scenario-progress.error{ color: var(--bad); }
.btn.danger{
  background: rgba(225,80,90,.12);
  border-color: rgba(225,80,90,.45);
  color: var(--bad);
}
.btn.danger:hover:not(:disabled){
  background: rgba(225,80,90,.22);
  border-color: var(--bad);
}
/* Overflow ⋯ button — compact icon-style trigger for the topbar's
   secondary actions (Shortcuts, Workspace save/load, Reports, Print A3,
   Compact). Smaller than primary buttons so it reads as utility. */
.topbar-overflow{
  padding: 6px 12px;
  font-size: 18px;
  line-height: 1;
  font-weight: 700;
}
/* Screen-reader-only utility — used to give icon-only buttons (like the
   topbar overflow ⋯) an accessible label without visible text. */
.sr-only{
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* State indicator strip — sits between the topbar and the layout, surfacing
   the three things the user most needs to know at a glance: where the data
   came from, which scenario they're working on, and what the last optimizer
   run produced. Pills are uniformly sized; muted label + brighter value. */
.state-strip{
  display:flex;
  flex-wrap:wrap;
  gap:8px 12px;
  align-items:center;
  padding:8px 16px;
  background:rgba(15,22,32,.55);
  border-bottom:1px solid var(--line);
  font-size:12px;
}
.state-strip[hidden]{display:none;}
.state-pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:4px 10px;
  background:rgba(91,214,255,.06);
  border:1px solid rgba(91,214,255,.18);
  border-radius:999px;
}
.state-pill-label{
  text-transform:uppercase;
  letter-spacing:1px;
  font-size:10px;
  font-weight:700;
  color:var(--muted);
}
.state-pill-value{
  color:var(--text-strong);
  font-weight:500;
  font-family:'SF Mono', Menlo, Consolas, monospace;
  font-size:12px;
}

/* Run Optimizer button while a run is in flight — re-skinned as Cancel.
   Border + subtle red wash signals that clicking it now stops the run
   instead of starting a new one. Text content is set in JS:
   "Cancel · 0:32 / 2:00". */
#runOptimizerBtn.running{
  border-color: rgba(232,98,98,.65) !important;
  background: rgba(232,98,98,.10) !important;
  color: #ffd9d9 !important;
}
#runOptimizerBtn.running:hover{
  background: rgba(232,98,98,.18) !important;
}

/* Ledger pagination footer row — appears when a table has more than its
   default 200-row cap. The row spans all columns; the inline button is the
   expand/collapse affordance. */
.ledger-pagination-row td.ledger-pagination{
  text-align: center;
  padding: 10px 12px;
  background: rgba(255,255,255,.02);
  color: var(--muted);
  font-size: 12px;
  border-top: 1px dashed var(--line);
}
.ledger-page-btn{
  margin-left: 6px;
  padding: 3px 10px;
  border: 1px solid rgba(91,214,255,.4);
  background: rgba(91,214,255,.08);
  color: var(--text-strong);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.ledger-page-btn:hover{
  background: rgba(91,214,255,.18);
}


/* Cluster identity color swatch */
.swatch{
  width:10px;
  height:10px;
  border-radius:3px;
  background: hsl(var(--hue, 210) 78% 55%);
  box-shadow: 0 0 0 1px rgba(0,0,0,.25);
  flex:none;
}
.cluster .name{
  display:flex;
  align-items:center;
  gap:8px;
}
.deptname{
  display:flex;
  align-items:center;
  gap:8px;
}

/* Chips use cluster hue (matches compact segments + swatch) */
.chip{
  border-color: hsla(var(--hue, 210), 78%, 55%, .90);
  background: hsla(var(--hue, 210), 78%, 45%, .62);
}
.chip .meta2{color: rgba(255,255,255,.82);}


/* CMF parent block — single "Common Facilities" header + hue-pill body
   appended to the bottom of every floor cell that has any Cat 2 / Cat 3
   placement. Replaces the old Cat 2 amber + Cat 3 blue separate badges
   with a unified visual parent across all views. */
.cmf-block{
  display:flex; flex-direction:column; gap:3px;
  padding:5px 7px; margin-top:4px;
  border-radius:6px;
  background:rgba(255,255,255,.03);
  border:1px solid rgba(91,214,255,.14);
}
.cmf-block-head{
  display:flex; align-items:baseline; justify-content:space-between; gap:8px;
}
.cmf-block-label{
  font-size:10px; font-weight:700; letter-spacing:.4px; text-transform:uppercase;
  color: hsl(200 70% 70%);
}
.cmf-block-meta{
  font-size:10px; color:var(--muted2);
}
.cmf-block-body{
  display:flex; flex-wrap:wrap; gap:4px;
}

/* Legacy class kept for any leftover references — same shape as cmf-block. */
.cmf-badge{
  display:flex;flex-wrap:wrap;gap:4px;
  padding:3px 6px;margin-top:3px;
  border-radius:4px;
  background:rgba(255,255,255,.03);
  border:1px solid rgba(255,255,255,.08);
  font-size:10px;color:var(--muted2,#7a9ab5);
  pointer-events:none;user-select:none;
}
.cmf-pill{
  background: hsl(var(--hue) 70% 18% / 0.55);
  border: 1px solid hsl(var(--hue) 70% 45% / 0.55);
  color: hsl(var(--hue) 95% 78%);
  border-radius:3px;padding:1px 5px;
  white-space:nowrap;
  font-weight:600;
}

/* Legacy classes — kept for backwards-compat with anywhere they may still
   be used; their layout matches .cmf-badge. */
.coverage-pool-badge,
.pre-placed-badge{
  display:flex;flex-wrap:wrap;gap:4px;
  padding:3px 6px;margin-top:3px;
  border-radius:4px;
  background:rgba(255,255,255,.03);
  border:1px solid rgba(255,255,255,.08);
  font-size:10px;color:var(--muted2,#7a9ab5);
  pointer-events:none;user-select:none;
}
.coverage-pool-badge span,
.pre-placed-badge span{
  background:rgba(91,214,255,.12);
  border-radius:3px;padding:1px 4px;
  color:var(--text-strong,#d8eeff);
  white-space:nowrap;
}

.summary-chip{
  display:flex;
  align-items:flex-start;
  gap:8px;
  width:100%;
  padding:6px 8px;
  border:1px solid rgba(34,48,65,.9);
  border-radius:8px;
  cursor:grab;
}
.summary-chip:active{cursor:grabbing}
.summary-chip .summary-main{flex:1; min-width:0; display:flex; flex-direction:column; gap:2px;}
.summary-chip .summary-label{font-size:12px; font-weight:700; color:var(--text-strong); overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.summary-chip .summary-sub{font-size:11px; color:rgba(255,255,255,.82); overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.summary-chip .meta2{flex:none; font-size:11px; margin-top:1px;}
.summary-chip .x{flex:none; color:rgba(255,255,255,.92); cursor:pointer; font-weight:700;}
.summary-chip .x:hover{color:#fff}

/* Hierarchical summary chip — header + children + element-codes summary */
.summary-chip.summary-tree{
  flex-direction:column;
  align-items:stretch;
  gap:4px;
}
.summary-chip.summary-tree .summary-head{
  display:flex; align-items:center; gap:8px;
}
.summary-chip.summary-tree .summary-head .summary-label{flex:1 1 auto; min-width:0;}
.summary-chip.summary-tree .summary-body{
  display:flex; flex-direction:column; gap:2px;
  padding-left:6px;
  border-left:2px solid rgba(255,255,255,.08);
  margin-left:2px;
}
.summary-child{
  display:flex; align-items:baseline; gap:6px;
  font-size:11px;
}
.summary-child-label{
  flex:1 1 auto; min-width:0;
  color:rgba(255,255,255,.86);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.summary-child-qty{
  flex:none; color:var(--muted2); font-size:10px; min-width:28px; text-align:right;
}
.summary-child-area{
  flex:none; color:rgba(255,255,255,.92); font-size:11px; min-width:60px; text-align:right;
}
.summary-codes{
  font-size:10px; color:var(--muted2);
  padding:0 0 2px 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing:.2px;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}

/* Flat element row (Element view): label · qty · area */
.summary-chip.summary-flat .sm-qty{min-width:28px; text-align:right;}

/* Always-visible floor header (compact + expanded) */
.cell .floor-meta{
  display:flex; align-items:center; gap:8px;
  padding:4px 6px;
  font-size:11px;
}
.cell .floor-meta .fm-name{
  font-weight:700; color:var(--text-strong); letter-spacing:.3px;
}
.cell .floor-meta .fm-stats{
  flex:1 1 auto; min-width:0;
  color:var(--muted);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.cell .floor-meta .fm-stats b{color:var(--text-strong); font-weight:700;}
.cell .floor-meta .fm-pill{
  flex:none; width:8px; height:8px; padding:0; border-radius:50%;
  background:rgba(91,214,255,.55);
}
.cell .floor-meta .fm-pill.good{background:#6bff95;}
.cell .floor-meta .fm-pill.warn{background:#ffcc66;}
.cell .floor-meta .fm-pill.bad {background:#ff6b6b;}
/* In compact mode, sit the floor-meta above the bar with tight spacing */
.cell.compact{display:flex; flex-direction:column; gap:2px;}
.cell.compact .floor-meta{padding:3px 6px 1px;}

/* Compact-bar hover tooltip content */
.tooltip .tt-block{display:flex; flex-direction:column; gap:6px;}
.tooltip .tt-head{
  display:flex; align-items:baseline; justify-content:space-between; gap:10px;
  padding-bottom:4px; border-bottom:1px solid var(--line);
}
.tooltip .tt-head b{color:var(--text-strong);}
.tooltip .tt-child{
  display:flex; align-items:baseline; justify-content:space-between; gap:10px;
  font-size:11px; color:rgba(255,255,255,.82);
}
.tooltip .tt-child .tt-area{flex:none; color:var(--text-strong);}
.tooltip .tt-codes{
  font-size:10px; color:var(--muted2);
  padding-left:8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.tooltip .tt-row{font-size:12px;}


/* Tooltip */
.tooltip{
  position:fixed;
  z-index:9999;
  min-width:220px;
  max-width:360px;
  pointer-events:none;
  opacity:0;
  transform: translateY(4px);
  transition: opacity .10s ease, transform .10s ease;
  background: rgba(15,22,32,.96);
  border:1px solid rgba(34,48,65,.9);
  border-radius:12px;
  box-shadow: 0 10px 25px rgba(0,0,0,.35);
  padding:10px 12px;
}
.tooltip.show{opacity:1; transform: translateY(0);}
.tooltip .t-title{font-weight:800; color:var(--text-strong); margin-bottom:6px;}
.tooltip .t-sub{color:var(--muted); font-size:12px; margin-bottom:8px;}
.tooltip .t-row{display:flex; justify-content:space-between; gap:10px; font-size:12px; padding:3px 0; border-bottom:1px solid rgba(34,48,65,.45);}
.tooltip .t-row:last-child{border-bottom:none}
.tooltip .t-name{color:var(--text-strong); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; display:flex; align-items:center; gap:8px;}
.tooltip .t-val{color:var(--text-strong); font-weight:700; white-space:nowrap;}
.tooltip .tt-dept{display:inline-flex; align-items:center; gap:4px; margin-right:6px;}
.tooltip .tt-dept .swatch{width:8px; height:8px; border-radius:2px;}


/* Cluster pane: denser header row */
.cluster-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.cluster-head-right{
  display:flex;
  align-items:center;
  gap:8px;
}
.cluster-toggle{
  width:26px; height:26px;
  border:1px solid rgba(34,48,65,.9);
  border-radius:9px;
  background:rgba(0,0,0,.12);
  color:var(--muted);
  cursor:pointer;
}
.cluster-toggle:hover{border-color:#2f4460; color:var(--text-strong);}

.cluster-menu, .comp-menu{
  width:26px; height:26px;
  border:1px solid rgba(34,48,65,.9);
  border-radius:9px;
  background:rgba(0,0,0,.12);
  color:var(--muted);
  cursor:pointer;
}
.cluster-menu:hover, .comp-menu:hover{border-color:#2f4460; color:var(--text-strong);}

.add-comp-btn{
    margin-top:8px;
  width:100%;
  padding:8px 10px;
  border-radius:10px;
  border:1px dashed rgba(34,48,65,.9);
  background:rgba(0,0,0,.10);
  color:var(--text-strong);
  cursor:pointer;
  font-size:12px;
}
.add-comp-btn:hover{border-color:#2f4460;}


.card.selected{
  border-color: rgba(91,214,255,.55);
  box-shadow: 0 0 0 1px rgba(91,214,255,.18), var(--shadow);
}

/* Component rows inside expanded cluster cards */
.component-row{
  display:flex;
  justify-content:flex-start;
  align-items:center;
  gap:10px;
  padding:6px 0;
  border-bottom:1px solid rgba(34,48,65,.35);
  user-select:none;
}
.component-row:last-child{border-bottom:none}
.component-row .left{
  display:flex; flex-direction:column; gap:2px;
  min-width:0;
}
.component-row .cname{
  display:flex; align-items:center; gap:8px;
  color:var(--text-strong);
  font-size:12px;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.component-row .cmeta{
  color:var(--muted2);
  font-size:11px;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.component-row .cpill{
  margin-left:auto;
  font-size:12px;
  padding:3px 8px;
  border-radius:999px;
  border:1px solid rgba(34,48,65,.9);
  background:rgba(0,0,0,.16);
  white-space:nowrap;
}
.component-row .cpill.complete{
  border-color:rgba(107,255,149,.45);
  color:var(--good);
  background:rgba(107,255,149,.10);
}
.component-row.draggable{cursor:grab;}
.component-row.draggable:active{cursor:grabbing}
.component-row.selected{
  background: rgba(91,214,255,.06);
  border-radius:0px;
  padding-left:8px;
  padding-right:8px;
}

.component-wrap{padding-left:4px;}
.element-list{
  padding:6px 0 8px 28px;
  margin-top:4px;
  border-left:2px solid rgba(47,68,96,.45);
}
.element-section-title{
  font-size:10px;
  text-transform:uppercase;
  letter-spacing:.08em;
  color:var(--muted2);
  padding:0 0 6px 10px;
}
.element-row{
  display:flex;
  align-items:center;
  gap:8px;
  margin:0 0 4px;
  padding:5px 8px 5px 10px;
  border:1px solid rgba(34,48,65,.45);
  border-radius:8px;
  background:rgba(11,17,25,.45);
}
.element-row:last-child{margin-bottom:0;}
.element-row .element-marker{
  width:6px;
  height:16px;
  border-radius:999px;
  background:linear-gradient(180deg, rgba(91,214,255,.9), rgba(91,214,255,.45));
  flex:0 0 6px;
}
.element-row .ename{font-size:12px; color:var(--text); flex:1 1 auto; min-width:0;}
.element-row .emeta{font-size:11px; color:var(--muted2);}
.element-pill{
  margin-left:auto;
  font-size:11px;
  padding:2px 8px;
  border-radius:999px;
  border:1px solid rgba(46,103,142,.9);
  background:rgba(18,32,46,.55);
  color:var(--text-strong);
  white-space:nowrap;
}
.element-pill.complete{
  border-color:rgba(107,255,149,.45);
  color:var(--good);
  background:rgba(107,255,149,.10);
}
.add-elem-btn{
  margin-top:6px;
  border:1px dashed var(--line);
  background:transparent;
  color:var(--muted);
  border-radius:8px;
  padding:6px 8px;
  cursor:pointer;
  font-size:12px;
}
.add-elem-btn:hover{border-color:#2f4460;color:var(--text);}

.compchk{
  display:flex;
  align-items:center;
  justify-content:center;
  width:18px;
  flex:0 0 18px;
  margin-right:6px;
  cursor:pointer;
}
.compchk-in{display:none;}
.compchk span{
  width:14px;
  height:14px;
  border-radius:3px;
  border:1px solid rgba(34,48,65,.85);
  background:rgba(0,0,0,.14);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.10);
  transition: all 0.1s ease;
}
/* Outline only check style */
.compchk-in:checked + span{
  background: transparent;
  border: 2px solid hsl(var(--hue, 210) 78% 65%);
  box-shadow: 0 0 4px rgba(255,255,255,0.2);
}
.compchk-in:disabled + span{
  opacity:.35;
  cursor:not-allowed;
  border-color: rgba(34,48,65,.55);
}

/* Map selection dimming */
#map.selecting .cell.dim{opacity:.32; filter:saturate(.75);}
#map.selecting .cell.sel{
  outline:2px solid rgba(91,214,255,.55);
  outline-offset:-2px;
  background: rgba(91,214,255,.04);
}
.chip.dim{opacity:.35;}
.chip.sel{
  border-color: rgba(91,214,255,.75);
  box-shadow: 0 0 0 1px rgba(91,214,255,.22);
}

/* Mono tint to help blocks read by color */
.cell.mono{
  background: hsla(var(--monoHue, 210), 75%, 40%, .06);
}
.cell.compact.mono{
  background: hsla(var(--monoHue, 210), 75%, 40%, .08);
}

/* Compact continuity (strict, mono-only): soften seams on touching edges */
.compactbar.mono{
  border-color: hsla(var(--monoHue, 210), 65%, 55%, .35);
}
.compactbar.join-up{
  border-top-color: transparent;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
.compactbar.join-down{
  border-bottom-color: transparent;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.compactbar.join-left{
  border-left-color: transparent;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
.compactbar.join-right{
  border-right-color: transparent;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

/* =========================================
   V1.9 POPOVER STYLES
   ========================================= */
.popover {
  position: fixed;
  z-index: 10000;
  background: var(--panel);
  border: 1px solid var(--accent);
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
  border-radius: 8px;
  padding: 12px;
  width: 280px;
  font-family: ui-sans-serif, system-ui;
  color: var(--text);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.1s, transform 0.1s;
  pointer-events: none;
}
.popover.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.pop-header {
  font-weight: 700;
  color: var(--text-strong);
  margin-bottom: 8px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
}
.pop-stats {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 12px;
  background: rgba(0,0,0,0.2);
  padding: 6px;
  border-radius: 4px;
}
.pop-stats b { color: var(--text-strong); }
.pop-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.pop-input {
  background: #000;
  border: 1px solid var(--line);
  color: var(--text-strong);
  padding: 6px 8px;
  border-radius: 4px;
  width: 80px;
  text-align: right;
  font-weight: 700;
}
.pop-input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.pop-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}
.pop-btn {
  font-size: 11px;
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--text-strong);
}
.pop-btn:hover { background: var(--line); }
.pop-btn.primary {
  background: rgba(91, 214, 255, 0.15);
  border-color: rgba(91, 214, 255, 0.4);
  color: var(--accent);
}
.pop-btn.primary:hover { background: rgba(91, 214, 255, 0.25); }
.pop-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: transparent;
}

.flash{
  box-shadow: 0 0 0 2px rgba(255,204,102,.35), 0 10px 30px rgba(0,0,0,.35);
  animation: flashPulse 900ms ease-out;
}
@keyframes flashPulse{
  0%{transform:scale(1.01);} 100%{transform:scale(1);} 
}


.kebab{
  width:28px; height:28px;
  border-radius:10px;
  border:1px solid var(--line);
  background:rgba(0,0,0,.18);
  color:var(--text-strong);
  display:inline-flex; align-items:center; justify-content:center;
  cursor:pointer;
}
.kebab:hover{background:rgba(255,255,255,.06);}
.kebab:active{transform:translateY(1px);}

.add-inline{
  width:100%;
  margin-top:8px;
  padding:8px 10px;
  border-radius:10px;
  border:1px dashed rgba(34,48,65,.9);
  background:rgba(0,0,0,.14);
  color:var(--text-strong);
  cursor:pointer;
}
.add-inline:hover{background:rgba(255,255,255,.05);}

/* ====================
   Bottom Ledger + Reports
   ==================== */

.ledger-stats{
  padding:8px 12px;
  font-size:12px;
  color:var(--muted);
  border-bottom:1px solid rgba(34,48,65,.7);
}

.ledger-tabs{
  display:flex;
  gap:6px;
  padding:8px 10px;
  border-bottom:1px solid var(--line);
  background:rgba(0,0,0,.10);
  overflow:auto;
}

.ltab{
  padding:7px 10px;
  border-radius:10px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.02);
  color:var(--muted);
  cursor:pointer;
  white-space:nowrap;
}
.ltab:hover{border-color:#2f4460}
.ltab.active{
  background:#162233;
  color:var(--text-strong);
}

/* Grouped ledger tabs — single row with inline group labels separated by
   vertical dividers. Saves ~60 px vs the three-row layout while still
   communicating the Inputs / Outputs / Analysis grouping via the labels
   and dividers. Wraps gracefully on narrow screens. */
.ledger-tabs.ledger-tabs-grouped{
  flex-direction:row;
  flex-wrap:wrap;
  align-items:center;
  gap:4px;
  padding:6px 10px;
}
.ledger-tab-group{
  display:inline-flex;
  align-items:center;
  gap:4px;
  padding-right:10px;
  margin-right:6px;
  border-right:1px solid var(--line);
}
.ledger-tab-group:last-child{
  padding-right:0;
  margin-right:0;
  border-right:none;
}
.ledger-tab-group-label{
  font-size:9px;
  font-weight:var(--fw-bold);
  letter-spacing:1px;
  text-transform:uppercase;
  color:var(--muted);
  padding:0 6px 0 0;
  flex:0 0 auto;
}

.ledger-content{
  flex:1 1 auto;
  min-height:0;
  overflow:hidden;
}

.ledger-tab{display:none; height:100%}
.ledger-tab.active{display:block}

.util-grid{
  display:grid;
  /* PR-B: bumped 2 → 3 columns to fit Floor / Building / Zone panels.
     The existing @media (max-width: 1100px) collapse below stacks to
     single-column at narrow viewports. */
  grid-template-columns: 1fr 1fr 1fr;
  gap:12px;
  padding:10px;
  height:100%;
  min-height:0;
}

.subpanel{
  border:1px solid var(--line);
  border-radius:12px;
  overflow:hidden;
  background:rgba(255,255,255,.02);
  display:flex;
  flex-direction:column;
  min-height:0;
}

.subhead{
  padding:10px 12px;
  border-bottom:1px solid var(--line);
  font-weight:700;
  color:var(--text-strong);
}

.ledger-tools{
  padding:8px 12px;
  border-bottom:1px solid rgba(34,48,65,.65);
  background:rgba(255,255,255,.01);
}
.ledger-tools .search{width:100%; max-width:360px}

#reportsOverlay th{cursor:pointer; user-select:none; position:relative;}
#reportsOverlay table[data-sort-col] th.sorted-asc::after,
#reportsOverlay table[data-sort-col] th.sorted-desc::after{
  content:'';
  display:inline-block;
  margin-left:6px;
  border-left:4px solid transparent;
  border-right:4px solid transparent;
}
#reportsOverlay table[data-sort-col] th.sorted-asc::after{border-bottom:6px solid rgba(91,214,255,.9)}
#reportsOverlay table[data-sort-col] th.sorted-desc::after{border-top:6px solid rgba(91,214,255,.9)}

/* Smaller on narrow screens */
@media (max-width: 1100px){
  .layout{grid-template-columns: 340px minmax(0,1fr); grid-template-rows:minmax(0,1fr);}
  .util-grid{grid-template-columns: 1fr;}
}

/* ====================
   Bottom Ledger + Reports
   ==================== */

.ledger-stats{
  padding:8px 12px;
  font-size:12px;
  color:var(--muted);
  border-bottom:1px solid rgba(34,48,65,.7);
}

.ledger-tabs{
  display:flex;
  gap:6px;
  padding:8px 10px;
  border-bottom:1px solid var(--line);
  background:rgba(0,0,0,.10);
  overflow:auto;
}

.ltab{
  padding:7px 10px;
  border-radius:10px;
  border:1px solid var(--line);
  background:rgba(15,22,32,.6);
  color:var(--muted);
  cursor:pointer;
  white-space:nowrap;
}
.ltab:hover{border-color:#2f4460; color:var(--text)}
.ltab.active{
  background:rgba(22,34,51,.9);
  color:var(--text-strong);
  border-color:#2f4460;
}

.ledger-content{
  flex:1 1 auto;
  min-height:0;
  overflow:hidden;
}

.ledger-tab{display:none; height:100%;}
.ledger-tab.active{display:block;}

.util-grid{
  display:grid;
  /* PR-B: bumped 2 → 3 columns to fit Floor / Building / Zone panels.
     The existing @media (max-width: 1100px) collapse below stacks to
     single-column at narrow viewports. */
  grid-template-columns: 1fr 1fr 1fr;
  gap:12px;
  padding:10px;
  height:100%;
  min-height:0;
}

.subpanel{
  border:1px solid var(--line);
  border-radius:12px;
  overflow:hidden;
  background:rgba(255,255,255,.02);
  display:flex;
  flex-direction:column;
  min-height:0;
}
.subhead{
  padding:10px 12px;
  border-bottom:1px solid var(--line);
  font-weight:750;
  color:var(--text-strong);
}

.ltab{
  padding:7px 10px;
  border-radius:10px;
  border:1px solid var(--line);
  background:rgba(15,22,32,.6);
  color:var(--muted);
  cursor:pointer;
  white-space:nowrap;
}
.ltab:hover{border-color:#2f4460; color:var(--text)}
.ltab.active{
  background:rgba(22,34,51,.9);
  color:var(--text-strong);
  border-color:#2f4460;
}

.ledger-content{
  flex:1 1 auto;
  min-height:0;
  overflow:hidden;
}

.ledger-tab{
  display:none;
  height:100%;
}
.ledger-tab.active{display:block;}

.util-grid{
  display:grid;
  /* PR-B: bumped 2 → 3 columns to fit Floor / Building / Zone panels.
     The existing @media (max-width: 1100px) collapse below stacks to
     single-column at narrow viewports. */
  grid-template-columns: 1fr 1fr 1fr;
  gap:12px;
  padding:10px;
  height:100%;
  min-height:0;
}

.subpanel{
  border:1px solid var(--line);
  border-radius:12px;
  overflow:hidden;
  background:rgba(255,255,255,.02);
  display:flex;
  flex-direction:column;
  min-height:0;
}

.subhead{
  padding:10px 12px;
  border-bottom:1px solid var(--line);
  font-weight:700;
  color:var(--text-strong);
}

/* Make tables inside ledger tabs scroll nicely */
#reportsOverlay .table-wrap{
  padding:10px;
  overflow:auto;
  height:100%;
  min-height:0;
}

.ledger-tab{
  display:none;
  height:100%;
}
.ledger-tab.active{display:block;}

.util-grid{
  display:grid;
  /* PR-B: bumped 2 → 3 columns to fit Floor / Building / Zone panels.
     The existing @media (max-width: 1100px) collapse below stacks to
     single-column at narrow viewports. */
  grid-template-columns: 1fr 1fr 1fr;
  gap:12px;
  padding:10px;
  height:100%;
  min-height:0;
}

.subpanel{
  border:1px solid var(--line);
  border-radius:12px;
  overflow:hidden;
  background:rgba(255,255,255,.02);
  display:flex;
  flex-direction:column;
  min-height:0;
}

.subhead{
  padding:10px 12px;
  border-bottom:1px solid var(--line);
  font-weight:750;
  color:var(--text-strong);
}

#reportsOverlay .table-wrap{
  padding:10px;
}

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

/* Element plan split modal */
.modal-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 120;
}
.modal-backdrop.active{ display:flex; }
.modal-card{
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  border:1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-height: 86vh;
  overflow: hidden;
}

.shortcut-help-card{max-width:560px; width:min(94vw,560px)}
.shortcut-help-list{padding:12px; display:grid; gap:8px}
.shortcut-help-list > div{
  display:grid;
  grid-template-columns: 130px 1fr;
  gap:10px;
  align-items:center;
  padding:8px 10px;
  border:1px solid rgba(49,70,95,.55);
  border-radius:10px;
  background:rgba(9,14,20,.5);
  font-size:13px;
}
kbd{
  display:inline-block;
  min-width: fit-content;
  padding:4px 8px;
  border:1px solid rgba(96,126,160,.65);
  border-bottom-width:2px;
  border-radius:8px;
  background:linear-gradient(180deg, rgba(28,41,56,.95), rgba(17,26,35,.95));
  color:var(--text-strong);
  font-size:12px;
}

.confirm-card{max-width:460px; width:min(92vw,460px)}
.confirm-message{
  padding:14px 12px 8px;
  color:var(--text);
  font-size:13px;
  line-height:1.45;
}

/* ====================
   UX refresh (professional shell, non-functional)
   ==================== */
:root{
  --radius-sm:8px;
  --radius-md:12px;
  --radius-lg:16px;
}

body{
  background:
    radial-gradient(1200px 500px at 15% -20%, rgba(91,214,255,.12), transparent 65%),
    radial-gradient(1200px 500px at 100% -20%, rgba(107,255,149,.08), transparent 65%),
    linear-gradient(180deg, #06090f, #0b0f14 40%, #0c121a);
}

.topbar{
  gap:16px;
  padding:12px 16px;
  border-bottom:1px solid rgba(61,84,109,.45);
  background:rgba(7,12,18,.88);
}

.brand-wrap{display:flex; flex-direction:column; gap:2px; min-width:max-content;}
.brand{
  border-bottom:none;
  padding-bottom:0;
  font-size:17px;
}
.brand-sub{font-size:11px; color:var(--muted2); letter-spacing:.15px;}
.scenario-badge{
  display:inline-block;
  margin-top:4px;
  padding:2px 8px;
  border-radius:10px;
  font-size:11px;
  font-weight:600;
  color:#5bd6ff;
  background:rgba(91,214,255,.1);
  border:1px solid rgba(91,214,255,.3);
  letter-spacing:.3px;
  max-width:280px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.actions{gap:12px; justify-content:flex-end; align-items:flex-end;}
.action-section{
  display:flex;
  align-items:center;
  gap:8px;
  padding:8px;
  border:1px solid rgba(34,48,65,.75);
  border-radius:var(--radius-md);
  background:rgba(14,21,30,.7);
  flex-wrap:wrap;
}
.action-label{
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.08em;
  color:var(--muted2);
  padding:0 2px;
}

.btn{
  border-radius:var(--radius-sm);
  transition:all .14s ease;
}
.btn:hover:not(:disabled), .seg:hover:not(:disabled){
  transform:translateY(-1px);
  box-shadow:0 6px 16px rgba(0,0,0,.25);
}
.btn.active{
  border-color:rgba(91,214,255,.6);
  background:linear-gradient(180deg, rgba(22,38,56,.95), rgba(15,24,35,.95));
  color:var(--text-strong);
  box-shadow:0 0 0 1px rgba(91,214,255,.2) inset;
}

.note{
  padding:10px 14px;
  background:rgba(10,16,24,.75);
  border-bottom:1px solid rgba(34,48,65,.75);
}

.layout{gap:14px; padding:14px;}
.panel{
  border-radius:var(--radius-lg);
  border-color:rgba(39,57,76,.85);
}
.panel-title{
  padding:11px 12px;
  background:linear-gradient(180deg, rgba(255,255,255,.045), rgba(255,255,255,.015));
}

.nav-filters{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  padding:10px 10px 0;
}
.nav-chip{
  border:1px solid rgba(34,48,65,.95);
  border-radius:999px;
  background:rgba(0,0,0,.16);
  color:var(--muted);
  font-size:11px;
  padding:5px 10px;
}
.nav-chip.active{border-color:rgba(91,214,255,.4); color:var(--accent);}

/* Universal focus ring — every interactive element gets the same accent
   outline so keyboard users have predictable feedback regardless of which
   widget they're on. :focus-visible (not :focus) avoids the ugly default
   outline when clicking with a mouse. */
:focus-visible{
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}
/* Reset the legacy targeted rule — kept here for parity if anything in this
   file overrides the universal one with a more-specific selector. */
.search:focus-visible,
.btn:focus-visible,
.nav-chip:focus-visible,
.ltab:focus-visible,
.dropdown-item:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible{
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Smooth state transitions — applied to every common interactive element
   so hover / active / disabled changes ease in rather than jump. 150 ms
   matches the perceptual sweet spot between "snappy" and "noticed". */
.btn,
.ltab,
.nav-chip,
.dropdown-item,
.dropdown-toggle,
.kpi-dial,
.state-pill,
.error-banner-action,
.error-banner-close,
.ledger-page-btn,
.tl-preset,
a{
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    opacity 0.15s ease,
    box-shadow 0.15s ease;
}

/* ── Project Fact Sheet (Phase 2A PR 4) ─────────────────────────────────── */
.fact-sections{
  display:flex;
  flex-direction:column;
  gap:18px;
  padding:12px;
  overflow-y:auto;
  height:100%;
}
.fact-section{
  background:rgba(255,255,255,.02);
  border:1px solid var(--line);
  border-radius:8px;
  padding:12px 14px;
}
.fact-section-title{
  margin:0 0 10px;
  font-size:var(--fs-subhead);
  font-weight:var(--fw-semibold);
  color:var(--text-strong);
}
.fact-count{
  font-weight:var(--fw-normal);
  font-size:var(--fs-body);
  color:var(--muted);
  margin-left:4px;
}
.fact-kv-grid{
  display:grid;
  grid-template-columns:120px 1fr;
  gap:4px 14px;
  font-size:var(--fs-body);
}
.fact-kv-label{
  font-size:var(--fs-caption);
  text-transform:uppercase;
  letter-spacing:.5px;
  color:var(--muted);
  padding-top:2px;
}
.fact-kv-value{
  color:var(--text-strong);
  font-family:'SF Mono', Menlo, Consolas, monospace;
  font-size:var(--fs-body);
}
.fact-chip-row{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
}
.fact-chip{
  display:inline-flex;
  align-items:center;
  padding:3px 10px;
  border:1px solid var(--line);
  border-radius:999px;
  background:rgba(91,214,255,.06);
  color:var(--text);
  font-family:'SF Mono', Menlo, Consolas, monospace;
  font-size:var(--fs-body);
}
.fact-org-div{
  margin:4px 0;
  padding:4px 0;
  border-top:1px solid rgba(34,48,65,.4);
}
.fact-org-div:first-of-type{border-top:none; padding-top:0;}
.fact-org-div > summary{
  cursor:pointer;
  font-weight:var(--fw-semibold);
  color:var(--text-strong);
  padding:4px 0;
}
.fact-org-list{
  list-style:none;
  margin:6px 0 6px 18px;
  padding-left:14px;
  border-left:1px dashed var(--line);
}
.fact-org-list li{
  padding:3px 0;
  font-size:var(--fs-body);
}
.fact-paste-block{
  margin-top:14px;
  border-top:1px dashed var(--line);
  padding-top:12px;
}
.fact-paste-block > summary{
  cursor:pointer;
  font-weight:var(--fw-semibold);
  color:var(--accent);
  padding:4px 0;
}
.fact-paste-help{
  font-size:var(--fs-body);
  line-height:var(--lh-snug);
  margin:8px 0;
}
.fact-paste-textarea{
  width:100%;
  font-family:'SF Mono', Menlo, Consolas, monospace;
  font-size:var(--fs-body);
  background:rgba(15,22,32,.6);
  border:1px solid var(--line);
  color:var(--text-strong);
  border-radius:6px;
  padding:8px 10px;
  resize:vertical;
  min-height:80px;
}
.fact-paste-actions{
  display:flex;
  justify-content:flex-end;
  gap:8px;
  margin-top:8px;
}
.fact-paste-feedback{
  font-size:var(--fs-body);
  white-space:pre-wrap;
  margin-top:8px;
  color:var(--muted);
}
.fact-paste-feedback.error{
  color:var(--bad);
}

/* ── Editable reference-data tables (Phase 2B PR 1) ──────────────────────── */
.editable-table-wrap{
  max-height:320px;
  overflow:auto;
}
.editable-table{
  width:100%;
  border-collapse:collapse;
  font-size:var(--fs-body);
}
.editable-table thead th{
  text-align:left;
  font-weight:var(--fw-semibold);
  color:var(--muted);
  border-bottom:1px solid var(--line);
  padding:6px 8px;
  font-size:var(--fs-caption);
  text-transform:uppercase;
  letter-spacing:.4px;
  background:rgba(15,22,32,.6);
  position:sticky;
  top:0;
  z-index:1;
}
.editable-table tbody td{
  padding:2px 4px;
  border-bottom:1px solid rgba(34,48,65,.4);
}
.editable-table input[type="text"],
.editable-table input[type="number"],
.editable-table select{
  width:100%;
  background:transparent;
  border:1px solid transparent;
  color:var(--text-strong);
  font:inherit;
  font-family:'SF Mono', Menlo, Consolas, monospace;
  padding:4px 6px;
  border-radius:4px;
}
.editable-table select{
  appearance:menulist;
}
.editable-table select option{
  background:rgba(15,22,32,1);
  color:var(--text-strong);
}
.editable-table input[type="text"]:hover,
.editable-table input[type="number"]:hover,
.editable-table select:hover{
  border-color:rgba(91,214,255,.18);
}
.editable-table input[type="text"]:focus,
.editable-table input[type="number"]:focus,
.editable-table select:focus{
  border-color:var(--accent);
  outline:none;
  background:rgba(15,22,32,.7);
}
.editable-table input[readonly]{
  color:var(--muted);
  cursor:not-allowed;
}
.editable-table input[readonly]:hover,
.editable-table input[readonly]:focus{
  border-color:transparent;
  background:transparent;
}
.editable-table .edit-actions-col{
  width:32px;
  text-align:center;
}
.edit-row-delete{
  width:24px;
  height:24px;
  border:1px solid transparent;
  background:transparent;
  color:var(--muted);
  border-radius:4px;
  cursor:pointer;
  font-size:16px;
  line-height:1;
  padding:0;
}
.edit-row-delete:hover{
  background:rgba(225,80,90,.12);
  border-color:rgba(225,80,90,.4);
  color:var(--bad);
}
.editable-table-actions{
  display:flex;
  align-items:center;
  gap:10px;
  margin-top:8px;
}
.editable-table-feedback{
  font-size:var(--fs-caption);
  color:var(--muted);
}
.editable-table-feedback.error{
  color:var(--bad);
}
.fact-subhead{
  margin:14px 0 6px;
  font-size:var(--fs-caption);
  text-transform:uppercase;
  letter-spacing:.5px;
  color:var(--muted);
  font-weight:var(--fw-semibold);
}
.fact-subhead:first-child{
  margin-top:0;
}
.dup-clone-option{
  display:flex;
  align-items:center;
  gap:8px;
  margin-top:12px;
  font-size:var(--fs-body);
  color:var(--text);
  cursor:pointer;
}
.dup-clone-option input{
  margin:0;
}

/* Honour user's reduced-motion preference — disable transitions for users
   with vestibular sensitivity or system-level reduce-motion enabled. */
@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}

.map{
  background:linear-gradient(180deg, rgba(255,255,255,.01), rgba(255,255,255,0));
}

@media (max-width: 1400px){
  .topbar{align-items:flex-start;}
  .actions{justify-content:flex-start;}
  .action-section{width:100%;}
}

/* Menu-first UX controls */
.priority-tools{width:100%;}
.collapsible-panel,
.reports-menu{
  display:none;
  width:100%;
}
.collapsible-panel.open,
.reports-menu.open{display:flex;}

#toggleOpsBtn.active,
#toggleReportsBtn.active{border-color:rgba(91,214,255,.65);}

.report-link{font-size:12px;}

.layout.nav-collapsed{--left-w: 62px;}
.layout.nav-collapsed #leftPanel .panel-title{padding:10px 8px;}
.layout.nav-collapsed #leftPanel .panel-title-left{display:none;}
.layout.nav-collapsed #leftPanel .panel-title-right > :not(#toggleLeftPanelBtn){display:none;}
.layout.nav-collapsed #leftPanel .nav-filters,
.layout.nav-collapsed #leftPanel #clusters,
.layout.nav-collapsed #leftPanel .trash-wrap{display:none;}
.layout.nav-collapsed #leftPanel{overflow:visible;}
.layout.nav-collapsed #toggleLeftPanelBtn{
  width:42px;
  height:32px;
  padding:0;
}

@media (max-width: 1200px){
  .layout{grid-template-columns: minmax(0, 1fr); grid-template-rows:minmax(0,1fr) minmax(0,1fr);}
  .panel.left{grid-column:1; grid-row:1;}
  .panel.center{grid-column:1; grid-row:2;}
  .layout.nav-collapsed{grid-template-columns:minmax(0,1fr);}
  .layout.nav-collapsed .panel.left{display:none;}
}

/* Final ledger/tab visibility hardening */
#reportsOverlay .ledger-stats,
#reportsOverlay .ledger-tabs{
  flex:0 0 auto;
  overflow-x:auto;
  overflow-y:hidden;
  scrollbar-width:thin;
  flex-wrap:nowrap;
  position:relative;
  z-index:4;
  isolation:isolate;
}
#reportsOverlay .ledger-tools{
  flex:0 0 auto;
  position:relative;
  z-index:4;
  isolation:isolate;
}
#reportsOverlay .ledger-content{
  flex:1 1 0;
  min-height:0;
  overflow:hidden;
  position:relative;
  z-index:1;
}
#reportsOverlay .ledger-tab{
  min-height:0;
  height:100%;
  overflow-y:auto;
}
#reportsOverlay .ledger-tab[data-tab="scorecard"]{
  overflow-y:auto;
  height:100%;
}
.scorecard-wrap{
  padding:12px;
  overflow-y:visible;
  height:auto;
}
#reportsOverlay .table-wrap{
  position:relative;
  z-index:1;
}
#reportsOverlay thead th{
  z-index:1;
}

/* Element rows: keep compact, avoid metric crowding */
.element-row .ename{flex:1 1 auto; min-width:0;}
.element-row .element-pill{flex:0 0 auto;}

/* Locked unit-rate input when selecting existing element from fact sheet */
.search.readonly-input{
  opacity:.72;
  cursor:not-allowed;
  border-style:dashed;
}


.ctx-menu{
  position:fixed;
  z-index:12000;
  min-width:220px;
  max-width:280px;
  display:none;
  flex-direction:column;
  gap:2px;
  padding:8px;
  border-radius:12px;
  border:1px solid rgba(47,68,96,.9);
  background:rgba(15,22,32,.98);
  box-shadow:0 14px 34px rgba(0,0,0,.45);
  backdrop-filter: blur(8px);
}
.ctx-menu.active{display:flex;}
.ctx-item{
  padding:9px 10px;
  border-radius:9px;
  color:var(--text-strong);
  font-size:13px;
  cursor:pointer;
  user-select:none;
}
.ctx-item:hover{background:rgba(91,214,255,.12); border:1px solid rgba(91,214,255,.25);}
.ctx-item:active{transform:translateY(1px);}
.ctx-sep{height:1px; background:rgba(47,68,96,.65); margin:4px 2px;}

/* ── OR Engine / Scorecard styles ─────────────────────────────────────── */
.btn.primary{background:var(--accent,#5bd6ff);color:#0a121c;font-weight:700;border:none;}
.btn.primary:hover{background:#7ae0ff;}
.btn.primary:disabled{background:#2a3a4a;color:#556;}

.scorecard-wrap{padding:12px;}
.scorecard-placeholder{color:#667;font-style:italic;padding:24px;text-align:center;}

.oralloc-toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:8px 10px;
  border-bottom:1px solid var(--line);
  flex-wrap:wrap;
}
.oralloc-toolbar .btn.active{
  background:var(--accent);
  color:#fff;
  border-color:var(--accent);
}

/* M3: OR pre-flight + preview modal */
.or-modal-backdrop{
  position:fixed; inset:0; z-index:1000;
  background:rgba(0,0,0,0.55);
  display:flex; align-items:center; justify-content:center;
  padding:20px;
}
.or-modal-backdrop[hidden]{ display:none; }
.or-modal{
  background:var(--panel, #0f1620);
  color:var(--text, #e8f4ff);
  border:1px solid var(--line);
  border-radius:12px;
  box-shadow:0 20px 60px rgba(0,0,0,0.5);
  width:min(560px, 100%);
  max-height:90vh;
  display:flex; flex-direction:column;
}
.or-modal-wide{ width:min(860px, 100%); }
.or-modal-head{
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 18px;
  border-bottom:1px solid var(--line);
}
.or-modal-head h3{ margin:0; font-size:15px; color:var(--text-strong); }
.or-modal-close{
  background:none; border:none; color:var(--text);
  font-size:22px; line-height:1; cursor:pointer; padding:0 6px;
}
.or-modal-body{
  padding:16px 18px;
  overflow:auto; flex:1;
  font-size:13px; line-height:1.5;
}
.or-modal-body h4{ margin:14px 0 6px; font-size:13px; color:var(--text-strong); }
.or-modal-body h4:first-child{ margin-top:0; }
.or-modal-body .kv{ display:flex; gap:10px; margin:4px 0; }
.or-modal-body .kv .k{ color:var(--muted, #8ea); min-width:160px; }
.or-modal-body table{ width:100%; border-collapse:collapse; font-size:12px; margin-top:6px; }
.or-modal-body th, .or-modal-body td{
  text-align:left; padding:5px 8px; border-bottom:1px solid var(--line);
}
.or-modal-body .warn{ color:#f0a000; }
.or-modal-body .err{ color:#e04040; }
.or-modal-body .ok{ color:#3ec28d; }

/* Pre-flight modal: solver time-limit picker row */
.or-modal-body .time-limit-row{
  display:flex; align-items:center; gap:10px;
  margin:10px 0 4px;
  padding:8px 10px;
  border:1px solid var(--line);
  border-radius:8px;
  background:rgba(91,214,255,.04);
}
.or-modal-body .time-limit-row .k{ color:var(--muted, #8ea); min-width:140px; }
.or-modal-body .tl-presets{
  display:flex; align-items:center; gap:6px; flex-wrap:wrap;
}
.or-modal-body .tl-preset{
  padding:4px 9px;
  border:1px solid var(--line);
  border-radius:7px;
  background:#0f1620;
  color:var(--muted);
  cursor:pointer;
  font-size:12px;
}
.or-modal-body .tl-preset:hover{ border-color:#2f4460; color:var(--text-strong); }
.or-modal-body .tl-preset.active{
  background:#162233;
  color:var(--text-strong);
  border-color:rgba(91,214,255,.45);
}
.or-modal-foot{
  display:flex; justify-content:flex-end; gap:8px;
  padding:12px 18px;
  border-top:1px solid var(--line);
}

/* Pre-flight modal redesign — section grouping + prominent Unlock-all callout
   + solution-quality row. Default 100% selected matches pre-redesign behaviour. */
.or-modal-body .pf-section{ margin-bottom:14px; }
.or-modal-body .pf-section-head{
  font-size:10px;
  letter-spacing:1.5px;
  color:var(--spacesense-yellow, #F2C12E);
  border-bottom:1px solid rgba(242,193,46,.3);
  padding-bottom:4px;
  margin-bottom:8px;
}
.or-modal-body .pf-row{
  display:flex; align-items:center; gap:10px;
  margin-top:6px;
}
.or-modal-body .pf-row-stack{
  flex-direction:column; align-items:stretch; gap:6px;
  padding:8px 10px;
  border:1px solid var(--line);
  border-radius:8px;
  background:rgba(91,214,255,.04);
}
.or-modal-body .pf-row-label{
  display:flex; justify-content:space-between; align-items:baseline;
}
.or-modal-body .pf-row-hint{
  font-size:10px; color:var(--muted);
}
.or-modal-body .pf-select{
  flex:1 1 auto; padding:4px 6px;
  border-radius:6px;
  border:1px solid var(--line);
  background:#0f1620;
  color:var(--text-strong);
}
.or-modal-body .pf-number{
  width:70px; padding:4px 6px;
  border-radius:6px;
  border:1px solid var(--line);
  background:#0f1620;
  color:var(--text-strong);
  margin-left:8px;
}
.or-modal-body .pf-unit{ font-size:11px; margin-left:4px; }
.or-modal-body .pf-help{
  font-size:11px;
  margin:-2px 0 0;
  line-height:1.4;
}
/* Lock-status warning callout — yellow, prominent, only when all chips locked */
.or-modal-body .pf-callout{
  margin-top:10px;
  padding:10px 12px;
  border-radius:6px;
}
.or-modal-body .pf-callout-warn{
  background:rgba(242,193,46,.08);
  border:1px solid var(--spacesense-yellow, #F2C12E);
}
.or-modal-body .pf-callout-head{
  color:var(--spacesense-yellow, #F2C12E);
  font-weight:700;
  font-size:12px;
  margin-bottom:4px;
}
.or-modal-body .pf-callout-body{
  color:var(--text-strong);
  font-size:11px;
  margin-bottom:8px;
}
.or-modal-body .pf-callout-action{
  display:block;
  width:100%;
  padding:8px 12px;
  border:0;
  border-radius:4px;
  background:var(--spacesense-yellow, #F2C12E);
  color:#1a2330;
  font-weight:700;
  font-size:12px;
  cursor:pointer;
  transition:filter .15s;
}
.or-modal-body .pf-callout-action:hover{ filter:brightness(1.08); }
.or-modal-body .pf-warnings{ margin-top:12px; }
.or-modal-body .pf-warnings h4{ margin:0 0 6px; font-size:12px; color:var(--text-strong); }
.or-modal-body .pf-warnings ul{ margin:0; padding-left:18px; font-size:11px; }

input.chip-lock{
  cursor:pointer;
  accent-color:var(--accent);
}
.scorecard-header h3{margin:0 0 4px;color:var(--text-strong,#e8f4ff);font-size:16px;}
.scorecard-meta{font-size:11px;color:#667;margin-bottom:12px;}

.scorecard-grid{display:flex;flex-direction:column;gap:2px;}
.sc-section-title{
  margin-top:12px;padding:4px 8px;
  background:rgba(91,214,255,.1);
  border-left:3px solid #5bd6ff;
  color:#5bd6ff;font-size:12px;font-weight:700;letter-spacing:.05em;
}
.sc-row{display:grid;grid-template-columns:2fr 1fr 1fr;gap:4px;padding:4px 8px;font-size:12px;border-bottom:1px solid rgba(255,255,255,.04);}
.sc-row.sc-head{font-weight:700;color:#8ab;font-size:11px;}
.sc-row.sc-subhead{font-style:italic;color:#6a8;font-size:11px;border-top:1px dashed var(--line);margin-top:4px;padding-top:4px;}
.sc-row.highlight{background:rgba(91,214,255,.06);color:var(--text-strong,#e8f4ff);}
.sc-row span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}

/* PR-K: NPV sensitivity grid — 4 equal-width columns (rate label + 3 horizons) */
.sc-row.sc-grid-head,.sc-row.sc-grid-row{grid-template-columns:1.4fr 1fr 1fr 1fr;}
.sc-grid-cell{text-align:right;font-variant-numeric:tabular-nums;padding:0 4px;border-radius:3px;}
.sc-grid-cell.sc-bench-in-band{background:rgba(76,175,80,.15);color:#7fd687;}
.sc-grid-cell.sc-bench-below{background:rgba(244,67,54,.15);color:#ff8a80;}

/* PR-2 (Pareto Compare): plan tab strip + Compare Plans table + preset selector */
.plan-tab-strip{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  padding:6px 10px;
  background:var(--panel,#181c20);
  border-bottom:1px solid var(--line,#2a2f35);
  flex:0 0 auto;
}
.plan-tab-strip[hidden]{display:none;}
.plan-tab{
  display:inline-flex;
  align-items:center;
  gap:6px;
  background:rgba(255,255,255,.04);
  border:1px solid var(--line,#2a2f35);
  color:var(--text,#cfd8e0);
  padding:4px 10px;
  font-size:12px;
  border-radius:4px;
  cursor:pointer;
  transition:background .12s, border-color .12s;
}
.plan-tab:hover{background:rgba(255,255,255,.07);}
.plan-tab.active{
  background:rgba(91,214,255,.12);
  border-color:#5bd6ff;
  color:var(--text-strong,#e8f4ff);
  font-weight:600;
}
.plan-tab-label{font-size:12px;}
.plan-tab-kpi{font-size:11px;color:#7fd687;font-variant-numeric:tabular-nums;}
.plan-tab-strip-label{
  font-size:10px;text-transform:uppercase;letter-spacing:.06em;font-weight:700;
  color:var(--muted,#9ba6af);align-self:center;margin-right:4px;
}
.plan-tab-compare-btn{
  margin-left:auto;background:rgba(91,214,255,.10);border:1px solid rgba(91,214,255,.30);
  color:#5bd6ff;padding:4px 10px;border-radius:4px;font-size:11px;cursor:pointer;
}
.plan-tab-compare-btn:hover{background:rgba(91,214,255,.18);}
/* Hotfix-B: special "Existing" baseline tab style (load-history button
   removed in PR-X1 — tabs are now strictly session-only). */
.plan-tab.plan-tab-existing{
  background:rgba(255,193,7,.06);border-color:rgba(255,193,7,.30);color:#ffd54f;
}
.plan-tab.plan-tab-existing.active{
  background:rgba(255,193,7,.18);border-color:#ffc107;
}
.opt-badge-existing{
  background:rgba(255,193,7,.18);color:#ffd54f;
}
/* PR-X2: per-tab close × button (hidden on Existing) */
.plan-tab-close{
  margin-left:6px;padding:0 4px;border-radius:50%;background:rgba(255,255,255,.05);
  color:var(--muted,#9ba6af);font-size:13px;line-height:14px;cursor:pointer;
}
.plan-tab-close:hover{background:rgba(244,67,54,.20);color:#ff8a80;}
/* PR-X2: Unlock-all-chips button in Allocations table header */
.ledger-unlock-all-btn{
  margin-left:8px;background:rgba(255,255,255,.04);border:1px solid var(--line,#2a2f35);
  color:var(--text,#cfd8e0);padding:1px 6px;border-radius:3px;font-size:10px;
  text-transform:uppercase;letter-spacing:0.04em;cursor:pointer;font-weight:600;
}
.ledger-unlock-all-btn:hover{background:rgba(91,214,255,.10);border-color:#5bd6ff;color:#5bd6ff;}
.opt-badge{
  display:inline-block;padding:0 5px;font-size:10px;border-radius:3px;font-weight:600;
}
.opt-badge-proven  {background:rgba(76,175,80,.20);color:#7fd687;}
.opt-badge-near    {background:rgba(255,193,7,.20);color:#ffd54f;}
.opt-badge-best    {background:rgba(255,152,0,.20);color:#ffb74d;}
.opt-badge-limited {background:rgba(244,67,54,.20);color:#ff8a80;}
.opt-badge-unknown {background:rgba(255,255,255,.05);color:#9ba6af;}

/* Preset selector row inside the Sensitivity tuner */
.prd-preset-row{
  display:flex;align-items:center;gap:8px;
  margin-bottom:12px;padding:6px 8px;
  background:rgba(91,214,255,.04);
  border-left:2px solid #5bd6ff;border-radius:3px;
}
.prd-preset-label{font-size:11px;text-transform:uppercase;letter-spacing:.05em;color:var(--muted,#9ba6af);font-weight:700;}
.prd-preset-select{
  flex:1 1 auto;min-width:140px;
  background:var(--panel,#181c20);color:var(--text,#cfd8e0);
  border:1px solid var(--line,#2a2f35);padding:4px 6px;border-radius:3px;font-size:12px;
}

/* Compare Plans table */
.compare-wrap{padding:8px 4px;}
.compare-meta{font-size:12px;color:var(--muted,#9ba6af);margin-bottom:10px;}
.compare-tbl-wrap{overflow-x:auto;}
.compare-tbl{width:100%;border-collapse:collapse;font-size:12px;}
.compare-tbl th,.compare-tbl td{padding:6px 10px;border-bottom:1px solid rgba(255,255,255,.05);vertical-align:top;}
.compare-tbl thead th{background:var(--panel,#181c20);font-size:11px;color:var(--text-strong,#e8f4ff);text-align:left;}
.compare-row-label{font-weight:600;color:var(--muted,#9ba6af);width:200px;text-align:left;}
.compare-tbl td{text-align:right;font-variant-numeric:tabular-nums;}
.compare-col-active{background:rgba(91,214,255,.08);}
.compare-active-pill{background:rgba(91,214,255,.20);color:#5bd6ff;font-size:10px;padding:1px 5px;border-radius:3px;margin-left:4px;}
.compare-plan-name{font-weight:700;font-size:12px;}
.compare-plan-meta{margin-top:2px;display:inline-flex;gap:6px;align-items:center;}
.compare-section th{
  background:rgba(255,255,255,.03);text-transform:uppercase;font-size:10px;letter-spacing:.05em;
  color:var(--muted,#9ba6af);padding-top:12px;
}

.status-allocated{color:#4caf50;font-weight:600;}
.status-partial{color:#ff9800;font-weight:600;}
.status-unmet{color:#f44336;font-weight:600;}
.badge{display:inline-block;padding:1px 5px;border-radius:4px;font-size:10px;background:rgba(91,214,255,.15);color:#5bd6ff;}
.badge-block{background:rgba(255,180,60,.18);color:#ffb43c;}
.muted{color:var(--text-muted,#555);}

/* Section hierarchy: dept group within cluster */
.dept-group{border-left:2px solid hsla(var(--hue,200),40%,60%,.35);margin:4px 0 4px 6px;border-radius:0 4px 4px 0}
.dept-group-header{display:flex;align-items:center;gap:6px;padding:4px 8px;cursor:pointer;border-radius:4px;user-select:none}
.dept-group-header:hover{background:rgba(255,255,255,.06)}
.dept-toggle{background:none;border:none;color:var(--text-muted,#888);font-size:11px;cursor:pointer;padding:0 2px;line-height:1}
.dept-group-name{flex:1;font-size:12px;font-weight:600;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.dept-group-pill{font-size:11px;color:var(--text-muted,#888);white-space:nowrap;padding:2px 6px;border-radius:10px;background:rgba(255,255,255,.06)}
.dept-group-pill.complete{color:#4caf50}
.dept-group-sections{padding-left:4px}

/* M6: KPI bar */
.kpi-bar{
  display:flex;
  flex-direction:column;
  gap:0;
  background:var(--line);
  border-bottom:1px solid var(--line);
  flex-shrink:0;
}
.kpi-bar[hidden]{display:none}
/* Two-tier KPI layout — primary row (4 always-visible workspace metrics
   in the existing large dial style), secondary row (run-quality
   diagnostics in smaller, muted dials). Empty .kpi-secondary collapses
   to zero height. */
.kpi-primary,
.kpi-secondary{
  display:flex;
  gap:1px;
  overflow-x:auto;
}
.kpi-secondary{
  background:rgba(0,0,0,.20);
}
/* :has() matches "has any element child"; the negation hides the secondary
   row when no diagnostics conditions emit anything (pre-run + no CMF). */
.kpi-secondary:not(:has(*)){display:none;}

/* Element view filter bar — appears below kpi bar when Element view active */
.element-filter-bar{
  display:flex;
  flex-direction:column;
  gap:6px;
  padding:8px 14px;
  background:rgba(91,214,255,.04);
  border-bottom:1px solid var(--line);
  flex-shrink:0;
}
.element-filter-bar[hidden]{display:none}
.ef-row{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  align-items:center;
}
.ef-row[hidden]{display:none}
.ef-row::before{
  content:attr(data-label);
  font-size:10px;
  text-transform:uppercase;
  letter-spacing:.4px;
  color:var(--muted2);
  margin-right:6px;
  white-space:nowrap;
}
.ef-btn{
  padding:5px 10px;
  border:1px solid var(--line);
  border-radius:8px;
  background:#0f1620;
  color:var(--muted);
  cursor:pointer;
  font-size:12px;
  white-space:nowrap;
}
.ef-btn:hover{border-color:#2f4460;color:var(--text-strong)}
.ef-btn.active{
  background:#162233;
  color:var(--text-strong);
  border-color:rgba(91,214,255,.45);
}
.ef-btn.ef-all{
  font-weight:600;
}
.ef-btn.ef-cmf{
  border-color: rgba(255,200,80,.30);
  color: #ffd060;
}
.ef-btn.ef-cmf.active{
  background: rgba(255,200,80,.10);
  border-color: rgba(255,200,80,.55);
  color: #fff0c0;
}

/* Cat 1 / Cat 2 / Cat 3 category pill in OR Allocations table */
.cat-pill{
  display:inline-block;
  font-size:10px;
  font-weight:700;
  letter-spacing:.3px;
  padding:2px 7px;
  border-radius:10px;
  border:1px solid var(--line);
  background:rgba(0,0,0,.18);
  color:var(--text-strong);
  white-space:nowrap;
}
.cat-pill-cat1{ border-color: rgba(91,214,255,.45);  color:#5bd6ff; background:rgba(91,214,255,.08); }
.cat-pill-cat2{ border-color: rgba(255,200,80,.45);  color:#ffd060; background:rgba(255,200,80,.08); }
.cat-pill-cat3{ border-color: rgba(107,255,149,.45); color:#6bff95; background:rgba(107,255,149,.08); }
.kpi-dial{
  flex:1 0 auto;
  min-width:110px;
  padding:5px 14px;
  background:var(--panel2);
  display:flex;
  flex-direction:column;
  gap:1px;
}
.kpi-label{font-size:10px;color:var(--muted);text-transform:uppercase;letter-spacing:.05em;white-space:nowrap}
.kpi-value{font-size:14px;font-weight:700;color:var(--text-strong);white-space:nowrap}
.kpi-sub{font-size:10px;color:var(--muted2);white-space:nowrap}

/* Secondary tier dials — visually subordinate to the 4 primary metrics.
   Smaller font, tighter padding, darker background. Used for run-quality
   diagnostics (Common Facilities, OR Score, Solver, Conflicts, Coverage)
   that matter only after an optimizer run. */
.kpi-dial-secondary{
  min-width:90px;
  padding:3px 12px;
  background:rgba(15,22,32,.55);
}
.kpi-dial-secondary .kpi-label{font-size:9px;}
.kpi-dial-secondary .kpi-value{font-size:12px;font-weight:600;}
.kpi-dial-secondary .kpi-sub{font-size:9px;}

/* M6: Plan Review tab */
.plan-review-wrap{padding:10px;overflow:auto;height:100%}
.plan-review-grid{display:flex;gap:14px;flex-wrap:wrap;align-items:flex-start}
.plan-review-section{flex:1 1 260px;min-width:0}
.plan-review-section .subhead{margin-bottom:6px;font-size:12px;font-weight:600;color:var(--muted)}

/* M6: Plan list in Load Plan modal */
.plan-list-table{width:100%;border-collapse:collapse;font-size:12px}
.plan-list-table th,.plan-list-table td{padding:6px 8px;border-bottom:1px solid var(--line);text-align:left;vertical-align:middle}
.plan-list-table tr:last-child td{border-bottom:none}
.plan-list-table .plan-actions{display:flex;gap:6px}

/* M6: summary row in alloc tfoot */
.summary-row td{font-size:11px;color:var(--muted);border-top:2px solid var(--line);padding:4px 6px}

/* M6/M7: ledger-tools flex row (adds Export CSV button) */
#reportsOverlay .ledger-tools{display:flex;gap:8px;align-items:center}
#reportsOverlay .ledger-tools .search{flex:1;max-width:none}

/* M7: Sensitivity Analysis tab */
.sens-wrap{padding:10px;overflow:auto;height:100%}
.sens-grid{display:flex;gap:14px;flex-wrap:wrap;align-items:flex-start}
.sens-section{flex:1 1 280px;min-width:0}
.sens-section .subhead{margin-bottom:8px;font-size:12px;font-weight:600;color:var(--muted)}
.sens-component-list{display:flex;flex-direction:column;gap:6px;margin-bottom:10px}
.sens-row{display:grid;grid-template-columns:160px 1fr 70px;align-items:center;gap:8px;font-size:12px}
.sens-label{color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sens-bar-track{height:10px;background:rgba(255,255,255,.07);border-radius:4px;overflow:hidden}
.sens-bar{height:100%;border-radius:4px;transition:width .3s}
.sens-val{text-align:right;font-weight:700;font-size:12px;white-space:nowrap}
.sens-total{margin-top:8px;padding:6px 8px;font-weight:700;font-size:14px;border-top:1px solid var(--line)}

/* Constraint Management tab */
.constraint-wrap{padding:10px;overflow:auto;height:100%}
.constraint-section{max-width:1100px}

/* Violations panel (top of Constraints tab) */
.violations-panel{margin-bottom:18px}
.violations-header{display:flex;flex-direction:column;gap:4px;margin-bottom:10px;max-width:1100px}
.violations-header .subhead{font-weight:600}
.violations-empty{color:var(--good);font-size:13px;padding:6px 0}

/* Violation card — one per conflict, with full diagnosis */
.violation-card{
  border:1px solid var(--line);
  border-left-width:4px;
  border-radius:4px;
  margin-bottom:10px;
  background:var(--panel2);
  overflow:hidden;
}
.violation-card.severity-hard{border-left-color:var(--bad);background:rgba(220,80,80,0.04)}
.violation-card.severity-soft{border-left-color:var(--warn);background:rgba(200,160,80,0.025)}
.violation-head{
  display:flex;align-items:center;gap:10px;
  padding:8px 12px;
  border-bottom:1px solid var(--line);
  font-size:12px;
  flex-wrap:wrap;
}
.violation-cid{font-family:var(--mono,monospace);font-size:11px;color:var(--muted);font-weight:600}
.violation-rule-label{font-family:var(--mono,monospace);font-size:11px;color:var(--muted)}
.violation-members-text{font-weight:500}
.violation-badge{display:inline-block;padding:2px 8px;border-radius:3px;font-size:10px;font-weight:700;letter-spacing:0.5px}
.violation-badge.severity-hard{background:var(--bad);color:#fff}
.violation-badge.severity-soft{background:var(--warn);color:#1a1a1a}

.violation-diagnosis{padding:10px 12px;display:flex;flex-direction:column;gap:10px}
.diagnosis-section .diagnosis-section-title{
  font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:0.5px;
  color:var(--muted);margin-bottom:4px;
}
.diagnosis-list{margin:0;padding-left:18px;font-size:12px;line-height:1.6}
.diagnosis-list li{margin-bottom:1px}
.diagnosis-hint p{margin:0 0 4px 0;font-size:12px;color:var(--muted)}
.diagnosis-hint ul{margin:0;padding-left:18px;font-size:12px;line-height:1.6}

/* Conflicts dial in KPI bar — clickable */
.kpi-dial.kpi-conflicts{cursor:pointer;transition:background 0.15s}
.kpi-dial.kpi-conflicts:hover{background:var(--panel3,var(--panel2));filter:brightness(1.1)}
.constraint-header{display:flex;align-items:baseline;gap:12px;margin-bottom:10px}
.cst-table{width:100%;border-collapse:collapse;font-size:12px}
.cst-table th{text-align:left;padding:5px 8px;border-bottom:2px solid var(--line);white-space:nowrap;color:var(--muted);font-weight:600}
.cst-table td{padding:5px 8px;border-bottom:1px solid var(--line);vertical-align:middle}
.cst-row.cst-inactive{opacity:.45}
.cst-id{font-size:11px;white-space:nowrap}
.cst-scope-badge{display:inline-block;font-size:10px;padding:1px 5px;border-radius:3px;background:rgba(255,255,255,.09);color:var(--muted);vertical-align:middle;margin-right:2px}
.cst-arrow{text-align:center;color:var(--muted);font-size:14px}
.cst-type{font-size:11px;white-space:nowrap;color:var(--muted)}
.cst-weight-cell{white-space:nowrap;display:flex;align-items:center;gap:6px;min-width:140px}
.cst-weight-slider{flex:1;min-width:80px;accent-color:var(--accent,#4a9eff);cursor:pointer}
.cst-weight-val{min-width:22px;text-align:right;font-size:12px;font-weight:600}
.cst-hard-badge{font-size:10px;padding:1px 5px;border-radius:3px;background:rgba(255,80,80,.18);color:#ff6060;font-weight:700}
.cst-active-toggle{cursor:pointer;accent-color:var(--accent,#4a9eff)}
.cst-del-btn{background:none;border:none;color:var(--muted);font-size:13px;cursor:pointer;padding:2px 5px;border-radius:3px;line-height:1}
.cst-del-btn:hover{background:rgba(255,80,80,.15);color:#ff6060}

/* Constraint add-form */
.cst-add-section{margin-top:18px;padding-top:14px;border-top:1px solid var(--line)}
.cst-add-form{display:flex;flex-direction:column;gap:8px;max-width:760px}
.cst-add-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.cst-form-label{font-size:11px;color:var(--muted);white-space:nowrap;min-width:80px}
.cst-select{background:var(--bg2,#1e2230);border:1px solid var(--line);color:var(--text);border-radius:4px;padding:4px 6px;font-size:12px;min-width:130px}
.cst-weight-input{width:64px;background:var(--bg2,#1e2230);border:1px solid var(--line);color:var(--text);border-radius:4px;padding:4px 6px;font-size:12px}

/* What-if section in Sensitivity tab */
.wi-section{margin-top:18px;padding-top:14px;border-top:1px solid var(--line)}
.wi-row{margin-bottom:12px;padding:8px 10px;background:rgba(255,255,255,.03);border-radius:6px;border-left:3px solid var(--line)}
.wi-label{font-size:12px;margin-bottom:6px;display:flex;align-items:center;flex-wrap:wrap;gap:4px}
.wi-cid{margin-right:4px;font-size:11px}
.wi-arrow{margin:0 2px;color:var(--muted)}
.wi-type{font-size:11px}
.wi-controls{display:flex;align-items:center;flex-wrap:wrap;gap:8px;font-size:12px}
.wi-slider{width:110px;accent-color:var(--accent,#4a9eff);cursor:pointer}
.wi-weight-val{min-width:22px;font-weight:600;font-size:12px}
.wi-delta{font-weight:700;font-size:12px;min-width:40px}

/* ====================
   Reports overlay — full-area takeover opened from the Reports menu.
   Replaces the bottom Ledger panel. Hidden by default; openReport(tab)
   in app.js sets hidden=false and activates the selected .ledger-tab
   content pane inside .reports-overlay-body.
   ==================== */
.reports-overlay{
  position:fixed;
  top:48px;   /* sits below the topbar */
  left:0; right:0; bottom:0;
  background:var(--bg);
  z-index:60;
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.reports-overlay[hidden]{display:none;}
.reports-overlay-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:10px 16px;
  border-bottom:1px solid var(--line);
  background:var(--panel);
  flex:0 0 auto;
}
.reports-title{
  margin:0;
  font-size:15px;
  font-weight:600;
}
.reports-tools{
  display:flex;
  gap:8px;
  align-items:center;
}
.reports-stats{
  font-size:12px;
  color:var(--muted);
  margin-right:4px;
}
.reports-tools .search{max-width:280px;}
/* PR-M: sidebar layout. Head sits above, sidebar + body share the rest
   horizontally. Sidebar is persistent so switching reports is one click
   (no modal-close + dropdown-reopen dance). */
.reports-overlay-main{
  flex:1 1 auto;
  display:flex;
  flex-direction:row;
  overflow:hidden;
  min-height:0;
}
.reports-sidebar{
  flex:0 0 200px;
  border-right:1px solid var(--line);
  background:var(--panel);
  overflow-y:auto;
  padding:10px 0;
}
.reports-sidebar-group{padding:6px 0 10px;}
.reports-sidebar-group + .reports-sidebar-group{border-top:1px solid var(--line);}
.reports-sidebar-title{
  margin:0 0 4px 0;
  padding:4px 14px;
  font-size:10px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:0.06em;
  color:var(--muted);
}
.reports-sidebar-item{
  display:block;
  width:100%;
  text-align:left;
  background:transparent;
  border:0;
  color:var(--text,inherit);
  padding:6px 14px;
  font-size:13px;
  cursor:pointer;
  border-left:2px solid transparent;
}
.reports-sidebar-item:hover{background:rgba(255,255,255,.05);}
.reports-sidebar-item.active{
  background:rgba(91,214,255,.10);
  color:var(--text-strong,#e8f4ff);
  border-left-color:#5bd6ff;
  font-weight:600;
}
.reports-overlay-body{
  flex:1 1 auto;
  overflow:auto;
  padding:12px 16px;
  min-width:0;
}
.reports-overlay-body .ledger-tab{display:none;}
.reports-overlay-body .ledger-tab.active{display:block;}

/* ====================
   Industry-benchmark badge (PR-C). Inline pill appended to KPI values in
   the Value Scorecard when a band exists for the metric. Three colour
   states: in-band (green-tinted), below (orange-tinted), above (blue-tinted).
   Hover for the full source citation via the title attribute.
   ==================== */
.sc-bench{
  display:inline-block;
  margin-left:8px;
  padding:1px 7px;
  border-radius:10px;
  font-size:11px;
  font-weight:600;
  border:1px solid transparent;
  vertical-align:baseline;
  white-space:nowrap;
  cursor:help;
}
.sc-bench-in-band{
  background:rgba(60, 200, 120, 0.14);
  color:#7ddca7;
  border-color:rgba(60, 200, 120, 0.35);
}
.sc-bench-below{
  background:rgba(255, 165, 60, 0.14);
  color:#ffc285;
  border-color:rgba(255, 165, 60, 0.35);
}
.sc-bench-above{
  background:rgba(91, 170, 255, 0.14);
  color:#9ec6ff;
  border-color:rgba(91, 170, 255, 0.35);
}

/* ====================
   Re-Stacking Weight Tuner (PR-H). Sliders for the three PR-D
   soft-objective weights, on the Sensitivity tab.
   ==================== */
.prd-tuner-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding:6px 0;
  border-bottom:1px dashed var(--line);
}
.prd-tuner-row:last-of-type{border-bottom:none;}
.prd-tuner-label{
  font-size:12px;
  cursor:help;
  flex:0 0 auto;
}
.prd-tuner-controls{
  display:flex;
  align-items:center;
  gap:10px;
  flex:1 1 auto;
  min-width:0;
  justify-content:flex-end;
}
.prd-tuner-slider{
  flex:1 1 auto;
  max-width:300px;
  accent-color:var(--accent,#4a9eff);
  cursor:pointer;
}
.prd-tuner-val{
  font-weight:700;
  min-width:48px;
  text-align:right;
  font-variant-numeric:tabular-nums;
}
.prd-tuner-actions{
  display:flex;
  align-items:center;
  gap:8px;
  margin-top:12px;
}

/* ================================================================
 * SPACESENSE MODERNIZATION LAYER — Commit 1 of 3: Foundation
 * ----------------------------------------------------------------
 * Appended at file tail so the CSS cascade gives these rules
 * priority over earlier ones. No new class names introduced that
 * `app.js` depends on; only overrides on existing selectors plus
 * additive design-system tokens in :root.
 *
 * To revert this commit: delete everything from this banner to EOF.
 * ================================================================ */

:root{
  /* Shadow scale */
  --ms-sh-1: 0 1px 2px rgba(0,0,0,.20), 0 1px 1px rgba(0,0,0,.12);
  --ms-sh-2: 0 4px 10px rgba(0,0,0,.26), 0 2px 4px rgba(0,0,0,.16);
  --ms-sh-3: 0 10px 24px rgba(0,0,0,.34), 0 4px 8px rgba(0,0,0,.20);
  --ms-sh-4: 0 20px 48px rgba(0,0,0,.45), 0 8px 16px rgba(0,0,0,.28);
  --ms-glow-yellow: 0 0 0 1px rgba(242,193,46,.30), 0 8px 24px rgba(242,193,46,.18);
  --ms-glow-accent: 0 0 0 1px rgba(91,214,255,.28), 0 8px 24px rgba(91,214,255,.15);

  /* Radius scale */
  --ms-r-sm: 6px;
  --ms-r-md: 10px;
  --ms-r-lg: 14px;
  --ms-r-xl: 20px;

  /* Spacing scale */
  --ms-s-1: 4px;
  --ms-s-2: 8px;
  --ms-s-3: 12px;
  --ms-s-4: 16px;
  --ms-s-5: 20px;
  --ms-s-6: 24px;
  --ms-s-8: 32px;

  /* Motion */
  --ms-d-fast: 120ms;
  --ms-d-med: 220ms;
  --ms-d-slow: 320ms;
  --ms-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ms-ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  /* Surface tints */
  --ms-tint-yellow: linear-gradient(180deg, rgba(242,193,46,.05), transparent 70%);
  --ms-tint-navy:   linear-gradient(180deg, rgba(63,90,108,.18), transparent 70%);
}

/* Body — subtle radial brand wash replaces flat gradient */
body{
  background:
    radial-gradient(ellipse 1200px 820px at 12% -10%, rgba(63,90,108,.24), transparent 60%),
    radial-gradient(ellipse 900px 620px at 96% 108%, rgba(242,193,46,.07), transparent 65%),
    linear-gradient(180deg, #070a0f, #0b0f14);
  background-attachment: fixed;
}

/* Scrollbars — slim, brand-tinted */
*{ scrollbar-width: thin; scrollbar-color: rgba(63,90,108,.55) transparent; }
*::-webkit-scrollbar{ width: 10px; height: 10px; }
*::-webkit-scrollbar-track{ background: transparent; }
*::-webkit-scrollbar-thumb{
  background: linear-gradient(180deg, rgba(63,90,108,.60), rgba(63,90,108,.38));
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover{
  background: linear-gradient(180deg, rgba(242,193,46,.55), rgba(242,193,46,.35));
  background-clip: padding-box;
}

/* Focus rings — accessibility + brand */
:focus-visible{
  outline: 2px solid var(--spacesense-yellow);
  outline-offset: 2px;
  border-radius: 4px;
}
.btn:focus-visible, button:focus-visible, a:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible{
  outline: 2px solid var(--spacesense-yellow);
  outline-offset: 2px;
}

/* Motion baseline on interactive elements (scoped — no global *) */
.btn, .btn-small, .seg, .dropdown-item, .menubar-btn,
.chip, .tab, a, .scenario-badge, .panel-actions button{
  transition:
    background-color var(--ms-d-fast) var(--ms-ease-out),
    border-color var(--ms-d-fast) var(--ms-ease-out),
    color var(--ms-d-fast) var(--ms-ease-out),
    box-shadow var(--ms-d-med) var(--ms-ease-out),
    transform var(--ms-d-med) var(--ms-ease-out);
}

/* Button lift on hover */
.btn:hover:not(:disabled){
  transform: translateY(-1px);
  box-shadow: var(--ms-sh-2);
}
.btn:active:not(:disabled){
  transform: translateY(0);
  box-shadow: var(--ms-sh-1);
}

/* Brand wordmark — gradient text + tighter weight */
.brand{
  background: linear-gradient(180deg, #ffffff 0%, #cfd9e3 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 1px;
  font-weight: 800;
}
.brand-sub{
  color: rgba(207,217,227,.72);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-size: 10px;
  font-weight: 600;
}

/* Typography polish — pull headings up a half-step in weight */
h1, h2, h3{ letter-spacing: -0.01em; }

/* Selection */
::selection{
  background: rgba(242,193,46,.30);
  color: #ffffff;
}

/* Reduced-motion users opt out of transforms */
@media (prefers-reduced-motion: reduce){
  .btn, .btn-small, .seg, .dropdown-item, .menubar-btn,
  .chip, .tab, a, .scenario-badge, .panel-actions button{
    transition: none !important;
  }
  .btn:hover:not(:disabled){ transform: none; }
}
/* === END MODERNIZATION COMMIT 1 === */


/* ================================================================
 * SPACESENSE MODERNIZATION LAYER — Commit 2 of 3: Surfaces
 * ----------------------------------------------------------------
 * Glassmorphic topbar, card-style panels, KPI dial polish, tab
 * underline accent, empty-state lift, Reports overlay softening.
 * All additive overrides on existing selectors — no JS contracts
 * touched.
 *
 * To revert this commit only: delete from this banner to the
 * matching `=== END MODERNIZATION COMMIT 2 ===` line.
 * ================================================================ */

/* Topbar — glassmorphism */
.topbar{
  background: linear-gradient(180deg, rgba(11,15,20,.74), rgba(11,15,20,.58));
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid rgba(63,90,108,.38);
  box-shadow:
    0 1px 0 rgba(255,255,255,.04) inset,
    0 12px 32px rgba(0,0,0,.30);
}

/* Panels — soft card surfaces */
.panel{
  border-radius: var(--ms-r-lg);
  box-shadow:
    var(--ms-sh-2),
    inset 0 1px 0 rgba(255,255,255,.04);
  border: 1px solid rgba(63,90,108,.30);
}

/* Panel titles — subtle gradient header strip */
.panel-title{
  background: linear-gradient(180deg, rgba(63,90,108,.18), rgba(63,90,108,.04));
  border-bottom: 1px solid rgba(63,90,108,.30);
  border-top-left-radius: var(--ms-r-lg);
  border-top-right-radius: var(--ms-r-lg);
}

/* KPI bar — card-like */
.kpi-bar{
  background:
    linear-gradient(180deg, rgba(63,90,108,.10), rgba(63,90,108,.02));
  border-bottom: 1px solid rgba(63,90,108,.28);
}

/* KPI dials — subtle gradient + hover affordance */
.kpi-dial{
  background:
    linear-gradient(180deg, rgba(255,255,255,.025), rgba(255,255,255,.00)),
    var(--panel2);
  border-right: 1px solid rgba(63,90,108,.18);
  transition:
    background var(--ms-d-med) var(--ms-ease-out),
    box-shadow var(--ms-d-med) var(--ms-ease-out),
    transform var(--ms-d-med) var(--ms-ease-out);
  position: relative;
}
.kpi-dial:hover{
  background:
    linear-gradient(180deg, rgba(242,193,46,.06), rgba(242,193,46,.01)),
    var(--panel2);
  box-shadow: inset 0 2px 0 0 var(--spacesense-yellow);
}
.kpi-dial:last-child{ border-right: none; }
.kpi-value{
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #ffffff 0%, #cfd9e3 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Plan-tab strip — active tab gets a yellow underline accent */
.plan-tab{
  border-radius: var(--ms-r-md) var(--ms-r-md) 0 0;
  position: relative;
}
.plan-tab.active{
  background: linear-gradient(180deg, rgba(242,193,46,.08), rgba(242,193,46,.02));
}
.plan-tab.active::after{
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 0;
  height: 2px;
  background: var(--spacesense-yellow);
  border-radius: 2px 2px 0 0;
  box-shadow: 0 0 8px rgba(242,193,46,.55);
}
.plan-tab-existing.active::after{
  background: var(--accent);
  box-shadow: 0 0 8px rgba(91,214,255,.55);
}

/* Scenario badge — pill polish */
.scenario-badge{
  background: linear-gradient(180deg, rgba(63,90,108,.55), rgba(63,90,108,.30));
  border: 1px solid rgba(63,90,108,.50);
  box-shadow: 0 1px 2px rgba(0,0,0,.30), inset 0 1px 0 rgba(255,255,255,.05);
}

/* Empty state — better hierarchy, soft illustrated dot */
.empty-state{
  padding: 36px 20px;
  position: relative;
}
.empty-state::before{
  content: "";
  display: block;
  width: 44px;
  height: 44px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 35%, rgba(242,193,46,.55), rgba(242,193,46,.12) 55%, transparent 70%),
    radial-gradient(circle at 70% 70%, rgba(63,90,108,.45), transparent 60%);
  box-shadow:
    0 0 0 1px rgba(242,193,46,.18),
    0 6px 18px rgba(0,0,0,.30);
}

/* Reports overlay — softer shadow + rounded corners */
.reports-overlay{
  border-radius: var(--ms-r-lg);
  box-shadow: var(--ms-sh-4);
  border: 1px solid rgba(63,90,108,.35);
  overflow: hidden;
}

/* Dropdown menus — soft elevation */
.dropdown-menu{
  border-radius: var(--ms-r-md);
  box-shadow: var(--ms-sh-3);
  border: 1px solid rgba(63,90,108,.38);
  background: linear-gradient(180deg, rgba(20,29,40,.96), rgba(15,22,32,.96));
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  overflow: hidden;
}
.dropdown-item{
  border-radius: 0;
}
.dropdown-item:hover{
  background: linear-gradient(90deg, rgba(242,193,46,.12), rgba(63,90,108,.18));
}

/* Buttons — primary tier (the Run Optimizer / Save buttons feel
   important when they have brand colour). Detect the .btn.primary
   class if it exists, else just give all .btn a brand-tinted hover. */
.btn{
  border-radius: var(--ms-r-md);
}
.btn:hover:not(:disabled){
  border-color: rgba(242,193,46,.45);
}

/* Tables inside Reports — slightly more breathing room */
.reports-overlay table th{
  background: linear-gradient(180deg, rgba(63,90,108,.22), rgba(63,90,108,.10));
  border-bottom: 1px solid rgba(63,90,108,.35);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: 11px;
}

/* Chips — soft elevation on hover (visual only, no drag interference) */
.chip{
  border-radius: var(--ms-r-sm);
  transition:
    box-shadow var(--ms-d-fast) var(--ms-ease-out),
    transform var(--ms-d-fast) var(--ms-ease-out),
    filter var(--ms-d-fast) var(--ms-ease-out);
}
.chip:hover{
  box-shadow: var(--ms-sh-2);
  filter: brightness(1.06);
}

/* Reduced motion opt-out for the new transitions */
@media (prefers-reduced-motion: reduce){
  .kpi-dial, .chip{ transition: none !important; }
  .kpi-dial:hover{ box-shadow: none; }
}
/* === END MODERNIZATION COMMIT 2 === */


/* ================================================================
 * SPACESENSE MODERNIZATION LAYER — Commit 3 of 3: Micro-interactions
 * ----------------------------------------------------------------
 * Page-load fade-ins, modal/overlay entry animations, button sheen,
 * brand wordmark slow shimmer, shimmer-loading utility, polished
 * toast.
 *
 * To revert this commit only: delete from this banner to EOF.
 * ================================================================ */

/* Keyframe library */
@keyframes ms-fade-in{
  from{ opacity: 0; transform: translateY(4px); }
  to{   opacity: 1; transform: translateY(0); }
}
@keyframes ms-fade-in-soft{
  from{ opacity: 0; }
  to{   opacity: 1; }
}
@keyframes ms-slide-up{
  from{ opacity: 0; transform: translateY(12px) scale(.98); }
  to{   opacity: 1; transform: translateY(0)    scale(1); }
}
@keyframes ms-overlay-in{
  from{ opacity: 0; transform: translateY(20px); }
  to{   opacity: 1; transform: translateY(0); }
}
@keyframes ms-shimmer{
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes ms-brand-sheen{
  0%   { background-position: 200% 0; }
  50%  { background-position: -200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes ms-pulse-yellow{
  0%, 100%{ box-shadow: 0 0 0 0 rgba(242,193,46,.40); }
  50%     { box-shadow: 0 0 0 6px rgba(242,193,46,0); }
}

/* Page-load fade-in on the main layout grid */
.layout{
  animation: ms-fade-in-soft var(--ms-d-slow) var(--ms-ease-out) both;
}
.panel{
  animation: ms-fade-in var(--ms-d-slow) var(--ms-ease-out) both;
}
.panel.left   { animation-delay: 40ms; }
.panel.center { animation-delay: 80ms; }
.kpi-bar      { animation: ms-fade-in var(--ms-d-slow) var(--ms-ease-out) 120ms both; }
.topbar       { animation: ms-fade-in-soft var(--ms-d-med) var(--ms-ease-out) both; }

/* Modal entry animation */
.modal-backdrop.active{
  animation: ms-fade-in-soft var(--ms-d-fast) var(--ms-ease-out) both;
}
.modal-backdrop.active .modal-card{
  animation: ms-slide-up var(--ms-d-med) var(--ms-ease-out) both;
}

/* Reports overlay entry */
.reports-overlay:not([hidden]){
  animation: ms-overlay-in var(--ms-d-slow) var(--ms-ease-out) both;
}

/* Dropdown menu entry */
.dropdown-menu:not([hidden]){
  animation: ms-slide-up var(--ms-d-fast) var(--ms-ease-out) both;
  transform-origin: top center;
}

/* Brand wordmark — slow yellow sheen sweep on load + every 14s */
.brand{
  background:
    linear-gradient(90deg,
      #ffffff 0%,
      #cfd9e3 30%,
      var(--spacesense-yellow) 50%,
      #cfd9e3 70%,
      #ffffff 100%
    );
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: ms-brand-sheen 14s var(--ms-ease-in-out) infinite;
}

/* Button sheen — primary CTAs (Run Optimizer style buttons) light up
   on hover with a subtle moving highlight. Implemented via a layered
   gradient so it works on existing .btn surfaces without new markup. */
.btn{
  position: relative;
  overflow: hidden;
}
.btn::before{
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    transparent 30%,
    rgba(242,193,46,.22) 50%,
    transparent 70%
  );
  transform: translateX(-100%);
  transition: transform 600ms var(--ms-ease-out);
  pointer-events: none;
  opacity: 0;
}
.btn:hover:not(:disabled)::before{
  transform: translateX(100%);
  opacity: 1;
}

/* Toast — polish entry and add slight bottom-shadow */
.toast{
  border-radius: var(--ms-r-md);
  box-shadow: var(--ms-sh-3);
  border: 1px solid rgba(63,90,108,.45);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
}
.toast.show{
  animation: ms-slide-up var(--ms-d-med) var(--ms-ease-out) both;
}

/* Shimmer-loading utility — used as accent on .empty-state during
   transition states (CSS-only; activates automatically while the
   parent has [aria-busy="true"]). */
[aria-busy="true"] .empty-state::before{
  background:
    linear-gradient(90deg,
      rgba(242,193,46,.18) 0%,
      rgba(242,193,46,.55) 50%,
      rgba(242,193,46,.18) 100%
    );
  background-size: 200% 100%;
  animation: ms-shimmer 1.6s linear infinite;
}

/* Active plan-tab pulse — soft yellow ring breath */
.plan-tab.active{
  animation: ms-pulse-yellow 2.6s var(--ms-ease-in-out) infinite;
}

/* Focus pulse for keyboard users (subtle accessibility flourish) */
:focus-visible{
  animation: ms-pulse-yellow 1.6s var(--ms-ease-in-out);
}

/* Cursor refinements */
.kpi-dial, .plan-tab, .dropdown-item, .chip{
  cursor: pointer;
}
.chip[draggable="true"]{
  cursor: grab;
}
.chip[draggable="true"]:active{
  cursor: grabbing;
}

/* Reduced-motion users disable the long-running animations */
@media (prefers-reduced-motion: reduce){
  .layout, .panel, .kpi-bar, .topbar,
  .modal-backdrop.active, .modal-backdrop.active .modal-card,
  .reports-overlay:not([hidden]),
  .dropdown-menu:not([hidden]),
  .brand, .toast.show, .plan-tab.active,
  [aria-busy="true"] .empty-state::before,
  :focus-visible{
    animation: none !important;
  }
  .btn::before{ display: none; }
}
/* === END MODERNIZATION COMMIT 3 === */


/* ================================================================
 * SPACESENSE MODERNIZATION LAYER — Commit 4: Typography scale-up
 * ----------------------------------------------------------------
 * Bumps font tokens, overrides legacy hard-coded sizes on the
 * highest-visibility elements (brand wordmark, panel titles, KPI
 * dials, menubar). Goal: make the UI read at arm's length.
 *
 * To revert: delete from this banner to the matching
 * `=== END MODERNIZATION COMMIT 4 ===` line.
 * ================================================================ */

:root{
  /* Token bumps — drive the migrated parts of the codebase that
     already read --fs-* variables. The plain-number overrides below
     handle the legacy hardcoded selectors. */
  --fs-caption: 11px;
  --fs-body:    13px;
  --fs-body-l:  14px;
  --fs-subhead: 15px;
  --fs-heading: 20px;
  --fs-display: 28px;
}

/* Body — larger base */
body{
  font-size: 14px;
  line-height: 1.5;
}

/* Brand wordmark — substantial, deliberate */
.brand{
  font-size: 24px;
  letter-spacing: 1.4px;
  line-height: 1.0;
}
.brand-sub{
  font-size: 11px;
  letter-spacing: 1.4px;
}

/* Menubar — readable */
.menubar-btn{
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* Primary CTA — Run Optimizer carries weight */
#runOptimizerBtn,
.btn.primary{
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 9px 16px;
}

/* Panel titles — clearly hierarchical */
.panel-title{
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  padding-top: 14px;
  padding-bottom: 14px;
}
.panel-title .small{ font-size: 12px; }

/* KPI dials — headline numbers should command attention */
.kpi-dial{
  padding: 12px 18px;
  gap: 4px;
}
.kpi-label{
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
}
.kpi-value{
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.kpi-sub{
  font-size: 11px;
}

/* Secondary KPI dials — still readable, just visually subordinate */
.kpi-dial-secondary{
  padding: 8px 14px;
}
.kpi-dial-secondary .kpi-label{ font-size: 10px; }
.kpi-dial-secondary .kpi-value{ font-size: 15px; font-weight: 700; }
.kpi-dial-secondary .kpi-sub  { font-size: 10px; }

/* Plan-tab strip — readable tab labels */
.plan-tab{ padding: 9px 14px; }
.plan-tab-label{ font-size: 13px; font-weight: 600; }
.plan-tab-kpi{ font-size: 12px; }
.plan-tab-strip-label{ font-size: 12px; font-weight: 600; }

/* State strip pills — bigger labels */
.state-pill-label{ font-size: 11px; }
.state-pill-value{ font-size: 13px; font-weight: 600; }

/* Scenario badge — readable */
.scenario-badge{
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 5px 12px;
}

/* Dropdown menu items — bigger click target & readability */
.dropdown-item{
  font-size: 13px;
  padding: 8px 14px;
  line-height: 1.35;
}

/* Tables in Reports overlay — bump up from 12px */
.reports-overlay table,
.reports-overlay td,
.reports-overlay th{
  font-size: 13px;
}
.reports-overlay th{ font-size: 11px; font-weight: 700; }

/* Cluster / dept / legend lists in left panel */
.deptname, .deptarea, .legend-item .legend-name{ font-size: 13px; }
.deptmeta, .legend-item .legend-metrics, .meta{ font-size: 12px; }
.meta2{ font-size: 11px; }

/* Empty state — bigger so it doesn't look like dead space */
.empty-state{
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  color: rgba(207,217,227,.78);
  padding: 44px 24px;
}

/* Common cell metric font (used inside tables) */
.cell-metric{ font-size: 13px; }

/* Toast — readable popup */
.toast{ font-size: 13px; }
.toast-msg{ font-size: 13px; }

/* Buttons baseline */
.btn{ font-size: 13px; font-weight: 600; }
.btn-small{ font-size: 12px; }

/* Headings inside modal cards */
.modal-card h2{ font-size: 18px; }
.modal-card h3{ font-size: 15px; }
/* === END MODERNIZATION COMMIT 4 === */


/* ================================================================
 * SPACESENSE MODERNIZATION LAYER — Commit 5: Icon system
 * ----------------------------------------------------------------
 * Inline Lucide-style SVG icons applied via CSS mask-image. No new
 * markup; the only JS change (app.js renderKPIBar) emits `data-kpi`
 * attributes on each dial so this CSS can target them by role.
 *
 * Icons live as data-URIs in mask-image so we can recolour them via
 * background-color without touching SVG source.
 *
 * To revert: delete from this banner to the matching
 * `=== END MODERNIZATION COMMIT 5 ===` line AND drop the
 * `data-kpi="…"` attributes in app.js (cosmetic, won't break runtime).
 * ================================================================ */

/* Shared icon utility — only emitted on elements we explicitly target,
   so a stray .panel-title without an --icon doesn't render a coloured
   square. Use --icon to set the glyph, --icon-color to tint, --icon-size
   to scale. */
.menubar-btn[data-dropdown-toggle]::before,
.panel.left .panel-title .panel-title-left::before,
.panel.center .panel-title > div:first-child::before,
.kpi-dial[data-kpi]::before,
#runOptimizerBtn::before{
  content: "";
  display: inline-block;
  width: var(--icon-size, 16px);
  height: var(--icon-size, 16px);
  margin-right: 8px;
  vertical-align: -3px;
  background-color: var(--icon-color, var(--spacesense-yellow));
  -webkit-mask-image: var(--icon);
          mask-image: var(--icon);
  -webkit-mask-size: contain;
          mask-size: contain;
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-position: center;
          mask-position: center;
  transition: background-color var(--ms-d-fast) var(--ms-ease-out);
  flex-shrink: 0;
}

/* ===== Menubar icons ===== */
[data-dropdown-toggle="menuProject"]{
  --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 14 1.45-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.55 6a2 2 0 0 1-1.94 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.93a2 2 0 0 1 1.66.9l.82 1.2a2 2 0 0 0 1.66.9H18a2 2 0 0 1 2 2v2'/></svg>");
}
[data-dropdown-toggle="menuPlan"]{
  --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polygon points='12 2 2 7 12 12 22 7 12 2'/><polyline points='2 17 12 22 22 17'/><polyline points='2 12 12 17 22 12'/></svg>");
}
[data-dropdown-toggle="menuView"]{
  --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z'/><circle cx='12' cy='12' r='3'/></svg>");
}
[data-dropdown-toggle="menuRun"]{
  --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polygon points='13 2 3 14 12 14 11 22 21 10 12 10 13 2'/></svg>");
}
[data-dropdown-toggle="menuReports"]{
  --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 3v18h18'/><path d='M18 17V9'/><path d='M13 17V5'/><path d='M8 17v-3'/></svg>");
}
[data-dropdown-toggle="menuHelp"]{
  --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><path d='M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3'/><line x1='12' x2='12.01' y1='17' y2='17'/></svg>");
}

/* ===== Run Optimizer primary CTA — sparkles, slightly larger ===== */
#runOptimizerBtn{
  --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.582a.5.5 0 0 1 0 .962L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z'/><path d='M20 3v4'/><path d='M22 5h-4'/><path d='M4 17v2'/><path d='M5 18H3'/></svg>");
  --icon-size: 18px;
}

/* ===== Panel-title icons (kept inline-block to preserve flex layout) ===== */
.panel.left .panel-title .panel-title-left{
  --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='16' y='16' width='6' height='6' rx='1'/><rect x='2' y='16' width='6' height='6' rx='1'/><rect x='9' y='2' width='6' height='6' rx='1'/><path d='M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3'/><path d='M12 12V8'/></svg>");
}
.panel.left .panel-title .panel-title-left::before{
  --icon-size: 18px;
  vertical-align: -4px;
}

.panel.center .panel-title > div:first-child{
  --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polygon points='3 6 9 3 15 6 21 3 21 18 15 21 9 18 3 21'/><line x1='9' x2='9' y1='3' y2='18'/><line x1='15' x2='15' y1='6' y2='21'/></svg>");
}
.panel.center .panel-title > div:first-child::before{
  --icon-size: 18px;
  vertical-align: -4px;
}

/* ===== KPI dial icons — positioned in top-right corner ===== */
.kpi-dial[data-kpi]::before{
  --icon-size: 14px;
  position: absolute;
  top: 12px;
  right: 12px;
  margin-right: 0;
  opacity: 0.55;
  transition: opacity var(--ms-d-fast) var(--ms-ease-out),
              background-color var(--ms-d-fast) var(--ms-ease-out);
}
.kpi-dial[data-kpi]:hover::before{ opacity: 1; }
.kpi-dial-secondary[data-kpi]::before{ --icon-size: 12px; top: 8px; right: 10px; }

.kpi-dial[data-kpi="demand"]{
  --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><circle cx='12' cy='12' r='3'/></svg>");
}
.kpi-dial[data-kpi="allocated"]{
  --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M22 11.08V12a10 10 0 1 1-5.93-9.14'/><path d='m9 11 3 3L22 4'/></svg>");
  --icon-color: var(--good, #6bff95);
}
.kpi-dial[data-kpi="unallocated"]{
  --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><line x1='12' x2='12' y1='8' y2='12'/><line x1='12' x2='12.01' y1='16' y2='16'/></svg>");
  --icon-color: var(--warn, #ffd060);
}
.kpi-dial[data-kpi="floors"]{
  --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z'/><path d='M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2'/><path d='M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2'/><path d='M10 6h4'/><path d='M10 10h4'/><path d='M10 14h4'/><path d='M10 18h4'/></svg>");
}
.kpi-dial[data-kpi="cmf"]{
  --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2'/><circle cx='9' cy='7' r='4'/><path d='M22 21v-2a4 4 0 0 0-3-3.87'/><path d='M16 3.13a4 4 0 0 1 0 7.75'/></svg>");
}
.kpi-dial[data-kpi="orScore"]{
  --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m12 14 4-4'/><path d='M3.34 19a10 10 0 1 1 17.32 0'/></svg>");
}
.kpi-dial[data-kpi="solver"]{
  --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect width='16' height='16' x='4' y='4' rx='2'/><rect width='6' height='6' x='9' y='9' rx='1'/><path d='M15 2v2'/><path d='M15 20v2'/><path d='M2 15h2'/><path d='M2 9h2'/><path d='M20 15h2'/><path d='M20 9h2'/><path d='M9 2v2'/><path d='M9 20v2'/></svg>");
}
.kpi-dial[data-kpi="conflicts"]{
  --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z'/><line x1='12' x2='12' y1='9' y2='13'/><line x1='12' x2='12.01' y1='17' y2='17'/></svg>");
}
.kpi-dial[data-kpi="coverage"]{
  --icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><circle cx='12' cy='12' r='6'/><circle cx='12' cy='12' r='2'/></svg>");
}

/* Make .kpi-dial position:relative so the absolute icon anchors right. */
.kpi-dial{ position: relative; }

/* Hide icon if --icon var is unset (graceful fallback) */
.kpi-dial:not([data-kpi])::before{ display: none; }

/* ===== Empty state — replace the abstract dot with a real icon ===== */
.empty-state{ position: relative; }
.empty-state::before{
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, rgba(242,193,46,.22), rgba(242,193,46,.04) 60%, transparent 75%),
    rgba(63,90,108,.18);
  box-shadow:
    inset 0 0 0 1px rgba(242,193,46,.22),
    0 8px 24px rgba(0,0,0,.32);
}
.empty-state::after{
  content: "";
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 32px;
  background-color: var(--spacesense-yellow);
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><polygon points='12 2 2 7 12 12 22 7 12 2'/><polyline points='2 17 12 22 22 17'/><polyline points='2 12 12 17 22 12'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><polygon points='12 2 2 7 12 12 22 7 12 2'/><polyline points='2 17 12 22 22 17'/><polyline points='2 12 12 17 22 12'/></svg>");
  -webkit-mask-size: contain;
          mask-size: contain;
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  pointer-events: none;
}

/* Menubar buttons — keep label on one line so the icon doesn't wrap */
.menubar-btn{ white-space: nowrap; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce){
  .menubar-btn::before,
  .kpi-dial::before,
  .panel-title::before,
  #runOptimizerBtn::before{ transition: none !important; }
}
/* === END MODERNIZATION COMMIT 5 === */


/* ================================================================
 * SPACESENSE MODERNIZATION LAYER — Commit 6: Palette lift
 * ----------------------------------------------------------------
 * Shifts the surface palette from near-black to a navy-dominant set.
 *
 *   Base    #0b0f14 → #131e2a   (deeper navy, not black)
 *   Panel   #111822 → #243443   (lifted panel surface)
 *   Panel2  #0f1620 → #1c2a38   (slight contrast for gradient ends)
 *   Line    #223041 → #3a526b   (visible navy border)
 *   Muted   #9fb0c0 → #b3c2d1   (slightly higher contrast on lighter bg)
 *   Muted2  #7f94a7 → #94a5b8
 *
 * Strategy: override the :root tokens at file tail AND retarget the
 * highest-visibility selectors that hardcode the old dark values
 * (body gradient, topbar, panels, buttons, segmented controls,
 * KPI bar, dropdowns, modal cards, scenario badge, scrollbar
 * thumbs). Translucent `rgba(0,0,0,X)` overlays elsewhere now read
 * as gentle tonal modifiers on top of the navy base — no change
 * needed for those.
 *
 * To revert: delete from this banner to the matching
 * `=== END MODERNIZATION COMMIT 6 ===` line.
 * ================================================================ */

:root{
  --bg:       #131e2a;
  --panel:    #243443;
  --panel2:   #1c2a38;
  --line:     #3a526b;
  --muted:    #b3c2d1;
  --muted2:   #94a5b8;
  --surface-tint: rgba(255,255,255,.04);
  /* Slightly stronger shadow against the lighter base */
  --shadow: 0 10px 28px rgba(7, 12, 20, .55);
}

/* Body — navy base under the existing brand wash */
body{
  background:
    radial-gradient(ellipse 1200px 820px at 12% -10%, rgba(63,90,108,.34), transparent 60%),
    radial-gradient(ellipse 900px 620px at 96% 108%, rgba(242,193,46,.08), transparent 65%),
    linear-gradient(180deg, #0d1722 0%, #131e2a 100%);
  background-attachment: fixed;
}

/* Topbar — glass over navy, not glass over black */
.topbar{
  background: linear-gradient(180deg, rgba(28,42,56,.78), rgba(28,42,56,.62));
  border-bottom: 1px solid rgba(63,90,108,.55);
}

/* Panels — navy surfaces */
.panel{
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  border: 1px solid rgba(63,90,108,.45);
}
.panel-title{
  background: linear-gradient(180deg, rgba(63,90,108,.30), rgba(63,90,108,.08));
  border-bottom: 1px solid rgba(63,90,108,.40);
}

/* KPI bar — sits on a slightly different navy tone for separation */
.kpi-bar{
  background:
    linear-gradient(180deg, rgba(63,90,108,.18), rgba(63,90,108,.06));
  border-bottom: 1px solid rgba(63,90,108,.40);
  border-top:    1px solid rgba(63,90,108,.30);
}
.kpi-dial{
  background:
    linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.00)),
    var(--panel2);
  border-right: 1px solid rgba(63,90,108,.28);
}
.kpi-dial-secondary{
  background:
    linear-gradient(180deg, rgba(63,90,108,.20), rgba(63,90,108,.08));
}

/* Buttons — base + segmented controls */
.btn{
  background: linear-gradient(180deg, #2c3e50, #243443);
  border: 1px solid rgba(63,90,108,.55);
  color: var(--text-strong);
}
.btn:hover:not(:disabled){
  background: linear-gradient(180deg, #344a60, #283a4a);
  border-color: rgba(242,193,46,.50);
}
.btn:disabled{ opacity: .50; }

/* Run Optimizer primary CTA — yellow accent so it actually pops */
#runOptimizerBtn,
.btn.primary{
  background: linear-gradient(180deg, rgba(242,193,46,.95), rgba(216,164,16,.95));
  border: 1px solid rgba(242,193,46,.85);
  color: #1a1408;
  box-shadow:
    0 2px 0 rgba(216,164,16,.4) inset,
    0 6px 16px rgba(242,193,46,.22);
}
#runOptimizerBtn:hover:not(:disabled),
.btn.primary:hover:not(:disabled){
  background: linear-gradient(180deg, #ffd24a, #e8b020);
  border-color: rgba(242,193,46,1);
  box-shadow:
    0 2px 0 rgba(216,164,16,.4) inset,
    0 10px 22px rgba(242,193,46,.32);
}
#runOptimizerBtn:disabled,
.btn.primary:disabled{
  background: linear-gradient(180deg, rgba(63,90,108,.70), rgba(40,58,75,.70));
  color: rgba(207,217,227,.55);
  border-color: rgba(63,90,108,.55);
  box-shadow: none;
}
/* Sparkle icon on the primary CTA needs to read against the yellow fill */
#runOptimizerBtn::before{
  background-color: #1a1408;
}
#runOptimizerBtn:disabled::before{
  background-color: rgba(207,217,227,.55);
}

/* Segmented controls / .seg */
.seg{ background: #243443; color: var(--muted); }
.seg.active{ background: #2f4660; color: var(--text-strong); }

/* Dropdown menus — navy glass */
.dropdown-menu{
  background: linear-gradient(180deg, rgba(36,52,67,.96), rgba(28,42,56,.96));
  border: 1px solid rgba(63,90,108,.55);
}
.menubar-btn:hover{
  background: rgba(242,193,46,.10);
  border-color: rgba(242,193,46,.30);
}
.menubar-btn[aria-expanded="true"]{
  background: rgba(242,193,46,.18);
  border-color: rgba(242,193,46,.45);
}

/* Modal cards — match panel tone */
.modal-card{
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  border: 1px solid rgba(63,90,108,.55);
}

/* Scenario badge — sits on the topbar, brighter navy fill */
.scenario-badge{
  background: linear-gradient(180deg, rgba(63,90,108,.70), rgba(47,70,94,.55));
  border: 1px solid rgba(63,90,108,.75);
  color: #ffffff;
}

/* Reports overlay — navy panel */
.reports-overlay{
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  border: 1px solid rgba(63,90,108,.55);
}

/* Toasts — navy base, not black */
.toast{
  background: linear-gradient(180deg, rgba(36,52,67,.95), rgba(28,42,56,.92));
  border: 1px solid rgba(63,90,108,.55);
  color: var(--text-strong);
}

/* Scrollbar thumbs — match new palette */
*::-webkit-scrollbar-thumb{
  background: linear-gradient(180deg, rgba(63,90,108,.70), rgba(63,90,108,.45));
  background-clip: padding-box;
}

/* Input fields — readable on lighter base */
input, select, textarea, .search{
  background: rgba(13,23,34,.65);
  border: 1px solid rgba(63,90,108,.55);
  color: var(--text);
}
input::placeholder{ color: rgba(180,194,209,.55); }

/* Subtle inset highlight at the very top of each panel — adds depth
   when the surrounding bg is lighter and panels don't naturally
   detach as much from it. */
.panel{
  box-shadow:
    var(--ms-sh-2),
    inset 0 1px 0 rgba(255,255,255,.06);
}
/* === END MODERNIZATION COMMIT 6 === */


/* ================================================================
 * SPACESENSE MODERNIZATION LAYER — Commit 7: Hero mark + entrance
 * ----------------------------------------------------------------
 * Adds a custom SVG pictogram to the left of the SPACESENSE
 * wordmark (three stacked floor blocks — matches the app metaphor)
 * and re-orchestrates the page-load entrance so the UI assembles
 * itself with deliberate staging rather than a single fade.
 *
 * To revert: delete from this banner to the matching
 * `=== END MODERNIZATION COMMIT 7 ===` line.
 * ================================================================ */

/* Brand wrap — restructure to a 2-col grid (icon + text stack) */
.brand-wrap{
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 2px;
  align-items: center;
}
.brand-wrap::before{
  content: "";
  grid-column: 1;
  grid-row: 1 / span 2;
  width: 40px;
  height: 40px;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'><defs><linearGradient id='y' x1='0' x2='0' y1='0' y2='1'><stop offset='0' stop-color='%23F2C12E'/><stop offset='1' stop-color='%23D8A410'/></linearGradient><linearGradient id='n' x1='0' x2='0' y1='0' y2='1'><stop offset='0' stop-color='%234E6F86'/><stop offset='1' stop-color='%233F5A6C'/></linearGradient></defs><rect x='4' y='28' width='32' height='8' rx='1.6' fill='url(%23y)'/><rect x='7' y='18.5' width='26' height='7' rx='1.4' fill='url(%23n)'/><rect x='10' y='9' width='20' height='7' rx='1.4' fill='url(%23y)' opacity='0.88'/><circle cx='14' cy='31.5' r='0.9' fill='%231a1408' opacity='0.75'/><circle cx='18' cy='31.5' r='0.9' fill='%231a1408' opacity='0.75'/><circle cx='22' cy='31.5' r='0.9' fill='%231a1408' opacity='0.75'/><circle cx='26' cy='31.5' r='0.9' fill='%231a1408' opacity='0.75'/><circle cx='30' cy='31.5' r='0.9' fill='%231a1408' opacity='0.75'/><circle cx='15' cy='22' r='0.7' fill='%23E6EDF3' opacity='0.55'/><circle cx='20' cy='22' r='0.7' fill='%23E6EDF3' opacity='0.55'/><circle cx='25' cy='22' r='0.7' fill='%23E6EDF3' opacity='0.55'/><circle cx='17' cy='12.5' r='0.7' fill='%231a1408' opacity='0.6'/><circle cx='23' cy='12.5' r='0.7' fill='%231a1408' opacity='0.6'/></svg>");
  background-repeat: no-repeat;
  background-size: contain;
  filter: drop-shadow(0 2px 4px rgba(242,193,46,.30));
}
.brand{ grid-column: 2; grid-row: 1; }
.brand-sub{ grid-column: 2; grid-row: 2; }

/* Scenario badge — keep on its own row underneath (spans both cols) */
#scenarioBadge.scenario-badge{
  grid-column: 1 / span 2;
  grid-row: 3;
  margin-top: 4px;
  justify-self: start;
}

/* Hero mark entrance — drop-in + tiny build-up bounce */
@keyframes ms-mark-build{
  0%   { opacity: 0; transform: translateY(-8px) scale(.85); }
  60%  { opacity: 1; transform: translateY(2px)  scale(1.04); }
  100% { opacity: 1; transform: translateY(0)    scale(1); }
}
.brand-wrap::before{
  animation: ms-mark-build 700ms var(--ms-ease-out) both;
  animation-delay: 80ms;
}

/* Wordmark + sub entrance — slide in after the mark lands */
@keyframes ms-text-rise{
  from{ opacity: 0; transform: translateX(-6px); }
  to{   opacity: 1; transform: translateX(0); }
}
.brand     { animation: ms-text-rise 500ms var(--ms-ease-out) 380ms both; }
.brand-sub { animation: ms-text-rise 500ms var(--ms-ease-out) 480ms both; }

/* Menubar staggered cascade */
@keyframes ms-fall{
  from{ opacity: 0; transform: translateY(-6px); }
  to{   opacity: 1; transform: translateY(0); }
}
.menubar-entry:nth-child(1) .menubar-btn{ animation: ms-fall 380ms var(--ms-ease-out)  580ms both; }
.menubar-entry:nth-child(2) .menubar-btn{ animation: ms-fall 380ms var(--ms-ease-out)  640ms both; }
.menubar-entry:nth-child(3) .menubar-btn{ animation: ms-fall 380ms var(--ms-ease-out)  700ms both; }
.menubar-entry:nth-child(4) .menubar-btn{ animation: ms-fall 380ms var(--ms-ease-out)  760ms both; }
.menubar-entry:nth-child(5) .menubar-btn{ animation: ms-fall 380ms var(--ms-ease-out)  820ms both; }
.menubar-entry:nth-child(6) .menubar-btn{ animation: ms-fall 380ms var(--ms-ease-out)  880ms both; }

/* Run Optimizer CTA — lands last, with a gentle pop */
@keyframes ms-cta-pop{
  0%   { opacity: 0; transform: scale(.85); }
  60%  { opacity: 1; transform: scale(1.06); }
  100% { opacity: 1; transform: scale(1); }
}
.primary-action #runOptimizerBtn{
  animation: ms-cta-pop 600ms var(--ms-ease-out) 940ms both;
}

/* KPI bar fades in slightly later so the eye reaches it after
   the topbar settles. */
.kpi-bar{
  animation: ms-fade-in var(--ms-d-slow) var(--ms-ease-out) 300ms both;
}

/* Reduced motion — disable the entrance choreography */
@media (prefers-reduced-motion: reduce){
  .brand-wrap::before,
  .brand, .brand-sub,
  .menubar-entry .menubar-btn,
  .primary-action #runOptimizerBtn,
  .kpi-bar{
    animation: none !important;
  }
}
/* === END MODERNIZATION COMMIT 7 === */


/* ================================================================
 * SPACESENSE MODERNIZATION LAYER — Commit 8: Louder animations
 * ----------------------------------------------------------------
 * Bumps the brand wordmark sheen, adds an "available CTA" pulse to
 * the Run Optimizer button when it's enabled, gives the KPI value
 * gradient a slow sweep so the dials look alive at rest, and
 * energises the active plan-tab underline glow.
 *
 * Reduced-motion users get all of these disabled.
 *
 * To revert: delete from this banner to EOF.
 * ================================================================ */

/* Brand wordmark sheen — louder + faster */
@keyframes ms-brand-sheen-loud{
  0%   { background-position: 200% 0; }
  45%  { background-position: -200% 0; }
  100% { background-position: -200% 0; }
}
.brand{
  background:
    linear-gradient(90deg,
      #ffffff 0%,
      #d4dde6 25%,
      var(--spacesense-yellow) 45%,
      #ffd76b 50%,
      var(--spacesense-yellow) 55%,
      #d4dde6 75%,
      #ffffff 100%
    );
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: ms-brand-sheen-loud 9s var(--ms-ease-in-out) infinite;
  animation-delay: 1500ms; /* wait until entrance choreography settles */
}

/* Run Optimizer "ready to use" pulse — only fires when the button
   is enabled, so a disabled state stays quiet. */
@keyframes ms-cta-pulse{
  0%, 100%{
    box-shadow:
      0 2px 0 rgba(216,164,16,.4) inset,
      0 6px 16px rgba(242,193,46,.22),
      0 0 0 0 rgba(242,193,46,.50);
  }
  50%{
    box-shadow:
      0 2px 0 rgba(216,164,16,.4) inset,
      0 8px 22px rgba(242,193,46,.34),
      0 0 0 10px rgba(242,193,46,0);
  }
}
#runOptimizerBtn:not(:disabled){
  animation:
    ms-cta-pop 600ms var(--ms-ease-out) 940ms both,
    ms-cta-pulse 2400ms var(--ms-ease-in-out) 1600ms infinite;
}
#runOptimizerBtn:not(:disabled):hover{
  animation: none;          /* hover takes over with its own state */
  transform: translateY(-1px);
}

/* KPI value text — slow gradient sweep so the dials breathe */
@keyframes ms-kpi-sweep{
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.kpi-value{
  background:
    linear-gradient(90deg,
      #ffffff 0%,
      #f0f5fb 35%,
      #ffffff 50%,
      #f0f5fb 65%,
      #ffffff 100%
    );
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: ms-kpi-sweep 8s var(--ms-ease-in-out) infinite;
}

/* Active plan-tab underline — louder glow breath */
@keyframes ms-tab-glow-loud{
  0%, 100%{ box-shadow: 0 0 8px  rgba(242,193,46,.55), 0 0 14px rgba(242,193,46,.20); }
  50%     { box-shadow: 0 0 14px rgba(242,193,46,.85), 0 0 26px rgba(242,193,46,.45); }
}
.plan-tab.active::after{
  animation: ms-tab-glow-loud 2.4s var(--ms-ease-in-out) infinite;
}

/* (Topbar scan-line idea removed — would have required overflow:hidden
   on .topbar which clips floating dropdown menus.) */

/* Hero pictogram — gentle continuous bob after entrance */
@keyframes ms-mark-bob{
  0%, 100%{ transform: translateY(0); }
  50%     { transform: translateY(-2px); }
}
.brand-wrap::before{
  /* layer entrance + bob; the bob takes over after the build-up */
  animation:
    ms-mark-build 700ms var(--ms-ease-out) 80ms both,
    ms-mark-bob 4.5s var(--ms-ease-in-out) 1500ms infinite;
}

/* Reduced motion — kill the loud ongoing animations */
@media (prefers-reduced-motion: reduce){
  .brand,
  #runOptimizerBtn:not(:disabled),
  .kpi-value,
  .plan-tab.active::after,
  .brand-wrap::before{
    animation: none !important;
  }
}
/* === END MODERNIZATION COMMIT 8 === */


/* ================================================================
 * SPACESENSE MODERNIZATION LAYER — Commit 9: Declutter
 * ----------------------------------------------------------------
 * Visual declutter pass on top of the previous arc. Pure CSS, no
 * HTML or JS contracts touched. Reclaims ~140px of vertical chrome
 * by slimming the topbar + state strip, and removes visual noise
 * (per-row ⋯ ▸ buttons, "Drag from left → drop on map" hint) by
 * hiding it until hover.
 *
 * Wins:
 *   - Topbar height ~95px → ~64px (smaller pictogram + tighter brand stack)
 *   - State strip ~50px → ~32px (compact pills, hides duplicate SOURCE)
 *   - Cluster rows: ⋯ + ▸ fade in on hover only
 *   - Center panel: "Drag from left" ghost text removed
 *   - SCENARIO pill gets a green "live data" dot
 *
 * To revert this commit only: delete from this banner to the
 * matching `=== END MODERNIZATION COMMIT 9 ===` line.
 * ================================================================ */

/* ---- Topbar slim ------------------------------------------------- */
/* Tighter vertical padding and a smaller hero pictogram. The
   modernization arc bumped .brand to 24px; we pull it back to 18px
   so the topbar reads as a chrome strip, not a hero band. */
.topbar{
  padding-top: 4px !important;
  padding-bottom: 4px !important;
  min-height: 0;
}

.brand{
  font-size: 18px !important;
  padding-bottom: 2px !important;
  border-bottom-width: 2px !important;
}

.brand-sub{
  font-size: 10px !important;
  letter-spacing: 0.4px;
  opacity: 0.75;
}

.brand-wrap::before{
  width: 32px !important;
  height: 32px !important;
}

/* Tighten the grid gap on .brand-wrap so the icon + text stack
   sits closer together. */
.brand-wrap{
  column-gap: 10px !important;
  row-gap: 0 !important;
}

/* ---- State strip slim ------------------------------------------- */
/* Compact the source / scenario / last-run pills into a thinner
   secondary strip. Hide the SOURCE pill — it consistently duplicates
   the scenario id and just eats horizontal space. */
.state-strip{
  padding: 5px 16px !important;
  gap: 6px 10px !important;
  font-size: 11px !important;
}

/* Drop the SOURCE pill — first .state-pill child is "Source". */
.state-strip .state-pill:first-child{
  display: none !important;
}

.state-pill{
  padding: 3px 10px 3px 8px !important;
  background: rgba(91,214,255,.04) !important;
  border-color: rgba(91,214,255,.14) !important;
  gap: 6px !important;
}

.state-pill-label{
  font-size: 9px !important;
  letter-spacing: 1.4px !important;
}

.state-pill-value{
  font-size: 11px !important;
  font-weight: 600 !important;
}

/* SCENARIO pill — green "live data" dot on the left.
   The pill order is fixed by index.html: Source / Scenario / Last run,
   and we just hid Source, so the SCENARIO pill is now the first
   visible .state-pill in the strip. */
.state-strip .state-pill:nth-of-type(2)::before{
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3DD17A;
  box-shadow: 0 0 0 2px rgba(61,209,122,0.18);
  flex: 0 0 auto;
}

/* ---- Cluster row hover-fade ⋯ ▸ ---------------------------------- */
/* Hide cluster-toggle (▸) and cluster-menu (⋯) until the row is
   hovered, focus-within, or has a menu open. Keeps them keyboard-
   accessible (focus reveals them) while removing the per-row visual
   noise that was making the sidebar feel busy. */
.cluster-head .cluster-toggle,
.cluster-head .cluster-menu,
.cluster-head .comp-menu{
  opacity: 0.18;
  transition: opacity 180ms var(--ms-ease-out, ease);
}
.cluster-head:hover .cluster-toggle,
.cluster-head:hover .cluster-menu,
.cluster-head:hover .comp-menu,
.cluster-head:focus-within .cluster-toggle,
.cluster-head:focus-within .cluster-menu,
.cluster-head:focus-within .comp-menu{
  opacity: 1;
}

/* Reduced motion — kill the opacity transition. */
@media (prefers-reduced-motion: reduce){
  .cluster-head .cluster-toggle,
  .cluster-head .cluster-menu,
  .cluster-head .comp-menu{
    transition: none !important;
  }
}

/* ---- Center panel: hide "Drag from left → drop on map" ghost ---- */
/* The hint is helpful first-time but turns into permanent visual
   noise. Removed from the panel title; .panel.center > .panel-title
   > .muted is the targeted span. */
.panel.center > .panel-title .muted{
  display: none;
}

/* === END MODERNIZATION COMMIT 9 === */


/* ================================================================
 * SPACESENSE MODERNIZATION LAYER — Commit 10: Hero-the-vacancy
 * ----------------------------------------------------------------
 * Three additions:
 *
 *  A. Annual Saving primary KPI dial — brand-yellow value, sits
 *     between Unallocated and Active Floors. JS in app.js handles
 *     fallback states (baseline plan, missing data, pre-run).
 *
 *  B. Vacant cell tint — cells on an optimised plan with zero
 *     chips get a yellow-hatched overlay and "VACANT" label.
 *     Overlay uses pointer-events: none so drag-drop into the
 *     cell continues to land normally; the .cell-vacant-opt class
 *     is removed automatically when a chip is dropped (renderMap
 *     re-runs and re-evaluates floorStats().used). Skipped
 *     entirely on the Existing baseline tab.
 *
 *  C. Diagnostics collapse — toggle button hides/shows the
 *     secondary KPI strip (OR Score / Solver / Conflicts /
 *     Coverage). Default = expanded; state persists in
 *     localStorage.
 *
 * To revert this commit only: delete from this banner to the
 * matching `=== END MODERNIZATION COMMIT 10 ===` line. App still
 * runs — JS reads localStorage / classList safely whether the
 * CSS is present or not.
 * ================================================================ */

/* ---- A. Annual Saving hero dial --------------------------------- */
/* Brand-yellow accent so the seminar audience reads it as the hero
   number. Subtle glow on the value, slightly heavier border. */
.kpi-dial[data-kpi="annualSaving"]{
  position: relative;
  background:
    linear-gradient(180deg, rgba(242,193,46,0.07), rgba(242,193,46,0.02)) ,
    var(--panel2);
  border-color: rgba(242,193,46,0.30);
}
.kpi-dial[data-kpi="annualSaving"] .kpi-label{
  color: var(--spacesense-yellow);
  letter-spacing: 1.6px;
}
.kpi-dial[data-kpi="annualSaving"] .kpi-value{
  text-shadow: 0 0 22px rgba(242,193,46,0.25);
  font-weight: 800;
}
/* Top edge accent line in brand yellow */
.kpi-dial[data-kpi="annualSaving"]::before{
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg,
    rgba(242,193,46,0.0),
    rgba(242,193,46,0.85) 50%,
    rgba(242,193,46,0.0));
  pointer-events: none;
}

/* ---- B. Vacant cell tint ---------------------------------------- */
/* Yellow wash + dashed border + "VACANT" badge for empty cells on
   an optimised plan. The overlay uses pointer-events: none so
   drag-and-drop still hits the cell underneath. */
.cell.cell-vacant-opt{
  background:
    repeating-linear-gradient(
      135deg,
      rgba(242,193,46,0.05) 0,
      rgba(242,193,46,0.05) 10px,
      rgba(242,193,46,0.10) 10px,
      rgba(242,193,46,0.10) 20px
    ),
    var(--panel);
  border-color: rgba(242,193,46,0.32) !important;
  box-shadow:
    inset 0 0 0 1px rgba(242,193,46,0.12),
    inset 0 0 24px rgba(242,193,46,0.06);
}

/* "VACANT" badge overlay — sits in the center of the cell, fades
   in on render so it doesn't compete with chip placement transitions. */
.cell.cell-vacant-opt::after{
  content: "VACANT";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, calc(-50% + 8px));
  font-family: -apple-system, "Inter", "Helvetica Neue", sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2.5px;
  color: var(--spacesense-yellow);
  background: rgba(242,193,46,0.12);
  border: 1px solid rgba(242,193,46,0.40);
  border-radius: 999px;
  padding: 3px 12px;
  pointer-events: none;
  opacity: 0.85;
  animation: ms-vacant-fade-in 400ms var(--ms-ease-out, ease) both;
}
.cell.cell-vacant-opt{ position: relative; }

@keyframes ms-vacant-fade-in{
  from{ opacity: 0; transform: translate(-50%, calc(-50% + 14px)); }
  to{   opacity: 0.85; transform: translate(-50%, calc(-50% + 8px)); }
}

/* Drop-target hover override — when user drags a chip over a vacant
   cell, suppress the yellow wash so the drop highlight stands out. */
.cell.cell-vacant-opt.drop-ok{
  background: rgba(91,214,255,0.08) !important;
}
.cell.cell-vacant-opt.drop-ok::after{
  opacity: 0.25;
}

/* Reduced motion — no fade-in. */
@media (prefers-reduced-motion: reduce){
  .cell.cell-vacant-opt::after{ animation: none !important; }
}

/* ---- C. Diagnostics collapse ----------------------------------- */
/* Toggle button sits above the secondary row. When collapsed, the
   secondary row is removed from layout (display:none) so the page
   reclaims that vertical space. */
.kpi-diagnostics-wrap{
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.kpi-diag-toggle{
  align-self: flex-end;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}
.kpi-diag-toggle:hover{
  color: var(--spacesense-yellow);
  border-color: rgba(242,193,46,0.40);
  background: rgba(242,193,46,0.04);
}
.kpi-diag-toggle:focus-visible{
  outline: 2px solid var(--spacesense-yellow);
  outline-offset: 2px;
}

.kpi-diagnostics-wrap[data-collapsed="true"] .kpi-secondary{
  display: none;
}

/* When expanded, give the secondary row a soft top divider so it
   feels visually attached to the toggle. */
.kpi-diagnostics-wrap[data-collapsed="false"] .kpi-secondary{
  border-top: 1px dashed rgba(255,255,255,0.06);
  padding-top: 8px;
}

/* === END MODERNIZATION COMMIT 10 === */


/* ================================================================
 * SPACESENSE MODERNIZATION LAYER — Commit 11: Mockup alignment
 * ----------------------------------------------------------------
 * Closes the visual gap between Commit 10 and the design mockup:
 *
 *   A. Allocated dial — inline "100%" pill (green / amber / muted)
 *      instead of a sub-text line.
 *   B. Active Floors dial — "X / Y" total + "N floors freed" sub
 *      in brand-yellow when on an optimised plan.
 *   C. Building column header — yellow "VACANT · N FLOORS" pill
 *      next to the building name when the optimiser has freed
 *      floors in that column.
 *   D. Vacant cell — second line "LEASE-EXIT CANDIDATE" below the
 *      VACANT badge on expanded (non-compact) cells. Compact cells
 *      keep the simpler single-word badge.
 *
 * To revert this commit only: delete from this banner to the
 * matching `=== END MODERNIZATION COMMIT 11 ===` line.
 * ================================================================ */

/* ---- A. Allocated inline pill ----------------------------------- */
.kpi-alloc-pill{
  display: inline-flex;
  align-items: center;
  margin-left: 10px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  vertical-align: middle;
  transform: translateY(-2px);
}
.kpi-alloc-pill.is-full{
  background: rgba(61,209,122,0.16);
  color: #5ee0a0;
  border: 1px solid rgba(61,209,122,0.30);
}
.kpi-alloc-pill.is-partial{
  background: rgba(255,177,66,0.15);
  color: #ffb142;
  border: 1px solid rgba(255,177,66,0.30);
}
.kpi-alloc-pill.is-empty{
  background: rgba(255,255,255,0.05);
  color: var(--muted);
  border: 1px solid rgba(255,255,255,0.10);
}

/* ---- B. Active Floors X/Y --------------------------------------- */
.kpi-floors-total{
  font-size: 0.6em;
  font-weight: 500;
  color: var(--muted);
  margin-left: 2px;
  letter-spacing: 0;
}

/* ---- C. Building column header VACANT pill ---------------------- */
.header-cell .header-cell-name{
  margin-right: 10px;
}
.building-vacant-pill{
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-family: -apple-system, "Inter", "Helvetica Neue", sans-serif;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  background: rgba(242,193,46,0.14);
  color: var(--spacesense-yellow);
  border: 1px solid rgba(242,193,46,0.35);
  vertical-align: middle;
  white-space: nowrap;
}

/* ---- D. Vacant cell two-line label (expanded only) -------------- */
/* Override the single-word "VACANT" badge for non-compact cells with
   a richer two-line label. Compact cells keep the compact badge. */
.cell.cell-vacant-opt:not(.compact)::after{
  content: "VACANT\A LEASE-EXIT CANDIDATE";
  white-space: pre;
  text-align: center;
  line-height: 1.55;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  padding: 6px 14px;
  border-radius: 8px;
}

/* === END MODERNIZATION COMMIT 11 === */


/* ================================================================
 * SPACESENSE MODERNIZATION LAYER — Commit 12: Polish fixes
 * ----------------------------------------------------------------
 * Two real-world fixes from the first Vercel preview of Commits
 * 9–11:
 *
 *   A. Topbar wordmark was being clipped at the top because
 *      Commit 9 trimmed padding to 4px without giving the brand
 *      wordmark an explicit line-height. Adding `line-height: 1.2`
 *      to .brand and bumping topbar top-padding to 8px restores
 *      breathing room while still being much slimmer than the
 *      pre-modernization 14px.
 *
 *   B. (No CSS change; pure JS fix in app.js this commit.) The
 *      "VACANT · N FLOORS" pills and "X floors freed" sub were
 *      appearing on the Existing baseline tab because Commit 11
 *      checked `activePlanRunId === EXISTING_PLAN_ID` instead of
 *      `!activePlanRunId || === EXISTING_PLAN_ID`. Before any
 *      optimiser run, activePlanRunId is null (default), not
 *      EXISTING_PLAN_ID. The plan-tab UI already treats null as
 *      "Existing active" — we now match that semantics in
 *      renderKPIBar + renderMap.
 *
 * To revert this commit only: delete from this banner to the
 * matching `=== END MODERNIZATION COMMIT 12 ===` line and revert
 * the corresponding `Commit 12 fix:` lines in app.js.
 * ================================================================ */

/* ---- A. Topbar wordmark breathing room -------------------------- */
.topbar{
  padding-top: 8px !important;
  padding-bottom: 6px !important;
}

.brand{
  line-height: 1.2;
}

.brand-sub{
  line-height: 1.3;
}

/* === END MODERNIZATION COMMIT 12 === */


/* ================================================================
 * SPACESENSE MODERNIZATION LAYER — Commit 13: Round-1 polish
 * ----------------------------------------------------------------
 * Six small targeted fixes from the first deployed-Vercel review:
 *
 *   #1  VACANT badge — drop the "LEASE-EXIT CANDIDATE" second line.
 *       Lighter inset shadow on the cell wash.
 *   #2  Topbar wordmark clipping — more aggressive padding +
 *       overflow:visible. Wordmark now has real breathing room.
 *   #3  KPI dial icons bumped from 14→18px (primary) and 12→16px
 *       (secondary) so they read on a 1440p+ monitor.
 *   #4  Cell header simplified — F-label dropped, fill-bar dropped,
 *       text reads "0 / 709 sqm" only. (JS change in app.js.)
 *   #6  Menubar dropdown-toggle icons removed (menu items now
 *       text-only). The Run Optimizer sparkle icon is preserved.
 *   #16 Sub-menu visually distinct from menu — softer fill,
 *       brighter left border, larger indent.
 *
 * To revert this commit only: delete from this banner to the
 * matching `=== END MODERNIZATION COMMIT 13 ===` line and revert
 * the corresponding cell-header simplification in app.js
 * renderMap (~line 3752).
 * ================================================================ */

/* ---- #1. VACANT badge — single word + lighter shadow ------------ */
/* Override Commit 11's two-line label. */
.cell.cell-vacant-opt:not(.compact)::after{
  content: "VACANT";
  white-space: normal;
  text-align: center;
  line-height: 1;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2.5px;
  padding: 3px 14px;
  border-radius: 999px;
}
/* Softer ambient wash inside the cell — less heavy than Commit 10. */
.cell.cell-vacant-opt{
  box-shadow:
    inset 0 0 0 1px rgba(242,193,46,0.10),
    inset 0 0 12px rgba(242,193,46,0.04) !important;
}

/* ---- #2. Topbar wordmark breathing room (final fix) ------------- */
.topbar{
  padding-top: 12px !important;
  padding-bottom: 8px !important;
  overflow: visible !important;
}
.brand{
  line-height: 1.25;
  min-height: 22px;
}
.brand-sub{
  line-height: 1.4;
}
/* Pictogram down to 28px so the wordmark stack reads as the primary
   visual element, not the icon. */
.brand-wrap::before{
  width: 28px !important;
  height: 28px !important;
}

/* ---- #3. KPI icons larger --------------------------------------- */
.kpi-dial[data-kpi]::before{
  --icon-size: 18px !important;
  top: 10px;
  right: 12px;
  opacity: 0.65;
}
.kpi-dial-secondary[data-kpi]::before{
  --icon-size: 14px !important;
  top: 8px;
  right: 10px;
}
/* Panel-title icons get a small bump too — they were 18px, now 20px. */
.panel.left .panel-title .panel-title-left::before,
.panel.center .panel-title > div:first-child::before{
  --icon-size: 20px !important;
}

/* ---- #6. Remove menubar dropdown-toggle icons ------------------- */
/* Kills the per-menu Lucide-style icons (folder/layers/eye/zap/chart/
   help-circle). The Run Optimizer sparkle icon is untouched because
   it has its own selector. */
.menubar-btn[data-dropdown-toggle]::before{
  display: none !important;
}

/* ---- #16. Sub-menu visually distinct from menu ------------------ */
/* Currently the submenu content uses the same .dropdown-item class as
   top-level items, so they look identical apart from a faint left
   border. Lift the distinction with a softer background tint, larger
   indent, and a brand-yellow left edge. */
.dropdown-submenu-content{
  background: rgba(242,193,46,0.025);
  border-left: 2px solid rgba(242,193,46,0.32) !important;
  padding: 4px 0 4px 12px !important;
  margin: 4px 0 4px 14px !important;
  border-radius: 4px;
}
.dropdown-submenu-content .dropdown-item{
  font-size: 12.5px;
  color: var(--text-strong);
  padding-left: 14px;
}
.dropdown-submenu-content .dropdown-item:hover:not(:disabled){
  background: rgba(242,193,46,0.10);
  border-color: rgba(242,193,46,0.30);
}
/* Caret on the parent submenu item: brighter when open for visual feedback. */
.dropdown-submenu.open > .dropdown-item::after{
  color: var(--spacesense-yellow);
}

/* === END MODERNIZATION COMMIT 13 === */


/* ================================================================
 * SPACESENSE MODERNIZATION LAYER — Commit 14: Round-1 corrections
 * ----------------------------------------------------------------
 * Four corrections from second-pass review:
 *
 *   #4  Re-add the colored fill bar in expanded map cells. Commit
 *       13 removed it together with the F-label; user wanted only
 *       the redundant text removed, not the visual occupancy
 *       gauge. (JS change in app.js.)
 *   #16 corrected — the "menu vs sub-menu" feedback was about the
 *       *Reports overlay left sidebar* (Inputs / Outputs / Analysis
 *       section labels vs report-item buttons), not the topbar
 *       dropdown submenus. Lift the visual distinction with a
 *       brighter accent + extra spacing.
 *   #17 Compact-mode map cells: remove the floor-name + stats
 *       header (the left-column floor label already shows the
 *       F-label; the bar tooltip carries the stats). JS change in
 *       app.js.
 *   #18 Building column header "VACANT · N FLOORS" pill removed
 *       (revert of Commit 11 piece). Cell-level VACANT badges
 *       + Active Floors KPI already convey it. JS change in
 *       app.js. CSS for .building-vacant-pill is kept harmless
 *       (no element renders it).
 *
 * To revert this commit only: delete from this banner to the
 * matching `=== END MODERNIZATION COMMIT 14 ===` line.
 * ================================================================ */

/* ---- #16 corrected. Reports sidebar section vs item ------------ */
/* Section labels (Inputs / Outputs / Analysis) become more clearly
   "headers" — brand-yellow tint, larger letter-spacing, a top accent
   bar. Items get a quieter resting state so the contrast is real. */
.reports-sidebar-group{
  padding: 14px 0 12px !important;
}
.reports-sidebar-group + .reports-sidebar-group{
  border-top: 1px solid rgba(242,193,46,0.10) !important;
}
.reports-sidebar-title{
  margin: 0 0 10px 0 !important;
  padding: 4px 14px !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  letter-spacing: 2px !important;
  color: var(--spacesense-yellow) !important;
  position: relative;
}
.reports-sidebar-title::before{
  content: "";
  position: absolute;
  left: 14px;
  bottom: -4px;
  width: 22px;
  height: 2px;
  background: var(--spacesense-yellow);
  opacity: 0.55;
  border-radius: 2px;
}
.reports-sidebar-item{
  padding: 7px 14px !important;
  color: var(--muted) !important;
  transition: background 140ms ease, color 140ms ease, border-left-color 140ms ease;
}
.reports-sidebar-item:hover{
  color: var(--text-strong, #e8f4ff) !important;
}
.reports-sidebar-item.active{
  background: rgba(91,214,255,0.10);
  color: var(--text-strong, #e8f4ff) !important;
}

/* === END MODERNIZATION COMMIT 14 === */


/* ================================================================
 * SPACESENSE MODERNIZATION LAYER — Commit 16: Round-2a
 * ----------------------------------------------------------------
 * Two fixes:
 *
 *   #5 Open Scenario modal — soften card actions. Load button no
 *      longer "screams" yellow on every card; only the primary
 *      action of the active card uses brand-yellow. Delete button
 *      becomes a quiet text/border button (was filled red). Card
 *      padding/spacing tightened. (TEST_-prefix filter is in
 *      app.js renderCloudTabContent — Commit 16.)
 *
 *   #7 Allocations table — header lock-all checkbox replaces the
 *      "Unlock all" button. Standard select-all pattern (checked /
 *      indeterminate / unchecked). Styled to read as a single
 *      affordance next to the "Lock" column label. (Wiring in
 *      app.js renderLedger — Commit 16.)
 *
 * To revert this commit only: delete from this banner to the
 * matching `=== END MODERNIZATION COMMIT 16 ===` line and revert
 * the corresponding Commit 16 edits in app.js + index.html.
 * ================================================================ */

/* ---- #5. Open Scenario modal — quieter card actions ------------- */
.plan-card{
  padding: 12px 14px !important;
  gap: 12px !important;
}
.plan-card-actions{
  gap: 4px !important;
}
.plan-card-actions .btn{
  padding: 5px 12px !important;
  font-size: 12px !important;
}
/* Load button — quieter. Only ACTIVE plan-card uses bright yellow. */
.plan-card .scenario-action-load{
  background: rgba(255,255,255,0.04) !important;
  color: var(--text-strong) !important;
  border: 1px solid rgba(91,214,255,0.20) !important;
  font-weight: 600;
}
.plan-card .scenario-action-load:hover:not(:disabled){
  background: rgba(91,214,255,0.10) !important;
  border-color: rgba(91,214,255,0.40) !important;
}
.plan-card .scenario-action-load:disabled{
  background: rgba(61,209,122,0.10) !important;
  border-color: rgba(61,209,122,0.30) !important;
  color: #5ee0a0 !important;
  opacity: 1 !important;
}
/* Duplicate — even quieter, secondary look */
.plan-card .scenario-action-dup{
  background: transparent !important;
  color: var(--muted) !important;
  border: 1px solid rgba(255,255,255,0.08) !important;
}
.plan-card .scenario-action-dup:hover{
  color: var(--text-strong) !important;
  border-color: rgba(255,255,255,0.20) !important;
}
/* Delete — text-only red, not filled red. Less aggressive. */
.plan-card .scenario-action-del{
  background: transparent !important;
  color: #ff7c7c !important;
  border: 1px solid rgba(255,124,124,0.18) !important;
}
.plan-card .scenario-action-del:hover{
  background: rgba(255,124,124,0.08) !important;
  border-color: rgba(255,124,124,0.45) !important;
}

/* ---- #7. Lock-all header checkbox ------------------------------- */
.th-lock-label{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.chip-lock-all{
  appearance: auto;
  -webkit-appearance: auto;
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--spacesense-yellow);
}
.chip-lock-all:disabled{
  cursor: not-allowed;
  opacity: 0.4;
}
/* Subtle yellow tint on the column header when ALL are locked,
   so the user sees the "everything is locked" state at a glance. */
th.th-lock:has(.chip-lock-all:checked){
  background: rgba(242,193,46,0.06);
}

/* === END MODERNIZATION COMMIT 16 === */


/* ================================================================
 * SPACESENSE MODERNIZATION LAYER — Commit 17: Round-2b
 * ----------------------------------------------------------------
 * Three fixes:
 *
 *   #5 (cont.) — extend the modal "Load button quieter" treatment
 *      to the Test datasets tab (was previously only on Cloud tab
 *      because the selector targeted .scenario-action-load only).
 *
 *   #8 — per-column header filters on report tables. New utility
 *      enableTableTools() in app.js adds a second header row of
 *      text inputs (one per column) that AND together to filter
 *      visible rows. Excel-style.
 *
 *   #11 — click-to-sort headers and per-column filters applied to
 *      Floor utilization + Building utilization tables (in
 *      addition to Allocations).
 *
 * To revert this commit only: delete from this banner to the
 * matching `=== END MODERNIZATION COMMIT 17 ===` line and revert
 * the corresponding edits in app.js (the enableTableTools utility
 * + its three call sites at the tail of renderLedger).
 * ================================================================ */

/* ---- #5 cont. Load button quieter on Test datasets tab too ------ */
.plan-card .load-test-dataset-confirm,
.plan-card-actions .btn.primary{
  background: rgba(255,255,255,0.04) !important;
  color: var(--text-strong) !important;
  border: 1px solid rgba(91,214,255,0.20) !important;
  font-weight: 600;
}
.plan-card .load-test-dataset-confirm:hover:not(:disabled),
.plan-card-actions .btn.primary:hover:not(:disabled){
  background: rgba(91,214,255,0.10) !important;
  border-color: rgba(91,214,255,0.40) !important;
}

/* ---- #8 / #11. Per-column filter row + sortable headers --------- */
/* Second header row holding one filter input per column. */
.col-filter-row > th{
  padding: 4px 6px !important;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.col-filter-input{
  width: 100%;
  box-sizing: border-box;
  padding: 4px 8px;
  font-size: 11px;
  color: var(--text-strong);
  background: rgba(0,0,0,0.20);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  outline: none;
  transition: border-color 140ms ease, background 140ms ease;
}
.col-filter-input::placeholder{
  color: rgba(255,255,255,0.30);
  font-style: italic;
}
.col-filter-input:focus{
  border-color: rgba(242,193,46,0.45);
  background: rgba(242,193,46,0.04);
}
.col-filter-input:not(:placeholder-shown){
  border-color: rgba(242,193,46,0.32);
  background: rgba(242,193,46,0.05);
}

/* Sortable header — cursor pointer + small arrow indicator. */
th.th-sortable{
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 20px !important;
}
th.th-sortable::after{
  content: "⇅";
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: rgba(255,255,255,0.20);
  transition: color 140ms ease;
}
th.th-sortable:hover::after{ color: var(--spacesense-yellow); }
th.th-sortable.sort-asc::after{
  content: "▲";
  color: var(--spacesense-yellow);
}
th.th-sortable.sort-desc::after{
  content: "▼";
  color: var(--spacesense-yellow);
}
/* The Lock-column checkbox header is sortable, but the sort arrow
   would crowd the checkbox label. Suppress. */
th.th-lock.th-sortable::after{ display: none; }

/* The filter-row cells are <th> elements but they shouldn't be
   sortable nor show arrows. */
.col-filter-row > th.th-sortable{ cursor: default; }
.col-filter-row > th.th-sortable::after{ display: none; }

/* === END MODERNIZATION COMMIT 17 === */


/* ================================================================
 * SPACESENSE MODERNIZATION LAYER — Commit 18: Multi-select dropdown
 * ----------------------------------------------------------------
 * Excel-style multi-select dropdown alongside the per-column text
 * filter from Commit 17. Click the ▾ button next to any column's
 * text filter → popover shows unique values from that column with
 * checkboxes. Multiple values can be selected; row passes if
 * cell.textContent matches any selected value. Text filter and
 * multi-select within the same column AND together.
 *
 * Also wires the Optimised Allocations table (By Section / By
 * Department views) to use the same enableTableTools utility — the
 * head is rebuilt on each render but the utility now detects the
 * missing filter row and re-adds it.
 *
 * To revert: delete from this banner to the matching
 * `=== END MODERNIZATION COMMIT 18 ===` line.
 * ================================================================ */

/* ---- Column filter cell — text input + ▾ button ----------------- */
.col-filter-cell{
  display: flex;
  align-items: stretch;
  gap: 4px;
}
.col-filter-cell .col-filter-input{
  flex: 1 1 auto;
  min-width: 0;
}
.col-filter-ms-btn{
  flex: 0 0 22px;
  width: 22px;
  height: auto;
  padding: 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: rgba(0,0,0,0.20);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  cursor: pointer;
  transition: color 140ms ease, background 140ms ease, border-color 140ms ease;
}
.col-filter-ms-btn:hover{
  color: var(--spacesense-yellow);
  border-color: rgba(242,193,46,0.45);
  background: rgba(242,193,46,0.06);
}
.col-filter-ms-btn.is-active{
  color: #1F2D3D;
  background: var(--spacesense-yellow);
  border-color: var(--spacesense-yellow);
}
.col-filter-ms-btn:focus-visible{
  outline: 2px solid var(--spacesense-yellow);
  outline-offset: 1px;
}

/* ---- Multi-select popover --------------------------------------- */
.col-filter-popover{
  position: fixed;
  z-index: 9999;
  width: 240px;
  max-width: 90vw;
  background: rgba(28, 40, 54, 0.98);
  border: 1px solid rgba(242,193,46,0.30);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.04) inset;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: -apple-system, "Inter", "Helvetica Neue", sans-serif;
  font-size: 12px;
  color: var(--text-strong);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: cfp-fade-in 140ms ease-out;
}
.col-filter-popover[hidden]{ display: none; }
@keyframes cfp-fade-in{
  from{ opacity: 0; transform: translateY(-4px); }
  to{   opacity: 1; transform: translateY(0); }
}
.cfp-search{
  width: 100%;
  box-sizing: border-box;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-strong);
  background: rgba(0,0,0,0.30);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 6px;
  outline: none;
}
.cfp-search:focus{
  border-color: rgba(242,193,46,0.45);
}
.cfp-actions{
  display: flex;
  gap: 6px;
}
.cfp-actions button{
  flex: 1 1 50%;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: var(--muted);
  background: transparent;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 6px;
  cursor: pointer;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}
.cfp-actions button:hover{
  color: var(--spacesense-yellow);
  border-color: rgba(242,193,46,0.40);
  background: rgba(242,193,46,0.05);
}
.cfp-list{
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 4px 2px;
  background: rgba(0,0,0,0.20);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 6px;
}
.cfp-list label{
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  color: var(--text-strong);
  transition: background 100ms ease;
}
.cfp-list label:hover{
  background: rgba(242,193,46,0.06);
}
.cfp-list label input[type=checkbox]{
  accent-color: var(--spacesense-yellow);
  cursor: pointer;
}
.cfp-list label span{
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cfp-empty{
  padding: 12px;
  text-align: center;
  font-style: italic;
}
.cfp-footer{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 4px;
}
.cfp-count{
  font-size: 11px;
  letter-spacing: 0.3px;
}
.cfp-close{
  padding: 4px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #1F2D3D;
  background: var(--spacesense-yellow);
  border: 1px solid var(--spacesense-yellow);
  border-radius: 6px;
  cursor: pointer;
}
.cfp-close:hover{
  background: #FFD75A;
  border-color: #FFD75A;
}

/* Custom scrollbar inside the popover list. */
.cfp-list::-webkit-scrollbar{ width: 6px; }
.cfp-list::-webkit-scrollbar-thumb{
  background: rgba(242,193,46,0.25);
  border-radius: 3px;
}
.cfp-list::-webkit-scrollbar-thumb:hover{
  background: rgba(242,193,46,0.45);
}

/* === END MODERNIZATION COMMIT 18 === */


/* ================================================================
 * SPACESENSE MODERNIZATION LAYER — Commit 20: Scorecard V2
 * ----------------------------------------------------------------
 * Storytelling redesign of the Value Scorecard, living alongside
 * the original as a separate "Scorecard" tab. Once parity is
 * verified the legacy panel can be removed.
 *
 * Six sections: Hero → Physical impact → Cost breakdown →
 * Utilisation before/after → Coverage benchmarks → Trade-offs.
 * Pure presentation — same data, same formatters as renderScorecard.
 *
 * To revert: delete from this banner to the matching
 * `=== END MODERNIZATION COMMIT 20 ===` line + revert
 * renderScorecardV2 in app.js + the `data-tab="scorecard2"`
 * markup in index.html.
 * ================================================================ */

/* Wrap + page layout */
.scorecard-v2 .scV2-page{
  padding: 24px 28px 60px;
  max-width: 1500px;
  margin: 0 auto;
  font-family: -apple-system, "Inter", "Helvetica Neue", sans-serif;
}

/* ---- Header --------------------------------------------------- */
.scV2-header{ margin-bottom: 26px; }
.scV2-eyebrow{
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2.5px;
  color: var(--spacesense-yellow);
  margin-bottom: 4px;
}
.scV2-title{
  font-size: 26px;
  font-weight: 800;
  color: var(--text-strong, #FFFFFF);
  margin: 0 0 4px;
}
.scV2-meta{
  font-size: 13px;
  color: var(--muted);
}

/* ---- HERO ----------------------------------------------------- */
.scV2-hero{
  position: relative;
  border-radius: 20px;
  background: linear-gradient(180deg, #2A3B4D, #1B2A3A);
  border: 1px solid rgba(242,193,46,0.32);
  padding: 28px 36px;
  overflow: hidden;
  margin-bottom: 36px;
}
.scV2-hero::before{
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #FFD75A, #F2C12E);
  border-radius: 2px;
}
.scV2-hero-glow{
  position: absolute;
  top: -60px; left: 80px;
  width: 540px; height: 200px;
  background: radial-gradient(closest-side, rgba(242,193,46,0.22), transparent);
  filter: blur(40px);
  pointer-events: none;
}
.scV2-hero-grid{
  position: relative;
  display: grid;
  grid-template-columns: minmax(280px, 540px) 1fr;
  gap: 36px;
  align-items: stretch;
}
.scV2-hero-main{ padding: 8px 0; }
.scV2-hero-eyebrow{
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2.5px;
  color: var(--spacesense-yellow);
  margin-bottom: 6px;
}
.scV2-hero-value{
  font-size: 88px;
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(180deg, #FFD75A, #F2C12E);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 8px 0 12px;
  text-shadow: 0 0 28px rgba(242,193,46,0.18);
}
.scV2-hero-sub{
  font-size: 15px;
  color: var(--text-strong, #FFFFFF);
  opacity: 0.78;
}
.scV2-hero-kpis{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding-left: 36px;
  border-left: 1px solid rgba(255,255,255,0.10);
}
.scV2-kpi-label{
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2.5px;
  color: var(--muted);
  margin-bottom: 6px;
}
.scV2-kpi-value{
  font-size: 40px;
  font-weight: 800;
  color: var(--text-strong, #FFFFFF);
  line-height: 1.1;
  margin-bottom: 8px;
}
.scV2-kpi-sub{
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
}
.scV2-kpi-sub.is-good{ color: #5EE0A0; }
.scV2-kpi-sub.is-bad{ color: #FF7C7C; }
.scV2-kpi-sub.is-muted{ color: var(--muted); }
.scV2-kpi-foot{
  font-size: 11px;
  color: var(--muted);
}

/* ---- Generic section heading --------------------------------- */
.scV2-section{ margin-top: 32px; }
.scV2-section-head{ margin-bottom: 16px; }
.scV2-section-eyebrow{
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2.5px;
  color: var(--spacesense-yellow);
  margin-bottom: 4px;
}
.scV2-section-title{
  font-size: 20px;
  font-weight: 700;
  color: var(--text-strong, #FFFFFF);
}

/* ---- PHYSICAL IMPACT ----------------------------------------- */
.scV2-physical{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  background: linear-gradient(180deg, rgba(42,59,77,0.55), rgba(30,45,61,0.55));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 28px 36px;
}
.scV2-stat-label{
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--muted);
  margin-bottom: 8px;
}
.scV2-stat-value{
  font-size: 56px;
  font-weight: 900;
  line-height: 1;
  color: var(--text-strong, #FFFFFF);
}
.scV2-stat-value.scV2-stat-yellow{ color: var(--spacesense-yellow); }
.scV2-stat-total{
  font-size: 0.55em;
  font-weight: 500;
  color: var(--muted);
  margin-left: 4px;
}
.scV2-stat-sub{
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}

/* ---- COST BREAKDOWN ------------------------------------------ */
.scV2-cost-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.scV2-cost-card{
  border-radius: 16px;
  padding: 28px 32px;
  background: linear-gradient(180deg, rgba(42,59,77,0.55), rgba(30,45,61,0.55));
  border: 1px solid rgba(255,255,255,0.08);
}
.scV2-cost-card.scV2-cost-card-in{
  background: linear-gradient(180deg, rgba(242,193,46,0.14), rgba(242,193,46,0.04));
  border-color: rgba(242,193,46,0.35);
  position: relative;
}
.scV2-cost-card.scV2-cost-card-in::before{
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #FFD75A, #F2C12E);
  border-radius: 2px;
}
.scV2-cost-eyebrow{
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #FF7C7C;
  margin-bottom: 8px;
}
.scV2-cost-card-in .scV2-cost-eyebrow{ color: var(--spacesense-yellow); }
.scV2-cost-value{
  font-size: 44px;
  font-weight: 900;
  color: var(--text-strong, #FFFFFF);
  line-height: 1;
  margin-bottom: 24px;
}
.scV2-cost-value-yellow{
  background: linear-gradient(180deg, #FFD75A, #F2C12E);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
}
.scV2-cost-bars{
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.scV2-cost-bar{
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 4px 12px;
  font-size: 12px;
}
.scV2-cost-bar-name{
  color: var(--text-strong, #FFFFFF);
  opacity: 0.78;
}
.scV2-cost-bar-name.is-good{ color: #5EE0A0; opacity: 1; }
.scV2-cost-bar-amt{
  font-weight: 700;
  color: var(--text-strong, #FFFFFF);
  text-align: right;
}
.scV2-cost-bar-amt.is-good{ color: #5EE0A0; }
.scV2-cost-bar-amt.is-bad{ color: #FF7C7C; }
.scV2-cost-bar-track{
  grid-column: 1 / -1;
  height: 5px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
}
.scV2-cost-bar-fill{ height: 100%; border-radius: 3px; }
.scV2-cost-bar-fill.is-out   { background: rgba(255,124,124,0.65); }
.scV2-cost-bar-fill.is-in    { background: rgba(94,224,160,0.70); }
.scV2-cost-bar-fill.is-yellow{ background: linear-gradient(90deg, #FFD75A, #F2C12E); }
.scV2-cost-divider{
  height: 1px;
  background: rgba(255,255,255,0.10);
  margin: 4px 0;
}

/* ---- UTILISATION before / after ------------------------------ */
.scV2-util-row{
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  gap: 24px;
  align-items: center;
  background: linear-gradient(180deg, rgba(42,59,77,0.55), rgba(30,45,61,0.55));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 28px 36px;
}
.scV2-util-eyebrow{
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--muted);
  margin-bottom: 8px;
}
.scV2-util-eyebrow.is-yellow{ color: var(--spacesense-yellow); }
.scV2-util-value{
  font-size: 48px;
  font-weight: 800;
  color: var(--text-strong, #FFFFFF);
  line-height: 1;
}
.scV2-util-value.is-yellow{
  background: linear-gradient(180deg, #FFD75A, #F2C12E);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
}
.scV2-util-sub{
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}
.scV2-util-track{
  margin-top: 14px;
  height: 12px;
  background: rgba(255,255,255,0.06);
  border-radius: 6px;
  overflow: hidden;
}
.scV2-util-fill{ height: 100%; border-radius: 6px; }
.scV2-util-fill.is-ref{ background: rgba(143,160,176,0.65); }
.scV2-util-fill.is-opt{ background: linear-gradient(90deg, #FFD75A, #F2C12E); }
.scV2-util-arrow{
  font-size: 32px;
  color: var(--spacesense-yellow);
  opacity: 0.65;
  text-align: center;
}
.scV2-util-delta{
  padding: 14px 20px;
  border-radius: 12px;
  text-align: center;
  background: rgba(94,224,160,0.10);
}
.scV2-util-delta.is-bad{ background: rgba(255,124,124,0.10); }
.scV2-util-delta-label{
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #5EE0A0;
  margin-bottom: 4px;
}
.scV2-util-delta.is-bad .scV2-util-delta-label{ color: #FF7C7C; }
.scV2-util-delta-value{
  font-size: 22px;
  font-weight: 800;
  color: #5EE0A0;
}
.scV2-util-delta.is-bad .scV2-util-delta-value{ color: #FF7C7C; }

/* ---- COVERAGE scorecard -------------------------------------- */
.scV2-coverage-grid{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.scV2-cov-card{
  background: linear-gradient(180deg, rgba(42,59,77,0.55), rgba(30,45,61,0.55));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 24px 28px;
  position: relative;
}
.scV2-cov-eyebrow{
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--muted);
  margin-bottom: 8px;
}
.scV2-cov-value{
  font-size: 44px;
  font-weight: 800;
  color: var(--text-strong, #FFFFFF);
  line-height: 1;
  margin-bottom: 20px;
}
.scV2-cov-bench-label{
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin-bottom: 8px;
}
.scV2-cov-bench-bar{
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  height: 14px;
  border-radius: 7px;
  overflow: visible;
  position: relative;
  background: rgba(255,255,255,0.06);
}
.scV2-cov-bench-seg{
  height: 14px;
  opacity: 0.40;
}
.scV2-cov-bench-seg.scV2-cov-bench-low {
  background: #EE5A5A;
  border-radius: 7px 0 0 7px;
}
.scV2-cov-bench-seg.scV2-cov-bench-mid { background: #FFB142; }
.scV2-cov-bench-seg.scV2-cov-bench-high{
  background: #5EE0A0;
  border-radius: 0 7px 7px 0;
}
.scV2-cov-bench-pin{
  position: absolute;
  top: -3px;
  width: 4px;
  height: 20px;
  background: #FFFFFF;
  border-radius: 2px;
  transform: translateX(-2px);
  box-shadow: 0 0 6px rgba(255,255,255,0.4);
}
.scV2-cov-bench-legend{
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  margin-top: 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
}
.scV2-cov-bench-legend > :nth-child(1){ color: rgba(238,90,90,0.85); }
.scV2-cov-bench-legend > :nth-child(2){ color: rgba(255,177,66,0.85); text-align: center; }
.scV2-cov-bench-legend > :nth-child(3){ color: rgba(94,224,160,0.85); text-align: right; }
.scV2-cov-pill{
  position: absolute;
  top: 22px;
  right: 22px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.2px;
  padding: 4px 10px;
  border-radius: 999px;
}
.scV2-cov-pill.scV2-cov-pill-low { background: rgba(238,90,90,0.18); color: #FF7C7C; }
.scV2-cov-pill.scV2-cov-pill-mid { background: rgba(255,177,66,0.18); color: #FFB142; }
.scV2-cov-pill.scV2-cov-pill-high{ background: rgba(94,224,160,0.18); color: #5EE0A0; }
.scV2-cov-bench-empty{
  font-size: 12px;
  color: var(--muted);
  opacity: 0.6;
  font-style: italic;
  padding: 12px 0;
}

/* ---- TRADE-OFFS ---------------------------------------------- */
.scV2-tradeoff-grid{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 14px;
}
.scV2-trade-card{
  background: linear-gradient(180deg, rgba(42,59,77,0.55), rgba(30,45,61,0.55));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 24px 28px;
  position: relative;
}
.scV2-trade-card.is-current{
  background: linear-gradient(180deg, rgba(242,193,46,0.14), rgba(242,193,46,0.04));
  border-color: rgba(242,193,46,0.55);
}
.scV2-trade-card.is-current::before{
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #FFD75A, #F2C12E);
  border-radius: 2px;
}
.scV2-trade-current-pill{
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--spacesense-yellow);
  color: #1F2D3D;
}
.scV2-trade-eyebrow{
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2.5px;
  color: var(--muted);
}
.scV2-trade-card.is-current .scV2-trade-eyebrow{ color: var(--spacesense-yellow); }
.scV2-trade-sub{
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}
.scV2-trade-divider{
  height: 1px;
  background: rgba(255,255,255,0.10);
  margin: 16px 0 14px;
}
.scV2-trade-card.is-current .scV2-trade-divider{ background: rgba(242,193,46,0.20); }
.scV2-trade-saving-label{
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--muted);
}
.scV2-trade-card.is-current .scV2-trade-saving-label{ color: var(--spacesense-yellow); }
.scV2-trade-saving{
  font-size: 30px;
  font-weight: 800;
  color: var(--text-strong, #FFFFFF);
  line-height: 1;
  margin: 8px 0 16px;
}
.scV2-trade-card.is-current .scV2-trade-saving{
  background: linear-gradient(180deg, #FFD75A, #F2C12E);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
}
.scV2-trade-notrun{
  font-size: 0.45em;
  color: var(--muted);
  font-weight: 500;
}
.scV2-trade-row{
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 6px 0;
  border-top: 1px dashed rgba(255,255,255,0.08);
}
.scV2-trade-row > :first-child{ color: var(--muted); }
.scV2-trade-row > :last-child{ font-weight: 700; color: var(--text-strong, #FFFFFF); }

/* ---- CTA ----------------------------------------------------- */
.scV2-cta-wrap{
  text-align: center;
  margin-top: 24px;
  font-size: 14px;
  color: var(--muted);
}
.scV2-cta-link{
  background: transparent;
  border: 0;
  color: var(--spacesense-yellow);
  font-weight: 700;
  cursor: pointer;
  padding: 0 4px;
  font-size: 14px;
}
.scV2-cta-link:hover{ text-decoration: underline; }

/* ---- Responsive: collapse hero to single column on narrow ---- */
@media (max-width: 1100px){
  .scV2-hero-grid{ grid-template-columns: 1fr; gap: 24px; }
  .scV2-hero-kpis{ padding-left: 0; border-left: 0; border-top: 1px solid rgba(255,255,255,0.10); padding-top: 20px; }
  .scV2-cost-grid{ grid-template-columns: 1fr; }
  .scV2-coverage-grid{ grid-template-columns: 1fr; }
  .scV2-tradeoff-grid{ grid-template-columns: 1fr; }
  .scV2-util-row{ grid-template-columns: 1fr; }
  .scV2-util-arrow{ display: none; }
}

/* === END MODERNIZATION COMMIT 20 === */


/* ================================================================
 * SPACESENSE MODERNIZATION LAYER — Commit 22: Scorecard V2 parity
 * ----------------------------------------------------------------
 * Five surgical additions to V2 to close the "critical exec-summary"
 * gap vs the legacy Value Scorecard. Full detail (vacancy breakdown
 * per building/floor/block, NPV sensitivity grid, per-floor meeting-
 * seats drill-down, etc.) stays in the legacy panel.
 *
 *   1. Buildings freed → 4th card in Physical Impact (CSS: grid bump)
 *   2. Wasted Space Cost (before/after) → row under Utilisation bars
 *   3. Vacancy Decomposition headline → new compact 2-card section
 *      between Utilisation and Coverage
 *   4. Total one-time savings / costs → small rollup at bottom of
 *      the Cost Breakdown left card
 *   5. Collaboration improvement % → small delta pill on Coverage
 *      dial #3
 *
 * To revert: delete from this banner to the matching
 * `=== END MODERNIZATION COMMIT 22 ===` line and revert the
 * corresponding edits in app.js renderScorecardV2.
 * ================================================================ */

/* ---- 1. Physical Impact — 4 cards instead of 3 ---------------- */
.scV2-physical{
  grid-template-columns: repeat(4, 1fr) !important;
}
.scV2-physical .scV2-stat-value{
  font-size: 44px !important;
}
.scV2-physical .scV2-stat-value .scV2-stat-total{
  font-size: 0.52em !important;
}

/* ---- 2. Wasted-space cost row under Utilisation --------------- */
.scV2-util-extras{
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed rgba(255,255,255,0.08);
}
.scV2-util-extras-row{
  display: grid;
  grid-template-columns: auto auto 18px auto 1fr;
  gap: 14px;
  align-items: center;
}
.scV2-util-extras-label{
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--muted);
}
.scV2-util-extras-val{
  font-size: 18px;
  font-weight: 700;
  color: var(--text-strong, #FFFFFF);
}
.scV2-util-extras-val.is-yellow{
  background: linear-gradient(180deg, #FFD75A, #F2C12E);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
}
.scV2-util-extras-arrow{
  font-size: 14px;
  color: var(--spacesense-yellow);
  opacity: 0.55;
  text-align: center;
}
.scV2-util-extras-delta{
  justify-self: end;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
}
.scV2-util-extras-delta.is-good{
  color: #5EE0A0;
  background: rgba(94,224,160,0.12);
}
.scV2-util-extras-delta.is-bad{
  color: #FF7C7C;
  background: rgba(255,124,124,0.12);
}

/* ---- 3. Vacancy decomposition headline section ---------------- */
.scV2-vacancy-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.scV2-vacancy-card{
  border-radius: 16px;
  padding: 24px 28px;
  background: linear-gradient(180deg, rgba(42,59,77,0.55), rgba(30,45,61,0.55));
  border: 1px solid rgba(255,255,255,0.08);
  position: relative;
}
.scV2-vacancy-card.scV2-vacancy-useful{
  background: linear-gradient(180deg, rgba(94,224,160,0.10), rgba(94,224,160,0.02));
  border-color: rgba(94,224,160,0.30);
}
.scV2-vacancy-card.scV2-vacancy-waste{
  background: linear-gradient(180deg, rgba(255,124,124,0.08), rgba(255,124,124,0.02));
  border-color: rgba(255,124,124,0.25);
}
.scV2-vacancy-eyebrow{
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--muted);
  margin-bottom: 10px;
}
.scV2-vacancy-useful .scV2-vacancy-eyebrow{ color: #5EE0A0; }
.scV2-vacancy-waste  .scV2-vacancy-eyebrow{ color: #FF7C7C; }
.scV2-vacancy-value{
  font-size: 38px;
  font-weight: 800;
  color: var(--text-strong, #FFFFFF);
  line-height: 1;
  margin-bottom: 8px;
}
.scV2-vacancy-useful .scV2-vacancy-value{ color: #5EE0A0; }
.scV2-vacancy-waste  .scV2-vacancy-value{ color: #FF7C7C; }
.scV2-vacancy-unit{
  font-size: 0.45em;
  font-weight: 500;
  color: var(--muted);
  margin-left: 4px;
}
.scV2-vacancy-sub{
  font-size: 13px;
  color: var(--text-strong, #FFFFFF);
  opacity: 0.80;
  margin-bottom: 8px;
}
.scV2-vacancy-foot{
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
}

/* ---- 4. Cost breakdown rollup footer -------------------------- */
.scV2-cost-rollup{
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed rgba(255,255,255,0.10);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.scV2-cost-rollup-row{
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}
.scV2-cost-rollup-row > :first-child{
  color: var(--muted);
}
.scV2-cost-rollup-row > :last-child{
  font-weight: 700;
}
.scV2-cost-rollup-row .is-good{ color: #5EE0A0; }
.scV2-cost-rollup-row .is-bad{ color: #FF7C7C; }

/* ---- 5. Collaboration improvement % delta pill ---------------- */
.scV2-cov-delta{
  display: inline-block;
  margin-left: 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 999px;
  vertical-align: middle;
  transform: translateY(-6px);
}
.scV2-cov-delta.is-good{
  color: #5EE0A0;
  background: rgba(94,224,160,0.14);
  border: 1px solid rgba(94,224,160,0.30);
}
.scV2-cov-delta.is-bad{
  color: #FF7C7C;
  background: rgba(255,124,124,0.14);
  border: 1px solid rgba(255,124,124,0.30);
}

/* Responsive — Physical Impact + Vacancy collapse on narrow */
@media (max-width: 1100px){
  .scV2-physical{ grid-template-columns: repeat(2, 1fr) !important; }
  .scV2-vacancy-grid{ grid-template-columns: 1fr; }
}

/* === END MODERNIZATION COMMIT 22 === */


/* ================================================================
 * SPACESENSE MODERNIZATION LAYER — Commit 23: Scorecard clarity
 * ----------------------------------------------------------------
 * "Comparing" header chips on both Value Scorecard and Scorecard V2
 * to make it explicit which two plans are in the picture:
 *   Reference · Existing AS-IS  ↗   vs   Active · Cost-first @ 02:43
 * Reference chip is clickable — switches the map to the Existing tab.
 *
 * Paired with a JS fix that ensures both scorecards re-render when
 * the user switches the map to Existing (the legacy code only called
 * renderAll, leaving stale scorecard data showing).
 *
 * To revert: delete from this banner to the matching
 * `=== END MODERNIZATION COMMIT 23 ===` line.
 * ================================================================ */

/* ---- Legacy Value Scorecard "Comparing" chips ----------------- */
.scorecard-comparing{
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.sc-comparing-label{
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--muted);
  margin-right: 4px;
}
.sc-comparing-chip{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-strong, #e8f4ff);
  background: rgba(91,214,255,0.06);
  border: 1px solid rgba(91,214,255,0.22);
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: background 140ms ease, border-color 140ms ease;
}
.sc-comparing-chip:hover:not(.sc-comparing-active){
  background: rgba(91,214,255,0.14);
  border-color: rgba(91,214,255,0.45);
}
.sc-comparing-chip.sc-comparing-active{
  cursor: default;
  background: rgba(242,193,46,0.10);
  border-color: rgba(242,193,46,0.35);
  color: var(--spacesense-yellow);
}
.sc-comparing-vs{
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
}

/* ---- Scorecard V2 "COMPARING" chips ---------------------------- */
.scV2-comparing{
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.scV2-comparing-label{
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--muted);
}
.scV2-comparing-chip{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-strong, #e8f4ff);
  background: rgba(91,214,255,0.06);
  border: 1px solid rgba(91,214,255,0.22);
  border-radius: 999px;
  cursor: pointer;
  font-family: -apple-system, "Inter", "Helvetica Neue", sans-serif;
  transition: background 140ms ease, border-color 140ms ease;
}
.scV2-comparing-chip:hover:not(.scV2-comparing-active){
  background: rgba(91,214,255,0.14);
  border-color: rgba(91,214,255,0.45);
}
.scV2-comparing-chip.scV2-comparing-active{
  cursor: default;
  background: rgba(242,193,46,0.10);
  border-color: rgba(242,193,46,0.40);
  color: var(--spacesense-yellow);
  font-weight: 700;
}
.scV2-comparing-vs{
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

/* === END MODERNIZATION COMMIT 23 === */


/* ================================================================
 * SPACESENSE MODERNIZATION LAYER — Commit 24: Compare Plans visual
 * ----------------------------------------------------------------
 * Adds two graphical sections ABOVE the existing detailed Compare
 * Plans table:
 *   1. Trade-off scatter — Annual Saving (X) × Collab Score (Y)
 *      with each plan as a labelled dot, Pareto frontier hint,
 *      quadrant tags. Active plan glows in its preset colour.
 *   2. Bar comparison — top 6 metrics as 3 horizontal bars per row,
 *      ★ on best-in-row, switch buttons under each column.
 * Existing table kept verbatim as Section 3.
 *
 * Pure SVG + HTML; no chart library, no CDN dependency.
 *
 * To revert: delete from this banner to the matching
 * `=== END MODERNIZATION COMMIT 24 ===` line and revert the
 * corresponding renderComparePlans edits in app.js.
 * ================================================================ */

.compare-vsec{
  margin: 24px 0 36px;
  padding: 0 4px;
}
.compare-vsec-head{ margin-bottom: 16px; }
.compare-vsec-eyebrow{
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2.5px;
  color: var(--spacesense-yellow);
  margin-bottom: 4px;
}
.compare-vsec-title{
  font-size: 18px;
  font-weight: 700;
  color: var(--text-strong, #FFFFFF);
}

/* ---- SECTION 1 — Trade-off scatter --------------------------- */
.compare-scatter-wrap{
  background: linear-gradient(180deg, rgba(42,59,77,0.55), rgba(30,45,61,0.55));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 20px;
}
.compare-scatter-svg{
  display: block;
  width: 100%;
  height: auto;
  max-height: 580px;
}

/* ---- SECTION 2 — Bar comparison ------------------------------ */
.compare-bars-wrap{
  background: linear-gradient(180deg, rgba(42,59,77,0.55), rgba(30,45,61,0.55));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 24px 28px;
}
.compare-bars-grid{
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.compare-bar-row{
  display: grid;
  grid-template-columns: 220px repeat(var(--plan-count), 1fr);
  gap: 16px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.05);
}
.compare-bar-row:last-child{ border-bottom: 0; }
.compare-bar-row.compare-bar-headrow{
  border-bottom: 1px solid rgba(255,255,255,0.10);
  padding-bottom: 14px;
  margin-bottom: 6px;
}
.compare-bar-row.compare-bar-switchrow{
  border-bottom: 0;
  padding-top: 16px;
  margin-top: 4px;
  border-top: 1px solid rgba(255,255,255,0.10);
}

.compare-bar-label-name{
  font-size: 13px;
  font-weight: 600;
  color: var(--text-strong, #FFFFFF);
}
.compare-bar-label-sub{
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
  font-style: italic;
}

.compare-bar-head{
  display: flex;
  align-items: center;
  gap: 8px;
}
.compare-bar-head-name{
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--plan-color, var(--text-strong, #FFFFFF));
}
.compare-bar-head-pill{
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--plan-color);
  color: #1F2D3D;
}

.compare-bar-cell{
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
}
.compare-bar-track{
  height: 22px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  overflow: hidden;
}
.compare-bar-fill{
  height: 100%;
  border-radius: 4px;
  transition: width 240ms cubic-bezier(0.4, 0, 0.2, 1);
}
.compare-bar-val{
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  min-width: 50px;
  text-align: right;
}
.compare-bar-val.is-best{ font-weight: 800; }

.compare-switch-btn{
  width: 100%;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--plan-color);
  background: transparent;
  border: 1px solid var(--plan-color);
  border-radius: 8px;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}
.compare-switch-btn:hover:not(:disabled){
  background: var(--plan-color);
  color: #1F2D3D;
}
.compare-switch-btn.is-current{
  background: color-mix(in srgb, var(--plan-color) 14%, transparent);
  border-color: color-mix(in srgb, var(--plan-color) 50%, transparent);
  cursor: default;
}
.compare-switch-btn:disabled{ cursor: default; }

/* ---- Responsive ---------------------------------------------- */
@media (max-width: 1100px){
  .compare-bar-row{ grid-template-columns: 1fr; gap: 6px; }
  .compare-bar-head, .compare-bar-cell{ padding-left: 4px; }
}

/* === END MODERNIZATION COMMIT 24 === */


/* ================================================================
 * SPACESENSE MODERNIZATION LAYER — Commit 25: Sensitivity redesign
 * ----------------------------------------------------------------
 * Reflows the Sensitivity tab from 3 stacked sections (Weight Tuner,
 * Score Decomposition, Constraint Impact + Unmet Demand) with dead
 * space below, into a 3-row grid:
 *   Row 1 — full-width Run Summary strip (OR Score · Solver · Conflicts
 *           · Unmet · Active Preset)
 *   Row 2 — 2-col CAUSE × EFFECT (Weight Tuner | Score Decomposition)
 *   Row 3 — 2-col DIAGNOSTICS (Constraint Impact | Unmet Demand) with
 *           big ✓ empty states when nothing's wrong
 *
 * Pure JS template restructure + this CSS. The existing tuner sliders,
 * preset selector, Save / Save & Re-run buttons, and the What-If
 * section appended afterwards keep all their IDs/classes and event
 * wiring — no behavior change.
 *
 * To revert: delete from this banner to the matching
 * `=== END MODERNIZATION COMMIT 25 ===` line and revert the
 * renderSensitivity edits in app.js.
 * ================================================================ */

/* ---- Row 1 — Run Summary strip ------------------------------- */
.sens-v2-summary{
  display: grid;
  grid-template-columns: 1.4fr 1px 1fr 1px 1fr 1px 1fr 1px 1.2fr;
  gap: 0;
  align-items: stretch;
  background: linear-gradient(180deg, rgba(42,59,77,0.55), rgba(30,45,61,0.55));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 20px 28px;
  margin-bottom: 28px;
  position: relative;
}
.sens-v2-summary::before{
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #FFD75A, #F2C12E);
  border-radius: 2px;
}
.sens-v2-summary-divider{
  background: rgba(255,255,255,0.10);
  width: 1px;
  margin: 4px 16px;
}
.sens-v2-summary-cell{
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sens-v2-summary-label{
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--muted);
}
.sens-v2-summary-hero .sens-v2-summary-label{
  color: var(--spacesense-yellow);
}
.sens-v2-summary-value{
  font-size: 32px;
  font-weight: 800;
  color: var(--text-strong, #FFFFFF);
  line-height: 1;
}
.sens-v2-summary-hero-value{
  font-size: 40px;
  background: linear-gradient(180deg, #FFD75A, #F2C12E);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
}
.sens-v2-summary-value-row{
  display: flex;
  align-items: center;
  gap: 10px;
}
.sens-v2-summary-dot{
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sens-v2-summary-value-small{
  font-size: 20px;
  font-weight: 700;
}
.sens-v2-summary-sub{
  font-size: 11px;
  color: var(--muted);
}
.sens-v2-summary-preset{
  align-items: flex-end;
}
.sens-v2-preset-pill{
  font-size: 13px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(242,193,46,0.14);
  border: 1px solid rgba(242,193,46,0.45);
  color: var(--spacesense-yellow);
  white-space: nowrap;
}

/* ---- Section headers (CAUSE × EFFECT, DIAGNOSTICS) ------------ */
.sens-v2-section-head{
  margin: 24px 0 14px;
}
.sens-v2-section-eyebrow{
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2.5px;
  color: var(--spacesense-yellow);
  margin-bottom: 4px;
}
.sens-v2-section-title{
  font-size: 18px;
  font-weight: 700;
  color: var(--text-strong, #FFFFFF);
}

/* ---- 2-column grid containers --------------------------------- */
.sens-v2-grid-2col{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

/* ---- Card wrapper -------------------------------------------- */
.sens-v2-card{
  background: linear-gradient(180deg, rgba(42,59,77,0.55), rgba(30,45,61,0.55));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 24px 28px;
}
.sens-v2-card-tuner{
  padding: 20px 24px;
}
.sens-v2-card-head{
  margin-bottom: 18px;
}
.sens-v2-card-head-row{
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}
.sens-v2-card-title{
  font-size: 15px;
  font-weight: 700;
  color: var(--text-strong, #FFFFFF);
}
.sens-v2-card-sub{
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* ---- Score Decomposition total pill --------------------------- */
.sens-v2-score-total{
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(242,193,46,0.10);
  border: 1px solid rgba(242,193,46,0.32);
  flex-shrink: 0;
}
.sens-v2-score-total-label{
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
}
.sens-v2-score-total-val{
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

/* ---- Empty states (big green check) ---------------------------- */
.sens-v2-empty{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  gap: 12px;
}
.sens-v2-empty-check{
  width: 86px;
  height: 86px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(94,224,160,0.12);
  border: 2px solid rgba(94,224,160,0.40);
  font-size: 44px;
  font-weight: 700;
  color: #5EE0A0;
}
.sens-v2-empty-title{
  font-size: 16px;
  font-weight: 700;
  color: #5EE0A0;
}
.sens-v2-empty-sub{
  font-size: 12px;
  color: var(--muted);
  max-width: 320px;
}

/* ---- Responsive ---------------------------------------------- */
@media (max-width: 1200px){
  .sens-v2-grid-2col{ grid-template-columns: 1fr; }
}
@media (max-width: 900px){
  .sens-v2-summary{
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .sens-v2-summary-divider{ display: none; }
}

/* === END MODERNIZATION COMMIT 25 === */


/* ================================================================
 * SPACESENSE MODERNIZATION LAYER — Commit 26: Fact Sheet redesign
 * ----------------------------------------------------------------
 * Transforms the Fact Sheet from a long vertical scroll of 8 stacked
 * tables into:
 *   1. Sticky overview chip strip at the top — counts + click to jump
 *   2. Each section becomes a collapsible card with its own toggle
 *   3. Multiple cards can be open simultaneously (independent state)
 *   4. State persists in localStorage
 *
 * Zero changes to the existing render functions or editable-table
 * save logic. Existing IDs (factProjectBody, factBuildingsBody,
 * factBuildingsCount, etc.) preserved verbatim. The OUTER container
 * is restructured only.
 *
 * To revert: delete from this banner to the matching
 * `=== END MODERNIZATION COMMIT 26 ===` line + revert the HTML edits
 * in index.html data-tab="facts" + remove setupFactSheetCards /
 * updateFactSheetChips from app.js.
 * ================================================================ */

/* ---- Sticky chip strip --------------------------------------- */
.factsheet-chips-bar{
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: center;
  padding: 14px 20px;
  margin-bottom: 16px;
  background: linear-gradient(180deg, rgba(28,40,54,0.96), rgba(20,30,42,0.96));
  border: 1px solid rgba(242,193,46,0.30);
  border-radius: 14px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
}
.factsheet-chips-bar::before{
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #FFD75A, #F2C12E);
  border-radius: 2px;
}
.factsheet-chips-label{
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--muted);
  white-space: nowrap;
}
.factsheet-chips{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.factsheet-chip{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  background: rgba(91,214,255,0.10);
  border: 1px solid rgba(91,214,255,0.32);
  border-radius: 999px;
  color: #5DB9FF;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
  font-family: inherit;
}
.factsheet-chip:hover{
  background: rgba(242,193,46,0.10);
  border-color: rgba(242,193,46,0.50);
  color: var(--spacesense-yellow);
}
.factsheet-chip-count{
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 11px;
  background: rgba(255,255,255,0.08);
  padding: 1px 6px;
  border-radius: 999px;
  color: #FFFFFF;
}
.factsheet-chip:hover .factsheet-chip-count{
  background: rgba(242,193,46,0.20);
  color: var(--spacesense-yellow);
}
.factsheet-chips-actions{
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.factsheet-bulk-btn{
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  transition: color 140ms ease, border-color 140ms ease;
}
.factsheet-bulk-btn:hover{
  color: var(--text-strong, #FFFFFF);
  border-color: rgba(255,255,255,0.40);
}

/* ---- Collapsible card --------------------------------------- */
.factsheet-card{
  margin-bottom: 10px;
  background: linear-gradient(180deg, rgba(42,59,77,0.55), rgba(30,45,61,0.55));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 200ms ease;
}
.factsheet-card.is-open{
  border-color: rgba(242,193,46,0.30);
}

.factsheet-card-head{
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 22px;
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: var(--text-strong, #FFFFFF);
  transition: background 140ms ease;
}
.factsheet-card-head:hover{
  background: rgba(242,193,46,0.04);
}
.factsheet-card.is-open .factsheet-card-head{
  background: rgba(242,193,46,0.06);
  border-bottom: 1px solid rgba(242,193,46,0.18);
}

.factsheet-card-title{
  font-size: 15px;
  font-weight: 700;
  color: var(--text-strong, #FFFFFF);
  flex-shrink: 0;
}
.factsheet-card-sub{
  font-size: 12px;
  color: var(--muted);
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.factsheet-card-arrow{
  font-size: 16px;
  font-weight: 700;
  color: var(--muted);
  transition: transform 200ms ease, color 200ms ease;
  flex-shrink: 0;
}
.factsheet-card.is-open .factsheet-card-arrow{
  transform: rotate(90deg);
  color: var(--spacesense-yellow);
}

/* count pill — re-style the existing .fact-count to fit card header */
.factsheet-card-head .fact-count{
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 11px;
  background: rgba(91,214,255,0.10);
  color: #5DB9FF;
  border: 1px solid rgba(91,214,255,0.32);
  padding: 2px 10px;
  border-radius: 999px;
  flex-shrink: 0;
}
.factsheet-card-head .fact-count:empty{ display: none; }

/* legacy pill */
.factsheet-card-legacy-pill{
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--muted);
  flex-shrink: 0;
}

/* ---- Card body --------------------------------------------- */
.factsheet-card-body{
  max-height: 0;
  overflow: hidden;
  transition: max-height 320ms cubic-bezier(0.4, 0, 0.2, 1);
}
.factsheet-card.is-open .factsheet-card-body{
  max-height: 4000px;   /* large enough for biggest table; pure CSS shortcut */
}

.factsheet-card-body > .fact-section{
  padding: 18px 22px 22px;
  border: 0;          /* override the legacy .fact-section border */
  margin: 0;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce){
  .factsheet-card-body{ transition: none; }
  .factsheet-card-arrow{ transition: none; }
}

/* Narrow viewports */
@media (max-width: 1100px){
  .factsheet-chips-bar{
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .factsheet-chips-label{ font-size: 9px; }
  .factsheet-card-sub{ display: none; }
}

/* === END MODERNIZATION COMMIT 26 === */


/* ================================================================
 * SPACESENSE MODERNIZATION LAYER — Commit 27: Constraints / Sensitivity
 *                                              cleanup (PR-A)
 * ----------------------------------------------------------------
 * Structural fix: conflict diagnostics move from the Constraints tab
 * (INPUTS section) to the Sensitivity tab's Constraint Impact card
 * (ANALYSIS section), where they belong as post-run outputs.
 *
 *   - Constraints tab gets a compact summary banner ("3 conflicts —
 *     view in Sensitivity →") instead of the rich cards
 *   - Each rule row that has conflicts gets a `⚠ N` pill in its ID
 *     cell + a left-edge accent
 *   - Sensitivity's Constraint Impact card now embeds the individual
 *     violation cards below the type-summary table
 *   - showViolations() now jumps to Sensitivity (not Constraints)
 *
 * Functionality not touched: saveConstraintAdjField, deleteConstraintAdj,
 * addConstraintAdj, buildViolationDiagnosis all unchanged. The KPI bar's
 * Conflicts dial still uses showViolations(); just lands in a different
 * tab now.
 *
 * To revert: delete from this banner to the matching
 * `=== END MODERNIZATION COMMIT 27 ===` line and revert the
 * renderConstraints + renderSensitivity + showViolations edits in
 * app.js.
 * ================================================================ */

/* ---- Constraints summary banner ------------------------------ */
.cst-summary-banner{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  margin-bottom: 18px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid;
}
.cst-summary-banner-good{
  background: rgba(94,224,160,0.06);
  border-color: rgba(94,224,160,0.30);
  color: #5EE0A0;
}
.cst-summary-banner-warn{
  background: rgba(255,177,66,0.06);
  border-color: rgba(255,177,66,0.32);
  color: #FFB142;
}
.cst-summary-icon{
  font-size: 18px;
  flex-shrink: 0;
}
.cst-summary-banner strong{ color: var(--text-strong, #FFFFFF); }
.cst-summary-link{
  margin-left: auto;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--spacesense-yellow);
  background: rgba(242,193,46,0.08);
  border: 1px solid rgba(242,193,46,0.40);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 140ms ease, border-color 140ms ease;
}
.cst-summary-link:hover{
  background: rgba(242,193,46,0.18);
  border-color: rgba(242,193,46,0.60);
}

/* ---- Per-rule conflict badge in the ID cell ----------------- */
.cst-conflict-badge{
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  padding: 1px 8px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  border-radius: 999px;
  cursor: pointer;
  vertical-align: middle;
}
.cst-conflict-badge.is-hard{
  background: rgba(255,124,124,0.16);
  color: #FF7C7C;
  border: 1px solid rgba(255,124,124,0.40);
}
.cst-conflict-badge.is-soft{
  background: rgba(255,177,66,0.16);
  color: #FFB142;
  border: 1px solid rgba(255,177,66,0.40);
}
.cst-conflict-badge:hover{
  filter: brightness(1.15);
}
/* Left-edge accent on rows that have conflicts */
tr.cst-row.cst-has-conflict td:first-child{
  border-left: 3px solid #FFB142;
}
tr.cst-row.cst-has-conflict.cst-inactive td:first-child{
  border-left-color: rgba(255,177,66,0.30);
}

/* ---- Sensitivity violation-cards slot ----------------------- */
.sens-v2-violation-cards{
  display: flex;
  flex-direction: column;
  gap: 10px;
}
/* The legacy .violation-card / .violation-head / .violation-badge /
   .violation-cid / .violation-rule-label / .violation-members-text
   styles already exist further up in style.css — they keep working
   inside this new container. Just tighten the spacing. */
.sens-v2-violation-cards .violation-card{
  margin: 0;
}

/* === END MODERNIZATION COMMIT 27 === */


/* ================================================================
 * SPACESENSE MODERNIZATION LAYER — Commit 28: Constraints redesign
 *                                              (PR-B · chip strip
 *                                               + collapsible cards)
 * ----------------------------------------------------------------
 * Mirrors the Fact Sheet pattern (Commit 26) on the now-simplified
 * Constraints page. Reuses the .factsheet-chips-bar / .factsheet-card
 * presentation classes — no new state machinery, just two new
 * `data-section` namespaces (cst-rules, cst-add) added to the same
 * persisted Set.
 *
 * Hard chip gets a red-tint accent so the rule-population breakdown
 * is visually distinct. Everything else inherits from Commit 26.
 *
 * To revert: delete from this banner to the matching
 * `=== END MODERNIZATION COMMIT 28 ===` line and revert the
 * renderConstraints panel.innerHTML template in app.js back to its
 * Commit 27 form (one single .constraint-section wrapping
 * everything).
 * ================================================================ */

/* Slight padding tweak — constraints panel doesn't need as much top
   padding as Fact Sheet (no project metadata above the chip bar). */
.cst-chips-bar{
  margin-top: 4px;
}

/* Hard chip — red tint to distinguish from cyan default. */
.factsheet-chip.cst-chip-hard{
  background: rgba(255,124,124,0.10);
  border-color: rgba(255,124,124,0.32);
  color: #FF7C7C;
}
.factsheet-chip.cst-chip-hard:hover{
  background: rgba(242,193,46,0.10);
  border-color: rgba(242,193,46,0.50);
  color: var(--spacesense-yellow);
}
.factsheet-chip.cst-chip-hard .factsheet-chip-count{
  background: rgba(255,124,124,0.18);
  color: #FF7C7C;
}
.factsheet-chip.cst-chip-hard:hover .factsheet-chip-count{
  background: rgba(242,193,46,0.20);
  color: var(--spacesense-yellow);
}

/* === END MODERNIZATION COMMIT 28 === */


/* ================================================================
 * SPACESENSE MODERNIZATION LAYER — Commit 29: Sensitivity conflict
 *                                              detail polish
 * ----------------------------------------------------------------
 * Two fixes:
 *   1. The violation cards (moved here in Commit 27) lived INSIDE the
 *      Constraint Impact card in the left column of the 2-col grid.
 *      With many violations this made the left col much taller than
 *      the right (Unmet Demand) → ugly empty space on the right.
 *      Now they live in a separate full-width "Conflict Detail" card
 *      BELOW the 2-col Diagnostics grid.
 *   2. The legacy .violation-card style (Phase-2 era) didn't blend
 *      with the new .sens-v2-card aesthetic. Inside the new container
 *      we restyle them — gradient surface, rounded corners,
 *      brand-yellow accent for HARD, amber for SOFT.
 *
 * To revert: delete from this banner to the matching
 * `=== END MODERNIZATION COMMIT 29 ===` line + revert the
 * conflictDetailHtml extraction in renderSensitivity.
 * ================================================================ */

/* ---- Full-width Conflict Detail card -------------------------- */
.sens-v2-card-conflict-detail{
  margin-top: 20px;
}
.sens-v2-card-conflict-detail .sens-v2-violation-cards{
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

/* ---- Restyle .violation-card to match V2 aesthetic ------------ */
.sens-v2-violation-cards .violation-card{
  background: linear-gradient(180deg, rgba(42,59,77,0.55), rgba(30,45,61,0.55)) !important;
  border: 1px solid rgba(255,255,255,0.08) !important;
  border-left-width: 4px !important;
  border-radius: 10px !important;
  margin: 0 !important;
  overflow: hidden;
}
.sens-v2-violation-cards .violation-card.severity-hard{
  border-left-color: #FF7C7C !important;
  background: linear-gradient(180deg, rgba(255,124,124,0.08), rgba(255,124,124,0.02)) !important;
}
.sens-v2-violation-cards .violation-card.severity-soft{
  border-left-color: #FFB142 !important;
  background: linear-gradient(180deg, rgba(255,177,66,0.06), rgba(255,177,66,0.015)) !important;
}
.sens-v2-violation-cards .violation-head{
  padding: 10px 16px !important;
  border-bottom-color: rgba(255,255,255,0.08) !important;
  background: rgba(255,255,255,0.02);
  font-size: 13px;
}
.sens-v2-violation-cards .violation-badge{
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  padding: 3px 10px;
  border-radius: 999px;
}
.sens-v2-violation-cards .violation-badge.severity-hard{
  background: rgba(255,124,124,0.18);
  color: #FF7C7C;
}
.sens-v2-violation-cards .violation-badge.severity-soft{
  background: rgba(255,177,66,0.18);
  color: #FFB142;
}
.sens-v2-violation-cards .violation-cid{
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 11px;
  color: var(--muted);
}
.sens-v2-violation-cards .violation-rule-label{
  font-size: 12px;
  color: var(--text-strong, #FFFFFF);
  font-weight: 600;
}
.sens-v2-violation-cards .violation-members-text{
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 11px;
  color: var(--muted);
  margin-left: auto;
}

/* === END MODERNIZATION COMMIT 29 === */


/* ================================================================
 * SPACESENSE MODERNIZATION LAYER — Commit 30: Constraints expansion
 *                                              (Location · Capacity
 *                                               Buffer · Coverage)
 * ----------------------------------------------------------------
 * Adds 3 new cards to the Constraints page:
 *
 *   - Location Rules — read + inline edit (weight slider, Active
 *     toggle, Delete). Same pattern as the existing Adjacency card.
 *   - Capacity Buffer — read + inline edit (max_utilisation_pct
 *     slider 50–100%, Active toggle, Delete).
 *   - Coverage Standards — pure read-only viewer with a READ-ONLY
 *     pill in the card header.
 *
 * No new "Add" forms in this PR — direct DB insert still required.
 * UI for Add comes in a follow-up.
 *
 * All cards reuse the .factsheet-card pattern from Commit 26 plus
 * the existing .cst-table / .cst-scope-badge / .cst-hard-badge
 * styling. Just a few specifics added below.
 *
 * To revert: delete from this banner to the matching
 * `=== END MODERNIZATION COMMIT 30 ===` line and remove the
 * buildLocationRulesCard / buildCapacityBufferCard /
 * buildCoverageStandardsCard calls from renderConstraints panel
 * template.
 * ================================================================ */

/* Coverage chip — neutral grey tint so it looks "non-editable" relative
   to the colored editable-type chips. */
.factsheet-chip.cst-chip-coverage{
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.16);
  color: var(--muted);
}
.factsheet-chip.cst-chip-coverage:hover{
  background: rgba(242,193,46,0.10);
  border-color: rgba(242,193,46,0.50);
  color: var(--spacesense-yellow);
}

/* READ-ONLY pill inside Coverage card header. */
.cov-readonly-pill{
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.5px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  color: var(--muted);
  flex-shrink: 0;
}

/* Location + Capacity slider value display (mirrors .cst-weight-val) */
.loc-weight-val,
.cap-pct-val{
  display: inline-block;
  min-width: 36px;
  text-align: right;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--text-strong, #FFFFFF);
  margin-left: 8px;
}

/* Location slider — match Adjacency slider styling */
.loc-weight-slider,
.cap-pct-slider{
  width: 80px;
  vertical-align: middle;
}

/* === END MODERNIZATION COMMIT 30 === */


/* ================================================================
 * SPACESENSE MODERNIZATION LAYER — Commit 31: Colocation card +
 *                                              slider/number sync
 * ----------------------------------------------------------------
 * Two additions:
 *
 *   1. Colocation card on the Constraints page — members grouped by
 *      group_key. Each group has a "TOGETHER" or "SEPARATE" type pill
 *      read from the colocation_groups master table. Members below
 *      get inline edit (weight + Active toggle + Delete).
 *
 *   2. Slider + number-input bidirectional sync on ALL constraint
 *      sliders — Adjacency weight, Location weight, Colocation
 *      weight, Capacity Buffer max-%. Users can drag the slider OR
 *      type the number; either updates the other and triggers save.
 *
 * Touches existing .cst-weight-val / .loc-weight-val / .cap-pct-val
 * usage — those <span> displays are replaced by <input type="number">.
 *
 * To revert: delete from this banner to the matching
 * `=== END MODERNIZATION COMMIT 31 ===` line.
 * ================================================================ */

/* ---- Slider + number-input pairing ---------------------------- */
.cst-weight-slider,
.loc-weight-slider,
.cap-pct-slider,
.coloc-weight-slider{
  vertical-align: middle;
  width: 100px;
}
.cst-weight-num,
.loc-weight-num,
.cap-pct-num,
.coloc-weight-num{
  width: 50px;
  margin-left: 8px;
  padding: 3px 6px;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--text-strong, #FFFFFF);
  background: rgba(0,0,0,0.20);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 4px;
  text-align: right;
  vertical-align: middle;
  /* Hide the spinner buttons on Firefox; the input still accepts arrow keys */
  -moz-appearance: textfield;
}
.cst-weight-num::-webkit-outer-spin-button,
.cst-weight-num::-webkit-inner-spin-button,
.loc-weight-num::-webkit-outer-spin-button,
.loc-weight-num::-webkit-inner-spin-button,
.cap-pct-num::-webkit-outer-spin-button,
.cap-pct-num::-webkit-inner-spin-button,
.coloc-weight-num::-webkit-outer-spin-button,
.coloc-weight-num::-webkit-inner-spin-button{
  -webkit-appearance: none;
  margin: 0;
}
.cst-weight-num:focus,
.loc-weight-num:focus,
.cap-pct-num:focus,
.coloc-weight-num:focus{
  outline: none;
  border-color: rgba(242,193,46,0.50);
  background: rgba(242,193,46,0.05);
}

/* ---- Colocation card — group header row + type pill ---------- */
.coloc-group-row > td{
  padding: 12px 12px 6px !important;
  border-top: 1px solid rgba(242,193,46,0.20);
  background: rgba(242,193,46,0.03);
}
.coloc-group-key{
  font-size: 14px;
  font-weight: 700;
  color: var(--spacesense-yellow);
  letter-spacing: 0.4px;
}
.coloc-group-type{
  display: inline-block;
  margin-left: 12px;
  padding: 2px 10px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  color: var(--muted);
  vertical-align: middle;
}
.coloc-group-type.coloc-grouptype-together{
  background: rgba(94,224,160,0.12);
  border-color: rgba(94,224,160,0.40);
  color: #5EE0A0;
}
.coloc-group-type.coloc-grouptype-separate{
  background: rgba(255,124,124,0.12);
  border-color: rgba(255,124,124,0.40);
  color: #FF7C7C;
}

/* Indent member rows under a group */
.coloc-row > td:first-child{
  padding-left: 28px;
}

/* === END MODERNIZATION COMMIT 31 === */


/* ================================================================
 * SPACESENSE MODERNIZATION LAYER — Commit 33: Adjacency schema fix
 *                                              + inline Add Rule
 * ----------------------------------------------------------------
 * Two changes:
 *
 *   1. Adjacency UI matches the schema. constraint_adjacency is
 *      hard-only (Tranche 5-γ removed weight + is_hard columns;
 *      adjacency_type CHECK restricts to SAME_FLOOR / SAME_LEVEL /
 *      SAME_BUILDING). UI dropped weight slider + HARD/soft cell,
 *      and ADJ_TYPES tightened to the 3 valid values.
 *
 *   2. Inline "+ Add Rule" affordance INSIDE the Adjacency Rules
 *      card. The standalone "Add New Constraint" card at the bottom
 *      of the page is removed. Save requires an explicit confirm()
 *      dialog so an accidental click can't write to the DB.
 *
 * To revert: delete from this banner to the matching
 * `=== END MODERNIZATION COMMIT 33 ===` line. Also revert the
 * adjacency tableRows + thead trimming and the inline-add form
 * markup in renderConstraints.
 * ================================================================ */

/* ---- Inline Add Rule bar above the Adjacency table ----------- */
.cst-inline-add-bar{
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0 14px;
  border-bottom: 1px dashed rgba(255,255,255,0.06);
  margin-bottom: 12px;
}
.cst-inline-add-btn{
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--spacesense-yellow);
  background: rgba(242,193,46,0.08);
  border: 1px dashed rgba(242,193,46,0.50);
  border-radius: 8px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}
.cst-inline-add-btn:hover{
  background: rgba(242,193,46,0.18);
  border-color: rgba(242,193,46,0.80);
  border-style: solid;
}

/* ---- Inline Add Rule form panel ------------------------------ */
.cst-inline-add-form{
  background: rgba(242,193,46,0.04);
  border: 1px solid rgba(242,193,46,0.25);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cst-inline-add-form[hidden]{ display: none; }
.cst-inline-add-form .cst-add-row{
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.cst-inline-add-form .cst-form-label{
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--muted);
  text-transform: uppercase;
  min-width: 70px;
}
.cst-inline-add-form .cst-select{
  padding: 5px 10px;
  font-size: 13px;
  background: rgba(0,0,0,0.25);
  color: var(--text-strong, #FFFFFF);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 6px;
}
.cst-inline-add-form .cst-select:focus{
  outline: none;
  border-color: rgba(242,193,46,0.50);
}

/* === END MODERNIZATION COMMIT 33 === */

/* === MODERNIZATION COMMIT 34 ===
 * Coverage Standards card · two-layer viewer
 * --------------------------------------------------------------
 * The card now shows BOTH layers side-by-side: firm-wide defaults
 * (from space_type_groups columns) and per-scenario overrides
 * (from constraint_coverage rows), one row per CMF space-type
 * group. Both layers are dormant in the live schema today, so
 * value cells render as "—"; the structure becomes meaningful the
 * moment either layer is wired. Read-only viewer; editing comes
 * in a follow-up PR with the schema migrations.
 *
 * To revert: delete from "MODERNIZATION COMMIT 34" header to the
 * `=== END MODERNIZATION COMMIT 34 ===` line.
 */
.cst-table.cov-two-layer th{
  vertical-align: top;
  line-height: 1.35;
}
.cst-table.cov-two-layer code{
  font-size: 10px;
  padding: 1px 4px;
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
}
.cov-chip{
  display: inline-block;
  padding: 2px 7px;
  margin-right: 4px;
  font-size: 11px;
  font-weight: 500;
  background: rgba(63,90,108,0.35);
  border: 1px solid rgba(63,90,108,0.55);
  border-radius: 4px;
  color: #e8edf2;
}
.cov-status-badge{
  display: inline-block;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 10px;
  border: 1px solid transparent;
}
.cov-status-badge.cov-status-default{
  background: rgba(63,90,108,0.30);
  border-color: rgba(63,90,108,0.55);
  color: #d8e0e7;
}
.cov-status-badge.cov-status-override{
  background: rgba(242,193,46,0.20);
  border-color: rgba(242,193,46,0.55);
  color: #f5d36a;
}
/* === END MODERNIZATION COMMIT 34 === */

/* === MODERNIZATION COMMIT 35 ===
 * Inline + Add for Colocation, Location, Capacity Buffer cards
 * --------------------------------------------------------------
 * Completes the inline-Add pattern across the Constraints page —
 * the Adjacency card got it in Commit 33; this commit applies the
 * same UX (collapsed "+ Add Rule" bar, expanding form panel,
 * explicit confirm() before DB write) to the other three cards.
 * Reuses the existing `.cst-inline-add-bar`, `.cst-inline-add-btn`,
 * `.cst-inline-add-form` styles from Commit 33 — this block just
 * adds the per-group "+ Add Member" button styling for Colocation
 * (the only new visual primitive in this commit).
 *
 * To revert: delete from "MODERNIZATION COMMIT 35" header to the
 * `=== END MODERNIZATION COMMIT 35 ===` line. Restoring the
 * builders / handlers requires reverting the matching block in app.js.
 */
.coloc-member-add-btn{
  margin-left: 12px;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 500;
  background: rgba(242,193,46,0.10);
  color: var(--spacesense-yellow, #F2C12E);
  border: 1px dashed rgba(242,193,46,0.45);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.coloc-member-add-btn:hover{
  background: rgba(242,193,46,0.20);
  border-color: rgba(242,193,46,0.70);
}
.coloc-member-add-form-row td{
  background: rgba(63,90,108,0.18);
  border-top: 1px solid rgba(63,90,108,0.35);
  border-bottom: 1px solid rgba(63,90,108,0.35);
  padding: 6px 10px;
}
/* === END MODERNIZATION COMMIT 35 === */

/* ================================================================
 * SPACESENSE MODERNIZATION COMMIT 37 — Back-to-overview bridge
 * ----------------------------------------------------------------
 * Two affordances that let a visitor return from the tool to the
 * landing page at `/`:
 *   1. The brand wordmark in the top-left is now wrapped in an
 *      anchor (display: contents preserves the existing grid).
 *      Clicking SPACESENSE → home.
 *   2. A small "← Overview" pill in the topbar between the brand
 *      and the menubar — explicit affordance for first-time
 *      visitors who don't know the wordmark is clickable.
 *
 * Why: after PR #314 made the landing live at `/`, the tool became
 * a one-way trip. Faculty exploring after the seminar had no way
 * to get back to the framing context. This is the smallest possible
 * bridge.
 *
 * To revert: delete from this banner to the matching
 * `=== END MODERNIZATION COMMIT 37 ===` line.
 * ================================================================ */

/* 1. Brand wordmark becomes a link without disturbing the grid layout
   set up in Commit 7 (.brand-wrap is a 2-col x 2-row grid; .brand
   sits in grid 2/1, .brand-sub in 2/2). display: contents removes
   the anchor from layout but keeps it in the a11y tree as a link. */
.brand-home{
  display: contents;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
.brand-home:hover .brand{ color: var(--spacesense-yellow, #F2C12E); }
.brand-home:focus-visible .brand{
  outline: 2px solid var(--spacesense-yellow, #F2C12E);
  outline-offset: 3px;
  border-radius: 3px;
}

/* 2. Explicit "← Overview" pill, placed between brand-wrap and menubar */
.back-to-overview{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px 5px 10px;
  margin: 0 4px 0 8px;
  border: 1px solid rgba(242,193,46,0.45);
  border-radius: 999px;
  background: rgba(242,193,46,0.08);
  color: var(--spacesense-yellow, #F2C12E);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease, color 0.16s ease;
}
.back-to-overview:hover{
  background: rgba(242,193,46,0.16);
  border-color: rgba(242,193,46,0.72);
  color: #F8D45A;
}
.back-to-overview:hover .back-arrow{ transform: translateX(-2px); }
.back-to-overview:focus-visible{
  outline: 2px solid var(--spacesense-yellow, #F2C12E);
  outline-offset: 2px;
}
.back-arrow{
  display: inline-block;
  font-weight: 700;
  transition: transform 0.16s ease;
}

/* Below 980px the menubar already gets cramped — collapse the label
   so just the arrow remains as a circular button. */
@media (max-width: 980px){
  .back-to-overview{
    padding: 5px 10px;
  }
  .back-to-overview .back-label{ display: none; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce){
  .back-to-overview, .back-to-overview .back-arrow{ transition: none !important; }
}
/* === END MODERNIZATION COMMIT 37 === */
