:root {
  --bg-app: #090d16;
  --bg-surface: #0f172a;
  --bg-elevated: #1e293b;
  --bg-hud: rgba(15, 23, 42, 0.88);
  --border-subtle: rgba(148, 163, 184, 0.18);
  --border-strong: rgba(148, 163, 184, 0.34);
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --accent-blue: #2563eb;
  --accent-blue-hover: #3b82f6;
  --accent-sky: #38bdf8;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-hud: 0 8px 24px rgba(2, 6, 23, 0.55);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-app);
  color: var(--text-primary);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Custom Browser Surfaces (Scrollbars & Selection) */
::selection {
  background: rgba(37, 99, 235, 0.45);
  color: #ffffff;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.6);
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.5);
}

/* ========================================================================= */
/* TOP APPLICATION BAR (54px)                                                */
/* ========================================================================= */
.topbar {
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: #0b1120;
  border-bottom: 1px solid var(--border-subtle);
  gap: 16px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--accent-blue);
  color: #ffffff;
  font-weight: 800;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.brand-copy h1 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.brand-copy p {
  margin: 0;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workspace-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(30, 41, 59, 0.65);
  padding: 4px;
  border-radius: 9px;
  border: 1px solid var(--border-subtle);
}

.ws-tab {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 150ms ease, color 150ms ease;
}

.ws-tab:hover {
  color: var(--text-primary);
  background: rgba(148, 163, 184, 0.1);
}

.ws-tab.active {
  background: var(--accent-blue);
  color: #ffffff;
}

.ws-badge {
  background: rgba(15, 23, 42, 0.55);
  color: #93c5fd;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.compact-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.compact-control select,
.compact-control input {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11.5px;
}

.compact-control input {
  width: 68px;
}

.compact-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--text-secondary);
  cursor: pointer;
}

/* ========================================================================= */
/* WORKSPACE CONTAINERS                                                      */
/* ========================================================================= */
.workspace-panel {
  display: none;
  width: 100%;
  height: calc(100vh - 54px);
}

.workspace-panel.active {
  display: block;
}

/* ========================================================================= */
/* WORKSPACE 1: SPATIAL STAGE (73%) + INSPECTOR DRAWER (27%)                 */
/* ========================================================================= */
.spatial-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  width: 100%;
  height: 100%;
}

.viewport-stage {
  position: relative;
  width: 100%;
  height: 100%;
  background: #0b1120;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.canvas-container {
  position: relative;
  width: 100%;
  height: 100%;
  flex: 1;
}

#vr-house-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 2;
}

.vr-gl-layer {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  display: block;
  z-index: 1;
}

/* Floating Top HUD Bar */
.hud-top-bar {
  position: absolute;
  top: 12px;
  left: 14px;
  right: 14px;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
  flex-wrap: wrap;
}

.hud-pill-group,
.hud-right-controls {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-hud);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-subtle);
  padding: 5px 8px;
  border-radius: 10px;
  box-shadow: var(--shadow-hud);
}

.hud-group-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0 6px 0 4px;
}

.hud-divider {
  width: 1px;
  height: 18px;
  background: var(--border-subtle);
  margin: 0 4px;
}

.hud-pill {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 140ms ease;
}

.hud-pill:hover {
  color: #ffffff;
  background: rgba(148, 163, 184, 0.14);
}

.hud-pill.active {
  background: var(--accent-blue);
  color: #ffffff;
  border-color: rgba(147, 197, 253, 0.45);
}

.hud-select-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0 4px;
}

.hud-select-pill select {
  background: rgba(30, 41, 59, 0.92);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

/* Floating Bottom-Center Mode Dock */
.hud-bottom-dock {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-hud);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-strong);
  padding: 6px 10px;
  border-radius: 12px;
  box-shadow: var(--shadow-hud);
}

.dock-btn {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 140ms ease;
  white-space: nowrap;
}

.dock-btn:hover {
  color: #ffffff;
  background: rgba(148, 163, 184, 0.14);
}

.dock-btn.active {
  background: var(--accent-blue);
  color: #ffffff;
  border-color: rgba(147, 197, 253, 0.5);
}

.dock-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.45);
  font-size: 10px;
  font-weight: 700;
  color: #cbd5e1;
}

.dock-btn-ghost {
  color: var(--text-muted);
}

/* ========================================================================= */
/* RIGHT CONTEXTUAL INSPECTOR DRAWER (390px)                                 */
/* ========================================================================= */
.inspector-drawer {
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.inspector-header {
  padding: 14px 16px 0 16px;
  background: #0b1120;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.selected-title-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.tag-code-pill {
  background: rgba(37, 99, 235, 0.25);
  color: #93c5fd;
  border: 1px solid rgba(96, 165, 250, 0.45);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11.5px;
  font-weight: 800;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  flex-shrink: 0;
}

.selected-title-text h2 {
  margin: 0 0 2px 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.selected-title-text p {
  margin: 0;
  font-size: 11.5px;
  color: var(--text-muted);
}

.room-vr-action-row {
  margin-bottom: 10px;
}

.btn-enter-vr {
  width: 100%;
  background: rgba(37, 99, 235, 0.22);
  color: #bfdbfe;
  border: 1px solid rgba(96, 165, 250, 0.5);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 140ms ease;
}

.btn-enter-vr:hover {
  background: var(--accent-blue);
  color: #ffffff;
}

.inspector-subtabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.subtab-btn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 140ms ease;
}

.subtab-btn:hover {
  color: var(--text-primary);
}

.subtab-btn.active {
  color: #60a5fa;
  border-bottom-color: #3b82f6;
}

.inspector-body {
  padding: 14px 16px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.inspector-card {
  background: rgba(30, 41, 59, 0.52);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px;
}

.split-wall-card {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(120, 53, 15, 0.16);
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.card-title-row h3 {
  margin: 0;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.card-helper {
  margin: 0 0 10px 0;
  font-size: 11.5px;
  color: var(--text-secondary);
}

.code-tag,
.trade-pill,
.gate-pill {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}

.subtle-caption {
  font-size: 11px;
  color: var(--text-muted);
}

.split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.field-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--text-secondary);
}

.field-item input,
.field-item select {
  background: #0f172a;
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 11.5px;
}

.split-btn-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.preset-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preset-chip {
  background: rgba(15, 23, 42, 0.75);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 140ms ease;
}

.preset-chip:hover {
  color: #ffffff;
  border-color: var(--accent-blue-hover);
  background: rgba(37, 99, 235, 0.22);
}

.scope-input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.scope-input-group textarea {
  width: 100%;
  background: #0b1120;
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 12px;
  resize: vertical;
}

.scope-input-group textarea:focus {
  outline: none;
  border-color: var(--accent-blue-hover);
}

.factors-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.factor-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.factor-row label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
}

.factor-row select {
  width: 100%;
  background: #0b1120;
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
}

.empty-hint {
  margin: 0;
  font-size: 11.5px;
  color: var(--text-muted);
}

.btn-secondary-full {
  width: 100%;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary-full:hover {
  background: rgba(51, 65, 85, 0.9);
}

.btn-secondary-sm,
.btn-accent-sm {
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
}

.btn-secondary-sm {
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

.btn-accent-sm {
  background: var(--accent-blue);
  color: #ffffff;
  border-color: transparent;
}

.confirm-cta-bar {
  margin-top: auto;
  padding-top: 4px;
}

.btn-primary-cta {
  width: 100%;
  background: var(--accent-emerald);
  color: #042f2e;
  border: none;
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  transition: opacity 150ms ease, transform 100ms ease;
}

.btn-primary-cta:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ========================================================================= */
/* SUB-TAB 2: ON-DEMAND PROPERTIES & MEASUREMENTS SHEET                      */
/* ========================================================================= */
.property-sheet-list {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.prop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  background: rgba(15, 23, 42, 0.65);
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.1);
}

.prop-row dt {
  font-size: 11.5px;
  color: var(--text-muted);
}

.prop-row dd {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.formula-preview-box {
  background: #0b1120;
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 11.5px;
  color: var(--text-secondary);
  white-space: pre-wrap;
  max-height: 150px;
  overflow-y: auto;
}

.compact-search {
  background: #0b1120;
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  width: 150px;
}

.tag-directory-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-height: 190px;
  overflow-y: auto;
}

.tag-chip {
  background: #0b1120;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
}

.tag-chip.active {
  background: var(--accent-blue);
  color: #ffffff;
  border-color: #60a5fa;
}

.tag-chip.scoped {
  border-color: var(--accent-emerald);
  color: #6ee7b7;
}

/* ========================================================================= */
/* WORKSPACE 2 & 3: ESTIMATE TABLE & REPORTS                                 */
/* ========================================================================= */
.estimate-workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 16px;
  padding: 16px;
  height: 100%;
  overflow-y: auto;
}

.panel-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.totals-strip {
  display: flex;
  gap: 14px;
}

.total-metric {
  background: rgba(30, 41, 59, 0.7);
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
}

.total-metric span {
  font-size: 10.5px;
  color: var(--text-muted);
}

.total-metric strong {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.total-metric.highlight strong {
  color: #34d399;
}

.table-scroll-wrap {
  max-height: calc(100vh - 210px);
  overflow-y: auto;
}

.estimate-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.estimate-table th,
.estimate-table td {
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.estimate-table th {
  color: var(--text-muted);
  font-weight: 600;
  background: rgba(15, 23, 42, 0.8);
  position: sticky;
  top: 0;
}

.empty-table-cell {
  text-align: center !important;
  color: var(--text-muted);
  padding: 32px !important;
}

.copilot-search-row {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.copilot-search-row input {
  flex: 1;
  background: #0b1120;
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 6px 10px;
}

.copilot-results-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
}

.copilot-item {
  background: #0b1120;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 8px;
  font-size: 11.5px;
}

.reports-workspace-wrap {
  padding: 16px;
  height: 100%;
  overflow-y: auto;
}

.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.report-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.report-col label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.report-col textarea {
  width: 100%;
  background: #0b1120;
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  line-height: 1.5;
}

/* ========================================================================= */
/* ROOM TAKEOFF (expandable properties)                                      */
/* ========================================================================= */
.takeoff-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 2px 8px 2px;
}
.takeoff-head strong {
  font-size: 13px;
}
.muted {
  color: var(--text-muted);
  font-size: 11.5px;
}
.takeoff-section {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 8px;
  margin-bottom: 6px;
  overflow: hidden;
}
.takeoff-section > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 10px;
  font-weight: 600;
  font-size: 12.5px;
}
.takeoff-section > summary::-webkit-details-marker {
  display: none;
}
.takeoff-section > summary::before {
  content: '';
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--text-muted);
  border-bottom: 1.5px solid var(--text-muted);
  transform: rotate(-45deg);
  margin-right: 8px;
  transition: transform 150ms ease;
}
.takeoff-section[open] > summary::before {
  transform: rotate(45deg);
}
.takeoff-section > summary > span:first-child {
  flex: 1;
}
.takeoff-sum {
  color: #93c5fd;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}
.takeoff-body {
  padding: 0 8px 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.takeoff-line {
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(30, 41, 59, 0.6);
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Simple / Advanced mode switch */
.mode-switch {
  display: inline-flex;
  background: rgba(30, 41, 59, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 3px;
}
.mode-switch button {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.mode-switch button.active {
  background: #f8fafc;
  color: #0f172a;
}
body.simple-mode .advanced-only {
  display: none !important;
}
body:not(.simple-mode) .simple-only {
  display: none !important;
}
.action-chip-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.action-chip {
  background: rgba(15, 23, 42, 0.75);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.action-chip small {
  display: block;
  font-weight: 400;
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 2px;
}
.action-chip:hover,
.action-chip.active {
  border-color: #3b82f6;
  background: rgba(37, 99, 235, 0.2);
}
.plain-summary {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-primary);
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 8px;
  padding: 10px;
}

.property-loader-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 16px;
  background: #111b2e;
  border-bottom: 1px solid var(--border-strong);
  z-index: 25;
}
.loader-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.loader-group input[type="text"] {
  background: #0b1120;
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 5px 10px;
  width: 260px;
  font-size: 12px;
}
.multi-select-banner {
  background: rgba(37, 99, 235, 0.16);
  border: 1px solid rgba(96, 165, 250, 0.45);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.multi-select-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  color: #bfdbfe;
  font-size: 12px;
}
.link-clear-btn {
  background: transparent;
  border: none;
  color: #93c5fd;
  text-decoration: underline;
  cursor: pointer;
  font-size: 11px;
  padding: 0;
}


/* Granular Multi-Gang Switches/Outlets & Room Inspection Photo Scan-Verification */
.verify-source-line {
  font-size: 11px;
  color: #93c5fd;
  background: rgba(37, 99, 235, 0.14);
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: 6px;
  padding: 5px 8px;
  margin-bottom: 6px;
}
.gran-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 6px;
}
.gran-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.gran-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.gran-pill {
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 5px;
  border: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.8);
  color: var(--text-secondary);
}
.gran-pill.sw {
  border-color: rgba(245, 158, 11, 0.4);
  color: #fde68a;
}
.gran-pill.out {
  border-color: rgba(16, 185, 129, 0.4);
  color: #a7f3d0;
}
.room-photo-verify-box {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.photo-verify-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.photo-verify-btn {
  flex: 1;
  min-width: 120px;
  text-align: center;
  background: rgba(37, 99, 235, 0.22);
  border: 1px solid rgba(96, 165, 250, 0.5);
  color: #dbeafe;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.photo-verify-btn.camera {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(52, 211, 153, 0.5);
  color: #d1fae5;
}
.room-photo-note-input {
  width: 100%;
  box-sizing: border-box;
  background: #0b1120;
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 11.5px;
}
.photo-verify-submit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.photo-verify-status {
  font-size: 10.5px;
}
.btn-verify-room-photo {
  background: #2563eb;
  color: #ffffff;
  border: 1px solid #60a5fa;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.verify-log-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.verify-log-item {
  font-size: 11px;
  line-height: 1.4;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.35);
  color: #d1fae5;
  border-radius: 6px;
  padding: 5px 7px;
}
.room-photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
}
.room-photo-card {
  background: #0b1120;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.room-photo-card img {
  width: 100%;
  height: 76px;
  object-fit: cover;
  display: block;
}
.room-photo-placeholder {
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(30, 41, 59, 0.5);
}
.room-photo-meta {
  padding: 4px 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.room-photo-title {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.room-photo-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}
.scan-ref-badge,
.packout-ref-badge,
.upload-ref-badge {
  font-size: 9.5px;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 600;
}
.scan-ref-badge {
  background: rgba(37, 99, 235, 0.22);
  color: #93c5fd;
}
.packout-ref-badge {
  background: rgba(245, 158, 11, 0.22);
  color: #fcd34d;
}
.upload-ref-badge {
  background: rgba(16, 185, 129, 0.22);
  color: #6ee7b7;
}

/* Roof Engineering Measurements & Clickable Slope Schedule */
.roof-kpi-card {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(15, 23, 42, 0.82);
}
.roof-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  margin-top: 6px;
}
.roof-kpi-cell {
  background: rgba(30, 41, 59, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 6px;
  padding: 5px 7px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.roof-kpi-cell span {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.roof-kpi-cell strong {
  font-size: 12px;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.roof-kpi-cell.accent strong {
  color: #fbbf24;
}
.focused-slope-banner {
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(251, 191, 36, 0.45);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.roof-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 4px;
}
.roof-slope-row {
  cursor: pointer;
  border: 1px solid transparent;
  transition: border-color 120ms ease, background 120ms ease;
}
.roof-slope-row:hover {
  border-color: rgba(96, 165, 250, 0.55);
  background: rgba(37, 99, 235, 0.18);
}
.roof-slope-row.selected {
  border-color: #fbbf24;
  background: rgba(245, 158, 11, 0.18);
}
.slope-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.pitch-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(245, 158, 11, 0.22);
  color: #fde68a;
  font-variant-numeric: tabular-nums;
}


/* ===================================================================== */
/* Domain Isolation Banner, Whole-Room Surface Selector & Step Wizard    */
/* ===================================================================== */
.domain-lock-banner {
  border-radius: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(56, 189, 248, 0.38);
  background: rgba(14, 116, 144, 0.16);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.domain-lock-banner.exterior {
  border-color: rgba(59, 130, 246, 0.45);
  background: rgba(29, 78, 216, 0.18);
}
.domain-lock-banner.roof {
  border-color: rgba(245, 158, 11, 0.48);
  background: rgba(180, 83, 9, 0.18);
}
.domain-lock-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}
.domain-pill {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(6, 182, 212, 0.24);
  color: #67e8f9;
}
.domain-pill.exterior {
  background: rgba(59, 130, 246, 0.28);
  color: #93c5fd;
}
.domain-pill.roof {
  background: rgba(245, 158, 11, 0.28);
  color: #fde68a;
}
.area-cap-pill {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #e2e8f0;
  font-variant-numeric: tabular-nums;
}
.domain-lock-desc {
  margin: 0;
  font-size: 11px;
  line-height: 1.38;
  color: #cbd5e1;
}

.wizard-card {
  border-color: rgba(59, 130, 246, 0.38);
  background: rgba(15, 23, 42, 0.88);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wizard-progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.wizard-step-pill {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(37, 99, 235, 0.26);
  color: #93c5fd;
  font-variant-numeric: tabular-nums;
}
.surface-selector-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.surface-selector-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(30, 41, 59, 0.68);
  border: 1px solid rgba(148, 163, 184, 0.18);
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}
.surface-selector-item:hover {
  border-color: rgba(96, 165, 250, 0.52);
  background: rgba(37, 99, 235, 0.14);
}
.surface-selector-left {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
}
.surface-selector-cap {
  font-size: 11px;
  font-weight: 600;
  color: #93c5fd;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.wizard-fields-stack {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.wizard-qty-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
.wizard-qty-input {
  width: 100%;
  background: #0f172a;
  color: var(--text-primary);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.wizard-cap-note {
  font-size: 10.5px;
  color: #38bdf8;
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.wizard-footer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 4px;
}
.wizard-secondary-group {
  display: flex;
  align-items: center;
  gap: 5px;
}
.wizard-review-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.wizard-review-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.32);
  font-size: 11.5px;
  color: #e2e8f0;
}

.iicrc-optin-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.iicrc-toggle-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--text-primary);
  cursor: pointer;
}
.compact-loader-select {
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  max-width: 340px;
}
.scan-mode-loader-group {
  flex-wrap: wrap;
}
.scan-mode-pros-cons {
  width: 100%;
  font-size: 11px;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 6px;
  padding: 5px 9px;
  margin-top: 3px;
  line-height: 1.4;
}
.locate-pin-btn {
  background: rgba(6, 182, 212, 0.18);
  color: #67e8f9;
  border: 1px solid rgba(6, 182, 212, 0.45);
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.locate-pin-btn:hover {
  background: rgba(6, 182, 212, 0.32);
}
.mep-schedule-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}
.mep-schedule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 7px;
  border-radius: 5px;
  background: rgba(30, 41, 59, 0.62);
  border: 1px solid rgba(148, 163, 184, 0.15);
  font-size: 11px;
}

/* =========================================================================
   CLEAN TOGGLE-SECTION PROGRESSIVE STEP ESTIMATOR
   ========================================================================= */
.section-estimator-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(56, 189, 248, 0.28);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(2, 6, 23, 0.88));
}
.sec-est-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sec-est-header h3 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  color: #f8fafc;
}
.sec-est-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}
.sec-active-pill {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.2);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.35);
}
.sec-est-helper {
  margin: 0;
  font-size: 11.5px;
  color: #94a3b8;
  line-height: 1.35;
}
.sec-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sec-row {
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.65);
  overflow: hidden;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.sec-row.active {
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(15, 23, 42, 0.95);
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.14);
}
.sec-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
}
.sec-row-title-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex-wrap: wrap;
}
.sec-row-title {
  font-size: 12.5px;
  font-weight: 600;
  color: #f1f5f9;
}
.sec-meas-badge {
  font-size: 10.5px;
  font-weight: 600;
  color: #94a3b8;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 5px;
  padding: 1px 6px;
  white-space: nowrap;
}
.sec-row.active .sec-meas-badge {
  color: #bae6fd;
  border-color: rgba(56, 189, 248, 0.38);
  background: rgba(2, 132, 199, 0.18);
}
.yn-toggle {
  display: inline-flex;
  border-radius: 999px;
  background: #020617;
  border: 1px solid rgba(148, 163, 184, 0.26);
  padding: 2px;
  flex-shrink: 0;
}
.yn-btn {
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.yn-btn.is-no.selected {
  background: rgba(71, 85, 105, 0.55);
  color: #e2e8f0;
}
.yn-btn.is-yes.selected {
  background: #0284c7;
  color: #ffffff;
}
.sec-steps-body {
  padding: 9px 10px 10px;
  border-top: 1px solid rgba(56, 189, 248, 0.2);
  background: rgba(2, 6, 23, 0.45);
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.step-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 7px 9px;
  border-radius: 7px;
  background: rgba(30, 41, 59, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.15);
}
.step-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.step-title-left {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: #e2e8f0;
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.22);
  color: #7dd3fc;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.step-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 6px;
}
.step-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.step-field > span {
  font-size: 10.5px;
  color: #94a3b8;
  font-weight: 600;
}
.step-field select,
.step-field input {
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 6px;
  padding: 5px 7px;
  font-size: 11.5px;
}
.dr-chip-grid,
.wall-pick-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.dr-chip,
.wall-pick-chip {
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.85);
  color: #cbd5e1;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
}
.dr-chip.selected,
.wall-pick-chip.selected {
  background: rgba(2, 132, 199, 0.28);
  border-color: #38bdf8;
  color: #f8fafc;
}
.wall-pick-banner {
  font-size: 11px;
  color: #bae6fd;
  background: rgba(2, 132, 199, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.32);
  border-radius: 6px;
  padding: 5px 8px;
  line-height: 1.35;
}
.wall-gate-notice {
  font-size: 11px;
  color: #fde68a;
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.38);
  border-radius: 6px;
  padding: 6px 8px;
  line-height: 1.35;
}
.esx-formula-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 5px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.32);
  color: #a7f3d0;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.sec-apply-bar {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-top: 4px;
}
.btn-apply-sections {
  width: 100%;
  border: none;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, #0284c7, #0ea5e9);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.32);
}
.btn-apply-sections:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}
.sec-apply-status {
  font-size: 11px;
  color: #6ee7b7;
  text-align: center;
}
.advanced-tools-drawer {
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.45);
  margin-top: 4px;
}
.advanced-tools-drawer > summary {
  cursor: pointer;
  padding: 8px 11px;
  font-size: 11.5px;
  font-weight: 600;
  color: #94a3b8;
  user-select: none;
}
.advanced-tools-drawer[open] > summary {
  color: #e2e8f0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}
.advanced-drawer-body {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
