@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --background: oklch(0.992 0.008 88);
  --panel: #ffffff;
  --ink: oklch(0.22 0.014 66);
  --muted: oklch(0.55 0.022 72);
  --line: oklch(0.905 0.014 84);
  --toolbar-muted: oklch(0.966 0.012 91);
  --toolbar-active: var(--panel);
  --green: #6f7d68;
  --green-soft: #e3ead9;
  --brown: #a07859;
  --shadow: 0 18px 60px rgba(62, 48, 32, 0.12);
  --radius: 0.625rem;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--ink);
  font-family:
    "Inter Variable", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 14px;
}

.app-shell {
  display: grid;
  width: 100vw;
  height: 100vh;
  grid-template-rows: auto minmax(0, 1fr);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  padding: 10px 24px;
}

.customer-heading {
  min-width: 0;
}

.customer-heading p,
.customer-heading h1,
.customer-heading span,
h2,
h3,
p {
  margin: 0;
  letter-spacing: 0;
}

.customer-heading p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.25;
}

.customer-heading h1 {
  overflow: hidden;
  max-width: min(58vw, 980px);
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
}

.customer-heading span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.25;
}

.view-tabs {
  display: inline-grid;
  flex: 0 0 auto;
  grid-template-columns: repeat(3, minmax(70px, 1fr));
  align-items: center;
  justify-content: center;
  height: 40px;
  gap: 0;
  border: 0;
  border-radius: calc(var(--radius) * 0.8);
  background: var(--toolbar-muted);
  padding: 4px;
  color: var(--muted);
}

.view-tab {
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) * 0.45);
  background: transparent;
  color: var(--muted);
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.25;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

.view-tab:hover,
.view-tab.active {
  background: var(--toolbar-active);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(20, 20, 20, 0.08);
}

.view-tab:disabled {
  cursor: default;
  opacity: 0.58;
}

.view-tab:disabled:hover {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

.view-shell {
  min-height: 0;
  padding: 12px;
}

.view-panel {
  display: none;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  box-shadow: var(--shadow);
}

.view-panel.active {
  display: grid;
}

#view-panel-3d.active {
  grid-template-rows: auto minmax(0, 1fr);
}

#view-panel-2d.active,
#view-panel-ortho.active {
  grid-template-rows: auto minmax(0, 1fr);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font: 650 11px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0;
  text-transform: uppercase;
}

h2 {
  font-size: 17px;
  line-height: 1.2;
}

h3 {
  font-size: 16px;
  line-height: 1.2;
}

.surface-tabs-wrap {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
}

.surface-tabs-meta {
  min-width: 132px;
}

.surface-tabs-meta span,
.panel-toolbar span {
  display: inline-flex;
  border-radius: 8px;
  background: var(--green-soft);
  color: #43503b;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.2;
}

.surface-tabs {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.surface-tab {
  min-width: 0;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
  color: var(--muted);
  padding: 7px 9px;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.2;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

.surface-tab:hover,
.surface-tab.active {
  border-color: var(--green);
  background: var(--green-soft);
  color: #35412e;
}

.design-page {
  display: grid;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 390px);
}

.model-stage {
  position: relative;
  min-width: 0;
  border-right: 1px solid var(--line);
  display: grid;
  place-items: start center;
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.64), rgba(247, 244, 236, 0.9)),
    #eee8dc;
  padding: 12px;
}

.viewer-hint {
  position: absolute;
  right: 14px;
  bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  color: var(--muted);
  padding: 6px 9px;
  font-size: 11px;
  font-weight: 650;
  box-shadow: 0 10px 26px rgba(62, 48, 32, 0.1);
  pointer-events: none;
}

.material-page {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  padding: 14px;
}

.shingle-app {
  background: #f7f4ec;
}

.pipeline-view {
  display: grid;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 390px);
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.pipeline-stage-wrap {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.64), rgba(247, 244, 236, 0.9)),
    #eee8dc;
  padding: 18px;
}

.pipeline-stage {
  position: relative;
  width: min(100%, 1100px);
  aspect-ratio: 612 / 406;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #d8d2c7;
  box-shadow: 0 18px 44px rgba(62, 48, 32, 0.16);
}

.pipeline-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.roof-underlay {
  z-index: 1;
}

.house-cutout {
  z-index: 2;
}

.generated-preview {
  z-index: 4;
  display: none;
  object-fit: contain;
}

.pipeline-stage.has-generated-preview .generated-preview {
  display: block;
}

.pipeline-stage.has-generated-preview .roof-underlay,
.pipeline-stage.has-generated-preview .house-cutout {
  display: none;
}

.original-reference {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 3;
  width: 154px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  box-shadow: 0 10px 26px rgba(20, 18, 14, 0.22);
}

.image-arrow {
  position: absolute;
  top: 50%;
  z-index: 5;
  display: grid;
  width: 38px;
  height: 54px;
  place-items: center;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: rgba(22, 21, 19, 0.46);
  color: #fff;
  font-size: 34px;
  line-height: 1;
  transform: translateY(-50%);
}

.image-arrow:hover {
  background: rgba(22, 21, 19, 0.64);
}

.image-arrow-left {
  left: 12px;
}

.image-arrow-right {
  right: 12px;
}

.pipeline-sidebar {
  gap: 18px;
  padding: 18px;
  overflow: auto;
}

.pipeline-card {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.material-controls {
  display: grid;
  gap: 10px;
}

.pipeline-swatches {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.material-swatch {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
  color: var(--ink);
  padding: 9px;
  text-align: left;
}

.material-swatch.active,
.material-swatch:hover {
  border-color: var(--green);
  background: var(--green-soft);
}

.swatch-chip {
  display: block;
  width: 38px;
  height: 30px;
  border-radius: 6px;
  background:
    linear-gradient(135deg, #b8ad92, #d6c7a3 30%, #9d9887 58%, #c8b98f);
  box-shadow: inset 0 0 0 1px rgba(52, 45, 34, 0.14);
}

.material-swatch strong,
.material-swatch small,
.material-swatch em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.material-swatch strong {
  font-size: 13px;
}

.material-swatch small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.material-swatch em {
  margin-top: 5px;
  color: #43503b;
  font-size: 11px;
  font-style: normal;
  font-weight: 750;
}

.material-page p:not(.eyebrow) {
  max-width: 360px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.selector-panel {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
  padding: 10px;
}

.ai-preview-panel {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
  padding: 10px;
}

.selector-panel-header,
.selector-actions,
.selector-mode-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.selector-mode-actions {
  justify-content: flex-end;
}

.selector-panel strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.selector-toggle,
.selector-actions button {
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 6px 9px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
}

.selector-toggle[aria-pressed="true"] {
  border-color: var(--green);
  background: var(--green-soft);
  color: #35412e;
}

.selector-control {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.selector-control input {
  width: 100%;
  accent-color: var(--green);
}

.selector-control select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 7px 8px;
  font: inherit;
}

#selector-status,
#ai-preview-status {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.swatches {
  display: grid;
  min-height: 0;
  grid-auto-rows: min-content;
  grid-template-columns: 1fr;
  gap: 8px;
  overflow: auto;
  padding-right: 4px;
}

.swatch {
  display: flex;
  min-width: 0;
  cursor: pointer;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
  padding: 9px;
  color: var(--ink);
  text-align: left;
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    background 160ms ease;
}

.swatch:hover,
.swatch.active {
  border-color: var(--green);
  background: #f2f5eb;
  transform: translateY(-1px);
}

.swatch-chip {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 999px;
}

.swatch strong,
.swatch small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.swatch strong {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
}

.swatch small {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.25;
}

.panel-toolbar {
  display: flex;
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

#model-canvas,
#cad-canvas {
  min-height: 0;
}

#model-canvas {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.design-photo-stage {
  --design-roof: #7b6d5c;
  --design-roof-accent: #4f463b;
  --roof-palette-0: #8c7b66;
  --roof-palette-1: #6f6253;
  --roof-palette-2: #4f463b;
  --roof-palette-3: #a0917a;
  --roof-palette-4: #766a59;
  --roof-palette-5: #3f382f;
  --roof-palette-6: #88745f;
  position: relative;
  width: min(100%, calc((100vh - 216px) * 1.507));
  max-width: 100%;
  aspect-ratio: 612 / 406;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  border-radius: 14px;
  background: #f2eee4;
  box-shadow: 0 20px 70px rgba(62, 48, 32, 0.18);
}

.design-photo-stage img,
.design-photo-stage svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.design-photo-stage img {
  object-fit: cover;
}

.design-photo-stage svg {
  overflow: visible;
}

.design-photo-stage[data-preview-mode="ai-image"] svg {
  display: none;
}

.mask-layer {
  cursor: pointer;
  transition:
    opacity 160ms ease,
    filter 160ms ease;
}

.roof-edit-polygon {
  fill: transparent;
  stroke: transparent;
  stroke-width: 0;
  vector-effect: non-scaling-stroke;
}

.roof-material {
  opacity: 0.98;
}

.roof-source-texture {
  filter: grayscale(1) contrast(1.2) brightness(1.42);
  mix-blend-mode: luminosity;
  opacity: 0.78;
}

.roof-color-wash {
  fill: var(--design-roof);
  opacity: 0.82;
}

.roof-shingle-texture {
  mix-blend-mode: overlay;
  opacity: 0.54;
}

.mask-layer:hover,
.design-photo-stage[data-active-surface="roof"] .surface-roof {
  filter: none;
}

.design-photo-stage[data-selector-mode="wand"][data-active-surface="roof"] .roof-edit-polygon {
  stroke: #f6d676;
  stroke-width: 2.4;
}

.design-photo-stage[data-selector-mode="wand"] .surface-roof {
  filter: drop-shadow(0 0 10px rgba(245, 210, 122, 0.42));
}

.design-photo-stage[data-selector-mode="wand"] {
  cursor: crosshair;
}

.design-photo-stage[data-selector-mode="wand"]::after {
  position: absolute;
  inset: 0;
  border: 2px solid #f6d676;
  border-radius: inherit;
  content: "";
  pointer-events: none;
}

.placeholder-map {
  display: grid;
  min-height: 0;
  place-items: center;
  padding: 22px;
  text-align: center;
}

.placeholder-map div {
  width: min(820px, 84%);
  height: min(52vh, 420px);
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(35deg, transparent 48%, rgba(111, 125, 104, 0.35) 49%, rgba(111, 125, 104, 0.35) 51%, transparent 52%),
    linear-gradient(-18deg, transparent 45%, rgba(160, 120, 89, 0.25) 46%, rgba(160, 120, 89, 0.25) 50%, transparent 51%),
    #ebe4d8;
}

.placeholder-map p {
  max-width: 500px;
  margin-top: 14px;
  color: var(--muted);
}

@media (max-width: 980px) {
  .app-header {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .customer-heading h1 {
    max-width: 100%;
  }

  .view-tabs {
    width: 100%;
  }

  .surface-tabs-wrap {
    grid-template-columns: 1fr;
  }

  .design-page {
    grid-template-columns: minmax(0, 1fr) minmax(150px, 190px);
  }

  .surface-tabs-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .surface-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .model-stage {
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .material-page {
    gap: 10px;
    padding: 12px;
  }

  .material-page p:not(.eyebrow) {
    display: none;
  }

  #selector-status {
    display: block;
  }

  .swatch {
    display: grid;
    gap: 6px;
    justify-items: start;
    padding: 8px;
  }

  .swatch-chip {
    width: 24px;
    height: 24px;
    flex-basis: 24px;
  }
}

@media (max-width: 640px) {
  .view-shell {
    padding: 8px;
  }

  .view-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .surface-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
