* {
  box-sizing: border-box;
}
body {
  margin: 0;
  color: #25333c;
  background: #e6e9e5;
  font:
    13px 'Avenir Next',
    'Segoe UI',
    sans-serif;
}
button,
input,
select:where(:not(.shared-panel-controls *)) {
  font: inherit;
}
button {
  cursor: pointer;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible:where(:not(.shared-panel-controls *)) {
  outline: 3px solid #1494de;
  outline-offset: 3px;
}
[hidden] {
  display: none !important;
}
#viewer {
  position: fixed;
  inset: 47px 370px 0 0;
}
#canvasHost,
#canvasHost canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
.sidebar {
  width: 350px;
  padding: 0;
  overflow-y: auto;
}
.sidebar header:where(:not(.shared-panel-controls *)) {
  padding-bottom: 16px;
}
.eyebrow:where(:not(.shared-panel-controls *)) {
  letter-spacing: 2px;
  font-size: 10px;
  color: #0878c9;
  font-weight: 800;
}
h1:where(:not(.shared-panel-controls *)) {
  font-size: 23px;
  letter-spacing: -0.7px;
  margin: 8px 0;
}
header p:where(:not(.shared-panel-controls *)) {
  color: #66767f;
  line-height: 1.6;
}
details:where(:not(.shared-panel-controls *)) {
  border-top: 1px solid #e0e5e8;
  padding: 14px 0;
}
summary:where(:not(.shared-panel-controls *)) {
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
  margin-bottom: 12px;
}
.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
label {
  display: block;
  font-size: 11px;
  line-height: 1.6;
  margin: 8px 0;
}
input[type='number']:where(:not(.shared-panel-controls *)),
select:where(:not(.shared-panel-controls *)) {
  display: block;
  width: 100%;
  padding: 9px;
  border: 1px solid #d5dfe3;
  border-radius: 7px;
  margin-top: 5px;
  color: inherit;
  background: #fff;
}
input[type='checkbox'] {
  accent-color: #0878c9;
}
.tile-choices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.tile-card:where(:not(.shared-panel-controls *)) {
  padding: 8px 4px;
  border: 1px solid #dce3e6;
  border-radius: 8px;
  background: #f7f9fa;
  font-size: 11px;
  color: inherit;
}
.tile-card[aria-pressed='true']:where(:not(.shared-panel-controls *)) {
  border-color: #0878c9;
  background: #eaf5fc;
  box-shadow: 0 0 0 1px #0878c9;
}
.tile-card small {
  display: block;
  font-size: 9px;
  margin-top: 4px;
}
.tile-icon {
  display: block;
  margin: 5px auto 10px;
  height: 25px;
  width: 48px;
  background:
    repeating-linear-gradient(90deg, transparent 0 22px, #fff 22px 24px),
    repeating-linear-gradient(0deg, #a4aaa7 0 10px, #fff 10px 12px);
  transform: skewY(-8deg);
}
.tile-card[data-tile='square'] .tile-icon {
  width: 35px;
  background:
    repeating-linear-gradient(90deg, transparent 0 16px, #fff 16px 18px),
    repeating-linear-gradient(0deg, #a4aaa7 0 16px, #fff 16px 18px);
}
.tile-card[data-tile='slab'] .tile-icon {
  background: #a4aaa7;
}
a {
  color: #0878c9;
  font-size: 10px;
  display: inline-block;
  margin: 9px 0;
}
.field-label {
  font-size: 11px;
}
.swatches {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}
.swatch {
  width: 31px;
  height: 31px;
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px #d2dadd;
  border-radius: 50%;
  background: var(--swatch);
}
.swatch[aria-pressed='true'] {
  box-shadow: 0 0 0 2px #0878c9;
}
.edges {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
.edges label {
  display: flex;
  align-items: center;
  gap: 3px;
}
.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  background: #f0f5f7;
  padding: 12px;
  border-radius: 8px;
  margin: 15px 0;
}
.metrics span {
  display: block;
  font-size: 10px;
  color: #657780;
}
.metrics strong {
  font-size: 14px;
}
.bom-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid #edf0f2;
}
.bom-row small {
  display: block;
  color: #657780;
  line-height: 1.7;
  font-size: 10px;
}
.total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  gap: 8px;
}
.total strong {
  font-size: 20px;
  color: #0878c9;
}
.note {
  font-size: 10px;
  line-height: 1.6;
  color: #657780;
}
.export {
  width: 100%;
  padding: 11px;
  border: 1px solid #0878c9;
  border-radius: 8px;
  color: #0878c9;
  background: #edf7fd;
  font-weight: 700;
}
.scene-caption {
  position: absolute;
  left: 26px;
  bottom: 80px;
  pointer-events: none;
}
.scene-caption span {
  display: block;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #53655a;
}
.scene-caption strong {
  font-size: 26px;
  line-height: 1.7;
  color: #273c30;
}
.view-actions {
  position: absolute;
  bottom: 24px;
  left: 26px;
  display: flex;
  align-items: center;
  gap: 15px;
}
.view-actions button {
  border: 1px solid #c6ceca;
  background: #fff;
  padding: 10px 15px;
  border-radius: 9px;
}
.view-actions span {
  font-size: 11px;
  color: #59685f;
}
#viewerError {
  position: absolute;
  top: 90px;
  left: 20px;
  right: 20px;
  background: #fff;
  padding: 20px;
  border-radius: 10px;
}
body.tiles-sidebar-collapsed #viewer {
  right: 0;
}
body.dark {
  background: #242c30;
  color: #e4ebef;
}
body.dark .sidebar {
  background: #253139;
  color: #e4ebef;
}
body.dark input:where(:not(.shared-panel-controls *)),
body.dark select:where(:not(.shared-panel-controls *)),
body.dark .tile-card:where(:not(.shared-panel-controls *)) {
  background: #35424a;
  color: #fff;
}
body.dark .metrics {
  background: #35424a;
}
body.dark .scene-caption strong,
body.dark .scene-caption span {
  color: #e4ebef;
}
@media (max-width: 760px) {
  #viewer {
    right: 0;
  }
  .sidebar {
    width: min(350px, calc(100vw - 40px));
  }
  .scene-caption {
    left: 16px;
    bottom: 83px;
  }
  .view-actions {
    left: 16px;
    bottom: 22px;
  }
  .view-actions span {
    max-width: 140px;
  }
  .scene-caption strong {
    font-size: 21px;
  }
}

html,
body {
  height: 100%;
  overflow: hidden;
}
body.tiles-sidebar-collapsed .shared-settings-toggle {
  right: 0 !important;
}
body.dark .sidebar {
  background: #253139 !important;
}

#areaPlan {
  width: 100%;
  height: 150px;
  margin: 8px 0;
}
#areaPlan text {
  font: 600 12px sans-serif;
  fill: #0878c9;
}
#closingLength {
  display: block;
  background: #edf3f6;
  padding: 9px;
  border-radius: 7px;
  margin-top: 5px;
  font-size: 13px;
}
#areaError {
  padding: 10px;
  background: #fff0e9;
  color: #963b17;
  font-size: 11px;
  line-height: 1.5;
  border-radius: 6px;
}
.edges {
  grid-template-columns: repeat(auto-fit, minmax(55px, 1fr));
}

.dimension-control {
  margin: 12px 0;
}
.fields:has(.dimension-control) {
  grid-template-columns: 1fr;
}
.dimension-heading:where(:not(.shared-panel-controls *)) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.dimension-heading label:where(:not(.shared-panel-controls *)) {
  margin: 0;
  font-weight: 650;
}
.dimension-heading output:where(:not(.shared-panel-controls *)) {
  color: #0878c9;
  font-size: 12px;
  font-weight: 750;
}
.slider-row:where(:not(.shared-panel-controls *)) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px;
  gap: 14px;
  align-items: center;
}
.slider-row input[type='range']:where(:not(.shared-panel-controls *)) {
  width: 100%;
  accent-color: #1494de;
  cursor: pointer;
  min-height: 34px;
}
.slider-row input[type='number']:where(:not(.shared-panel-controls *)) {
  margin: 0;
}
.house-toggle:where(:not(.shared-panel-controls *)) {
  display: flex;
  align-items: center;
  gap: 8px;
}
#centerHouse {
  padding: 9px;
  border: 1px solid #0878c9;
  border-radius: 7px;
  color: #0878c9;
  background: #edf7fd;
  width: 100%;
}

.pattern-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 8px 0 15px;
}
.pattern-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 8px;
  border: 1px solid #d5dfe3;
  border-radius: 10px;
  background: #f7f9fa;
  color: inherit;
  transition:
    border-color 0.15s,
    background 0.15s;
}
.pattern-card:hover {
  border-color: #1494de;
  background: #f0f8fd;
}
.pattern-card[aria-pressed='true'] {
  border-color: #0878c9;
  box-shadow: 0 0 0 1px #0878c9;
  background: #eaf5fc;
}
.pattern-preview {
  display: block;
  width: 100%;
  max-height: 118px;
  aspect-ratio: 1;
  border-radius: 5px;
  overflow: hidden;
}
.pattern-card span {
  font-size: 11px;
  font-weight: 650;
  text-align: center;
  line-height: 1.4;
}
.pattern-check {
  display: none;
  position: absolute;
  right: 12px;
  top: 12px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #0878c9;
  color: #fff;
  font-size: 13px;
  font-style: normal;
  line-height: 20px;
  text-align: center;
  box-shadow: 0 1px 5px #0003;
}
.pattern-card[aria-pressed='true'] .pattern-check {
  display: block;
}
body.dark .pattern-card {
  background: #35424a;
  border-color: #52626c;
  color: #e4ebef;
}
body.dark .pattern-card[aria-pressed='true'] {
  background: #183d54;
  border-color: #1494de;
}

.tile-card[data-tile='hbeton'] .tile-icon {
  height: 30px;
  width: 38px;
  background: #a4aaa7;
  clip-path: polygon(
    0 0,
    20% 0,
    30% 15%,
    70% 15%,
    80% 0,
    100% 0,
    100% 100%,
    80% 100%,
    70% 85%,
    30% 85%,
    20% 100%,
    0 100%
  );
}
.tile-card[data-tile='granit'] .tile-icon {
  width: 30px;
  height: 30px;
  background:
    repeating-linear-gradient(90deg, transparent 0 8px, #fff 8px 10px),
    repeating-linear-gradient(0deg, #a4aaa7 0 8px, #fff 8px 10px);
}
.tile-card[data-tile='tetraNova'] .tile-icon {
  background:
    repeating-linear-gradient(90deg, transparent 0 22px, #fff 22px 24px),
    linear-gradient(90deg, #9c9d96 0 50%, #555957 50%);
}

#houseMapDialog {
  width: min(800px, 94vw);
  max-height: 92dvh;
  overflow: auto;
  border: 0;
  border-radius: 12px;
  padding: 20px;
  color: #25333c;
  background: #fff;
}
#houseMapDialog::backdrop {
  background: #0008;
}
.map-header,
.map-search {
  display: flex;
  align-items: center;
  gap: 12px;
}
.map-header {
  justify-content: space-between;
}
.map-header h2 {
  font-size: 19px;
}
.map-search input {
  flex: 1;
  min-width: 0;
  padding: 10px;
}
.map-header button,
.map-search button {
  padding: 10px;
  border: 1px solid #bccbd5;
  border-radius: 7px;
}
#houseMap {
  height: min(48dvh, 400px);
  margin: 12px 0;
}
#houseMapResults {
  max-height: 150px;
  overflow: auto;
}
#houseMapResults button {
  display: block;
  text-align: left;
  width: 100%;
  padding: 10px;
  background: #f0f6fa;
  border: 1px solid #d5dfe3;
}
.export:disabled {
  opacity: 0.5;
  cursor: default;
}
body.dark #houseMapDialog {
  background: #253139;
  color: #e4ebef;
}

/* Keep phone controls clear of the shared Tools launcher and demo CTA. */
@media (max-width: 760px) {
  body.tiles-sidebar-collapsed #tilesSidebarToggle {
    right: 0 !important;
  }
  .view-actions {
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    left: calc(16px + env(safe-area-inset-left, 0px));
  }
  .view-actions button {
    min-height: 44px;
    flex-shrink: 0;
  }
  .scene-caption {
    bottom: calc(136px + env(safe-area-inset-bottom, 0px));
    left: calc(16px + env(safe-area-inset-left, 0px));
  }
}

/* The mobile demo CTA lives in the shared header stacking context. Hide it
   while settings are open so the price/cart footer remains unobstructed,
   without placing the panel above shared account, cart and save dialogs. */
@media (max-width: 760px) {
  body:not(.tiles-sidebar-collapsed) .shared-ui-host .book-demo-button {
    display: none;
  }
}

/* Tiles-specific composition and previews remain local. */
:where(.shared-panel-controls) .dimension-heading label { margin: 0; font-weight: 700; }
:where(.shared-panel-controls) .range-row input { min-width: 0; margin: 0; }
:where(.shared-panel-controls) .fields > label > .number-input { width: 100%; }
:where(.shared-panel-controls) .house-toggle { margin: 8px 0 14px; }
:where(.shared-panel-controls) .tile-choices { grid-template-columns: repeat(3, minmax(0, 1fr)); }
:where(.shared-panel-controls) .tile-card { min-width: 0; overflow-wrap: anywhere; }
:where(.shared-panel-controls) .tile-icon { margin: 5px auto; }
:where(.shared-panel-controls) .tile-card small { font-size: 9px; }
:where(.shared-panel-controls) .accordion-panel > label > span { display: block; margin-bottom: 8px; font-weight: 800; }
