:root {
  color-scheme: light;
  --ink: #17231f;
  --muted: #68746f;
  --line: #dfe6e2;
  --soft: #f4f7f5;
  --paper: #ffffff;
  --brand: #173f36;
  --brand-2: #2e685a;
  --accent: #d99c55;
  --accent-soft: #fff5e8;
  --danger: #a3483f;
  --shadow: 0 24px 60px rgba(29, 56, 47, .09);
  --radius: 18px;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 1rem;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 5% 0%, rgba(217, 156, 85, .08), transparent 22rem),
    #edf2ef;
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }

.app-shell { min-height: 100vh; }

.topbar {
  min-height: 70px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, .9);
  border-bottom: 1px solid rgba(23, 63, 54, .1);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: white;
  background: var(--brand);
}

.brand-mark svg { width: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.brand strong { display: block; font: 700 1.1875rem/1.05 Georgia, serif; letter-spacing: .02em; }
.brand small { display: block; margin-top: 0.1875rem; color: var(--muted); font-size: 0.6875rem; }

.top-actions { display: flex; align-items: center; gap: 12px; }
.history-button, .module-button {
  height: 38px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--brand);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  cursor: pointer;
  font-size: 0.6875rem;
  font-weight: 700;
}
.history-button svg, .module-button svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.font-control {
  height: 38px;
  display: grid;
  grid-template-columns: 34px 44px 34px;
  align-items: center;
  overflow: hidden;
  color: var(--brand);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}
.font-control button {
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  font-weight: 800;
  cursor: pointer;
}
.font-control button:hover { background: var(--soft); }
.font-control button:disabled { color: #aeb7b3; cursor: default; }
.font-control span {
  font-size: .625rem;
  text-align: center;
  color: var(--muted);
}
.language-control { display: flex; align-items: center; gap: 0.5rem; color: var(--muted); font-size: 0.75rem; }
.language-control select {
  height: 38px;
  padding: 0 34px 0 12px;
  color: var(--ink);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  cursor: pointer;
}

.icon-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.workspace {
  min-height: calc(100vh - 70px);
  display: grid;
  grid-template-columns: 200px minmax(480px, 1fr);
  gap: 14px;
  padding: 14px;
}

.progress-panel, .wizard-card {
  background: var(--paper);
  border: 1px solid rgba(23, 63, 54, .08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.progress-panel { padding: 18px 14px; }
.progress-copy { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.75rem; }
.progress-copy strong { color: var(--brand); }
.progress-track { height: 4px; margin: 10px 0 24px; overflow: hidden; border-radius: 4px; background: var(--line); }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .35s ease; }

.step-nav { display: grid; gap: 6px; }
.step-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.step-button:disabled { cursor: default; opacity: .55; }
.step-button.active { color: var(--brand); background: #edf5f1; }
.step-number {
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 0.6875rem;
  font-weight: 700;
  background: white;
}
.step-button.active .step-number, .step-button.complete .step-number {
  color: white;
  border-color: var(--brand);
  background: var(--brand);
}
.step-label { font-size: 0.75rem; line-height: 1.35; }
.step-label .bi-secondary { font-size: 0.625rem; opacity: .72; }

.main-panel { min-width: 0; }
.wizard-card {
  min-height: calc(100vh - 98px);
  padding: 26px 30px 22px;
  display: flex;
  flex-direction: column;
}

.eyebrow {
  display: block;
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 0.625rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.wizard-header h1 {
  max-width: 680px;
  margin: 0;
  font: 600 clamp(1.45rem, 2.05vw, 2.05rem)/1.16 Georgia, "Microsoft YaHei", serif;
  color: var(--brand);
}
.wizard-header p { max-width: 45rem; margin: 0.55rem 0 0; color: var(--muted); font-size: 0.8125rem; line-height: 1.55; }

.bi-text { display: inline-flex; flex-direction: column; gap: 2px; }
.bi-secondary { display: block; color: inherit; font-size: .78em; font-weight: 400; opacity: .72; }

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}
.product-grid { gap: 12px; }
.choice-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.choice-card {
  min-height: 112px;
  position: relative;
  padding: 16px 42px 16px 16px;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: white;
  text-align: left;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.choice-card:hover { transform: translateY(-2px); border-color: #94b0a7; box-shadow: 0 12px 24px rgba(29, 56, 47, .08); }
.choice-card.selected { border: 2px solid var(--brand); padding: 15px 41px 15px 15px; background: #f7fbf9; }
.choice-check {
  width: 20px;
  height: 20px;
  position: absolute;
  top: 13px;
  right: 13px;
  display: none;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--brand);
  font-size: 0.75rem;
}
.choice-card.selected .choice-check { display: grid; }
.choice-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  color: var(--brand);
  background: #eaf2ef;
  border-radius: 14px;
}
.product-grid .choice-card {
  min-height: 132px;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 18px;
}
.product-grid .choice-icon {
  width: 74px;
  height: 74px;
  border-radius: 18px;
}
.choice-icon svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.opening-card { grid-template-columns: 72px minmax(0, 1fr); gap: 22px; }
.opening-card .choice-icon { width: 68px; height: 60px; }
.opening-card .mini-opening { width: 62px; height: 44px; overflow: visible; }
.mini-frame { fill: #fff; stroke: currentColor; stroke-width: 2.5; }
.mini-sash, .mini-panel, .mini-leaf { fill: rgba(194,121,45,.1); stroke: var(--accent); stroke-width: 2; transform-box: fill-box; }
.opening-card:hover .mini-turn, .opening-card.selected .mini-turn { animation: mini-turn 1.15s ease-in-out; transform-origin: left center; }
.opening-card:hover .mini-tilt, .opening-card.selected .mini-tilt { animation: mini-tilt 1.15s ease-in-out; transform-origin: center bottom; }
.opening-card:hover .mini-tiltTurn, .opening-card.selected .mini-tiltTurn { animation: mini-tilt-turn 1.7s ease-in-out; transform-origin: left bottom; }
.opening-card:hover .mini-slide, .opening-card.selected .mini-slide { animation: mini-slide 1.15s ease-in-out; }
.opening-card:hover .mini-left, .opening-card.selected .mini-left { animation: mini-left 1.25s ease-in-out; transform-origin: left center; }
.opening-card:hover .mini-right, .opening-card.selected .mini-right { animation: mini-right 1.25s ease-in-out; transform-origin: right center; }
@keyframes mini-turn { 45%, 65% { transform: translate(5px, 8px) skewY(16deg) scaleX(.62); } }
@keyframes mini-tilt { 45%, 65% { transform: translateY(7px) scale(1.12, .72); fill: rgba(194,121,45,.28); } }
@keyframes mini-tilt-turn { 28% { transform: translate(5px, 8px) skewY(16deg) scaleX(.62); } 52% { transform: none; } 72% { transform: translateY(7px) scale(1.12, .72); fill: rgba(194,121,45,.28); } }
@keyframes mini-slide { 45%, 65% { transform: translateX(21px); } }
@keyframes mini-left { 45%, 65% { transform: translate(-2px, 7px) skewY(-16deg) scaleX(.6); } }
@keyframes mini-right { 45%, 65% { transform: translate(2px, 7px) skewY(16deg) scaleX(.6); } }
.product-grid .choice-icon svg { width: 42px; height: 42px; }
.choice-copy { min-width: 0; display: block; }
.choice-card h3 { margin: 0 0 0.3125rem; font-size: 0.95rem; line-height: 1.25; color: var(--ink); }
.product-grid .choice-card h3 { font-size: 1.12rem; }
.choice-card p { margin: 0; color: var(--muted); font-size: 0.72rem; line-height: 1.45; }
.choice-card .tag { display: inline-block; margin-top: 0.625rem; padding: 0.1875rem 0.4375rem; border-radius: 0.3125rem; color: var(--brand); background: #eaf2ef; font-size: 0.5625rem; font-weight: 700; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 28px; }
.field { display: grid; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label, .field-label { font-size: 0.6875rem; font-weight: 700; color: var(--ink); }
.field small { color: var(--muted); font-size: 0.625rem; line-height: 1.45; }
.hinge-options, .layout-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.hinge-option, .layout-option {
  min-height: 56px;
  padding: 8px 13px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 22px;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 11px;
  background: white;
  text-align: left;
  font-size: .75rem;
  font-weight: 700;
  cursor: pointer;
}
.hinge-option:hover, .layout-option:hover { border-color: #94b0a7; background: #f7fbf9; }
.hinge-option.selected, .layout-option.selected { color: var(--brand); border: 2px solid var(--brand); background: #edf5f1; }
.hinge-symbol { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; color: white; background: var(--brand); font-size: .7rem; }
.layout-symbol { width: 30px; height: 30px; display: grid; place-items: center; color: var(--brand); }
.layout-symbol svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.hinge-check, .layout-check { visibility: hidden; color: var(--brand); font-size: 1rem; text-align: right; }
.hinge-option.selected .hinge-check, .layout-option.selected .layout-check { visibility: visible; }
.input-wrap { position: relative; }
.input-wrap input, .field input, .field textarea, .field select {
  width: 100%;
  padding: 12px 13px;
  color: var(--ink);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.input-wrap input { padding-right: 48px; }
.input-wrap span { position: absolute; right: 0.8125rem; top: 50%; color: var(--muted); font-size: 0.6875rem; transform: translateY(-50%); }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(46, 104, 90, .1); }
.field textarea { min-height: 90px; resize: vertical; line-height: 1.6; }

.counter {
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
}
.counter button { border: 0; background: white; cursor: pointer; font-size: 1.125rem; }
.counter input { border: 0; border-radius: 0; text-align: center; }

.notice {
  margin-top: 18px;
  padding: 12px 14px;
  display: flex;
  gap: 10px;
  border-radius: 10px;
  color: #6e593e;
  background: var(--accent-soft);
  font-size: 0.625rem;
  line-height: 1.55;
}
.notice.error { color: var(--danger); background: #fff0ee; }
.size-notice { align-items: flex-start; }
.notice-mark { flex: 0 0 auto; font-weight: 800; }
.notice-copy { flex: 1 1 auto; }
.notice-link { display: block; width: fit-content; margin-top: 6px; color: var(--brand); font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.notice-link:hover { color: var(--brand-2); }

.wizard-footer {
  margin-top: auto;
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.wizard-footer > .button, .wizard-footer > div .button { min-height: 52px; padding: 0 25px; font-size: .78rem; }
.button {
  min-height: 42px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  font-weight: 700;
  font-size: 0.6875rem;
  cursor: pointer;
}
.button.primary { color: white; border-color: var(--brand); background: var(--brand); }
.button.accent { color: #3e2b15; border-color: var(--accent); background: var(--accent); }
.button:disabled { opacity: .4; cursor: default; }
.button svg { width: 15px; fill: none; stroke: currentColor; stroke-width: 2; }

.preview-dialog {
  width: min(720px, 100vw);
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0 0 0 auto;
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
}
.preview-dialog::backdrop { background: rgba(12, 27, 23, .55); backdrop-filter: blur(3px); }
.preview-dialog[open] { animation: preview-in .25s ease-out; }
@keyframes preview-in { from { opacity: 0; transform: translateX(32px); } }
.preview-panel {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: auto;
  min-width: 0;
  padding: 30px;
  background: #173f36;
  color: white;
}
.preview-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.preview-heading .eyebrow { font-size: .72rem; }
.preview-heading h2 { margin: 0; font: 600 1.65rem/1.2 Georgia, serif; }
.preview-actions { display: flex; gap: 10px; }
.preview-control {
  min-width: 96px;
  height: 48px;
  padding: 0 15px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  color: #3b2915;
  border: 1px solid #d99b32;
  border-radius: 10px;
  background: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
}
.preview-control:hover { background: #ffd477; }
.preview-icon { width: 19px; height: 19px; flex: 0 0 19px; }
.preview-icon-play { fill: currentColor; stroke: none; }
.preview-icon-close { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }

.window-stage {
  height: clamp(420px, 60vh, 620px);
  position: relative;
  margin: 16px -2px 12px;
  overflow: hidden;
  border-radius: 12px;
  background:
    radial-gradient(circle at 66% 20%, rgba(255,255,255,.9), transparent 34%),
    linear-gradient(155deg, #e9e3d8, #bcae9c);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
}
.three-stage { width: 100%; height: 100%; position: relative; cursor: grab; touch-action: none; }
.three-stage:active { cursor: grabbing; }
.three-stage canvas { width: 100%; height: 100%; display: block; border-radius: inherit; }
.three-loading {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: grid;
  place-items: center;
  color: rgba(23,63,54,.35);
  font: 700 1.25rem Georgia, serif;
}
.preview-explanation {
  min-height: 60px;
  padding: 13px 15px;
  color: rgba(255,255,255,.82);
  background: rgba(255,255,255,.08);
  border-radius: 10px;
  font-size: 0.78rem;
  line-height: 1.6;
}
.quick-summary { margin: 12px 0 0; }
.quick-summary div { padding: 0.58rem 0; display: grid; grid-template-columns: 7rem 1fr; border-bottom: 0.0625rem solid rgba(255,255,255,.1); font-size: 0.75rem; }
.quick-summary dt { color: rgba(255,255,255,.55); }
.quick-summary dd { margin: 0; text-align: right; }

.preview-float {
  position: fixed;
  top: 86px;
  right: 16px;
  z-index: 8;
  min-height: 56px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: #35240f;
  border: 1px solid #d99b32;
  border-radius: 999px;
  background: #ffc85a;
  box-shadow: 0 12px 30px rgba(111,74,20,.28);
  font-size: .86rem;
  font-weight: 800;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.preview-float:hover { background: #ffd477; box-shadow: 0 14px 34px rgba(111,74,20,.34); }
.preview-float.dragging { cursor: grabbing; box-shadow: 0 18px 42px rgba(111,74,20,.38); }
.preview-float.hidden { display: none; }

.package-card {
  min-height: 176px;
  display: block;
  padding-right: 18px;
}
.package-card.selected { padding-right: 17px; }
.package-card.unavailable {
  color: #89928f;
  border-color: #d8dddb;
  background: #f1f3f2;
  box-shadow: none;
  cursor: not-allowed;
  filter: grayscale(.75);
  opacity: .62;
}
.package-card.unavailable:hover { border-color: #d8dddb; box-shadow: none; transform: none; }
.package-unavailable { margin-top: .75rem; color: #6f7774; font-size: .62rem; font-weight: 800; }
.package-top { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.flag-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.package-lines { display: grid; gap: 0.375rem; margin-top: 0.75rem; color: var(--muted); font-size: 0.625rem; }
.package-lines span::before { content: "✓"; margin-right: 6px; color: var(--brand-2); font-weight: 800; }
.price-line { margin-top: 0.875rem; color: var(--brand); font-size: 0.75rem; font-weight: 800; }
.rate-editor {
  margin-top: 1rem;
  padding: .85rem 1rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8faf9;
}
.rate-editor summary {
  color: var(--brand);
  font-size: .75rem;
  font-weight: 800;
  cursor: pointer;
}
.rate-editor > p {
  margin: .45rem 0 .8rem;
  color: var(--muted);
  font-size: .625rem;
}
.rate-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .6rem;
}
.rate-field { display: grid; gap: .3rem; }
.rate-field span { color: var(--muted); font-size: .59rem; line-height: 1.3; }
.rate-field input {
  width: 100%;
  min-width: 0;
  padding: .55rem .6rem;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  outline: none;
}
.rate-field input:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(46,104,90,.1); }

.review-layout { display: grid; gap: 14px; margin-top: 18px; }
.review-card { padding: 18px; border: 1px solid var(--line); border-radius: 13px; }
.review-card h3 { margin: 0 0 0.75rem; color: var(--brand); font-size: 0.9375rem; }
.review-summary { padding: 18px 20px; }
.review-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin: 0; }
.review-list div { display: flex; justify-content: space-between; gap: 0.875rem; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 0.75rem; }
.review-list dt { color: var(--muted); }
.review-list dd { margin: 0; text-align: right; font-weight: 700; }
.cost-details {
  margin-top: .8rem;
  padding-top: .65rem;
  border-top: 1px solid var(--line);
}
.cost-details summary {
  color: var(--brand);
  font-size: .625rem;
  font-weight: 800;
  cursor: pointer;
}
.cost-details dl { margin: .6rem 0 0; display: grid; gap: .35rem; }
.cost-details dl div { display: flex; justify-content: space-between; gap: .8rem; font-size: .59rem; }
.cost-details dt { color: var(--muted); }
.cost-details dd { margin: 0; font-weight: 700; }
.review-drawing { padding: 6px 12px; display: grid; place-items: center; overflow: hidden; background: #fafbf9; }
.review-drawing svg { display: block; width: 100%; height: auto; max-height: 520px; }

.success-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
  padding: 7px 10px;
  color: var(--brand);
  background: #eaf4ef;
  border-radius: 999px;
  font-size: 0.625rem;
  font-weight: 700;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 20;
  padding: 11px 16px;
  color: white;
  border-radius: 9px;
  background: #1d2925;
  box-shadow: 0 12px 30px rgba(0,0,0,.2);
  font-size: 0.6875rem;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: .25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.history-dialog {
  width: min(680px, calc(100vw - 40px));
  max-height: 80vh;
  padding: 24px;
  color: var(--ink);
  border: 0;
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(15, 35, 29, .28);
}
.history-dialog::backdrop { background: rgba(18, 34, 29, .55); backdrop-filter: blur(3px); }
.dialog-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.dialog-header h2 { margin: 0; color: var(--brand); font: 600 1.5625rem Georgia, "Microsoft YaHei", serif; }
.dialog-header .icon-button { font-size: 1.25rem; }
.dialog-note { margin: 0.75rem 0 1.125rem; color: var(--muted); font-size: 0.6875rem; line-height: 1.6; }
.history-search { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.history-search input {
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
}
.history-search input:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(46,104,90,.1); }
.history-results { max-height: 390px; margin-top: 16px; display: grid; gap: 9px; overflow: auto; }
.history-empty { padding: 2.25rem 1rem; color: var(--muted); background: var(--soft); border-radius: 0.75rem; text-align: center; font-size: 0.6875rem; }
.history-record {
  padding: 13px 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.history-record strong { display: block; color: var(--brand); font-size: 0.75rem; }
.history-record p { margin: 0.3125rem 0 0; color: var(--muted); font-size: 0.625rem; line-height: 1.55; }
.history-record-actions { display: flex; align-items: center; gap: 6px; }
.history-record-actions .button { min-height: 34px; padding: 0 10px; }

.print-sheet { display: none; }

@media (max-width: 1250px) {
  .workspace { grid-template-columns: 176px minmax(430px, 1fr); gap: 12px; padding: 12px; }
  .wizard-card { padding: 24px; }
  .choice-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .choice-card { grid-template-columns: 52px minmax(0, 1fr); gap: 12px; }
  .opening-card { grid-template-columns: 68px minmax(0, 1fr); gap: 18px; }
  .choice-icon { width: 52px; height: 52px; }
  .choice-icon svg { width: 31px; height: 31px; }
  .product-grid .choice-card { grid-template-columns: 66px minmax(0, 1fr); }
  .product-grid .choice-icon { width: 66px; height: 66px; }
  .product-grid .choice-icon svg { width: 38px; height: 38px; }
}

@media (max-width: 1080px) {
  .topbar {
    min-height: auto;
    padding: 12px;
    flex-wrap: wrap;
    gap: 10px;
  }
  .top-actions { flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
  .workspace {
    min-height: auto;
    grid-template-columns: minmax(0, 1fr);
  }
  .progress-panel {
    grid-column: 1 / -1;
    padding: 12px;
  }
  .progress-track { margin-bottom: 12px; }
  .step-nav {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 7px;
  }
  .step-button {
    min-height: 56px;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding: 7px 5px;
    text-align: center;
  }
  .step-number { width: 23px; height: 23px; flex-basis: 23px; }
  .step-label { font-size: 0.65rem; }
  .step-label .bi-secondary { display: none; }
  .wizard-card { min-height: 600px; }
}

@media (max-width: 860px) {
  .brand small { display: none; }
  .language-control > span { display: none; }
  .workspace { grid-template-columns: 1fr; }
  .window-stage { height: clamp(360px, 54vh, 520px); }
  .wizard-card { min-height: auto; }
  .choice-grid, .choice-grid.three, .product-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .rate-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .review-list { grid-template-columns: 1fr; }
  .review-drawing { padding: 5px 8px; }
}

@media (max-width: 560px) {
  .topbar { align-items: flex-start; }
  .top-actions { width: 100%; justify-content: flex-start; }
  .history-button, .module-button { flex: 1 1 140px; justify-content: center; }
  .language-control { flex: 1 1 160px; }
  .language-control select { width: 100%; }
  .font-control { flex: 0 0 auto; }
  .workspace { padding: 8px; gap: 8px; }
  .wizard-card, .progress-panel { border-radius: 14px; }
  .wizard-card { padding: 18px; }
  .step-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .choice-card, .choice-card.selected {
    padding-right: 38px;
    grid-template-columns: 48px minmax(0, 1fr);
  }
  .choice-icon { width: 48px; height: 48px; border-radius: 12px; }
  .product-grid .choice-card, .product-grid .choice-card.selected {
    min-height: 116px;
    grid-template-columns: 58px minmax(0, 1fr);
  }
  .product-grid .choice-icon { width: 58px; height: 58px; }
  .window-stage { height: clamp(310px, 48vh, 430px); }
  .wizard-footer { flex-wrap: wrap; }
  .button { flex: 1 1 140px; }
  .rate-grid { grid-template-columns: 1fr; }
  .size-notice { flex-wrap: wrap; }
  .review-card { padding: 12px; }
  .review-summary { padding: 16px; }
  .review-list div { padding: 9px 4px; font-size: 0.75rem; }
  .review-drawing { padding: 3px; }
  .opening-card, .opening-card.selected { grid-template-columns: 62px minmax(0, 1fr); gap: 16px; }
  .preview-float { top: auto; right: 10px; bottom: 84px; min-height: 52px; padding: 0 18px; font-size: .8rem; }
  .preview-dialog {
    width: 100vw;
    height: min(90dvh, 760px);
    margin: auto 0 0;
  }
  .preview-dialog[open] { animation-name: preview-up; }
  @keyframes preview-up { from { opacity: 0; transform: translateY(32px); } }
  .preview-panel { padding: 20px 16px; border-radius: 18px 18px 0 0; }
  .preview-heading { display: grid; align-items: start; gap: 13px; }
  .preview-heading h2 { font-size: 1.35rem; }
  .preview-actions { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .preview-control { width: 100%; min-width: 0; min-height: 52px; height: auto; padding: 8px 10px; line-height: 1.25; white-space: normal; }
  .preview-control .bi-text { align-items: center; text-align: center; }
  .review-actions-footer {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }
  .review-actions-footer > div { display: contents; }
  .review-actions-footer .button {
    width: 100%;
    min-width: 0;
    min-height: 64px;
    padding: 9px 8px;
    flex: none;
    line-height: 1.25;
    text-align: center;
    white-space: normal;
  }
  .review-actions-footer .button .bi-text { align-items: center; text-align: center; }
}

@media (max-width: 360px) {
  .review-actions-footer { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .opening-card .mini-sash, .opening-card .mini-panel, .opening-card .mini-leaf,
  .preview-dialog[open] { animation: none !important; }
}

@media print {
  @page { size: A4 landscape; margin: 8mm; }
  html, body { width: 281mm !important; min-width: 281mm; margin: 0; background: white; }
  .app-shell, .toast, .history-dialog, .preview-dialog { display: none !important; }
  .print-sheet { width: 281mm; display: block; color: #111; font-family: Arial, "Microsoft YaHei", sans-serif; }
  .order-page { width: 100%; height: 190mm; display: grid; grid-template-rows: 25mm 132mm 33mm; overflow: hidden; box-sizing: border-box; border: 1.2px solid #111; }
  .order-header { min-height: 0; display: grid; grid-template-columns: 1fr 1.3fr 1fr; border-bottom: 1px solid #111; }
  .order-logo, .order-title, .order-meta { min-width: 0; padding: 2.5mm; }
  .order-logo { display: flex; align-items: center; font: 700 17px Georgia, serif; }
  .order-title { display: grid; place-items: center; border-left: 1px solid #111; border-right: 1px solid #111; text-align: center; }
  .order-title strong { font-size: 16px; }
  .order-title span { font-size: 10px; }
  .order-meta { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); align-content: center; gap: .7mm 2mm; font-size: 7px; line-height: 1.15; }
  .order-meta span, .order-meta strong { min-width: 0; overflow-wrap: anywhere; }
  .order-body { min-height: 0; display: grid; grid-template-columns: 1.5fr .82fr; overflow: hidden; border-bottom: 1px solid #111; }
  .order-drawing { min-width: 0; min-height: 0; display: grid; place-items: center; padding: 4mm; overflow: hidden; border-right: 1px solid #111; }
  .order-drawing svg { width: 100%; height: 100%; max-height: 122mm; }
  .order-data { min-width: 0; min-height: 0; padding: 2mm; overflow: hidden; }
  .order-table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 7px; line-height: 1.18; }
  .order-table th, .order-table td { padding: .85mm 1mm; overflow-wrap: anywhere; border: 1px solid #777; vertical-align: top; }
  .order-table th { width: 36%; background: #eee; text-align: left; }
  .order-footer { min-height: 0; display: grid; grid-template-columns: 1.3fr .7fr; overflow: hidden; }
  .order-notes, .order-sign { min-width: 0; min-height: 0; padding: 2.5mm; overflow: hidden; font-size: 7px; line-height: 1.32; }
  .order-notes { border-right: 1px solid #111; }
  .order-notes strong { display: block; margin-bottom: 1mm; font-size: 7.5px; }
  .order-sign { display: grid; grid-template-rows: 1fr 1fr; }
  .sign-row { min-height: 0; padding-bottom: 1mm; overflow: hidden; border-bottom: 1px solid #bbb; }
  .sign-row:last-child { border-bottom: 0; }
  .order-legend { font-size: 7px; fill: #111; }
}
