:root {
  color-scheme: light;
  --ink: #243129;
  --muted: #68736d;
  --line: #dce0da;
  --paper: #f4f2eb;
  --card: #fffef9;
  --cream: #ede9dc;
  --cabinet: #f3f0e6;
  --wood: #d5aa75;
  --wood-dark: #a67645;
  --green: #315e47;
  --green-soft: #e6efe8;
  --gold: #d8a94e;
  --danger: #8b3e31;
  --shadow: 0 18px 50px rgba(44, 52, 46, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 4% 1%, rgba(216, 169, 78, 0.12), transparent 27rem),
    var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button, input, select { font: inherit; }

button, select, input[type="range"] { cursor: pointer; }

.site-header {
  max-width: 1500px;
  margin: 0 auto;
  padding: 26px 36px 18px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.15em;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  margin-bottom: 7px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.1rem, 3.5vw, 3.7rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.lede { margin-bottom: 0; color: var(--muted); font-size: 1rem; }

main { max-width: 1500px; margin: 0 auto; padding: 0 36px 52px; }

.workspace {
  display: grid;
  grid-template-columns: minmax(340px, 0.82fr) minmax(520px, 1.58fr);
  gap: 18px;
}

.panel, .spec-section {
  background: rgba(255, 254, 249, 0.9);
  border: 1px solid rgba(210, 213, 205, 0.9);
  border-radius: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(9px);
}

.panel-heading, .spec-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading { padding: 17px 20px; border-bottom: 1px solid var(--line); }

.panel-heading > div, .spec-heading > div { display: flex; align-items: center; gap: 11px; }

.panel-heading h2, .spec-heading h2 { margin: 0; font-size: 1rem; letter-spacing: -0.01em; }

.step {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--green);
  color: white;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 0.73rem;
  font-weight: 750;
  white-space: nowrap;
}

.status-chip i { width: 6px; height: 6px; border-radius: 50%; background: #4c996d; box-shadow: 0 0 0 4px rgba(76,153,109,.12); }

.control-group { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.control-group:last-child { border-bottom: 0; }
.control-group h3 { margin-bottom: 12px; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.09em; }

.control-row, .group-title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.control-row { margin-bottom: 9px; font-size: 0.87rem; }
.control-row output { color: var(--green); font-weight: 800; }

input[type="range"] {
  width: 100%;
  height: 5px;
  margin: 5px 0 18px;
  appearance: none;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green) var(--range-progress, 33%), #d9ddd7 var(--range-progress, 33%));
}
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 18px; height: 18px; border-radius: 50%; background: white; border: 5px solid var(--green); box-shadow: 0 1px 5px rgba(0,0,0,.18); }
input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: white; border: 5px solid var(--green); box-shadow: 0 1px 5px rgba(0,0,0,.18); }

.fixed-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.fixed-grid div { padding: 10px 11px; border-radius: 10px; background: #f3f3ed; }
.fixed-grid span, .number-field > span:first-child, .select-grid label > span, .compact-field span { display: block; color: var(--muted); font-size: 0.68rem; }
.fixed-grid strong { display: block; margin-top: 2px; font-size: 0.81rem; }

.checkbox-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 8px 10px; border: 1px solid #d9ddd7; border-radius: 10px; background: #f8f8f3; color: var(--ink); font-size: .78rem; font-weight: 700; cursor: pointer; }
.checkbox-row input { appearance: none; width: 34px; height: 19px; margin: 0; border-radius: 999px; background: #c7cec8; position: relative; transition: background .16s ease; }
.checkbox-row input::after { content: ""; position: absolute; width: 15px; height: 15px; left: 2px; top: 2px; border-radius: 50%; background: white; box-shadow: 0 1px 4px rgba(0,0,0,.22); transition: transform .16s ease; }
.checkbox-row input:checked { background: var(--green); }
.checkbox-row input:checked::after { transform: translateX(15px); }
.checkbox-row input:focus-visible { outline: 3px solid rgba(49,94,71,.18); outline-offset: 2px; }
[hidden] { display: none !important; }

.group-title-row h3 { margin-bottom: 0; }
.compact-field { display: flex; align-items: center; gap: 8px; }
.section-settings { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.compact-number { display: flex; align-items: center; gap: 7px; }
.compact-number > span:first-child, .dimension-note { color: var(--muted); font-size: .68rem; }
.compact-number .input-with-unit { width: 74px; }
.compact-number input { min-height: 34px; padding: 5px 27px 5px 8px; }
.cabinet-title { margin-bottom: 10px; }
.dimension-note { white-space: nowrap; }
.cabinet-dimensions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cabinet-dimensions input { min-height: 36px; }

select, input[type="number"] {
  min-height: 38px;
  padding: 7px 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #cfd4cd;
  border-radius: 9px;
  outline: none;
}

select:focus, input[type="number"]:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(49,94,71,.11); }

.compact-field select { min-height: 34px; padding: 4px 28px 4px 9px; }
.rollout-list { display: grid; gap: 8px; margin-top: 15px; }
.rollout-input { display: grid; grid-template-columns: 23px 1fr 82px; align-items: center; gap: 9px; }
.rollout-index { display: grid; place-items: center; width: 23px; height: 23px; border-radius: 7px; background: #efe5d4; color: #75562d; font-size: 0.69rem; font-weight: 850; }
.rollout-input label { color: var(--muted); font-size: 0.78rem; }
.rollout-input .input-with-unit input { min-height: 34px; padding: 5px 28px 5px 8px; }
.rollout-input select { width: 82px; min-height: 34px; padding: 5px 8px; }

.upper-rollout-list { display: grid; gap: 9px; margin-top: 15px; }
.upper-rollout-input, .rollout-input.profiled { display: grid; grid-template-columns: 23px repeat(3, minmax(0, 1fr)); align-items: end; gap: 9px; padding: 9px; border: 1px solid #e0e0d8; border-radius: 10px; background: #f8f7f1; }
.upper-rollout-input label, .rollout-input.profiled label { display: grid; gap: 4px; }
.upper-rollout-input label > span, .rollout-input.profiled label > span { color: var(--muted); font-size: .68rem; }
.upper-rollout-input select, .rollout-input.profiled select, .usable-field input { width: 100%; min-height: 34px; padding: 5px 8px; font-size: .76rem; }
.usable-readout { display: grid; gap: 4px; align-self: stretch; }
.usable-readout span { color: var(--muted); font-size: .68rem; }
.usable-readout strong { min-height: 34px; display: flex; align-items: center; padding: 5px 8px; border-radius: 9px; background: #eceee8; color: var(--green); font-size: .72rem; line-height: 1.2; }

.input-with-unit { position: relative; display: block; }
.input-with-unit input { width: 100%; padding-right: 29px; }
.input-with-unit em { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .7rem; font-style: normal; pointer-events: none; }
.hint { margin: 11px 0 0; color: var(--muted); font-size: .7rem; }
.fixed-note { margin: -3px 0 12px; color: var(--muted); font-size: .72rem; }
.fixed-note strong { color: var(--ink); }

.two-column-fields, .select-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; }
.number-field, .select-grid label { display: grid; gap: 5px; }
.select-grid select { width: 100%; font-size: .78rem; }
.select-grid .span-two { grid-column: 1 / -1; }

.preview-panel { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.drawing-stage { flex: 1; min-height: 510px; padding: 12px 14px 14px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.view-card { min-width: 0; padding: 10px 12px 7px; background: linear-gradient(145deg, #f9f8f1, #f1efe6); border: 1px solid #e0e0d8; border-radius: 14px; overflow: hidden; }
.view-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.view-title strong { font-size: .77rem; }
.view-title span { color: var(--muted); font-size: .65rem; }
.svg-host { height: 100%; min-height: 455px; }
.svg-host svg { display: block; width: 100%; height: 100%; }

.assumption-bar {
  margin: 0 18px 18px;
  padding: 11px 13px;
  border-radius: 10px;
  background: var(--green-soft);
  color: #315e47;
  font-size: .73rem;
}
.assumption-bar.warning { background: #f7e8e4; color: var(--danger); }

.spec-section { margin-top: 18px; padding: 24px; }
.spec-heading { margin-bottom: 20px; }
.spec-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.spec-card { min-height: 135px; padding: 17px 18px; background: var(--card); }
.spec-card h3 { margin-bottom: 9px; color: var(--green); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; }
.spec-card p { margin-bottom: 0; font-size: .82rem; }
.spec-card strong { display: block; margin-bottom: 3px; color: var(--ink); font-size: .95rem; }
.spec-card .subline { display: block; margin-top: 5px; color: var(--muted); font-size: .72rem; }
.disclaimer { margin: 13px 0 0; color: var(--muted); font-size: .68rem; }

.button { min-height: 42px; padding: 9px 14px; border: 0; border-radius: 10px; font-size: .78rem; font-weight: 800; transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button-secondary { color: var(--green); background: rgba(255,255,255,.72); border: 1px solid #cfd5ce; }
.button-primary { display: inline-flex; align-items: center; gap: 8px; color: white; background: var(--green); box-shadow: 0 7px 18px rgba(49,94,71,.17); }
.button-print { display: inline-flex; align-items: center; gap: 8px; color: var(--green); background: #f3f5f0; border: 1px solid #d4d9d2; }
.copy-icon { width: 13px; height: 15px; border: 1.6px solid currentColor; border-radius: 3px; position: relative; opacity: .9; }
.copy-icon::after { content: ""; position: absolute; width: 8px; height: 3px; top: -4px; left: 1px; border: 1.6px solid currentColor; border-radius: 2px 2px 0 0; background: var(--green); }
.print-icon { position: relative; width: 14px; height: 10px; border: 1.6px solid currentColor; border-radius: 2px; }
.print-icon::before { content: ""; position: absolute; left: 2px; right: 2px; top: -6px; height: 7px; border: 1.6px solid currentColor; background: #f3f5f0; }
.print-icon::after { content: ""; position: absolute; left: 2px; right: 2px; bottom: -5px; height: 6px; border: 1.6px solid currentColor; background: white; }
.print-summary { display: none; }
body.printing-review .spec-section { display: none !important; }

.toast { position: fixed; right: 24px; bottom: 24px; padding: 11px 15px; border-radius: 10px; color: white; background: var(--ink); font-size: .78rem; box-shadow: 0 12px 35px rgba(0,0,0,.2); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

.cabinet-shell { fill: var(--cabinet); stroke: #555f57; stroke-width: .55; }
.cabinet-interior { fill: #fbfaf4; stroke: #828980; stroke-width: .34; }
.cabinet-frame { fill: #e9e6da; stroke: #646c65; stroke-width: .34; }
.wood-box { fill: var(--wood); stroke: var(--wood-dark); stroke-width: .32; }
.wood-line { fill: none; stroke: rgba(116,78,39,.72); stroke-width: .26; }
.slide-rail { stroke: #5e6764; stroke-width: .55; }
.dimension { stroke: #65716a; stroke-width: .28; }
.dimension-text { fill: #4f5b54; font-size: 2.45px; font-weight: 700; font-family: Inter, sans-serif; }
.usable-dimension { stroke: var(--green); stroke-width: .28; }
.usable-tick { stroke: rgba(49, 94, 71, .55); stroke-width: .22; stroke-dasharray: .8 .55; }
.usable-dimension-text { fill: var(--green); stroke: #fbfaf4; stroke-width: 1.05px; paint-order: stroke fill; stroke-linejoin: round; font-size: 1.85px; font-weight: 800; letter-spacing: -.03px; font-family: Inter, sans-serif; }
.view-label { fill: #6d756f; font-size: 2.25px; font-family: Inter, sans-serif; }
.panel-line { fill: none; stroke: #aaa99f; stroke-width: .35; }
.grain { stroke: rgba(142,96,49,.35); stroke-width: .18; fill: none; }

@media (max-width: 1050px) {
  .workspace { grid-template-columns: 1fr; }
  .drawing-stage { min-height: 560px; }
  .controls-panel { display: grid; grid-template-columns: 1fr 1fr; }
  .controls-panel .panel-heading { grid-column: 1 / -1; }
  .control-group { border-right: 1px solid var(--line); }
  .construction-group { grid-column: 1 / -1; }
  .spec-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
  .site-header { padding: 28px 18px 19px; align-items: flex-start; flex-direction: column; }
  h1 { font-size: 2.5rem; }
  main { padding: 0 14px 34px; }
  .controls-panel { display: block; }
  .control-group { border-right: 0; }
  .drawing-stage { grid-template-columns: 1fr; min-height: auto; }
  .svg-host { min-height: 435px; }
  .spec-heading { align-items: stretch; flex-direction: column; }
  .button-primary { justify-content: center; }
  .spec-grid { grid-template-columns: 1fr; }
  .fixed-grid { grid-template-columns: 1fr 1fr; }
  .upper-rollout-input, .rollout-input.profiled { grid-template-columns: 23px 1fr; }
  .upper-rollout-input > :not(.rollout-index), .rollout-input.profiled > :not(.rollout-index) { grid-column: 2; }
  .group-title-row { align-items: flex-start; }
  .section-settings { align-items: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

@media print {
  @page { size: landscape; margin: 0.35in; }
  body { background: white; color: #1f2923; }
  .site-header, .controls-panel, .spec-section, .toast, .preview-panel > .panel-heading, .print-summary, .assumption-bar, .view-title { display: none !important; }
  main { max-width: none; margin: 0; padding: 0; }
  .workspace { display: block; }
  .preview-panel { width: 100%; border: 0; border-radius: 0; box-shadow: none; overflow: visible; background: white; }
  .drawing-stage { height: 7in; min-height: 0; padding: 0; gap: 0.1in; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .view-card { padding: 0.08in; border-radius: 6px; background: white; break-inside: avoid; }
  .svg-host { height: 6.84in; min-height: 0; }
}
