:root {
  --hall-blue: #1188d1;
  --hall-blue-dark: #075f96;
  --hall-ink: #16232c;
  --hall-muted: #6f7f8a;
  --hall-border: #dbe3e7;
  --hall-panel: #ffffff;
  --hall-soft: #f4f7f8;
  --hall-sidebar-width: 390px;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
body {
  overflow: hidden;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--hall-ink);
  background: #edf3f5;
}
button,
input,
select:where(:not(.shared-panel-controls *)) { font: inherit; }
button { cursor: pointer; }

/* The hall has no product-specific upper/lower bar. The viewer occupies the full
   area below the shared top bar, while Hall settings float on the right. */
.app-shell {
  position: fixed;
  inset: var(--shared-topbar-height, 52px) 0 0 0;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #dfe9ec;
}
.viewer-panel,
.viewer-stage,
#canvasHost { position: absolute; inset: 0; min-width: 0; min-height: 0; }
.viewer-stage {
  overflow: hidden;
  background: radial-gradient(circle at 48% 28%, #f8fbfc 0, #e9f1f3 46%, #d4e0e4 100%);
}
#canvasHost canvas { display: block; width: 100%; height: 100%; }

.hall-embed-inspection-controls { display: none; }
body.configurator-embed-preview .hall-embed-inspection-controls {
  position: absolute;
  z-index: 24;
  top: 14px;
  left: 14px;
  display: flex;
  gap: 8px;
  pointer-events: auto;
}
.hall-embed-inspection-controls button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid rgba(102, 128, 141, .28);
  border-radius: 999px;
  color: #29404d;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 5px 18px rgba(34, 57, 68, .14);
  font-size: 12px;
  font-weight: 800;
  backdrop-filter: blur(10px);
}
.hall-embed-inspection-controls button[aria-pressed="true"] {
  color: #075f96;
  border-color: rgba(17, 136, 209, .42);
  background: rgba(235, 247, 253, .97);
}
.hall-embed-control-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #80929c;
}
#hallPreviewCladdingButton[aria-pressed="true"] .hall-embed-control-dot { background: #1188d1; }
.hall-embed-control-icon { font-size: 15px; line-height: 1; }

@media (max-width: 520px) {
  body.configurator-embed-preview .hall-embed-inspection-controls { top: 9px; left: 9px; gap: 6px; }
  .hall-embed-inspection-controls button { min-height: 32px; padding: 0 10px; font-size: 11px; }
}

.sidebar {
  position: absolute !important;
  z-index: 40;
  top: 0;
  right: 0;
  bottom: 0;
  left: auto !important;
  width: var(--hall-sidebar-width) !important;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(255,255,255,.985);
  border: 0;
  border-left: 1px solid var(--hall-border);
  box-shadow: -11px 0 32px rgba(29,50,61,.09);
  transform: translateX(0);
  transition: transform .22s ease;
}
.sidebar.is-collapsed { transform: translateX(100%) !important; margin: 0 !important; }

/* Explicit right-side geometry keeps this correct even with older shared-shell CSS. */
.shared-settings-toggle {
  position: fixed !important;
  z-index: 860 !important;
  top: calc(var(--shared-topbar-height, 52px) + 18px) !important;
  right: var(--hall-sidebar-width) !important;
  left: auto !important;
  width: 44px !important;
  height: 48px !important;
  display: grid !important;
  place-items: center;
  margin: 0 !important;
  border: 1px solid var(--hall-border) !important;
  border-right: 0 !important;
  border-radius: 13px 0 0 13px !important;
  color: #31505e;
  background: rgba(255,255,255,.985) !important;
  box-shadow: -7px 4px 18px rgba(31,52,62,.10) !important;
  transition: right .22s ease !important;
}
body.hall-sidebar-collapsed .shared-settings-toggle { right: 0 !important; }
body.hall-sidebar-collapsed .shared-settings-toggle svg { transform: rotate(180deg); }
.eyebrow:where(:not(.shared-panel-controls *)) { margin: 0 0 5px; color: var(--hall-blue-dark); font-size: 11px; font-weight: 850; letter-spacing: .11em; text-transform: uppercase; }
h2,
h3,
p,
h1:where(:not(.shared-panel-controls *)) { margin-top: 0; }
h1:where(:not(.shared-panel-controls *)) { margin-bottom: 9px; font-size: 25px; line-height: 1.12; letter-spacing: -.03em; }
h2 { margin-bottom: 0; font-size: 20px; letter-spacing: -.025em; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.section-number { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: #0a74b2; background: #eaf6fd; font-size: 12px; font-weight: 850; }
input[type="range"]:where(:not(.shared-panel-controls *)) { width: 100%; accent-color: var(--hall-blue); }
select:focus:where(:not(.shared-panel-controls *)) { outline: 2px solid rgba(17,136,209,.18); border-color: var(--hall-blue); }
.color-heading { display: block; margin: 0 0 8px; color: #53636d; font-size: 11px; font-weight: 800; }
select:where(:not(.shared-panel-controls *)) { width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--hall-border); border-radius: 10px; color: #21323c; background: #fff; font-size: 12px; font-weight: 700; }
.info-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; margin-top: 15px; padding: 13px 14px; border: 1px solid #d7e5ed; border-radius: 12px; background: #f1f8fc; }
.info-card span { color: #536873; font-size: 11px; font-weight: 700; }
.info-card strong { grid-row: 1 / span 2; grid-column: 2; align-self: center; color: var(--hall-blue-dark); font-size: 23px; }
.info-card small { color: #70828c; font-size: 10px; }
.profile-card small:last-child { grid-column: 1 / -1; margin-top: 4px; padding-top: 7px; border-top: 1px solid rgba(59,112,142,.14); }
.hea-reference-card { margin-top: 12px; padding: 12px; border: 1px solid #d7e5ed; border-radius: 12px; background: #f8fbfd; }
.hea-reference-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.hea-reference-heading > div { display: grid; gap: 2px; }
.hea-reference-heading b { color: #263741; font-size: 12px; }
.hea-reference-heading small, .hea-reference-source { color: #748690; font-size: 9px; line-height: 1.35; }
.hea-reference-heading > span { flex: none; padding: 3px 7px; border-radius: 999px; color: #0a74b2; background: #e7f4fb; font-size: 8px; font-weight: 850; text-transform: uppercase; letter-spacing: .05em; }
.hea-reference-table-wrap { max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; border: 1px solid #e1e9ed; border-radius: 9px; background: #fff; scrollbar-width: thin; }
.hea-reference-table { width: max-content; min-width: 690px; border-collapse: collapse; color: #405560; font-size: 9px; line-height: 1.25; user-select: text; }
.hea-reference-table th, .hea-reference-table td { min-width: 46px; padding: 6px 7px; border-right: 1px solid #edf1f3; border-bottom: 1px solid #edf1f3; text-align: center; white-space: nowrap; }
.hea-reference-table th { color: #506876; background: #f3f7f9; font-weight: 850; }
.hea-reference-table tbody th { color: #18384a; background: #eaf2f6; }
.hea-reference-table tr:last-child > * { border-bottom: 0; }
.hea-reference-table tr > *:last-child { border-right: 0; }
.hea-reference-source { display: block; margin-top: 7px; }
.color-heading { margin-top: 17px; }
.swatch-row { display: flex; gap: 10px; }
.swatch { width: 38px; height: 38px; padding: 0; border: 3px solid #fff; border-radius: 10px; background: var(--swatch); box-shadow: 0 0 0 1px #d5dde1; }
.swatch.selected { box-shadow: 0 0 0 2px var(--hall-blue), 0 0 0 4px #d9eef9; }
.door-controls { display: grid; gap: 16px; margin-top: 18px; padding-top: 18px; border-top: 1px solid #e8edef; }
.door-controls.is-disabled { opacity: .42; pointer-events: none; }

.explode-control { width: 100%; margin-top: 18px; padding: 13px; border: 1px solid #d5e0e5; border-radius: 12px; background: #f8fbfc; }
.explode-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; color: #445761; font-size: 11px; font-weight: 800; }
.explode-heading strong { color: #087bb9; }
.explode-copy { margin: 0 0 10px; color: #71818b; font-size: 10px; line-height: 1.45; }
.explode-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 9px; align-items: center; }
.explode-row button { height: 32px; padding: 0 12px; border: 1px solid #b9d9e9; border-radius: 8px; color: #076fa7; background: #edf8fd; font-size: 10px; font-weight: 850; }
.bom-settings-button { width: 100%; min-height: 62px; margin-top: 12px; padding: 11px 13px; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 12px; border: 1px solid #c7dfeb; border-radius: 12px; color: #18384a; background: #f1f9fd; text-align: left; }
.bom-settings-button span { display: grid; gap: 3px; }
.bom-settings-button b { font-size: 12px; }
.bom-settings-button small { color: #6b7e88; font-size: 10px; }
.bom-settings-button strong { color: #087bb9; font-size: 11px; }

.dimension-label { padding: 3px 6px; border: 1px solid rgba(25,45,57,.12); border-radius: 6px; color: #15252e; background: rgba(255,255,255,.92); box-shadow: 0 3px 10px rgba(27,45,53,.08); font-size: 9px; font-weight: 800; white-space: nowrap; }

.bom-panel { width: min(860px, calc(100vw - 36px)); max-height: min(760px, calc(100vh - 46px)); padding: 0; border: 1px solid #d8e1e5; border-radius: 16px; color: var(--hall-ink); background: #fff; box-shadow: 0 30px 90px rgba(16,32,41,.22); }
.bom-panel::backdrop { background: rgba(20,32,38,.38); backdrop-filter: blur(3px); }
.bom-header, .bom-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid #e4eaed; }
.bom-header h2 { font-size: 20px; }
.bom-close { width: 34px; height: 34px; border: 0; border-radius: 9px; color: #52636d; background: #f1f4f5; font-size: 21px; }
.bom-scroll-region { max-height: calc(100vh - 220px); overflow: auto; padding: 18px 20px; }
.bom-disclaimer { margin-bottom: 15px; padding: 12px 14px; border: 1px solid #d7e7ef; border-radius: 11px; color: #55707d; background: #f0f8fc; font-size: 11px; line-height: 1.5; }
.bom-table-wrap { overflow-x: auto; border: 1px solid #e0e7ea; border-radius: 11px; }
.bom-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.bom-table th, .bom-table td { padding: 10px 11px; border-bottom: 1px solid #e8edef; text-align: left; }
.bom-table th { color: #677781; background: #f6f8f9; font-size: 9px; text-transform: uppercase; letter-spacing: .04em; }
.bom-table tr:last-child td { border-bottom: 0; }
.bom-table td strong { display: block; color: #20333e; }
.bom-assumptions { margin-top: 19px; }
.bom-assumptions h3 { margin-bottom: 10px; font-size: 13px; }
.assumption-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.assumption-grid > div { display: grid; gap: 4px; padding: 10px; border: 1px solid #e0e7ea; border-radius: 9px; background: #fafbfb; }
.assumption-grid span { color: #71818a; font-size: 9px; }
.assumption-grid strong { font-size: 12px; }
.bom-footer { border-top: 1px solid #e4eaed; border-bottom: 0; justify-content: flex-end; }
.primary-action, .secondary-action { min-height: 38px; padding: 0 16px; border-radius: 9px; font-size: 11px; font-weight: 850; }
.primary-action { border: 1px solid var(--hall-blue); color: #fff; background: var(--hall-blue); }
.secondary-action { border: 1px solid #cbd7dc; color: #35505e; background: #fff; }

/* Dark mode uses one consistent text/background pairing across Hall settings. */
.app-shell.is-dark-mode,
body.shared-ui-dark-mode .app-shell { color: #edf4f7; background: #0f1724; }
.app-shell.is-dark-mode .sidebar,
body.shared-ui-dark-mode .sidebar { background: #172235; border-color: #2a3a51; box-shadow: -11px 0 32px rgba(0,0,0,.25); }
.app-shell.is-dark-mode .color-heading,
.app-shell.is-dark-mode .explode-copy,
body.shared-ui-dark-mode .color-heading,
body.shared-ui-dark-mode .explode-copy { color: #aebdca; }
.app-shell.is-dark-mode .eyebrow:where(:not(.shared-panel-controls *)),
body.shared-ui-dark-mode .eyebrow:where(:not(.shared-panel-controls *)) { color: #6dc6ff; }
.app-shell.is-dark-mode .section-number,
body.shared-ui-dark-mode .section-number { color: #8fd2ff; background: #203a53; }
.app-shell.is-dark-mode select:where(:not(.shared-panel-controls *)),
body.shared-ui-dark-mode select:where(:not(.shared-panel-controls *)) { color: #edf4f7; background: #1d2b41; border-color: #34445d; }
.app-shell.is-dark-mode .info-card,
body.shared-ui-dark-mode .info-card { border-color: #36526a; background: #1b3247; }
.app-shell.is-dark-mode .info-card span,
.app-shell.is-dark-mode .info-card small,
body.shared-ui-dark-mode .info-card span,
body.shared-ui-dark-mode .info-card small { color: #a9bac7; }
.app-shell.is-dark-mode .info-card strong,
body.shared-ui-dark-mode .info-card strong { color: #79ccff; }
.app-shell.is-dark-mode .profile-card small:last-child,
body.shared-ui-dark-mode .profile-card small:last-child { border-color: rgba(151,199,229,.14); }
.app-shell.is-dark-mode .hea-reference-card,
body.shared-ui-dark-mode .hea-reference-card { border-color: #36526a; background: #182e42; }
.app-shell.is-dark-mode .hea-reference-heading b,
body.shared-ui-dark-mode .hea-reference-heading b { color: #d7e3eb; }
.app-shell.is-dark-mode .hea-reference-heading small,
.app-shell.is-dark-mode .hea-reference-source,
body.shared-ui-dark-mode .hea-reference-heading small,
body.shared-ui-dark-mode .hea-reference-source { color: #99adbb; }
.app-shell.is-dark-mode .hea-reference-heading > span,
body.shared-ui-dark-mode .hea-reference-heading > span { color: #85d2ff; background: #244861; }
.app-shell.is-dark-mode .hea-reference-table-wrap,
body.shared-ui-dark-mode .hea-reference-table-wrap { border-color: #35536a; background: #14283a; }
.app-shell.is-dark-mode .hea-reference-table,
body.shared-ui-dark-mode .hea-reference-table { color: #b9c8d2; }
.app-shell.is-dark-mode .hea-reference-table th,
body.shared-ui-dark-mode .hea-reference-table th { color: #b9cedb; background: #1d3a50; }
.app-shell.is-dark-mode .hea-reference-table tbody th,
body.shared-ui-dark-mode .hea-reference-table tbody th { color: #8bd2fb; background: #21455f; }
.app-shell.is-dark-mode .hea-reference-table th,
.app-shell.is-dark-mode .hea-reference-table td,
body.shared-ui-dark-mode .hea-reference-table th,
body.shared-ui-dark-mode .hea-reference-table td { border-color: #2b465a; }
.app-shell.is-dark-mode .swatch,
body.shared-ui-dark-mode .swatch { border-color: #172235; box-shadow: 0 0 0 1px #435268; }
.app-shell.is-dark-mode .explode-control,
body.shared-ui-dark-mode .explode-control { color: #dce7ee; background: #1d2b40; border-color: #34465b; }
.app-shell.is-dark-mode .explode-heading,
body.shared-ui-dark-mode .explode-heading { color: #dce7ee; }
.app-shell.is-dark-mode .bom-settings-button,
body.shared-ui-dark-mode .bom-settings-button { color: #edf4f7; background: #1b3247; border-color: #36526a; }
.app-shell.is-dark-mode .bom-settings-button small,
body.shared-ui-dark-mode .bom-settings-button small { color: #a9bac7; }
.app-shell.is-dark-mode .viewer-stage,
body.shared-ui-dark-mode .viewer-stage { background: radial-gradient(circle at 48% 28%, #26364a 0, #182538 48%, #101a28 100%); }
.app-shell.is-dark-mode .dimension-label,
body.shared-ui-dark-mode .dimension-label { color: #eef6fb; background: rgba(20,31,46,.94); border-color: rgba(255,255,255,.12); }
body.shared-ui-dark-mode .shared-settings-toggle { color: #dfeaf1 !important; background: #19283b !important; border-color: #34445d !important; }
body.shared-ui-dark-mode .bom-panel { color: #edf4f7; background: #172235; }
body.shared-ui-dark-mode .bom-header,
body.shared-ui-dark-mode .bom-footer { border-color: #2b3c52; }
body.shared-ui-dark-mode .bom-close,
body.shared-ui-dark-mode .assumption-grid > div { color: #e5eef4; background: #223149; border-color: #34455c; }
body.shared-ui-dark-mode .bom-disclaimer { color: #c1d2de; background: #1d3448; border-color: #36526a; }
body.shared-ui-dark-mode .bom-table-wrap { border-color: #34455c; }
body.shared-ui-dark-mode .bom-table th { color: #aab9c5; background: #202e43; }
body.shared-ui-dark-mode .bom-table th,
body.shared-ui-dark-mode .bom-table td { border-color: #2c3c51; }
body.shared-ui-dark-mode .bom-table td strong { color: #edf4f7; }
body.shared-ui-dark-mode .assumption-grid span { color: #aab9c5; }
body.shared-ui-dark-mode .secondary-action { color: #dfeaf1; background: #223149; border-color: #40516a; }

@media (max-width: 1200px) {
  :root { --hall-sidebar-width: 350px; }
}
@media (max-width: 820px) {
  :root { --hall-sidebar-width: min(86vw, 360px); }
}
@media (max-width: 620px) {
  .assumption-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

/* v5 accordion settings layout — mirrors the compact pergola settings pattern. */
.service-note { margin-top: 13px; padding: 12px 13px; border: 1px solid #d7e6ee; border-radius: 10px; color: #5f7480; background: #f4f9fc; font-size: 10px; line-height: 1.5; }

.summary-section { padding-bottom: 16px; }
.summary-total-card { display: grid; gap: 4px; padding: 16px; border: 1px solid #b8dced; border-radius: 14px; background: linear-gradient(145deg,#edf8fd,#f8fcfe); }
.summary-total-card span { color: #526a78; font-size: 11px; font-weight: 750; }
.summary-total-card strong { color: #086fa9; font-size: 29px; letter-spacing: -.035em; }
.summary-total-card small { color: #788b95; font-size: 9px; line-height: 1.45; }
.summary-price-breakdown, .summary-bom-list { display: grid; gap: 0; margin-top: 13px; border: 1px solid #e0e7ea; border-radius: 11px; overflow: hidden; }
.summary-price-breakdown > div, .summary-bom-list > div { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 9px 10px; border-bottom: 1px solid #edf0f2; background: #fff; font-size: 10px; }
.summary-price-breakdown > div:last-child, .summary-bom-list > div:last-child { border-bottom: 0; }
.summary-price-breakdown span, .summary-bom-list span { color: #637680; }
.summary-price-breakdown strong, .summary-bom-list strong { color: #263b47; text-align: right; }
.summary-metrics { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-top: 13px; }
.summary-metrics > div { display: grid; gap: 3px; padding: 10px; border: 1px solid #e0e7ea; border-radius: 10px; background: #fafcfc; }
.summary-metrics span { color: #72848e; font-size: 9px; text-transform: capitalize; }
.summary-metrics strong { color: #213642; font-size: 11px; text-transform: capitalize; }
.summary-bom-preview { margin-top: 18px; }
.summary-subheading { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #263b47; font-size: 12px; }
.summary-subheading span { color: #087bb9; font-size: 10px; font-weight: 850; }
.summary-bom-more { color: #73858f !important; font-size: 9px !important; font-weight: 700; }
.summary-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.summary-actions button { width: 100%; }

/* Hide the old step-specific decorations even if a cached shared stylesheet still defines them. */
.section-number { display: none !important; }
body.shared-ui-dark-mode .service-note { color: #b6c7d2; background: #1d3247; border-color: #36526a; }
body.shared-ui-dark-mode .summary-total-card { background: linear-gradient(145deg,#1b3349,#1c2d42); border-color: #365b75; }
body.shared-ui-dark-mode .summary-total-card span, body.shared-ui-dark-mode .summary-total-card small { color: #b0c0cb; }
body.shared-ui-dark-mode .summary-total-card strong { color: #79ccff; }
body.shared-ui-dark-mode .summary-price-breakdown, body.shared-ui-dark-mode .summary-bom-list { border-color: #34455c; }
body.shared-ui-dark-mode .summary-price-breakdown > div, body.shared-ui-dark-mode .summary-bom-list > div { background: #1d2b41; border-color: #2c3c51; }
body.shared-ui-dark-mode .summary-price-breakdown span, body.shared-ui-dark-mode .summary-bom-list span { color: #aec0cc; }
body.shared-ui-dark-mode .summary-price-breakdown strong, body.shared-ui-dark-mode .summary-bom-list strong { color: #edf4f7; }
body.shared-ui-dark-mode .summary-metrics > div { background: #1d2b41; border-color: #34455c; }
body.shared-ui-dark-mode .summary-metrics span { color: #aebdca; }
body.shared-ui-dark-mode .summary-metrics strong, body.shared-ui-dark-mode .summary-subheading { color: #edf4f7; }

/* v6 — shared tools + hall-specific inspection controls */
.display-tool-group {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #e3e9ec;
}
.display-tool-group:first-of-type { margin-top: 16px; }
.display-tool-heading { display: grid; gap: 4px; margin-bottom: 13px; }
.display-tool-heading b { color: #243741; font-size: 13px; }
.display-tool-heading small { color: #758690; font-size: 10px; line-height: 1.45; }
.compact-toggle-stack { margin-top: 12px; }
.display-slider { margin-top: 12px; padding: 0 4px; }
.display-slider.is-disabled { opacity: .42; pointer-events: none; }

.environment-panel {
  position: fixed;
  z-index: 850;
  top: calc(var(--shared-topbar-height, 52px) + 14px);
  left: 64px;
  width: min(420px, calc(100vw - 90px));
  display: none;
  padding: 24px 26px 26px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 18px;
  color: #f7fbff;
  background: #172536;
  box-shadow: 0 18px 44px rgba(7,19,31,.28);
}
.environment-panel.is-open { display: block; }
.environment-panel__header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.environment-panel__header strong { font-size: 20px; }
.environment-panel__header button { border: 0; color: #fff; background: transparent; font-size: 28px; line-height: 1; }
.environment-control { display: grid; gap: 8px; margin-top: 17px; }
.environment-control > span { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.environment-control output { color: #a9bfce; }
.environment-control input[type="range"] { width: 100%; accent-color: #168ed4; }
.environment-control > small { display: flex; justify-content: space-between; color: #8499aa; font-size: 10px; }
.scene-segmented { display: grid; grid-template-columns: repeat(3,1fr); padding: 5px; border-radius: 12px; background: #f0f3f5; }
.scene-segmented button { min-height: 38px; border: 0; border-radius: 9px; color: #697987; background: transparent; font-size: 11px; font-weight: 800; }
.scene-segmented button.is-selected { color: #075c91; background: #fff; box-shadow: 0 1px 4px rgba(11,39,59,.16); }
.night-preview-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding: 16px;
  border: 1px solid #40536a;
  border-radius: 13px;
  background: #25364d;
}
.night-preview-row > span:nth-child(2) { display: grid; gap: 3px; }
.night-preview-row strong { color: #f6fbff; font-size: 13px; }
.night-preview-row small { color: #9eb7cb; font-size: 10px; }
.night-preview-icon { color: #eaf7ff; font-size: 26px; }
.night-preview-row input { position: absolute; opacity: 0; pointer-events: none; }
.night-preview-row i { position: relative; width: 46px; height: 26px; border-radius: 999px; background: #c9d3da; }
.night-preview-row i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s ease; }
.night-preview-row input:checked + i { background: #1188d1; }
.night-preview-row input:checked + i::after { transform: translateX(20px); }

.compass-label {
  min-width: 18px;
  padding: 2px 4px;
  border-radius: 5px;
  color: #11384f;
  background: rgba(255,255,255,.88);
  box-shadow: 0 1px 4px rgba(22,42,52,.14);
  font-size: 9px;
  font-weight: 900;
  text-align: center;
}

body.shared-ui-dark-mode .display-tool-group { border-color: #304158; }
body.shared-ui-dark-mode .display-tool-heading b { color: #eef5f8; }
body.shared-ui-dark-mode .display-tool-heading small { color: #aebdca; }
body.shared-ui-dark-mode .compass-label { color: #eaf5fb; background: rgba(22,35,52,.94); }

@media (max-width: 720px) {
  .environment-panel { left: 58px; width: min(390px, calc(100vw - 72px)); padding: 20px; }
}

/* v9 — interactive wall openings */
.opening-help {
  margin: 0 0 13px;
  color: #667b87;
  font-size: 10px;
  line-height: 1.55;
}
.opening-add-grid { display: grid; gap: 8px; }
.opening-add-button {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid #cddde5;
  border-radius: 10px;
  color: #254453;
  background: #f9fcfd;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.opening-add-button span { color: #0b7fbe; font-size: 18px; line-height: 1; }
.opening-add-button b { font-size: 11px; }
.opening-add-button:hover { border-color: #8fc4df; background: #f1f9fd; }
.opening-add-button.is-placement-active { color: #fff; background: #bd3131; border-color: #bd3131; }
.opening-add-button.is-placement-active span { color: #fff; }
.opening-add-button:disabled:not(.is-placement-active) { opacity: .42; cursor: not-allowed; }
.opening-status {
  margin-top: 12px;
  padding: 10px 11px;
  border: 1px solid #dce7ec;
  border-radius: 9px;
  color: #687b86;
  background: #f7fafb;
  font-size: 9px;
  line-height: 1.45;
}
.opening-status.is-error { color: #9d2424; border-color: #edb8b8; background: #fff4f4; }

.opening-editor {
  max-height: calc(100dvh - var(--shared-topbar-height, 47px) - 44px);
  overflow-y: auto;
  overscroll-behavior: contain;
  position: fixed;
  z-index: 960;
  width: 238px;
  padding: 13px;
  border: 1px solid rgba(18, 46, 64, .18);
  border-radius: 13px;
  color: #213946;
  background: rgba(255,255,255,.97);
  box-shadow: 0 16px 38px rgba(13, 34, 48, .24);
  backdrop-filter: blur(8px);
  transform: translate(-50%, calc(-100% - 16px));
}
.opening-editor[hidden] { display: none !important; }
.opening-editor__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.opening-editor__header > div { display: grid; gap: 2px; }
.opening-editor__header small { color: #72858f; font-size: 9px; }
.opening-editor__header strong { color: #203844; font-size: 13px; }
.opening-delete-button {
  width: 27px; height: 27px; padding: 0; border: 1px solid #ecc1c1; border-radius: 8px;
  color: #a82626; background: #fff5f5; font-size: 20px; line-height: 1; cursor: pointer;
}
.opening-delete-button svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.opening-editor__side,
.opening-editor__dimensions label,
.opening-editor__color { display: grid; gap: 5px; color: #687b85; font-size: 9px; font-weight: 800; }
.opening-editor__side { margin-top: 11px; }
.opening-editor__side select {
  width: 100%; height: 32px; padding: 0 8px; border: 1px solid #cfdde4; border-radius: 8px;
  color: #203844; background: #fff; font: inherit; font-size: 10px; font-weight: 750;
}
.opening-editor__dimensions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.opening-editor__dimensions label > div { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 5px; }
.opening-editor__dimensions input {
  min-width: 0; width: 100%; height: 34px; padding: 0 8px; border: 1px solid #cfdde4; border-radius: 8px;
  color: #203844; background: #fff; font: inherit; font-size: 11px; font-weight: 750;
}
.opening-editor__dimensions em { color: #85949c; font-size: 9px; font-style: normal; }
.opening-editor__color { grid-template-columns: 1fr auto; align-items: center; margin-top: 11px; }
.opening-editor__color input { width: 38px; height: 28px; padding: 2px; border: 1px solid #cad9e0; border-radius: 7px; background: #fff; }
.opening-editor__warning { margin-top: 10px; padding: 8px 9px; border: 1px solid #efb7b7; border-radius: 8px; color: #9c2626; background: #fff1f1; font-size: 9px; line-height: 1.4; }
.opening-dimension-label {
  padding: 3px 6px;
  border: 1px solid rgba(14, 91, 132, .24);
  border-radius: 6px;
  color: #075e91;
  background: rgba(255,255,255,.94);
  box-shadow: 0 2px 8px rgba(17,56,79,.14);
  font-size: 9px;
  font-weight: 850;
  white-space: nowrap;
}
.summary-validation-error {
  padding: 13px 14px;
  border: 1px solid #e9aaaa;
  border-radius: 11px;
  color: #982424;
  background: #fff2f2;
  font-size: 10px;
  line-height: 1.5;
}
.summary-validation-error strong { display: block; margin-bottom: 4px; font-size: 12px; }
.summary-content.is-blocked { display: none; }

body.shared-ui-dark-mode .opening-help { color: #aebec8; }
body.shared-ui-dark-mode .opening-add-button { color: #e7f0f5; background: #1d2c41; border-color: #3a4c62; }
body.shared-ui-dark-mode .opening-add-button:hover { background: #23354b; border-color: #4d7490; }
body.shared-ui-dark-mode .opening-status { color: #aec0cb; background: #1c2b3f; border-color: #34475e; }
body.shared-ui-dark-mode .opening-status.is-error { color: #ffb9b9; background: #49282d; border-color: #764047; }
body.shared-ui-dark-mode .opening-editor { color: #edf5f8; background: rgba(24,36,53,.97); border-color: #3c5069; }
body.shared-ui-dark-mode .opening-editor__header small,
body.shared-ui-dark-mode .opening-editor__side,
body.shared-ui-dark-mode .opening-editor__dimensions label,
body.shared-ui-dark-mode .opening-editor__color { color: #aebfca; }
body.shared-ui-dark-mode .opening-editor__header strong { color: #f0f6f8; }
body.shared-ui-dark-mode .opening-editor__side select,
body.shared-ui-dark-mode .opening-editor__dimensions input { color: #edf5f8; background: #223149; border-color: #40536a; }
body.shared-ui-dark-mode .opening-editor__color input { background: #223149; border-color: #40536a; }
body.shared-ui-dark-mode .opening-dimension-label { color: #8bd2fb; background: rgba(23,37,55,.96); border-color: #42647b; }
body.shared-ui-dark-mode .summary-validation-error { color: #ffc0c0; background: #48282d; border-color: #78434a; }

@media (max-width: 720px) {
  .opening-editor { width: min(230px, calc(100vw - 28px)); }
}

/* v13 — mobile-first hall workspace -------------------------------------- */
#canvasHost,
#canvasHost canvas {
  overscroll-behavior: contain;
}
#canvasHost canvas { touch-action: none; }

.opening-placement-cancel { display: none; }

@media (max-width: 760px) {
  :root { --hall-sidebar-width: min(360px, calc(100vw - 54px)); }

  body { overflow: hidden; }
  .app-shell {
    inset: var(--shared-topbar-height, 47px) 0 0 0;
    height: calc(100dvh - var(--shared-topbar-height, 47px));
  }

  .viewer-stage { touch-action: none; }

  /* Settings are an off-canvas mobile drawer, initially collapsed by JS. */
  .sidebar {
    top: 8px;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    width: var(--hall-sidebar-width) !important;
    max-width: calc(100vw - 54px);
    border: 1px solid var(--hall-border);
    border-radius: 16px;
    box-shadow: -8px 10px 30px rgba(20, 40, 52, .18);
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar.is-collapsed { transform: translateX(calc(100% + 8px)) !important; }

  .shared-settings-toggle {
    top: auto !important;
    right: calc(var(--hall-sidebar-width) + 8px) !important;
    bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important;
    width: 42px !important;
    height: 48px !important;
    border-radius: 12px 0 0 12px !important;
    touch-action: manipulation;
  }
  body.hall-sidebar-collapsed .shared-settings-toggle { right: 0 !important; }
  input[type="range"]:where(:not(.shared-panel-controls *)) { min-height: 32px; touch-action: pan-x; }
  .opening-editor__side select,
.opening-editor__dimensions input,
select:where(:not(.shared-panel-controls *)) { height: 44px; font-size: 16px; }
  .swatch-row { gap: 12px; }
  .swatch { width: 42px; height: 42px; touch-action: manipulation; }
  .opening-add-button { min-height: 50px; touch-action: manipulation; }
  .opening-add-button b { font-size: 12px; }
  .opening-status { font-size: 10px; }

  .hea-reference-card { padding: 10px; }
  .hea-reference-table-wrap {
    margin-right: -4px;
    -webkit-overflow-scrolling: touch;
  }

  .summary-actions { grid-template-columns: 1fr; }
  .summary-actions button,
  .primary-action,
  .secondary-action { min-height: 44px; touch-action: manipulation; }

  /* The shared tool rail stays on the free left edge and collapses after use. */
  .shared-ui-host .tools-toolbar {
    top: calc(var(--shared-topbar-height, 47px) + 8px);
    left: 8px;
    gap: 8px;
  }
  .shared-ui-host .tool-launcher {
    min-width: 66px;
    height: 44px;
    padding: 0 14px;
    border-radius: 13px;
    touch-action: manipulation;
  }
  .shared-ui-host .tools-toolbar__panel { gap: 8px; }
  .shared-ui-host .round-tool {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
    touch-action: manipulation;
  }

  /* Light/orientation becomes a bottom sheet rather than covering the model. */
  .environment-panel {
    top: auto;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    left: 10px;
    width: auto;
    max-width: none;
    max-height: min(68dvh, 470px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 18px;
    border-radius: 18px;
    -webkit-overflow-scrolling: touch;
  }
  .environment-panel__header { margin-bottom: 15px; }
  .environment-panel__header button {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 10px;
    touch-action: manipulation;
  }
  .environment-control { margin-top: 14px; }
  .environment-control input[type="range"] { min-height: 34px; }
  .scene-segmented button { min-height: 44px; touch-action: manipulation; }
  .night-preview-row { min-height: 66px; touch-action: manipulation; }

  /* Selected openings use a predictable bottom editor on touch screens. */
  .opening-editor {
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    left: 10px !important;
    top: auto !important;
    width: auto;
    max-width: none;
    padding: 14px;
    border-radius: 16px;
    transform: none;
  }
  .opening-editor__header { align-items: center; }
  .opening-editor__header small { font-size: 10px; }
  .opening-editor__header strong { font-size: 14px; }
  .opening-delete-button { width: 42px; height: 42px; }
  .opening-delete-button svg { width: 17px; height: 17px; }
  .opening-editor__side,
  .opening-editor__dimensions label,
  .opening-editor__color { font-size: 10px; }
  .opening-editor__side { margin-top: 9px; }
  .opening-editor__dimensions { gap: 10px; margin-top: 9px; }
  .opening-editor__color { margin-top: 10px; }
  .opening-editor__color input { width: 48px; height: 38px; }
  .opening-editor__warning { font-size: 10px; }

  body:not(.hall-sidebar-collapsed) .opening-editor,
  body.hall-environment-open .opening-editor,
  body.hall-opening-placement-active .opening-editor { display: none !important; }

  /* Touch placement has an explicit escape hatch; mobile has no right-click. */
  .opening-placement-cancel:not([hidden]) {
    position: fixed;
    z-index: 980;
    left: 50%;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    display: inline-flex;
    min-height: 46px;
    max-width: calc(100vw - 28px);
    align-items: center;
    justify-content: center;
    padding: 0 18px;
    border: 1px solid rgba(122, 22, 22, .25);
    border-radius: 999px;
    color: #fff;
    background: #b63232;
    box-shadow: 0 10px 28px rgba(73, 20, 20, .24);
    transform: translateX(-50%);
    font-size: 13px;
    font-weight: 850;
    white-space: nowrap;
    touch-action: manipulation;
  }

  /* BOM is a true phone dialog, with scrolling isolated from the page. */
  .bom-panel {
    inset: 0;
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .bom-header {
    min-height: 60px;
    padding: 10px 12px 10px 16px;
  }
  .bom-header h2 { font-size: 19px; }
  .bom-close { width: 42px; height: 42px; }
  .bom-scroll-region {
    max-height: calc(100dvh - 126px);
    overscroll-behavior: contain;
    padding: 12px;
    -webkit-overflow-scrolling: touch;
  }
  .bom-disclaimer { margin-bottom: 10px; }
  .bom-table { min-width: 650px; }
  .bom-table-wrap { -webkit-overflow-scrolling: touch; }
  .bom-assumptions { margin-top: 14px; }
  .assumption-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bom-footer {
    min-height: 66px;
    gap: 8px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  }
  .bom-footer button { flex: 1; }
}

@media (max-width: 420px) {
  :root { --hall-sidebar-width: calc(100vw - 50px); }
  .sidebar { right: 6px; bottom: calc(6px + env(safe-area-inset-bottom, 0px)); }
  .shared-settings-toggle { right: calc(var(--hall-sidebar-width) + 6px) !important; }
  body.hall-sidebar-collapsed .shared-settings-toggle { right: 0 !important; }
  .summary-metrics { grid-template-columns: 1fr 1fr; }
  .opening-editor { right: 8px; left: 8px !important; }
}

/* Phone landscape: preserve model height and keep sheets compact. */
@media (max-width: 900px) and (max-height: 520px) {
  .sidebar { top: 6px; bottom: 6px; }
  .environment-panel { max-height: calc(100dvh - var(--shared-topbar-height, 47px) - 12px); }
  .opening-editor {
    max-height: calc(100dvh - var(--shared-topbar-height, 47px) - 18px);
    overflow-y: auto;
  }
  .opening-editor__side { grid-template-columns: 72px minmax(0, 1fr); align-items: center; }
  .bom-scroll-region { max-height: calc(100dvh - 116px); }
  .bom-header, .bom-footer { min-height: 56px; }
}


/* Opt-in hall template preview; no effect on another configurator's catalog. */
.shared-ui-host .hall-template-grid { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.shared-ui-host .hall-template-card-image { height: 220px; mix-blend-mode: normal; }
.hall-template-dialog { width: min(850px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid #dce4e8; border-radius: 20px; background: #fff; color: #1d303b; box-shadow: 0 24px 70px #13293544; overflow: hidden; }
.hall-template-dialog[open] { display: flex; flex-direction: column; }
.hall-template-dialog::backdrop { background: rgba(13, 29, 40, .45); }
.hall-template-dialog__header { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; gap: 12px; border-bottom: 1px solid #e3e9ed; }
.hall-template-dialog__header h2 { margin: 0; font-size: 22px; }
.hall-template-dialog__close { flex: 0 0 36px; width: 36px; height: 36px; border: 0; border-radius: 9px; background: #f0f4f6; color: inherit; font-size: 25px; cursor: pointer; }
.hall-template-dialog__content { padding: 0 24px 20px; overflow-y: auto; overscroll-behavior: contain; min-height: 0; font-size: 14px; line-height: 1.5; }
.hall-template-dialog__image { display: block; width: 100%; max-height: 300px; object-fit: contain; margin: 14px 0; border-radius: 12px; background: #f3f7f6; }
.hall-template-dialog__features { padding-left: 21px; display: grid; gap: 7px; }
.hall-template-dialog__note { padding: 12px 14px; border-radius: 10px; background: #f0f5f7; color: #536874; font-size: 12px; }
.hall-template-dialog__warning { margin-bottom: 0; color: #6a5330; }
.hall-template-dialog__error { color: #b52838; }
.hall-template-dialog__footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid #e3e9ed; flex-shrink: 0; }
.hall-template-dialog__footer button { min-height: 44px; cursor: pointer; }
.hall-template-dialog button:focus-visible { outline: 3px solid #1089d8; outline-offset: 3px; }
.hall-template-dialog button:disabled { cursor: wait; opacity: .55; }
body.shared-ui-dark-mode .hall-template-dialog { color: #e5eff5; background: #172235; border-color: #34465b; }
body.shared-ui-dark-mode .hall-template-dialog__note, body.shared-ui-dark-mode .hall-template-dialog__close { color: #cbdbe5; background: #26384a; }
body.shared-ui-dark-mode .hall-template-dialog__warning { color: #eacb9a; }
body.shared-ui-dark-mode .hall-template-dialog__error { color: #ff98a4; }
.opening-editor__side[hidden] { display: none; }
.opening-editor__sill { display: grid; gap: 5px; margin-top: 10px; font-size: 12px; font-weight: 700; color: #647e8c; }
.opening-editor__sill > div { display: flex; align-items: center; gap: 7px; }
.opening-editor__sill input { width: 100%; min-width: 0; padding: 9px; border: 1px solid #cbdce7; border-radius: 10px; color: #233c49; background: #fff; }
.opening-editor__sill em { font-style: normal; }
body.shared-ui-dark-mode .opening-editor__sill { color: #aebfca; }
body.shared-ui-dark-mode .opening-editor__sill input { color: #edf5f8; background: #223149; border-color: #40536a; }
@media (max-width: 600px) {
  .hall-template-dialog__header, .hall-template-dialog__footer { padding: 14px 16px; }
  .hall-template-dialog__content { padding: 0 16px 16px; }
  .hall-template-dialog__footer button { flex: 1 1 150px; }
  .hall-template-dialog__image { max-height: 190px; }
}

/* Optional commercial detail controls, local to the hall. */
.commercial-sign-input { width: 100%; padding: 12px; border: 1px solid #cad7df; border-radius: 10px; background: #fff; color: #243741; font: inherit; }
.commercial-accent { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; font-weight: 700; font-size: 12px; }
.commercial-accent input { width: 48px; height: 36px; padding: 2px; border: 1px solid #cad7df; border-radius: 8px; background: #fff; }
.opening-editor__open { display: flex; align-items: center; gap: 8px; font-size: 12px; margin: 10px 0; }
.opening-editor__open[hidden] { display: none; }
.opening-editor { max-height: calc(100dvh - var(--shared-topbar-height, 47px) - 36px); overflow-y: auto; }
.is-dark-mode .commercial-sign-input { background: #22313b; color: #eff5f8; border-color: #4f626f; }
