body {
  margin: 0;
  font-family: "Inter", sans-serif;
  overflow: hidden;
}

#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

#sidebar {
  width: 320px;
  border-right: 1px solid #ddd;
  overflow-y: auto;
  user-select: none;
  -webkit-user-select: none;
}

#sidebar input {
  user-select: text;
  -webkit-user-select: text;
}

#canvas-container {
  --planning-hud-edge: 18px;
  --planning-hud-top: 18px;
  --planning-hud-center-clearance: 146px;
  --planning-action-clearance: 126px;
  position: relative;
  flex: 1;
  background: #f8f9fb;
  min-width: 0;
  overflow: hidden;
  height: 100%;
  container-type: inline-size;
}

.planning-view[hidden],
.planning-3d-fallback[hidden] {
  display: none !important;
}

.planning-view {
  position: absolute;
  inset: 0;
  min-width: 0;
  min-height: 0;
}

.planning-view--2d {
  display: flex;
  align-items: center;
  justify-content: center;
}

#container {
  width: 100%;
  height: 100%;
}

.planning-view-switch {
  position: absolute;
  top: var(--planning-hud-top);
  left: 50%;
  z-index: 1200;
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(148, 163, 184, 0.65);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 7px 24px rgba(15, 23, 42, 0.15);
  transform: translateX(-50%);
  backdrop-filter: blur(8px);
}

.planning-view-switch__button {
  min-width: 104px;
  padding: 8px 13px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #475569;
  font: 600 13px "Inter", sans-serif;
  cursor: pointer;
  transition:
    color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

.planning-view-switch__button:hover {
  color: #1d4ed8;
  background: #eff6ff;
}

.planning-view-switch__button:focus-visible {
  outline: 3px solid rgba(55, 129, 241, 0.32);
  outline-offset: 2px;
}

.planning-view-switch__button.is-active {
  background: #2563eb;
  color: #fff;
  box-shadow: 0 3px 9px rgba(37, 99, 235, 0.28);
}

.planning-view--3d {
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 35%, #f8fafc 0, #dbe7f2 62%, #cbd5e1 100%);
}

.planning-3d-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  min-width: 1px;
  min-height: 1px;
  touch-action: none;
}

.planning-3d-canvas canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  cursor: grab;
}

.planning-3d-canvas canvas:active {
  cursor: grabbing;
}

.planning-3d-canvas canvas:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.72);
  outline-offset: -5px;
}

.planning-3d-messages {
  position: absolute;
  right: var(--planning-hud-edge);
  bottom: var(--planning-action-clearance);
  left: var(--planning-hud-edge);
  z-index: 4;
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none;
}

.planning-3d-panorama-credit {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  width: max-content;
  max-width: calc(100vw - 24px);
  transform: translateX(-50%);
  box-sizing: border-box;
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.92);
  color: #334155;
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
}

.planning-view-switch:has(#view-mode-2d[aria-pressed="true"]) .planning-3d-panorama-credit {
  display: none;
}

.planning-3d-notice {
  display: block;
  width: min(480px, 100%);
  box-sizing: border-box;
  padding: 7px 10px;
  border: 1px solid rgba(245, 158, 11, 0.72);
  border-radius: 8px;
  background: rgba(255, 251, 235, 0.88);
  color: #78350f;
  font-size: 11px;
  line-height: 1.4;
  pointer-events: auto;
  backdrop-filter: blur(9px);
  font-size: 12px;
  font-weight: 700;
}

.planning-3d-roof-note {
  display: block;
  width: min(480px, 100%);
  box-sizing: border-box;
  padding: 9px 13px;
  border: 1px solid #60a5fa;
  border-radius: 9px;
  background: rgba(239, 246, 255, 0.95);
  color: #1e3a8a;
  font-size: 11px;
  line-height: 1.4;
  pointer-events: auto;
  backdrop-filter: blur(9px);
}

.planning-3d-roof-note[hidden] {
  display: none;
}

.planning-3d-roof-note summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  list-style-position: inside;
}

.planning-3d-roof-note span {
  display: block;
  margin-top: 5px;
}

.planning-3d-fallback {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  display: flex;
  width: min(440px, calc(100% - 48px));
  box-sizing: border-box;
  flex-direction: column;
  gap: 7px;
  padding: 22px;
  border: 1px solid #fca5a5;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  color: #7f1d1d;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  transform: translate(-50%, -50%);
  box-shadow: 0 15px 40px rgba(15, 23, 42, 0.16);
}

.planning-3d-status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}

.planning-3d-toolbar {
  position: absolute;
  top: var(--planning-hud-top);
  right: var(--planning-hud-edge);
  z-index: 5;
  display: flex;
  box-sizing: border-box;
  max-width: calc(50% - var(--planning-hud-center-clearance));
  gap: 3px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px;
  border: 1px solid rgba(148, 163, 184, 0.62);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(10px);
}

.planning-3d-toolbar::-webkit-scrollbar {
  display: none;
}

.planning-3d-toolbar button {
  min-width: 0;
  padding: 7px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #475569;
  font: 650 11px "Inter", sans-serif;
  cursor: pointer;
  white-space: nowrap;
}

.planning-3d-toolbar button:hover:not(:disabled) {
  background: #eff6ff;
  color: #1d4ed8;
}

.planning-3d-toolbar button[aria-pressed="true"] {
  background: #e0ecff;
  color: #1d4ed8;
}

.planning-3d-toolbar button:focus-visible {
  outline: 3px solid rgba(59, 130, 246, 0.3);
  outline-offset: 1px;
}

.planning-3d-toolbar button:disabled {
  opacity: 0.42;
  cursor: wait;
}

.planning-3d-info {
  position: absolute;
  top: var(--planning-hud-top);
  left: var(--planning-hud-edge);
  z-index: 4;
  display: grid;
  width: min(490px, calc(50% - var(--planning-hud-center-clearance)));
  max-width: none;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 6px;
  pointer-events: none;
}

.planning-3d-info__chip {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
  padding: 7px 10px;
  border: 1px solid rgba(148, 163, 184, 0.55);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: #1e293b;
  box-shadow: 0 7px 20px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(9px);
}

.planning-3d-info__chip small {
  color: #64748b;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.planning-3d-info__chip strong {
  overflow: hidden;
  font-size: 11px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.planning-view--3d:fullscreen {
  background: #e7eef4;
}

.planning-view--3d:fullscreen .planning-3d-messages {
  bottom: 16px;
}

@media (max-width: 980px) {
  .planning-3d-toolbar {
    top: 104px;
    right: 12px;
    left: 12px;
    max-width: none;
    overflow-x: auto;
  }

  .planning-3d-toolbar button {
    flex: 1 0 auto;
  }

  .planning-3d-info {
    top: 150px;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .planning-3d-messages {
    right: 12px;
    left: 12px;
  }
}

/* Productive pointer, touch and keyboard controls for the 2D plan. */
#container {
  position: relative;
  touch-action: none;
  overscroll-behavior: contain;
}

#container .konvajs-content,
#container canvas {
  touch-action: none;
}

#container:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.72);
  outline-offset: -4px;
}

.planning-2d-assistive-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}

.planning-2d-toolbar {
  position: absolute;
  top: 68px;
  right: 14px;
  left: 14px;
  z-index: 1190;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
  pointer-events: none;
}

@media (min-width: 901px) {
  .planning-2d-toolbar {
    display: none;
  }
}

.planning-2d-toolbar__group {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 3px;
  padding: 4px;
  border: 1px solid rgba(148, 163, 184, 0.62);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 25px rgba(15, 23, 42, 0.13);
  pointer-events: auto;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.planning-2d-toolbar button {
  min-width: 38px;
  min-height: 38px;
  padding: 7px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #3f5068;
  font: 700 12px/1 "Inter", sans-serif;
  cursor: pointer;
  white-space: nowrap;
}

.planning-2d-toolbar button:hover:not(:disabled) {
  background: #eff6ff;
  color: #1d4ed8;
}

.planning-2d-toolbar button:focus-visible,
.plan-context-menu button:focus-visible,
.object-palette-card:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.32);
  outline-offset: 1px;
}

.planning-2d-toolbar button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

#planning-2d-selection-label {
  max-width: 165px;
  padding: 0 7px;
  overflow: hidden;
  color: #52637b;
  font-size: 11px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.planning-2d-placement-cursor {
  position: absolute;
  z-index: 10;
  width: 22px;
  height: 22px;
  border: 2px solid #1d4ed8;
  border-radius: 50%;
  background:
    linear-gradient(#1d4ed8, #1d4ed8) center/2px 100% no-repeat,
    linear-gradient(90deg, #1d4ed8, #1d4ed8) center/100% 2px no-repeat,
    rgba(255, 255, 255, 0.78);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.22);
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.planning-2d-placement-cursor[hidden] {
  display: none;
}

.object-palette-hint {
  grid-column: 1 / -1;
  margin: 0 0 2px;
  padding: 9px 10px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #eff6ff;
  color: #31527f;
  font-size: 11px;
  line-height: 1.4;
}

.object-palette-card {
  width: 100%;
  box-sizing: border-box;
  appearance: none;
  border: 1px solid transparent;
  font: inherit;
}

#sidebar .object-palette-card.is-selected {
  border-color: #2563eb;
  background: linear-gradient(145deg, #f4f8ff, #e8f2ff);
  color: #1d4ed8;
  box-shadow:
    0 0 0 3px rgba(37, 99, 235, 0.13),
    0 10px 23px rgba(37, 99, 235, 0.13);
}

.plan-context-menu {
  position: fixed;
  z-index: 5000;
  display: flex;
  min-width: 190px;
  max-width: min(320px, calc(100vw - 16px));
  max-height: calc(100dvh - 16px);
  box-sizing: border-box;
  flex-direction: column;
  gap: 3px;
  padding: 6px;
  overflow-y: auto;
  border: 1px solid #d7e0eb;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 14px 38px rgba(15, 23, 42, 0.22);
}

.plan-context-menu[hidden] {
  display: none;
}

.plan-context-menu button {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #26364d;
  font: 600 12px/1.3 "Inter", sans-serif;
  text-align: left;
  cursor: pointer;
}

.plan-context-menu button:hover,
.plan-context-menu button:focus-visible {
  background: #eff6ff;
  color: #1d4ed8;
}

@media (max-width: 620px) {
  .planning-2d-toolbar {
    top: 62px;
    right: 8px;
    left: 8px;
    gap: 5px;
  }

  .planning-2d-toolbar__group {
    max-width: 100%;
  }

  .planning-2d-toolbar button {
    min-width: 40px;
    min-height: 40px;
    padding: 7px 8px;
  }

  #planning-2d-selection-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
}

@media (pointer: coarse) {
  .object-palette-card {
    cursor: pointer;
  }

  .planning-2d-toolbar button,
  .plan-context-menu button {
    min-height: 44px;
  }
}

@media (max-width: 620px) {
  .planning-view-switch__button {
    min-width: 82px;
    padding: 7px 9px;
  }

  .planning-3d-toolbar {
    top: 104px;
  }

  .planning-3d-info {
    grid-template-columns: 1fr;
  }

  .planning-3d-info__chip:nth-child(n + 3) {
    display: none;
  }

  .planning-3d-messages .planning-3d-notice span,
  .planning-3d-roof-note span {
    display: none;
  }

}

/* The editor sidebar reduces the actual planning canvas independently of the
   viewport. Container queries keep overlays usable for that real width; the
   media queries above remain as a compatibility fallback. */
@container (max-width: 980px) {
  .planning-3d-toolbar {
    top: 104px;
    right: 12px;
    left: 12px;
    max-width: none;
    overflow-x: auto;
  }

  .planning-3d-toolbar button {
    flex: 1 0 auto;
  }

  .planning-3d-info {
    top: 150px;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .planning-3d-messages {
    right: 12px;
    left: 12px;
  }
}

@container (max-width: 620px) {
  .planning-view-switch__button {
    min-width: 82px;
    padding: 7px 9px;
  }

  .planning-3d-toolbar {
    top: 104px;
  }

  .planning-3d-info {
    grid-template-columns: 1fr;
  }

  .planning-3d-info__chip:nth-child(n + 3) {
    display: none;
  }

  .planning-3d-messages .planning-3d-notice span,
  .planning-3d-roof-note span {
    display: none;
  }

}

.planning-3d-status[data-status="loading"] {
  color: #1d4ed8;
}

.planning-3d-status[data-status="error"] {
  color: #b91c1c;
}

.sidebar-section {
  border-bottom: 1px solid #ddd;
}

.sidebar-section-header {
  padding: 12px;
  font-weight: bold;
  background: #e9e9e9;
}

.sidebar-section-content {
  padding: 10px;
}

.object-palette {
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  overflow-y: auto;
}

.object-palette-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 16px 12px;
  cursor: grab;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;

  text-align: center;

  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  transition: all 0.2s ease;

  /* Disable text selection */
  -webkit-user-select: none; /* Safari */
  user-select: none; /* Standard syntax */
}

.object-palette-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.object-palette-card:active {
  cursor: grabbing;
  transform: scale(0.97);
}

.object-palette-card img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  display: block;
}

.object-palette-card span {
  font-size: 13px;
  font-weight: 500;
  color: #333;
}

.settings-palette {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-planning-notice {
  width: 100%;
  margin: 0 0 2px;
  background: #fffbeb;
  backdrop-filter: none;
}

.settings-release-notice,
.release-scope-notice {
  padding: 11px 12px;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  background: #fffbeb;
  color: #78350f;
  font-size: 12px;
  line-height: 1.45;
}

.settings-release-notice strong,
.release-scope-notice strong {
  display: block;
  margin-bottom: 5px;
}

.settings-release-notice ul,
.release-scope-notice ul {
  margin: 0;
  padding-left: 18px;
}

.settings-release-notice li + li,
.release-scope-notice li + li {
  margin-top: 3px;
}

.release-scope-notice {
  margin: 0 0 16px;
}

.binding-offer-notice {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 16px;
  padding: 11px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  line-height: 1.45;
}

.debug-release-scope {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.radio-group {
  display: flex;
  gap: 8px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #333;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}

.radio-label:has(input:checked) {
  border-color: #3781f1;
  background: rgba(55, 129, 241, 0.08);
  color: #3781f1;
}

.radio-label input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}

.radio-label:has(input:focus-visible) {
  outline: 3px solid rgba(55, 129, 241, 0.32);
  outline-offset: 2px;
}

.settings-palette-title {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 600;
  color: #333;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.settings-palette label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #666;
  margin-bottom: 4px;
}

.settings-palette input[type="number"],
.settings-palette input[type="text"],
.settings-palette select {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  height: 37px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-family: "Inter", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #333;
  background: #fff;
  outline: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.settings-palette select {
  cursor: pointer;
}

.settings-palette input[type="number"]:focus,
.settings-palette input[type="text"]:focus,
.settings-palette select:focus {
  border-color: #3781f1;
  box-shadow: 0 0 0 3px rgba(55, 129, 241, 0.15);
}

.settings-palette input[aria-invalid="true"] {
  border-color: #dc2626;
  background: #fff7f7;
}

.settings-height-hint {
  margin-top: -5px;
}

.settings-height-hint--review {
  padding: 7px 9px;
  border-left: 3px solid #d97706;
  border-radius: 4px;
  background: #fffbeb;
  color: #92400e;
}

.settings-checkbox {
  display: flex !important;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  font-weight: 600;
  cursor: pointer;
}

.settings-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 1px 0 0;
  flex: 0 0 auto;
}

.settings-checkbox--disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.settings-hint {
  margin: 5px 0 0;
  color: #66758a;
  font-size: 0.8rem;
  line-height: 1.35;
}

.wall-system-groups {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wall-system-group {
  min-width: 0;
  margin: 0;
  padding: 8px;
  border: 1px solid #dce3ec;
  border-radius: 10px;
  background: #f8fafc;
}

.wall-system-group legend {
  padding: 0 5px;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.025em;
}

.settings-palette .wall-system-card {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

.settings-palette .wall-system-card + .wall-system-card {
  margin-top: 6px;
}

.wall-system-card:hover {
  border-color: #a9c5ee;
}

.wall-system-card:has(input:checked) {
  border-color: #3781f1;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(55, 129, 241, 0.1);
}

.wall-system-card input[type="radio"] {
  width: 15px;
  height: 15px;
  margin: 2px 0 0;
  flex: 0 0 auto;
  accent-color: #3781f1;
}

.wall-system-swatch {
  width: 29px;
  height: 38px;
  flex: 0 0 29px;
  overflow: hidden;
  border: 1px solid #94a3b8;
  border-radius: 5px;
  background-color: #e2e8f0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}

.wall-system-swatch[data-wall-system="DOUBLE_ROD_MESH"] {
  background-image:
    repeating-linear-gradient(90deg, transparent 0 6px, #64748b 6px 8px),
    repeating-linear-gradient(0deg, transparent 0 9px, #64748b 9px 11px);
}

.wall-system-swatch[data-wall-system="BAR_GRATING"] {
  background-image:
    repeating-linear-gradient(90deg, transparent 0 4px, #475569 4px 6px),
    repeating-linear-gradient(0deg, transparent 0 13px, #94a3b8 13px 15px);
}

.wall-system-swatch[data-wall-system="CORRUGATED_WIRE_MESH"] {
  background-image:
    repeating-linear-gradient(45deg, transparent 0 5px, #64748b 5px 7px),
    repeating-linear-gradient(-45deg, transparent 0 5px, #94a3b8 5px 7px);
}

.wall-system-swatch[data-wall-system="SPOT_WELDED_MESH"] {
  background-image:
    radial-gradient(circle, #334155 0 1.5px, transparent 1.6px),
    linear-gradient(90deg, transparent 47%, #94a3b8 48% 52%, transparent 53%),
    linear-gradient(0deg, transparent 47%, #94a3b8 48% 52%, transparent 53%);
  background-size: 10px 10px;
}

.wall-system-swatch[data-wall-system="EXPANDED_METAL"] {
  background-color: #cbd5e1;
  background-image:
    repeating-linear-gradient(60deg, transparent 0 6px, #64748b 6px 7px),
    repeating-linear-gradient(-60deg, transparent 0 6px, #64748b 6px 7px);
}

.wall-system-swatch[data-wall-system="PERFORATED_SHEET"] {
  background-color: #94a3b8;
  background-image: radial-gradient(circle, #f8fafc 0 2px, transparent 2.2px);
  background-size: 8px 8px;
}

.wall-system-swatch[data-wall-system="LOUVERED_GRATING"] {
  background-image: repeating-linear-gradient(
    0deg,
    #475569 0 3px,
    #cbd5e1 3px 6px,
    #f8fafc 6px 8px
  );
}

.wall-system-swatch[data-wall-system="DOUBLE_ROD_MESH_PVC_PRIVACY"] {
  background-image:
    repeating-linear-gradient(0deg, #264e3a 0 6px, #376b50 6px 11px),
    repeating-linear-gradient(90deg, transparent 0 7px, #64748b 7px 9px);
}

.wall-system-swatch[data-wall-system="WOOD_SPECIAL_FILLING"] {
  border-color: #8b5e34;
  background-image: repeating-linear-gradient(
    90deg,
    #a86f3c 0 6px,
    #c58a52 6px 8px,
    #8f5d32 8px 14px
  );
}

.wall-system-card-content {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 4px;
}

.wall-system-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  color: #243247;
}

.wall-system-card-heading strong {
  font-size: 12px;
  line-height: 1.3;
}

.wall-system-card-description {
  color: #64748b;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.35;
}

.closed-weather-roof-group {
  min-width: 0;
  margin: 0;
  padding: 8px;
  border: 1px solid #dce3ec;
  border-radius: 10px;
  background: #f8fafc;
}

.closed-weather-roof-group legend {
  padding: 0 5px;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.025em;
}

.settings-palette .closed-weather-roof-card {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

.settings-palette .closed-weather-roof-card + .closed-weather-roof-card {
  margin-top: 6px;
}

.closed-weather-roof-card:hover {
  border-color: #a9c5ee;
}

.closed-weather-roof-card:has(input:checked) {
  border-color: #3781f1;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(55, 129, 241, 0.1);
}

.closed-weather-roof-card input[type="radio"] {
  width: 15px;
  height: 15px;
  margin: 2px 0 0;
  flex: 0 0 auto;
  accent-color: #3781f1;
}

.closed-weather-roof-swatch {
  width: 38px;
  height: 29px;
  flex: 0 0 38px;
  overflow: hidden;
  border: 1px solid #94a3b8;
  border-radius: 5px;
  background-color: #e2e8f0;
}

.closed-weather-roof-swatch[data-roof-type="NONE"] {
  background-image:
    repeating-linear-gradient(90deg, transparent 0 7px, #64748b 7px 9px),
    repeating-linear-gradient(0deg, transparent 0 7px, #64748b 7px 9px);
}

.closed-weather-roof-swatch[data-roof-type="TRAPEZOIDAL"] {
  border-color: #64748b;
  background-image: repeating-linear-gradient(
    90deg,
    #9aa8b6 0 4px,
    #dbe4ec 4px 8px,
    #7f8d9a 8px 10px,
    #dbe4ec 10px 14px
  );
}

.closed-weather-roof-card-content {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 4px;
}

.closed-weather-roof-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  color: #243247;
}

.closed-weather-roof-card-heading strong {
  font-size: 12px;
  line-height: 1.3;
}

.closed-weather-roof-card-description {
  color: #64748b;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.35;
}

.legal-links {
  position: fixed;
  right: 24px;
  bottom: 4px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.92);
  color: #334155;
  font-size: 12px;
  line-height: 18px;
}

.legal-links a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.legal-links a:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
  border-radius: 2px;
}

#project-actions {
  position: fixed;
  bottom: 32px;
  left: calc(320px + 24px);
  right: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 1000;
  pointer-events: none;
}

#project-actions button {
  min-height: 44px;
  padding: 12px 24px;
  border-radius: 10px;
  font-family: "Inter", sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  pointer-events: auto;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.1s ease;
}

.project-actions__spacer {
  flex: 1 1 auto;
}

#reconfig-btn {
  background: #fff;
  color: #3781f1;
  border: 2px solid #3781f1;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

#reconfig-btn:hover {
  background: #3781f1;
  color: #fff;
}

#reconfig-btn:active {
  transform: scale(0.97);
}

#projektanfrage-btn:active {
  transform: scale(0.97);
}

#projektanfrage-btn {
  padding-right: 24px;
  padding-left: 24px;
  border: 2px solid #3781f1;
  background: #3781f1;
  color: #fff;
  box-shadow: 0 4px 14px rgba(55, 129, 241, 0.35);
}

#projektanfrage-btn:hover {
  border-color: #2568d6;
  background: #2568d6;
  color: #fff;
  box-shadow: 0 6px 20px rgba(55, 129, 241, 0.45);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 9000;
}

.modal {
  box-sizing: border-box;
  background: #fff;
  border-radius: 14px;
  padding: 28px 32px;
  width: 420px;
  max-width: calc(100vw - 40px);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.modal--cost-estimate {
  box-sizing: border-box;
  width: min(920px, 94vw);
  max-height: min(900px, 92dvh);
  overflow-y: auto;
  border: 1px solid #dbeafe;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.cost-estimate-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.cost-estimate-kicker {
  display: block;
  margin-bottom: 4px;
  color: #2563eb;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cost-estimate-close {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #fff;
  color: #475569;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.cost-estimate-close:hover {
  border-color: #64748b;
  color: #0f172a;
}

.cost-estimate-nonbinding-notice {
  display: flex;
  gap: 8px;
  margin: 14px 0;
  padding: 10px 12px;
  border: 1px solid #93c5fd;
  border-radius: 8px;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 12px;
  line-height: 1.45;
}

p.cost-estimate-nonbinding-notice {
  display: block;
}

.cost-estimate-form-error {
  margin: 14px 0;
  padding: 10px 12px;
  border-left: 4px solid #dc2626;
  border-radius: 6px;
  background: #fef2f2;
  color: #991b1b;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
}

.cost-estimate-form-error[hidden] {
  display: none;
}

.project-inquiry-contact-legend {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}

.project-inquiry-contact-fields .modal-notes {
  margin-top: 10px;
}

.project-inquiry-privacy {
  margin: 12px 2px 4px;
}

.project-inquiry-privacy a {
  color: #1d4ed8;
  font-weight: 700;
}

.cost-estimate-total {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 14px 0;
  padding: 18px 20px;
  border: 1px solid #60a5fa;
  border-radius: 12px;
  background: linear-gradient(135deg, #eff6ff, #eef2ff);
  color: #1e3a8a;
}

.cost-estimate-total > span:first-child {
  font-size: 12px;
  font-weight: 700;
}

.cost-estimate-total strong {
  color: #1d4ed8;
  font-size: clamp(27px, 4vw, 42px);
  line-height: 1.08;
}

.cost-estimate-total > span:last-child {
  color: #475569;
  font-size: 12px;
}

.cost-estimate-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.cost-estimate-meta > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.cost-estimate-meta small {
  color: #64748b;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.cost-estimate-meta strong {
  overflow-wrap: anywhere;
  color: #1e293b;
  font-size: 13px;
}

.cost-estimate-quantity-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-top: 10px;
}

.cost-estimate-quantity-summary > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
  padding: 11px 12px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #f8fbff;
}

.cost-estimate-quantity-summary small {
  color: #64748b;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cost-estimate-quantity-summary strong {
  color: #1e3a8a;
  font-size: 12px;
  line-height: 1.35;
}

.cost-estimate-quantity-summary span {
  color: #64748b;
  font-size: 10px;
  line-height: 1.4;
}

.cost-estimate-review > h3 {
  margin: 20px 0 8px;
  color: #1e293b;
  font-size: 15px;
}

.cost-estimate-table-wrap {
  overflow-x: auto;
  border: 1px solid #dbe3ed;
  border-radius: 9px;
}

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

.cost-estimate-table th,
.cost-estimate-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: top;
}

.cost-estimate-table th {
  background: #f8fafc;
  color: #475569;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cost-estimate-table th:last-child,
.cost-estimate-table td:last-child {
  text-align: right;
  white-space: nowrap;
}

.cost-estimate-table tbody tr:last-child td {
  border-bottom: 0;
}

.cost-estimate-table td:first-child strong {
  display: block;
  margin-bottom: 5px;
}

.cost-estimate-confidence {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.cost-estimate-confidence--low {
  background: #fff7ed;
  color: #9a3412;
}

.cost-estimate-confidence--high {
  background: #ecfdf5;
  color: #047857;
}

.cost-estimate-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.cost-estimate-detail-grid--single {
  grid-template-columns: minmax(0, 1fr);
}

.cost-estimate-detail-grid section {
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.cost-estimate-detail-grid h3 {
  margin: 0 0 7px;
  color: #334155;
  font-size: 12px;
}

.cost-estimate-detail-grid ul {
  margin: 0;
  padding-left: 18px;
  color: #64748b;
  font-size: 11px;
  line-height: 1.45;
}

.project-inquiry-contact-summary {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid #dbe3ed;
  border-radius: 9px;
  background: #f8fafc;
}

.project-inquiry-contact-summary h3 {
  margin: 0 0 9px;
  color: #334155;
  font-size: 13px;
}

.project-inquiry-contact-summary dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin: 0;
}

.project-inquiry-contact-summary dl > div {
  min-width: 0;
}

.project-inquiry-contact-summary dt {
  color: #64748b;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.project-inquiry-contact-summary dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  color: #1e293b;
  font-size: 12px;
  white-space: pre-wrap;
}

.cost-estimate-empty-note {
  margin: 0;
  color: #64748b;
  font-size: 11px;
}

.cost-estimate-pdf-status,
.project-inquiry-submit-status {
  min-height: 18px;
  margin-top: 14px;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
}

.cost-estimate-pdf-status[data-status="loading"],
.project-inquiry-submit-status[data-status="loading"] {
  color: #2563eb;
}

.cost-estimate-pdf-status[data-status="success"],
.project-inquiry-submit-status[data-status="success"] {
  color: #15803d;
}

.cost-estimate-pdf-status[data-status="error"],
.project-inquiry-submit-status[data-status="error"] {
  color: #b91c1c;
}

.project-inquiry-progress {
  margin: 16px 0 4px;
  padding: 16px 18px;
  border: 1px solid #dce6fb;
  border-radius: 12px;
  background: #f1f6ff;
}

.project-inquiry-progress[hidden] {
  display: none;
}

.project-inquiry-progress__text {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 0 0 12px;
  color: #466084;
  font-size: 13px;
  line-height: 1.5;
}

.project-inquiry-progress__text strong {
  color: #294c8b;
}

.project-inquiry-progress__track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #dce6fb;
}

.project-inquiry-progress__bar {
  display: block;
  width: 32%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #79a7fb, #456bd3);
  animation: inquiry-progress-slide 1.6s ease-in-out infinite;
}

@keyframes inquiry-progress-slide {
  from { transform: translateX(-110%); }
  to { transform: translateX(325%); }
}

@media (prefers-reduced-motion: reduce) {
  .project-inquiry-progress__bar {
    width: 100%;
    animation: none;
    background: repeating-linear-gradient(135deg, #456bd3 0 10px, #79a7fb 10px 20px);
  }
}

.cost-estimate-pdf-button {
  border: 0;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  font-weight: 700;
}

.cost-estimate-pdf-button:hover {
  background: #1d4ed8;
}

.cost-estimate-review-actions {
  flex-wrap: wrap;
}

.project-inquiry-review-actions .project-inquiry-submit-button {
  flex: 1 1 280px;
  background: #2563eb;
  color: #fff;
}

.project-inquiry-review-actions .cost-estimate-pdf-button,
.project-inquiry-review-actions .modal-close-btn {
  flex: 1 1 190px;
}

.project-inquiry-review-actions .cost-estimate-pdf-button {
  border: 1px solid #94a3b8;
  background: #fff;
  color: #334155;
}

.project-inquiry-review-actions .cost-estimate-pdf-button:hover {
  background: #f8fafc;
}

.modal-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.modal-subtitle {
  margin: 0 0 20px;
  font-size: 13px;
  color: #666;
}

.modal-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.modal-fields label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: #666;
}

.modal-fields input {
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-family: "Inter", sans-serif;
  font-size: 14px;
  color: #333;
  outline: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.modal-fields input:focus {
  border-color: #3781f1;
  box-shadow: 0 0 0 3px rgba(55, 129, 241, 0.15);
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-actions button {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 8px;
  font-family: "Inter", sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.modal-actions button:first-child {
  background: #3781f1;
  color: #fff;
}

.modal-actions button:first-child:hover {
  background: #2568d6;
}

.modal-close-btn {
  background: #f0f0f0 !important;
  color: #333 !important;
}

.modal-close-btn:hover {
  background: #e0e0e0 !important;
}

.modal--wide {
  width: min(520px, calc(100vw - 40px));
}

.modal--quote {
  box-sizing: border-box;
  width: 720px;
  max-width: 100%;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

.modal--quote form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal--quote .modal-subtitle {
  margin-bottom: 2px;
}

.modal-fieldset {
  min-width: 0;
  margin: 0;
  padding: 12px 14px 14px;
  border: 1px solid #dbe3ec;
  border-radius: 10px;
}

.modal-fieldset legend {
  padding: 0 6px;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

.modal-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.modal-form-grid--address {
  grid-template-columns: minmax(0, 2fr) minmax(100px, 0.8fr);
}

.modal-field--wide {
  min-width: 0;
}

.modal-form-grid label,
.modal-notes {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
}

.modal-form-grid input,
.modal-form-grid select,
.modal-notes textarea {
  box-sizing: border-box;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #1e293b;
  font: 14px "Inter", sans-serif;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.modal-form-grid input:focus,
.modal-form-grid select:focus,
.modal-notes textarea:focus {
  border-color: #3781f1;
  box-shadow: 0 0 0 3px rgba(55, 129, 241, 0.15);
}

.modal-notes textarea {
  resize: vertical;
}

.modal-check-group {
  display: grid;
  gap: 9px;
}

.modal-check-group--compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.modal-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: #475569;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}

.modal-check input[type="checkbox"] {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 1px 0 0;
  accent-color: #3781f1;
}

.modal-help {
  margin: 0 0 10px;
  color: #64748b;
  font-size: 11px;
  line-height: 1.4;
}

.modal-help--warning,
.debug-help--warning {
  padding: 8px 10px;
  border-left: 3px solid #d97706;
  border-radius: 4px;
  background: #fffbeb;
  color: #92400e;
}

@media (max-width: 640px) {
  .modal-overlay {
    align-items: flex-start;
    padding: 10px;
  }

  .modal,
  .modal--wide {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - 20px);
    padding: 20px;
  }

  .config-choice-cards {
    flex-direction: column;
  }

  .config-choice-card {
    padding: 16px 12px;
  }

  .modal--quote {
    max-height: calc(100vh - 20px);
    padding: 20px;
  }

  .modal-form-grid,
  .modal-form-grid--address,
  .modal-check-group--compact {
    grid-template-columns: 1fr;
  }
}

.config-choice-cards {
  display: flex;
  gap: 12px;
  margin-bottom: 4px;
}

.config-choice-card {
  box-sizing: border-box;
  flex: 1;
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 16px;
  border: 2px solid #ddd;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  font-family: "Inter", sans-serif;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  transition:
    border-color 0.15s,
    background 0.15s,
    transform 0.1s;
}

.config-choice-card:hover {
  border-color: #3781f1;
  background: rgba(55, 129, 241, 0.05);
  transform: translateY(-2px);
}

.config-choice-card-icon {
  font-size: 28px;
}

.config-choice-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.config-choice-card-desc {
  display: block;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  font-size: 12px;
  color: #666;
  line-height: 1.4;
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
}

.bin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 12px 0 20px;
}

.bin-table th {
  background: #f5f5f5;
  padding: 6px 8px;
  text-align: left;
  font-weight: 600;
  color: #555;
  border-bottom: 1px solid #ddd;
}

.bin-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #f0f0f0;
  color: #333;
}

.bin-table tr:last-child td {
  border-bottom: none;
}

#alert-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.alert {
  padding: 10px;
  border-radius: 10px;
  z-index: 9999;
  font-size: 20px;
  overflow-wrap: break-word;
  max-width: min(400px, 90vw);
  animation: fadeIn 0.2s ease forwards;
}

.alert.fade-out {
  animation: fadeOut 0.2s ease forwards;
}

.alert-error {
  background-color: #ffdddd;
  border: 1px solid #ff0000;
}

.alert-info {
  background-color: #afdcf9;
  border: 1px solid #3781f1;
}

.alert-success {
  background-color: #94fd82;
  border: 1px solid #00ba28;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(20px);
  }
}

/* --- DEBUG PANEL MODAL --- */
.debug-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}

.debug-modal {
  background: #ffffff;
  border-radius: 16px;
  width: 1040px;
  max-width: 95vw;
  height: 85vh;
  max-height: 90vh;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

.debug-header {
  padding: 20px 24px;
  background: #0f172a;
  color: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.debug-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.debug-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.15s ease;
}

.debug-close:hover {
  color: #ffffff;
}

.debug-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.debug-section {
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 18px;
}

.debug-section-title {
  margin-top: 0;
  margin-bottom: 14px;
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 6px;
}

.debug-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.debug-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 12px;
}

.debug-card-label {
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 4px;
}

.debug-card-value {
  font-size: 16px;
  font-weight: 600;
  color: #0f172a;
}

.debug-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.debug-table th, .debug-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
  font-size: 13px;
}

.debug-table th {
  background: #f1f5f9;
  font-weight: 600;
  color: #475569;
}

.debug-table td code {
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}

.debug-btn-primary {
  background: #3b82f6;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.debug-btn-primary:hover {
  background: #2563eb;
}

.debug-btn-secondary {
  background: #475569;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.debug-btn-secondary:hover {
  background: #334155;
}

.debug-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.debug-console {
  background: #0f172a;
  color: #38bdf8;
  font-family: monospace;
  font-size: 12px;
  padding: 16px;
  border-radius: 8px;
  height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  border: 1px solid #334155;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.6);
}

.debug-links-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.debug-link-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
}

.debug-link-item:hover {
  text-decoration: underline;
}

.debug-tag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.debug-tag-success {
  background: #dcfce7;
  color: #15803d;
}

.debug-tag-fail {
  background: #fee2e2;
  color: #b91c1c;
}

.debug-override-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

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

.debug-override-row label {
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.debug-override-row input {
  padding: 7px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-family: "Inter", monospace;
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  background: #ffffff;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.debug-override-row input:focus {
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.debug-override-row input:not(:placeholder-shown) {
  background: #fef3c7;
  border-color: #f59e0b;
}

.debug-card-value--small {
  font-size: 13px;
  line-height: 1.45;
}

.debug-card-value--warning {
  color: #b91c1c;
}

.debug-help {
  margin: 0 0 14px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.5;
}

.debug-form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.debug-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
}

.debug-field input,
.debug-field select {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #0f172a;
  font: 13px "Inter", sans-serif;
}

.debug-field input:disabled {
  background: #f1f5f9;
  color: #64748b;
}

.debug-check-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.debug-check-fieldset {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 10px 12px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
}

.debug-check-fieldset legend {
  padding: 0 5px;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
}

.debug-check-fieldset label {
  color: #475569;
  font-size: 12px;
  line-height: 1.35;
}

.debug-check-fieldset input {
  accent-color: #2563eb;
}

.debug-status {
  display: flex;
  align-items: center;
  color: #64748b;
  font-size: 13px;
  font-weight: 600;
}

.debug-status--running {
  color: #2563eb;
}

.debug-status--success {
  color: #15803d;
}

.debug-status--warning {
  color: #b45309;
}

.debug-status--error {
  color: #b91c1c;
}

.debug-result-grid {
  margin: 16px 0;
}

.debug-card--result {
  border-color: #22c55e;
  background: #f0fdf4;
}

.debug-release-box {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.debug-json-details {
  margin-top: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
}

.debug-json-details summary {
  padding: 10px 12px;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.debug-json-details pre {
  max-height: 360px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  border-top: 1px solid #e2e8f0;
  background: #0f172a;
  color: #dbeafe;
  font: 11px/1.45 monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 800px) {
  .debug-form-grid,
  .debug-check-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .debug-form-grid,
  .debug-check-columns {
    grid-template-columns: 1fr;
  }
}

/* Narrow production layout
   Keep the editor usable when the permanent 320 px sidebar would otherwise
   leave only a sliver for the plan. The settings stay in their own scrollable
   row while the plan receives the full viewport width and the larger share of
   the available height. Desktop geometry above this breakpoint is unchanged. */
@media (max-width: 900px) {
  body {
    overflow-x: hidden;
    overflow-y: auto;
  }

  #app {
    display: grid;
    min-height: 100dvh;
    height: auto;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows:
      clamp(190px, 26dvh, 260px)
      minmax(560px, 1fr);
    overflow: visible;
  }

  #sidebar {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 0;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid #d7dee8;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    background: #fff;
  }

  #canvas-container {
    box-sizing: border-box;
    width: 100%;
    min-width: 100%;
    min-height: 560px;
    height: auto;
  }

  .legal-links {
    right: 12px;
    bottom: calc(4px + env(safe-area-inset-bottom, 0px));
  }

  #project-actions {
    bottom: calc(32px + env(safe-area-inset-bottom, 0px));
    align-items: end;
    left: 12px;
    right: 12px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
    gap: 6px;
  }

  .project-actions__spacer {
    display: none;
  }

  #project-actions button {
    box-sizing: border-box;
    max-width: none;
    min-height: 44px;
    padding: 10px 14px;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.2;
    overflow-wrap: anywhere;
    text-overflow: clip;
    white-space: normal;
  }

  #reconfig-btn {
    grid-column: 1;
    grid-row: 2;
  }

  #projektanfrage-btn {
    grid-column: 2;
    grid-row: 2;
  }

  #debug-btn:not([hidden]) {
    right: auto !important;
    bottom: calc(118px + env(safe-area-inset-bottom, 0px)) !important;
    left: 12px !important;
    max-width: calc(100vw - 24px);
  }

  .planning-3d-messages {
    bottom: calc(138px + env(safe-area-inset-bottom, 0px));
  }

  .cost-estimate-meta,
  .cost-estimate-quantity-summary,
  .cost-estimate-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  #project-actions button {
    padding-right: 10px;
    padding-left: 10px;
    font-size: 12px;
  }

  .modal--cost-estimate {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - 16px);
    padding: 18px 14px;
  }

  .cost-estimate-meta,
  .cost-estimate-quantity-summary,
  .cost-estimate-detail-grid,
  .project-inquiry-contact-summary dl {
    grid-template-columns: 1fr;
  }

  .cost-estimate-table th:nth-child(2),
  .cost-estimate-table td:nth-child(2) {
    display: none;
  }
}

/* Modern shared finish for the estimate and project-inquiry dialogs. */
.cost-estimate-overlay {
  padding: clamp(10px, 2.5vw, 30px);
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 10%, rgba(59, 130, 246, 0.18), transparent 36%),
    rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(12px) saturate(115%);
  -webkit-backdrop-filter: blur(12px) saturate(115%);
}

.modal--cost-estimate {
  --estimate-accent: #2563eb;
  --estimate-accent-dark: #1d4ed8;
  --estimate-ink: #14213d;
  --estimate-muted: #64748b;
  width: min(1040px, 100%);
  max-width: min(1040px, 100%);
  max-height: calc(100dvh - clamp(20px, 5vw, 60px));
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-color: #b7c6db transparent;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 26px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.99), rgba(247, 250, 255, 0.98));
  box-shadow:
    0 34px 90px rgba(15, 23, 42, 0.34),
    0 8px 24px rgba(15, 23, 42, 0.14),
    inset 0 1px 0 #fff;
  color: var(--estimate-ink);
  animation: cost-estimate-dialog-enter 220ms cubic-bezier(0.2, 0.85, 0.25, 1) both;
}

.modal--project-inquiry {
  --estimate-accent: #2563eb;
  --estimate-accent-dark: #1e40af;
}

@keyframes cost-estimate-dialog-enter {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal--cost-estimate .cost-estimate-form,
.modal--cost-estimate .cost-estimate-review {
  box-sizing: border-box;
  padding: clamp(22px, 3.4vw, 38px);
}

.modal--cost-estimate .cost-estimate-form,
.modal--cost-estimate .cost-estimate-review:not([hidden]) {
  display: block;
}

.modal--cost-estimate .cost-estimate-heading-row {
  align-items: center;
  gap: 24px;
  margin-bottom: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(203, 213, 225, 0.72);
}

.modal--cost-estimate .cost-estimate-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-bottom: 7px;
  padding: 0 10px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 999px;
  background: rgba(219, 234, 254, 0.72);
  color: var(--estimate-accent-dark);
  font-size: 10px;
  letter-spacing: 0.11em;
}

.modal--cost-estimate .modal-title {
  margin: 0;
  color: #0f1f3d;
  font-size: clamp(21px, 2.4vw, 29px);
  font-weight: 780;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.modal--cost-estimate .modal-subtitle {
  max-width: 790px;
  margin: 0 0 20px;
  color: var(--estimate-muted);
  font-size: 13px;
  line-height: 1.6;
}

.modal--cost-estimate .cost-estimate-close {
  display: grid;
  width: 40px;
  height: 40px;
  flex-basis: 40px;
  place-items: center;
  border-color: rgba(148, 163, 184, 0.45);
  background: rgba(248, 250, 252, 0.9);
  color: #475569;
  font-size: 23px;
  transition:
    color 150ms ease,
    border-color 150ms ease,
    background 150ms ease,
    transform 150ms ease;
}

.modal--cost-estimate .cost-estimate-close:hover {
  border-color: rgba(37, 99, 235, 0.36);
  background: #eff6ff;
  color: var(--estimate-accent-dark);
  transform: rotate(4deg);
}

.modal--cost-estimate .cost-estimate-nonbinding-notice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 12px;
  margin: 18px 0;
  padding: 13px 15px;
  border: 1px solid #d8e5f8;
  border-radius: 14px;
  background: rgba(239, 246, 255, 0.72);
  color: #29476f;
  font-size: 12px;
  line-height: 1.55;
}

.modal--cost-estimate div.cost-estimate-nonbinding-notice::before {
  content: "i";
  display: grid;
  width: 22px;
  height: 22px;
  grid-row: 1 / span 2;
  place-items: center;
  border-radius: 50%;
  background: var(--estimate-accent);
  color: #fff;
  font: 800 12px/1 "Inter", sans-serif;
}

.modal--cost-estimate .cost-estimate-nonbinding-notice strong {
  align-self: center;
  color: #173a70;
  font-size: 12px;
}

.modal--cost-estimate p.cost-estimate-nonbinding-notice {
  display: block;
  padding-left: 17px;
  border-left: 3px solid #60a5fa;
}

.modal--cost-estimate .modal-fieldset {
  margin-top: 16px;
  padding: 18px 18px 17px;
  border-color: #dce5f0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 7px 22px rgba(15, 23, 42, 0.045);
}

.modal--cost-estimate .modal-fieldset legend {
  padding: 0 9px;
  color: #203554;
  font-size: 12px;
  font-weight: 750;
}

.modal--cost-estimate .modal-form-grid {
  gap: 14px;
}

.modal--cost-estimate .modal-form-grid label,
.modal--cost-estimate .modal-notes {
  gap: 6px;
  color: #455873;
  font-size: 11px;
  font-weight: 700;
}

.modal--cost-estimate .modal-form-grid input,
.modal--cost-estimate .modal-form-grid select,
.modal--cost-estimate .modal-notes textarea {
  min-height: 42px;
  padding: 10px 12px;
  border-color: #cfd9e6;
  border-radius: 11px;
  background: rgba(248, 250, 252, 0.76);
  color: #17243b;
  transition:
    border-color 150ms ease,
    background 150ms ease,
    box-shadow 150ms ease;
}

.modal--cost-estimate .modal-notes textarea {
  min-height: 82px;
}

.modal--cost-estimate .modal-form-grid input:hover,
.modal--cost-estimate .modal-form-grid select:hover,
.modal--cost-estimate .modal-notes textarea:hover {
  border-color: #a9bad0;
  background: #fff;
}

.modal--cost-estimate .modal-form-grid input:focus,
.modal--cost-estimate .modal-form-grid select:focus,
.modal--cost-estimate .modal-notes textarea:focus {
  border-color: var(--estimate-accent);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.modal--cost-estimate .modal-help {
  margin: 11px 2px 0;
}

.modal--cost-estimate .project-inquiry-privacy {
  margin: 16px 2px 2px;
  padding: 13px 14px;
  border: 1px solid #dce5f0;
  border-radius: 13px;
  background: rgba(248, 250, 252, 0.78);
}

.modal--cost-estimate .cost-estimate-total {
  position: relative;
  isolation: isolate;
  gap: 8px;
  margin: 18px 0 16px;
  padding: clamp(21px, 3vw, 30px);
  overflow: hidden;
  border: 0;
  border-radius: 20px;
  background:
    radial-gradient(circle at 90% 20%, rgba(147, 197, 253, 0.36), transparent 33%),
    linear-gradient(125deg, #123b83, #2563eb 58%, #397cf0);
  box-shadow: 0 16px 34px rgba(37, 99, 235, 0.22);
  color: rgba(255, 255, 255, 0.9);
}

.modal--cost-estimate .cost-estimate-total::after {
  position: absolute;
  z-index: -1;
  right: -48px;
  bottom: -80px;
  width: 230px;
  height: 230px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  content: "";
}

.modal--cost-estimate .cost-estimate-total > span:first-child {
  max-width: 620px;
  color: rgba(255, 255, 255, 0.84);
  font-size: 11px;
  letter-spacing: 0.015em;
}

.modal--cost-estimate .cost-estimate-total strong {
  color: #fff;
  font-size: clamp(34px, 5.4vw, 54px);
  font-weight: 790;
  letter-spacing: -0.035em;
  text-shadow: 0 2px 14px rgba(6, 24, 56, 0.18);
}

.modal--cost-estimate .cost-estimate-total > span:last-child {
  width: fit-content;
  padding: 5px 9px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(7, 29, 70, 0.18);
  color: rgba(255, 255, 255, 0.88);
  font-size: 11px;
}

.modal--cost-estimate .cost-estimate-meta {
  gap: 11px;
}

.modal--cost-estimate .cost-estimate-meta > div,
.modal--cost-estimate .cost-estimate-quantity-summary > div {
  position: relative;
  padding: 14px 15px;
  overflow: hidden;
  border: 1px solid #dce5f0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 7px 19px rgba(15, 23, 42, 0.045);
}

.modal--cost-estimate .cost-estimate-meta > div::before,
.modal--cost-estimate .cost-estimate-quantity-summary > div::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(#60a5fa, #2563eb);
  content: "";
}

.modal--cost-estimate .cost-estimate-meta small,
.modal--cost-estimate .cost-estimate-quantity-summary small {
  color: #6a7d98;
  letter-spacing: 0.07em;
}

.modal--cost-estimate .cost-estimate-meta strong {
  color: #1c2d48;
  font-size: 13px;
  line-height: 1.35;
}

.modal--cost-estimate .cost-estimate-quantity-summary {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 11px;
  margin-top: 11px;
}

.modal--cost-estimate .cost-estimate-quantity-summary strong {
  color: #244d91;
  font-size: 12px;
}

.modal--cost-estimate .cost-estimate-review > h3 {
  margin: 25px 0 10px;
  color: #1b2b45;
  font-size: 16px;
  font-weight: 760;
  letter-spacing: -0.01em;
}

.modal--cost-estimate .cost-estimate-table-wrap {
  border-color: #dce5f0;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.045);
}

.modal--cost-estimate .cost-estimate-table {
  font-size: 12px;
}

.modal--cost-estimate .cost-estimate-table th,
.modal--cost-estimate .cost-estimate-table td {
  padding: 13px 15px;
}

.modal--cost-estimate .cost-estimate-table th {
  background: #f5f8fc;
  color: #65758e;
  letter-spacing: 0.075em;
}

.modal--cost-estimate .cost-estimate-table td {
  border-color: #e7edf4;
}

.modal--cost-estimate .cost-estimate-table tbody tr {
  transition: background 140ms ease;
}

.modal--cost-estimate .cost-estimate-table tbody tr:hover {
  background: #f8fbff;
}

.modal--cost-estimate .cost-estimate-detail-grid {
  gap: 12px;
  margin-top: 16px;
}

.modal--cost-estimate .cost-estimate-detail-grid section,
.modal--cost-estimate .project-inquiry-contact-summary {
  padding: 15px 17px;
  border-color: #dce5f0;
  border-radius: 15px;
  background: rgba(248, 250, 252, 0.82);
}

.modal--cost-estimate .cost-estimate-detail-grid h3,
.modal--cost-estimate .project-inquiry-contact-summary h3 {
  margin-bottom: 10px;
  color: #243650;
  font-size: 13px;
  font-weight: 750;
}

.modal--cost-estimate .cost-estimate-detail-grid ul {
  padding-left: 17px;
  color: #60718b;
  line-height: 1.58;
}

.modal--cost-estimate .project-inquiry-contact-summary {
  margin-top: 16px;
  background: rgba(239, 246, 255, 0.64);
}

.modal--cost-estimate .cost-estimate-form-error,
.modal--cost-estimate .cost-estimate-pdf-status:not(:empty),
.modal--cost-estimate .project-inquiry-submit-status:not(:empty) {
  padding: 11px 13px;
  border-radius: 11px;
}

.modal--cost-estimate .cost-estimate-pdf-status:empty,
.modal--cost-estimate .project-inquiry-submit-status:empty {
  display: none;
}

.modal--cost-estimate .cost-estimate-pdf-status[data-status="loading"],
.modal--cost-estimate .project-inquiry-submit-status[data-status="loading"] {
  background: #eff6ff;
}

.modal--cost-estimate .cost-estimate-pdf-status[data-status="success"],
.modal--cost-estimate .project-inquiry-submit-status[data-status="success"] {
  background: #ecfdf3;
}

.modal--cost-estimate .cost-estimate-pdf-status[data-status="error"],
.modal--cost-estimate .project-inquiry-submit-status[data-status="error"] {
  background: #fef2f2;
}

.modal--cost-estimate .modal-actions {
  gap: 11px;
  margin-top: 20px;
}

.modal--cost-estimate .modal-actions button {
  min-height: 46px;
  padding: 11px 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 750;
  box-shadow: none;
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    background 150ms ease,
    box-shadow 150ms ease;
}

.modal--cost-estimate .modal-actions button:not(:disabled):hover {
  transform: translateY(-1px);
}

.modal--cost-estimate .modal-actions button:not(:disabled):active {
  transform: translateY(0) scale(0.99);
}

.modal--cost-estimate .modal-actions button:first-child,
.modal--cost-estimate .cost-estimate-pdf-button,
.modal--cost-estimate .project-inquiry-submit-button {
  border-color: var(--estimate-accent);
  background: linear-gradient(135deg, #3478ef, var(--estimate-accent-dark));
  color: #fff;
  box-shadow: 0 10px 23px rgba(37, 99, 235, 0.2);
}

.modal--cost-estimate .modal-actions button:first-child:hover,
.modal--cost-estimate .cost-estimate-pdf-button:hover,
.modal--cost-estimate .project-inquiry-submit-button:hover {
  background: linear-gradient(135deg, #2563eb, #173f9b);
  box-shadow: 0 13px 27px rgba(37, 99, 235, 0.27);
}

.modal--cost-estimate .modal-close-btn,
.modal--cost-estimate .project-inquiry-review-actions .cost-estimate-pdf-button {
  border-color: #cfd9e6 !important;
  background: rgba(255, 255, 255, 0.9) !important;
  color: #3c4e68 !important;
  box-shadow: none;
}

.modal--cost-estimate .modal-close-btn:hover,
.modal--cost-estimate .project-inquiry-review-actions .cost-estimate-pdf-button:hover {
  border-color: #a9bad0 !important;
  background: #f3f6fa !important;
}

.modal--cost-estimate .modal-actions button:focus-visible,
.modal--cost-estimate .cost-estimate-close:focus-visible,
.modal--cost-estimate input:focus-visible,
.modal--cost-estimate textarea:focus-visible {
  outline: 3px solid rgba(59, 130, 246, 0.24);
  outline-offset: 2px;
}

.modal--cost-estimate .modal-actions button:disabled {
  cursor: wait;
  opacity: 0.62;
  transform: none;
}

@media (max-width: 720px) {
  .cost-estimate-overlay {
    align-items: center;
    padding: 8px;
  }

  .modal--cost-estimate {
    max-height: calc(100dvh - 16px);
    border-radius: 20px;
  }

  .modal--cost-estimate .cost-estimate-form,
  .modal--cost-estimate .cost-estimate-review {
    padding: 20px;
  }

  .modal--cost-estimate .cost-estimate-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .modal--cost-estimate .modal-form-grid--address {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .modal--cost-estimate .modal-field--wide {
    grid-column: 1 / -1;
  }
}

@media (max-width: 500px) {
  .modal--cost-estimate {
    border-radius: 17px;
  }

  .modal--cost-estimate .cost-estimate-form,
  .modal--cost-estimate .cost-estimate-review {
    padding: 16px;
  }

  .modal--cost-estimate .cost-estimate-heading-row {
    gap: 12px;
  }

  .modal--cost-estimate .modal-title {
    font-size: 20px;
  }

  .modal--cost-estimate .cost-estimate-total strong {
    font-size: clamp(31px, 11vw, 42px);
  }

  .modal--cost-estimate .cost-estimate-meta,
  .modal--cost-estimate .cost-estimate-quantity-summary,
  .modal--cost-estimate .cost-estimate-detail-grid,
  .modal--cost-estimate .project-inquiry-contact-summary dl,
  .modal--cost-estimate .modal-form-grid,
  .modal--cost-estimate .modal-form-grid--address {
    grid-template-columns: 1fr;
  }

  .modal--cost-estimate .modal-field--wide {
    grid-column: auto;
  }

  .modal--cost-estimate .cost-estimate-table th,
  .modal--cost-estimate .cost-estimate-table td {
    padding: 11px 10px;
  }

  .modal--cost-estimate .modal-actions {
    flex-direction: column;
  }

  .modal--cost-estimate .modal-actions button {
    width: 100%;
    flex: 1 1 auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .modal--cost-estimate {
    animation: none;
  }

  .modal--cost-estimate *,
  .modal--cost-estimate *::before,
  .modal--cost-estimate *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* Refined sidebar surface without changing the settings DOM or behavior. */
#sidebar {
  scroll-padding-top: 64px;
  scrollbar-color: #b8c6d8 #eef3f8;
  border-right-color: #d9e2ed;
  background:
    linear-gradient(180deg, #f8fbff 0, #f3f7fb 260px, #f5f7fa 100%);
}

#sidebar::-webkit-scrollbar {
  width: 10px;
}

#sidebar::-webkit-scrollbar-track {
  background: #eef3f8;
}

#sidebar::-webkit-scrollbar-thumb {
  border: 2px solid #eef3f8;
  border-radius: 999px;
  background: #b8c6d8;
}

#sidebar .sidebar-section {
  border-bottom: 1px solid #dce5ef;
  background: transparent;
}

#sidebar .sidebar-section-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  min-height: 58px;
  box-sizing: border-box;
  align-items: center;
  gap: 10px;
  padding: max(15px, env(safe-area-inset-top, 0px)) 20px 15px;
  border-bottom: 1px solid rgba(203, 213, 225, 0.76);
  background: rgba(255, 255, 255, 0.94);
  color: #17243b;
  font-size: 17px;
  font-weight: 780;
  letter-spacing: -0.02em;
  box-shadow: 0 7px 20px rgba(15, 23, 42, 0.055);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
}

#sidebar .sidebar-section-header::before {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  background: linear-gradient(135deg, #60a5fa, #2563eb);
  box-shadow: 0 0 0 5px rgba(59, 130, 246, 0.1);
  content: "";
}

#sidebar .sidebar-section-content {
  padding: 0;
}

#sidebar .settings-palette {
  gap: 15px;
  padding: 20px 18px 24px;
}

#sidebar .settings-planning-notice {
  margin: 0 0 1px;
  padding: 11px 13px;
  border: 1px solid #f4c873;
  border-radius: 14px;
  background: linear-gradient(145deg, #fffdf5, #fff7de);
  color: #71410c;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.42;
  box-shadow: 0 7px 18px rgba(146, 100, 20, 0.07);
}

#sidebar .settings-palette-title {
  position: relative;
  margin: 5px 0 0;
  padding-left: 12px;
  color: #27374f;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.075em;
  line-height: 1.35;
}

#sidebar .settings-palette-title::before {
  position: absolute;
  inset: 1px auto 1px 0;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(#60a5fa, #2563eb);
  content: "";
}

#sidebar .settings-palette label:not(.wall-system-card):not(.closed-weather-roof-card):not(.radio-label):not(.settings-checkbox) {
  margin: 0 0 -7px;
  color: #60718a;
  font-size: 11px;
  font-weight: 650;
}

#sidebar .radio-group {
  gap: 7px;
  padding: 4px;
  width: fit-content;
  border: 1px solid #dce5ef;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.04);
}

#sidebar .radio-label {
  min-width: 42px;
  justify-content: center;
  box-sizing: border-box;
  margin: 0;
  padding: 7px 11px;
  border-color: transparent;
  border-radius: 9px;
  background: transparent;
  color: #64748b;
}

#sidebar .radio-label:has(input:checked) {
  border-color: #93bbfa;
  background: linear-gradient(145deg, #eff6ff, #e2eeff);
  color: #1d5fd0;
  box-shadow: 0 4px 11px rgba(37, 99, 235, 0.11);
}

#sidebar .settings-palette input[type="number"],
#sidebar .settings-palette input[type="text"],
#sidebar .settings-palette select {
  height: 43px;
  padding: 10px 12px;
  border-color: #d4dee9;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.9);
  color: #17243b;
  box-shadow: 0 4px 13px rgba(15, 23, 42, 0.035);
  transition:
    border-color 150ms ease,
    background 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease;
}

#sidebar .settings-palette input[type="number"]:hover,
#sidebar .settings-palette input[type="text"]:hover,
#sidebar .settings-palette select:hover {
  border-color: #afbed0;
  background: #fff;
}

#sidebar .settings-palette input[type="number"]:focus,
#sidebar .settings-palette input[type="text"]:focus,
#sidebar .settings-palette select:focus {
  border-color: #3b82f6;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

#sidebar .settings-hint {
  margin: -3px 0 0;
  color: #6a7d98;
  font-size: 11px;
  line-height: 1.45;
}

#sidebar .wall-system-groups {
  gap: 13px;
}

#sidebar .wall-system-group,
#sidebar .closed-weather-roof-group {
  padding: 9px;
  border-color: #d8e2ed;
  border-radius: 15px;
  background: rgba(239, 244, 250, 0.78);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 6px 17px rgba(15, 23, 42, 0.035);
}

#sidebar .wall-system-group legend,
#sidebar .closed-weather-roof-group legend {
  padding: 0 7px;
  color: #5b6d86;
  font-size: 10px;
  font-weight: 780;
  letter-spacing: 0.045em;
}

#sidebar .settings-palette .wall-system-card,
#sidebar .settings-palette .closed-weather-roof-card {
  gap: 10px;
  padding: 11px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.035);
  transition:
    border-color 150ms ease,
    background 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease;
}

#sidebar .settings-palette .wall-system-card + .wall-system-card,
#sidebar .settings-palette .closed-weather-roof-card + .closed-weather-roof-card {
  margin-top: 7px;
}

#sidebar .wall-system-card:hover,
#sidebar .closed-weather-roof-card:hover {
  border-color: #a9c8f5;
  background: #fff;
  box-shadow: 0 8px 19px rgba(30, 64, 175, 0.075);
  transform: translateY(-1px);
}

#sidebar .wall-system-card:has(input:checked),
#sidebar .closed-weather-roof-card:has(input:checked) {
  border-color: #3b82f6;
  background: linear-gradient(145deg, #f4f8ff, #eaf3ff);
  box-shadow:
    0 0 0 2px rgba(59, 130, 246, 0.1),
    0 9px 21px rgba(37, 99, 235, 0.1);
}

#sidebar .wall-system-card input[type="radio"],
#sidebar .closed-weather-roof-card input[type="radio"] {
  margin-top: 4px;
  accent-color: #2563eb;
}

#sidebar .wall-system-swatch,
#sidebar .closed-weather-roof-swatch {
  border-color: #8294ab;
  border-radius: 7px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.62),
    0 3px 8px rgba(15, 23, 42, 0.09);
}

#sidebar .wall-system-card-heading strong,
#sidebar .closed-weather-roof-card-heading strong {
  color: #23344f;
  font-size: 12px;
  font-weight: 760;
}

#sidebar .wall-system-card-description,
#sidebar .closed-weather-roof-card-description {
  color: #667892;
  line-height: 1.42;
}

#sidebar .settings-checkbox {
  box-sizing: border-box;
  margin-top: 0;
  padding: 11px 12px;
  border: 1px solid #d8e2ed;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.82);
}

#sidebar .object-palette {
  gap: 10px;
  padding: 16px;
}

#sidebar .object-palette-card {
  border: 1px solid #dce5ef;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 17px rgba(15, 23, 42, 0.055);
}

#sidebar .object-palette-card:hover {
  border-color: #a9c8f5;
  box-shadow: 0 11px 24px rgba(30, 64, 175, 0.11);
}

@media (max-width: 980px) {
  #sidebar .sidebar-section-header {
    min-height: 52px;
    padding: 13px 18px;
  }

  #sidebar .settings-palette {
    padding: 16px;
  }
}

/* A short landscape touchscreen must never scroll the settings completely
   behind a touch-action:none canvas. Keep settings and plan side by side so
   both remain reachable while one-finger plan panning stays deterministic. */
@media (max-width: 900px) and (max-height: 500px) and (orientation: landscape) {
  body {
    overflow: hidden;
  }

  #app {
    display: flex;
    width: 100%;
    min-height: 0;
    height: 100dvh;
    overflow: hidden;
  }

  #sidebar {
    width: min(280px, 40vw);
    min-width: 220px;
    height: 100%;
    border-right: 1px solid #d7dee8;
    border-bottom: 0;
    overflow-y: auto;
  }

  #canvas-container {
    width: auto;
    min-width: 0;
    min-height: 0;
    height: 100%;
  }

  #project-actions {
    left: calc(min(280px, 40vw) + 12px);
  }
}
