:root {
  --ink: #18201d;
  --muted: #66706b;
  --paper: #f4f1ea;
  --surface: #ffffff;
  --surface-soft: #f8f7f3;
  --line: #dedbd2;
  --line-strong: #c9c4b8;
  --forest: #173f35;
  --forest-soft: #e5eee9;
  --gold: #b78a45;
  --warning: #885c17;
  --warning-bg: #fbf1dc;
  --danger: #9b3f32;
  --shadow: 0 16px 42px rgba(34, 42, 38, 0.08);
  --radius: 18px;
  --display-serif: "Songti SC", "STSong", "Iowan Old Style", Baskerville, Georgia, serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--paper);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-header {
  min-height: 88px;
  padding: 18px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: #f7f5ef;
  background: var(--forest);
  border-bottom: 3px solid var(--gold);
}

.brand, .header-meta, .summary-heading, .step-actions, .field-row, .fabric-toolbar, .form-actions {
  display: flex;
  align-items: center;
}

.brand { gap: 14px; }
.brand-logo-shell {
  width: 74px;
  height: 50px;
  padding: 5px 7px;
  display: grid;
  place-items: center;
  background: #f8f5ec;
  border: 1px solid rgba(216,179,111,.7);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
}
.brand-logo-shell img { width: 100%; height: 100%; display: block; object-fit: contain; }
.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  color: var(--forest);
  background: var(--gold);
  border-radius: 50%;
  font-family: Georgia, serif;
  font-weight: 700;
  letter-spacing: -1px;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 0.16em;
  opacity: 0.68;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-family: var(--display-serif); font-size: 24px; font-weight: 600; letter-spacing: .055em; }
h2 { margin-bottom: 0; font-family: var(--display-serif); font-size: 21px; letter-spacing: .035em; }
h3 { margin-bottom: 8px; font-size: 16px; }

.header-meta { gap: 14px; }
.save-status { font-size: 12px; opacity: 0.72; }
.current-user { max-width: 120px; overflow: hidden; color: #f7f5ef; font-size: 12px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.header-meta a { text-decoration: none; }

.app-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 310px;
  min-height: calc(100vh - 91px);
}

.step-sidebar, .summary-panel {
  padding: 28px 22px;
  background: var(--surface);
}
.step-sidebar { border-right: 1px solid var(--line); }
.summary-panel { border-left: 1px solid var(--line); }
.sidebar-label { margin-bottom: 16px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.12em; }
.step-nav { margin: 0; padding: 0; list-style: none; }
.step-nav li { position: relative; padding: 0 0 24px 42px; }
.step-nav li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 28px;
  bottom: 4px;
  left: 14px;
  width: 1px;
  background: var(--line);
}
.step-button {
  width: 100%;
  padding: 0;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: var(--muted);
  text-align: left;
  background: none;
  border: 0;
}
.step-number {
  position: absolute;
  left: 0;
  top: -4px;
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  z-index: 1;
}
.step-button strong { display: block; color: inherit; font-size: 14px; }
.step-button small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.step-nav li.is-active .step-button { color: var(--forest); }
.step-nav li.is-active .step-number, .step-nav li.is-complete .step-number {
  color: white;
  background: var(--forest);
  border-color: var(--forest);
}
.step-nav li.is-complete .step-button strong { color: var(--ink); }

.sidebar-note {
  margin-top: 18px;
  padding: 15px;
  background: var(--forest-soft);
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.65;
}
.sidebar-note p { margin: 5px 0 0; color: var(--muted); }

.workspace { min-width: 0; padding: 28px clamp(24px, 4vw, 64px) 36px; }
.progress-track { height: 3px; margin-bottom: 34px; background: var(--line); overflow: hidden; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--gold); transition: width 180ms ease; }
.step-content { max-width: 900px; min-height: 610px; margin: 0 auto; }
.step-header { margin-bottom: 28px; }
.step-kicker { margin-bottom: 7px; color: var(--gold); font-size: 12px; font-weight: 700; letter-spacing: 0.12em; }
.step-header h2 { margin-bottom: 8px; font-size: clamp(27px, 3vw, 38px); font-weight: 600; letter-spacing: .07em; }
.step-header p { max-width: 700px; margin-bottom: 0; color: var(--muted); line-height: 1.7; }

.section-block { margin-bottom: 32px; }
.section-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 14px; }
.section-heading h3 { margin: 0; }
.section-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.option-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.option-grid.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.option-card { position: relative; min-width: 0; cursor: pointer; }
.option-card input { position: absolute; opacity: 0; pointer-events: none; }
.option-card-body {
  min-height: 76px;
  padding: 16px 42px 14px 16px;
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}
.option-card:hover .option-card-body { border-color: var(--line-strong); transform: translateY(-1px); }
.option-card input:focus-visible + .option-card-body { outline: 3px solid rgba(183, 138, 69, 0.32); outline-offset: 2px; }
.option-card input:checked + .option-card-body { background: var(--forest-soft); border-color: var(--forest); }
.option-card-body strong { display: block; font-size: 14px; }
.option-card-body small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.option-check {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 20px;
  height: 20px;
  display: none;
  place-items: center;
  color: white;
  background: var(--forest);
  border-radius: 50%;
  font-size: 12px;
}
.option-card input:checked ~ .option-check { display: grid; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-field { display: grid; gap: 7px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label, .form-label { font-size: 13px; font-weight: 650; }
.required { color: var(--danger); }

.customer-master-panel { border: 1px solid rgba(153, 112, 52, .28); background: linear-gradient(135deg, rgba(255,255,255,.98), rgba(246,240,229,.72)); }
.customer-empty, .customer-selected { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px; border-radius: 12px; background: rgba(255,255,255,.82); border: 1px solid var(--line); }
.customer-empty { flex-direction: column; align-items: flex-start; border-style: dashed; }
.customer-empty span, .customer-selected span, .customer-selected small { color: var(--muted); }
.customer-selected > div { display: grid; gap: 4px; }
.customer-selected strong { font-family: var(--serif); font-size: 1.35rem; }
.customer-bound-badge { padding: 6px 10px; border-radius: 999px; color: #fff !important; background: #315f4e; font-size: .78rem; letter-spacing: .08em; }
.customer-search-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin-top: 14px; }
.customer-match-list { display: grid; gap: 8px; margin-top: 10px; }
.customer-match { display: grid; grid-template-columns: minmax(120px,.55fr) minmax(180px,1fr) minmax(140px,.7fr); align-items: center; gap: 14px; width: 100%; padding: 13px 15px; text-align: left; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.customer-match:hover, .customer-match:focus-visible { border-color: var(--gold); box-shadow: 0 4px 16px rgba(78,57,27,.08); }
.customer-match span, .customer-match small, .customer-lookup-message { color: var(--muted); }
.customer-lookup-message { margin: 10px 2px 0; }
.inline-customer-create { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.inline-customer-create summary { width: fit-content; color: var(--gold-dark); cursor: pointer; font-weight: 700; }
.inline-customer-create .form-grid { margin: 14px 0 10px; }
.customer-create-actions { display: flex; flex-wrap: wrap; gap: 10px; }

@media (max-width: 720px) {
  .customer-search-row, .customer-match { grid-template-columns: 1fr; }
  .customer-match { gap: 4px; }
}
.input, .select, .textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  outline: none;
}
.textarea { min-height: 96px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--forest); box-shadow: 0 0 0 3px var(--forest-soft); }
.field-help { color: var(--muted); font-size: 11px; line-height: 1.5; }

.body-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.body-field { padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; }
.body-field .field-row { justify-content: space-between; gap: 14px; }
.body-field label { font-size: 13px; font-weight: 650; }
.body-field select { width: min(190px, 55%); }
.body-field p { margin: 8px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }

.measurement-source-card {
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--forest-soft);
  border: 1px solid #bfd0c7;
  border-radius: 14px;
}
.measurement-source-card h3 { margin-bottom: 5px; }
.measurement-source-card p:last-child { margin: 0; color: var(--muted); font-size: 12px; }
.record-picker { width: min(360px, 48%); display: grid; gap: 7px; }
.record-picker label { font-size: 12px; font-weight: 650; }

.measurement-edit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.measurement-input {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(64px, .9fr) minmax(70px, 1fr) 25px;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.measurement-input span { color: var(--muted); font-size: 12px; }
.measurement-input .input { min-height: 36px; padding: 7px 8px; text-align: right; }
.measurement-input small { color: var(--muted); font-size: 10px; }
.measurement-notes { margin-top: 12px; }
.measurement-notes .textarea { min-height: 74px; }

.inference-panel { margin-bottom: 16px; overflow: hidden; background: #f7f4ec; border: 1px solid #ddcba9; border-radius: 13px; }
.inference-panel-head { padding: 13px 15px; display: flex; align-items: center; justify-content: space-between; gap: 18px; color: white; background: var(--forest); }
.inference-panel-head > div { display: grid; gap: 3px; }
.inference-panel-head span { color: #d8b36f; font-size: 8px; letter-spacing: .16em; }
.inference-panel-head strong { font-family: var(--display-serif); font-size: 15px; font-weight: 600; letter-spacing: .05em; }
.inference-panel-head small { color: rgba(255,255,255,.62); font-size: 9px; }
.inference-grid { padding: 13px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.inference-result { padding: 12px 13px; display: grid; gap: 5px; background: rgba(255,255,255,.76); border: 1px solid #e1d8c5; border-radius: 10px; }
.inference-result small { color: var(--muted); font-size: 9px; }
.inference-result b { color: var(--forest); font-size: 14px; }
.inference-result span { color: #6f685b; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }
.inference-attention { margin: 0 13px 13px; padding: 9px 11px; color: #77501a; background: #fff1cf; border-left: 3px solid var(--gold); font-size: 11px; line-height: 1.55; }
.manual-body-heading { margin: 0 2px 10px; display: flex; justify-content: space-between; gap: 16px; align-items: baseline; }
.manual-body-heading strong { font-size: 12px; }
.manual-body-heading span { color: var(--muted); font-size: 10px; }
.body-type-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 10px; }
.supplemental-body-section { margin-top: 20px; padding-top: 17px; border-top: 1px solid var(--line); }
.check-card { position: relative; cursor: pointer; }
.check-card input { position: absolute; opacity: 0; pointer-events: none; }
.check-card strong {
  min-height: 56px;
  padding: 17px 12px 15px 35px;
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
}
.check-card input:checked ~ strong { color: var(--forest); background: var(--forest-soft); border-color: var(--forest); }
.check-card input:focus-visible ~ strong { outline: 3px solid rgba(183, 138, 69, .32); outline-offset: 2px; }
.check-box {
  position: absolute;
  top: 18px;
  left: 12px;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  color: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  font-size: 10px;
  z-index: 1;
}
.check-card input:checked + .check-box { color: white; background: var(--forest); border-color: var(--forest); }

.fit-record-grid { overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.fit-record-row { padding: 10px 12px; display: grid; grid-template-columns: 180px 1fr; align-items: center; gap: 18px; border-bottom: 1px solid var(--line); }
.fit-record-row:last-child { border-bottom: 0; }
.fit-record-row label { font-size: 13px; font-weight: 650; }

.measurement-sheet { position: relative; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 12px; }
.measurement-watermark { position: absolute; top: 52%; left: 50%; z-index: 0; width: 44%; height: auto; opacity: .026; transform: translate(-50%, -50%) rotate(-8deg); pointer-events: none; }
.measurement-sheet > :not(.measurement-watermark) { position: relative; z-index: 1; }
.measurement-sheet-head {
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  background: #e4ece8;
  border-bottom: 2px solid var(--forest);
}
.measurement-sheet-head .eyebrow { color: var(--forest); }
.measurement-sheet-head h4 { margin: 0; font-family: var(--display-serif); font-size: 18px; font-weight: 500; letter-spacing: .055em; }
.measurement-sheet-head > span { color: var(--muted); font-family: ui-monospace, monospace; font-size: 11px; }
.measurement-identity { display: grid; grid-template-columns: 1.4fr .7fr .7fr 1.2fr; border-bottom: 1px solid var(--line); }
.measurement-identity > div { padding: 10px 12px; display: grid; gap: 3px; border-right: 1px solid var(--line); }
.measurement-identity > div:nth-child(4) { border-right: 0; }
.measurement-identity .wide { grid-column: 1 / -1; border-top: 1px solid var(--line); border-right: 0; }
.measurement-identity small { color: var(--muted); font-size: 9px; }
.measurement-identity strong { font-size: 12px; font-weight: 600; }
.measurement-review-table, .fit-summary-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.measurement-review-table th, .measurement-review-table td { padding: 7px 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.measurement-review-table th { width: 12%; color: var(--muted); background: #faf9f6; text-align: left; font-weight: 500; }
.measurement-review-table td { width: 21%; font-variant-numeric: tabular-nums; }
.measurement-review-table td small { color: var(--muted); font-size: 8px; }
.measurement-review-table tr > *:last-child { border-right: 0; }
.measurement-type-summary { padding: 11px 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; border-bottom: 1px solid var(--line); }
.measurement-type-summary strong { margin-right: 4px; color: var(--forest); font-size: 11px; }
.measurement-type-summary span { padding: 4px 7px; color: var(--muted); background: var(--surface-soft); border-radius: 99px; font-size: 9px; }
.measurement-type-summary span.is-active { color: var(--forest); background: var(--forest-soft); font-weight: 700; }
.fit-summary-table th, .fit-summary-table td { padding: 7px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.fit-summary-table th { width: 34%; color: var(--muted); font-weight: 500; }
.fit-summary-table tr:last-child > * { border-bottom: 0; }
.measurement-signoff { padding: 12px; display: flex; justify-content: space-between; gap: 20px; color: var(--muted); background: #faf9f6; border-top: 1px solid var(--line); font-size: 10px; }

.system-boundary-card {
  padding: 18px;
  display: grid;
  grid-template-columns: 1fr minmax(210px, .48fr);
  gap: 22px;
  align-items: center;
  background: linear-gradient(135deg, #eef3f0, #f8f7f3);
  border: 1px solid #cbd8d2;
  border-radius: 14px;
}
.system-boundary-card strong { display: block; margin-top: 9px; font-size: 15px; }
.system-boundary-card p, .system-boundary-card small { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.system-boundary-card small { padding-left: 18px; border-left: 1px solid var(--line-strong); }
.catalog-badge { padding: 4px 8px; color: var(--forest); background: white; border: 1px solid #cbd8d2; border-radius: 99px; font-size: 10px; font-weight: 700; }

.pending-panel {
  padding: 24px;
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 18px;
  background: var(--warning-bg);
  border: 1px solid #e5c98e;
  border-radius: 14px;
}
.pending-panel h3 { margin-bottom: 7px; }
.pending-panel p { color: var(--muted); line-height: 1.65; }
.pending-panel .form-field { max-width: 620px; margin-top: 18px; }
.pending-icon { width: 46px; height: 46px; display: grid; place-items: center; color: white; background: var(--gold); border-radius: 50%; font-weight: 800; }

.catalog-strip { margin-bottom: 28px; padding: 14px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; background: var(--forest-soft); border-left: 3px solid var(--forest); }
.catalog-strip span, .catalog-strip small { color: var(--muted); font-size: 11px; }
.catalog-strip small { flex: 1 1 240px; text-align: right; }
.code-input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .03em; text-transform: uppercase; }
.button-family-row { margin-top: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: 10px; }
.button-family-row b { padding: 5px 8px; color: var(--forest); background: var(--forest-soft); border-radius: 99px; font-weight: 700; }
.embroidery-grid { margin-top: 16px; }

.fabric-toolbar { flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.fabric-toolbar .input { flex: 1 1 260px; }
.fabric-toolbar .select { flex: 0 1 220px; }
.seasonal-brand-note { margin-bottom: 14px; padding: 13px 14px; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 9px 18px; background: #f7f4ec; border: 1px solid #ded2b9; border-radius: 11px; }
.seasonal-brand-note > div:first-child { display: grid; gap: 3px; }
.seasonal-brand-note small { color: var(--gold); font-size: 8px; letter-spacing: .14em; }
.seasonal-brand-note strong { color: var(--forest); font-size: 12px; }
.seasonal-brand-list { display: flex; flex-wrap: wrap; gap: 6px; }
.seasonal-brand-list span { padding: 4px 8px; color: var(--forest); background: white; border: 1px solid #d9cfbb; border-radius: 99px; font-size: 10px; font-weight: 650; }
.seasonal-brand-list span.is-unmapped { color: #8a6a35; background: #fff8e8; border-style: dashed; }
.seasonal-brand-note p { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.fabric-results { border-top: 1px solid var(--line); }
.fabric-result {
  width: 100%;
  min-height: 92px;
  padding: 10px 4px;
  display: grid;
  grid-template-columns: 76px minmax(110px, 0.8fr) minmax(140px, 1.5fr) minmax(80px, 0.7fr) minmax(70px, 0.6fr);
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
}
.fabric-result:hover { background: var(--surface-soft); }
.fabric-result.is-selected { background: var(--forest-soft); }
.swatch { width: 25px; height: 25px; border: 1px solid rgba(0,0,0,.14); border-radius: 50%; }
.fabric-thumb {
  position: relative;
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(145deg, #e7e1d4, #f7f4ed);
  border: 1px solid #d8cfbd;
  border-radius: 10px;
}
.fabric-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.fabric-thumb-fallback { padding: 6px; display: grid; gap: 2px; color: #806a43; text-align: center; line-height: 1.15; }
.fabric-thumb-fallback small { font-size: 8px; letter-spacing: .16em; }
.fabric-thumb-fallback strong { font-family: "Songti SC", STSong, serif; font-size: 11px; font-weight: 650; }
.fabric-thumb.is-reference { border-style: dashed; }
.fabric-thumb.is-selected-thumb { width: 72px; height: 72px; }
.fabric-result strong { font-size: 13px; }
.fabric-result span { min-width: 0; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fabric-result .fabric-code { color: var(--ink); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.selected-fabric {
  margin-bottom: 18px;
  padding: 16px;
  display: grid;
  grid-template-columns: 78px 1fr auto;
  gap: 12px;
  align-items: center;
  background: var(--forest-soft);
  border: 1px solid #bfd0c7;
  border-radius: 13px;
}
.selected-fabric .swatch { width: 38px; height: 38px; }
.selected-fabric p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.empty-state { padding: 28px 8px; color: var(--muted); text-align: center; }
.results-note { margin: 10px 0 0; color: var(--muted); font-size: 11px; }

.rule-note { margin-top: 12px; padding: 11px 13px; color: var(--warning); background: var(--warning-bg); border-left: 3px solid var(--gold); font-size: 12px; line-height: 1.55; }
.hidden-by-rule { display: none !important; }

.step-actions { max-width: 900px; margin: 26px auto 0; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); padding-top: 20px; }
.validation-message { flex: 1; margin: 0; color: var(--danger); text-align: center; font-size: 12px; }
.button {
  min-height: 42px;
  padding: 10px 17px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-weight: 650;
}
.button-primary { color: white; background: var(--forest); }
.button-primary:hover { background: #0f3028; }
.button-secondary { color: var(--forest); background: var(--surface); border-color: var(--line-strong); }
.button-quiet { min-height: 36px; color: #f7f5ef; background: transparent; border-color: rgba(255,255,255,.25); }
.button-text { padding: 5px 8px; color: var(--forest); background: transparent; border: 0; }
.button:disabled { opacity: 0.45; cursor: not-allowed; }

.summary-heading { justify-content: space-between; margin-bottom: 18px; }
.summary-heading h2 { font-size: 20px; }
.summary-heading .eyebrow { color: var(--muted); }
.count-badge { padding: 5px 9px; color: var(--forest); background: var(--forest-soft); border-radius: 99px; font-size: 11px; font-weight: 700; }
.summary-group { padding: 15px 0; border-bottom: 1px solid var(--line); }
.summary-group:first-child { padding-top: 0; }
.summary-group h3 { margin-bottom: 9px; color: var(--muted); font-size: 11px; letter-spacing: .08em; }
.summary-item { display: grid; grid-template-columns: 88px 1fr; gap: 8px; margin: 7px 0; font-size: 12px; line-height: 1.45; }
.summary-item dt { color: var(--muted); }
.summary-item dd { margin: 0; text-align: right; word-break: break-word; }
.summary-empty { padding: 40px 0; color: var(--muted); text-align: center; font-size: 12px; line-height: 1.7; }
.warning-box { margin-bottom: 18px; padding: 12px; color: var(--warning); background: var(--warning-bg); border-radius: 10px; font-size: 11px; line-height: 1.55; }
.warning-box strong { display: block; margin-bottom: 5px; }
.warning-box ul { margin: 0; padding-left: 18px; }

.print-only { display: none; }
.review-card { position: relative; padding: 22px; overflow: hidden; background: #fbfaf7; border: 1px solid #d7d7cf; border-radius: var(--radius); box-shadow: 0 20px 56px rgba(34, 42, 38, .1); }
.review-card > :not(.review-watermark) { position: relative; z-index: 1; }
.review-watermark { position: absolute; top: 24%; left: 50%; z-index: 2; width: min(390px, 48%); height: auto; opacity: .016; transform: translate(-50%, -50%) rotate(-7deg); pointer-events: none; user-select: none; }
.review-top {
  position: relative;
  margin: -22px -22px 20px;
  padding: 29px 30px 27px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  color: white;
  background: linear-gradient(135deg, #113a30 0%, #18483c 68%, #173f35 100%);
  border-top: 5px solid var(--gold);
}
.review-top::after { content: ""; position: absolute; right: 30px; bottom: 19px; width: 72px; height: 1px; background: rgba(216, 179, 111, .65); }
.review-brand-line { margin-bottom: 9px; display: flex; align-items: center; gap: 11px; color: #d8b36f; font-family: "Avenir Next", Optima, sans-serif; font-size: 8px; letter-spacing: .2em; }
.review-brand-line img { width: 64px; height: 38px; object-fit: contain; filter: invert(1); opacity: .92; }
.review-brand-line span { padding-left: 11px; border-left: 1px solid rgba(216,179,111,.45); }
.review-top h2 { margin: 0; color: #fffdf8; font-family: var(--display-serif); font-size: clamp(30px, 4vw, 42px); font-weight: 500; letter-spacing: .13em; line-height: 1.24; text-shadow: 0 1px 0 rgba(0,0,0,.12); }
.review-subtitle { margin: 10px 0 0; color: rgba(255,255,255,.58); font-family: "Avenir Next", Optima, sans-serif; font-size: 8px; letter-spacing: .19em; }
.order-identity { display: grid; gap: 6px; justify-items: end; padding-top: 5px; }
.order-identity small { color: rgba(255,255,255,.48); font-family: "Avenir Next", sans-serif; font-size: 8px; letter-spacing: .16em; }
.order-code { color: #f8f4ea; font-family: ui-monospace, monospace; font-size: 12px; letter-spacing: .04em; }
.pdf-document-meta { margin-bottom: 16px; display: grid; grid-template-columns: .8fr 1fr .9fr 1.8fr; background: #eef3f0; border: 1px solid #d3ded8; border-radius: 12px; overflow: hidden; }
.pdf-document-meta > div { min-width: 0; padding: 13px 14px; display: grid; gap: 5px; border-right: 1px solid #d3ded8; }
.pdf-document-meta > div:last-child { border-right: 0; }
.pdf-document-meta small { color: #77837d; font-family: "Avenir Next", Optima, sans-serif; font-size: 8px; letter-spacing: .16em; }
.pdf-document-meta strong { font-size: 12px; line-height: 1.4; }
.review-section { margin-bottom: 14px; padding: 17px; background: white; border: 1px solid #e0e1dc; border-radius: 13px; }
.review-section:last-of-type { margin-bottom: 0; }
.review-section h3 { margin-bottom: 12px; color: var(--forest); font-family: var(--display-serif); font-size: 17px; font-weight: 600; letter-spacing: .055em; }
.review-section h3 > span { width: 25px; height: 25px; margin-right: 8px; display: inline-grid; place-items: center; color: white; background: var(--forest); border-radius: 50%; font-size: 9px; letter-spacing: .04em; vertical-align: middle; }
.section-logo { width: 46px; height: 27px; float: right; object-fit: contain; opacity: .42; }
.spec-grid { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.spec-item { min-width: 0; padding: 11px 13px; display: grid; gap: 5px; background: #f7f8f6; border: 1px solid #e0e5e2; border-radius: 10px; }
.spec-item.is-wide { grid-column: 1 / -1; }
.spec-item dt { color: var(--muted); font-size: 10px; letter-spacing: .035em; }
.spec-item dd { margin: 0; color: var(--ink); font-size: 13px; font-weight: 600; line-height: 1.4; word-break: break-word; }
.spec-item dd.is-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; letter-spacing: .015em; }
.compact-spec-wrap { overflow: hidden; border: 1px solid #d9e0dc; border-radius: 10px; }
.compact-spec-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 11px; }
.compact-spec-table th, .compact-spec-table td { padding: 9px 10px; border-right: 1px solid #e0e5e2; border-bottom: 1px solid #e0e5e2; text-align: left; vertical-align: middle; }
.compact-spec-table th { width: 11%; color: var(--muted); background: #f1f4f2; font-weight: 500; }
.compact-spec-table td { width: 22.33%; background: white; font-weight: 650; line-height: 1.4; word-break: break-word; }
.compact-spec-table tr:nth-child(even) td { background: #fbfcfb; }
.compact-spec-table tr:last-child > * { border-bottom: 0; }
.compact-spec-table tr > *:last-child { border-right: 0; }
.compact-spec-table .is-empty { background: #fafbf9; }
.compact-spec-table .table-spacer { background: #fafbf9; }
.review-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.review-table th, .review-table td { padding: 9px 8px; vertical-align: top; border-bottom: 1px solid var(--line); text-align: left; }
.review-table th { width: 18%; color: var(--muted); font-weight: 500; }
.review-table td { width: 32%; }
.signature-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; padding-top: 36px; }
.signature-line { padding-top: 8px; border-top: 1px solid var(--ink); color: var(--muted); font-size: 11px; text-align: center; }
.form-actions { flex-wrap: wrap; gap: 10px; margin-top: 18px; }

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 190px minmax(0, 1fr); }
  .summary-panel { display: none; }
  .body-type-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .app-header { padding: 14px 16px; align-items: flex-start; flex-wrap: wrap; gap: 12px 16px; }
  .header-meta { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: end; gap: 8px; }
  .header-meta .recent-draft-picker { grid-column: 1; grid-row: 1; min-width: 0; }
  .header-meta #logoutButton { grid-column: 2; grid-row: 1; }
  .header-meta #resetButton { grid-column: 3; grid-row: 1; }
  .header-meta .save-status {
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
    padding: 6px 8px;
    display: block;
    color: #f7f5ef;
    background: rgba(255,255,255,.08);
    border-radius: 7px;
    font-weight: 600;
    line-height: 1.4;
    opacity: .92;
    overflow-wrap: anywhere;
  }
  .current-user, #adminLink, #customerLink { display: none; }
  .brand .eyebrow { display: none; }
  .brand-mark { width: 40px; height: 40px; }
  .brand-logo-shell { width: 62px; height: 43px; }
  .app-shell { display: block; }
  .step-sidebar { padding: 14px 16px 0; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .sidebar-label, .sidebar-note, .step-button small { display: none; }
  .step-nav { display: flex; min-width: 620px; }
  .step-nav li { flex: 1; padding: 0 8px 12px 34px; }
  .step-nav li:not(:last-child)::after { top: 14px; right: 0; bottom: auto; left: 27px; width: calc(100% - 20px); height: 1px; }
  .step-number { left: 0; }
  .workspace { padding: 22px 16px 30px; }
  .progress-track { margin-bottom: 24px; }
  .step-content { min-height: 0; }
  .option-grid, .option-grid.two-columns, .form-grid, .body-grid, .measurement-edit-grid { grid-template-columns: 1fr; }
  .system-boundary-card { grid-template-columns: 1fr; }
  .system-boundary-card small { padding: 12px 0 0; border-top: 1px solid var(--line-strong); border-left: 0; }
  .pending-panel { grid-template-columns: 1fr; }
  .catalog-strip small { text-align: left; }
  .measurement-source-card { display: block; }
  .record-picker { width: 100%; margin-top: 16px; }
  .inference-panel-head { align-items: flex-start; flex-direction: column; gap: 6px; }
  .inference-grid { grid-template-columns: 1fr; }
  .manual-body-heading { align-items: flex-start; flex-direction: column; gap: 4px; }
  .seasonal-brand-note { grid-template-columns: 1fr; }
  .seasonal-brand-note p { grid-column: auto; }
  .body-type-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fit-record-row { grid-template-columns: 1fr; gap: 7px; }
  .form-field.full { grid-column: auto; }
  .fabric-result { grid-template-columns: 66px 1fr 1fr; }
  .fabric-result .fabric-thumb { width: 58px; height: 58px; }
  .fabric-result span:nth-child(n+4) { display: none; }
  .selected-fabric { grid-template-columns: 68px 1fr; }
  .selected-fabric .fabric-thumb { width: 62px; height: 62px; }
  .selected-fabric .button-text { grid-column: 2; justify-self: start; }
  .step-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    margin: 20px -16px -30px;
    padding: 13px 16px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 12px;
    background: rgba(244,241,234,.96);
  }
  .step-actions #previousButton { grid-column: 1; grid-row: 2; justify-self: start; }
  .step-actions #nextButton { grid-column: 2; grid-row: 2; justify-self: end; }
  .validation-message {
    grid-column: 1 / -1;
    grid-row: 1;
    min-width: 0;
    min-height: 1.4em;
    display: block;
    text-align: left;
    font-weight: 600;
    line-height: 1.4;
    overflow-wrap: anywhere;
  }
  .review-card { padding: 16px; border-radius: 12px; }
  .review-top { margin: -16px -16px 16px; padding: 23px 20px 21px; display: block; }
  .review-top h2 { font-size: 29px; }
  .review-top::after { display: none; }
  .order-identity { margin-top: 18px; justify-items: start; }
  .order-code { display: block; margin-top: 0; }
  .pdf-document-meta { grid-template-columns: 1fr 1fr; }
  .pdf-document-meta > div:nth-child(2) { border-right: 0; }
  .pdf-document-meta > div:nth-child(-n+2) { border-bottom: 1px solid #d3ded8; }
  .review-table th, .review-table td { display: block; width: 100%; }
  .review-table th { padding-bottom: 3px; border-bottom: 0; }
  .review-table td { padding-top: 0; }
  .spec-grid { grid-template-columns: 1fr; }
  .spec-item.is-wide { grid-column: auto; }
  .compact-spec-wrap { overflow-x: auto; }
  .compact-spec-table { min-width: 700px; }
  .measurement-review-section { margin-left: -8px; margin-right: -8px; }
  .measurement-identity { grid-template-columns: 1fr 1fr; }
  .measurement-identity > div { border-bottom: 1px solid var(--line); }
  .measurement-identity .wide { grid-column: 1 / -1; }
  .measurement-review-table { min-width: 640px; }
  .measurement-sheet { overflow-x: auto; }
  .signature-row { grid-template-columns: 1fr; gap: 30px; }
}

@media print {
  @page { size: A4 portrait; margin: 12mm 12mm 15mm; }
  *, *::before, *::after { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  html, body { width: auto; background: white; }
  body { color: #18201d; font-family: "PingFang SC", "Microsoft YaHei", sans-serif; }
  .app-header, .step-sidebar, .summary-panel, .progress-track, .step-actions, .form-actions, .step-header { display: none !important; }
  .app-shell, .workspace, .step-content { display: block; min-height: 0; padding: 0; margin: 0; max-width: none; }
  .print-only { display: flex !important; }
  .review-card { padding: 0 0 7mm; overflow: visible; display: flex; flex-direction: column; background: white; border: 0; border-radius: 0; box-shadow: none; }
  .review-top { display: flex !important; }
  .review-top {
    order: 0;
    margin: 0 0 4mm;
    padding: 6mm 8mm 5.5mm;
    color: white;
    background: #173f35;
    border: 0;
    border-top: 2.2mm solid #b78a45;
    border-radius: 0 0 3.5mm 3.5mm;
  }
  .review-brand-line { margin-bottom: 1.2mm; gap: 2.2mm; color: #e7c98f; font-size: 5.5pt; letter-spacing: .18em; }
  .review-brand-line img { width: 13mm; height: 7.5mm; filter: invert(1); opacity: .92; }
  .review-brand-line span { padding-left: 2.2mm; }
  .review-top h2 { margin: 0; color: white; font-family: var(--display-serif); font-size: 20pt; font-weight: 500; letter-spacing: .12em; }
  .review-subtitle { margin-top: 2.2mm; font-size: 5.7pt; letter-spacing: .18em; }
  .order-identity { padding-top: 1mm; }
  .order-code { max-width: 62mm; color: #f7f5ef; font-size: 9pt; text-align: right; word-break: break-all; }
  .pdf-document-meta {
    order: 1;
    margin-bottom: 4mm;
    display: grid !important;
    grid-template-columns: .8fr 1fr .9fr 1.8fr;
    background: #f4f7f5;
    border: .3mm solid #d3ded8;
    border-radius: 2.5mm;
    overflow: hidden;
  }
  .pdf-document-meta > div { min-width: 0; padding: 2.5mm 3.2mm; display: grid; gap: .8mm; border-right: .25mm solid #d3ded8; }
  .pdf-document-meta > div:last-child { border-right: 0; }
  .pdf-document-meta small { color: #78837d; font-size: 6.3pt; letter-spacing: .14em; }
  .pdf-document-meta strong { font-size: 8.3pt; line-height: 1.35; }
  .order-review-section { order: 2; }
  .fit-review-section { order: 3; }
  .design-review-section { order: 4; }
  .accessories-review-section { order: 5; }
  .warning-review-section { order: 6; }
  .measurement-review-section { order: 7; break-before: page; page-break-before: always; }
  .signature-row { order: 8; }
  .review-section {
    margin: 0 0 2.8mm;
    padding: 3.4mm 4mm 3mm;
    background: white;
    border: .28mm solid #d9dfdc;
    border-radius: 2.8mm;
    break-inside: avoid-page;
    page-break-inside: avoid;
  }
  .review-section h3 { margin: 0 0 2.3mm; color: #173f35; font-size: 10pt; letter-spacing: .025em; }
  .review-section h3 > span { width: 6mm; height: 6mm; margin-right: 2.2mm; background: #173f35; font-size: 6.5pt; }
  .spec-grid { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 2.1mm; }
  .order-review-section .spec-grid, .fit-review-section .spec-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 1.8mm; }
  .spec-item { min-height: 11mm; padding: 1.7mm 2.3mm; gap: .7mm; background: #f6f8f6; border: .24mm solid #e0e5e2; border-radius: 1.8mm; break-inside: avoid; }
  .spec-item.is-wide { grid-column: 1 / -1 !important; }
  .spec-item dt { color: #6d7772; font-size: 6.7pt; letter-spacing: .04em; }
  .spec-item dd { font-size: 8.5pt; line-height: 1.32; }
  .spec-item dd.is-code { font-size: 7.9pt; }
  .compact-spec-wrap { overflow: hidden !important; border: .25mm solid #d3dcd7; border-radius: 2mm; }
  .compact-spec-table { min-width: 0 !important; width: 100%; table-layout: fixed; font-size: 7.2pt; }
  .compact-spec-table th, .compact-spec-table td { display: table-cell !important; padding: 1.65mm 1.8mm; border-right: .2mm solid #dce3df; border-bottom: .2mm solid #dce3df; }
  .compact-spec-table th { width: 11%; color: #65716b; background: #edf2ef; font-size: 6.6pt; font-weight: 500; }
  .compact-spec-table td { width: 22.33%; background: white; font-size: 7.5pt; font-weight: 650; line-height: 1.3; }
  .compact-spec-table tr:nth-child(even) td { background: #fafbf9; }
  .compact-spec-table .is-empty { background: #f7f9f7; }
  .compact-spec-table .table-spacer { background: #f7f9f7; }
  .review-table { font-size: 8.1pt; line-height: 1.42; }
  .review-table th, .review-table td { display: table-cell !important; padding: 1.65mm 2.2mm; border-bottom: .2mm solid #e3e7e4; }
  .review-table th { width: 18% !important; }
  .review-table td { width: 32% !important; }
  .review-table th { color: #69736e; background: #f7f8f6; font-size: 7.5pt; }
  .review-table tr:last-child > * { border-bottom: 0; }
  .warning-review-section { color: #744f17; background: #fff8e9; border-color: #e8cf9c; }
  .warning-review-section ul { margin: 0; padding-left: 5mm; font-size: 8pt; line-height: 1.55; }
  .measurement-review-section { padding: 0; overflow: hidden; border-color: #cbd7d1; }
  .measurement-review-section > h3 { margin: 0; padding: 4mm 4.5mm; color: white; background: #173f35; }
  .measurement-review-section > h3 > span { color: #173f35; background: #d8b36f; }
  .measurement-review-section .section-logo { width: 12mm; height: 7mm; filter: invert(1); opacity: .72; }
  .review-watermark { width: 43%; opacity: .013; }
  .measurement-watermark { width: 42%; opacity: .024; }
  .measurement-sheet { margin: 4mm; break-inside: avoid-page; page-break-inside: avoid; border-color: #cbd7d1; }
  .measurement-sheet-head { padding: 3.5mm 4mm; background: #e7efeb; border-bottom: .55mm solid #173f35; }
  .measurement-sheet-head h4 { font-size: 12.5pt; }
  .measurement-identity { grid-template-columns: 1.4fr .7fr .7fr 1.2fr !important; }
  .measurement-identity > div { padding: 2.4mm 2.8mm; }
  .measurement-identity .wide { grid-column: 1 / -1 !important; }
  .measurement-review-table { min-width: 0 !important; }
  .measurement-review-table, .fit-summary-table { font-size: 7.3pt; }
  .measurement-review-table th, .measurement-review-table td { padding: 1.8mm 2mm; }
  .measurement-type-summary { padding: 2.6mm 2.8mm; gap: 1.5mm; }
  .measurement-type-summary span { padding: 1mm 1.7mm; font-size: 6.6pt; }
  .fit-summary-table th, .fit-summary-table td { padding: 1.8mm 2.8mm; }
  .measurement-signoff { padding: 3mm; font-size: 7pt; }
  .signature-row { margin-top: 7mm; padding: 0 3mm; display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 12mm; break-inside: avoid; }
  .signature-line { padding-top: 2.5mm; color: #66706b; font-size: 7.5pt; }
  .pdf-footer {
    position: static;
    order: 9;
    margin-top: 6mm;
    align-items: center;
    justify-content: space-between;
    padding-top: 2.2mm;
    color: #7d8782;
    border-top: .25mm solid #cfd6d2;
    font-size: 6.5pt;
    letter-spacing: .06em;
  }
  .pdf-footer-brand img { width: 14mm; height: 8mm; display: block; object-fit: contain; opacity: .58; }
}
.recent-draft-picker {
  display: grid;
  gap: 4px;
  min-width: 230px;
}

.recent-draft-picker span {
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.recent-draft-picker .select {
  min-height: 36px;
  padding: 6px 34px 6px 10px;
  font-size: 0.78rem;
}

.save-status.is-error {
  color: #9f312f;
  background: #fff0ef;
}

.startup-error {
  width: min(620px, calc(100% - 40px));
  margin: 12vh auto;
  padding: 52px;
  text-align: center;
  border: 1px solid #d9d5ca;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 24px 70px rgb(19 49 42 / 12%);
}

.startup-error img { width: 88px; }
.startup-error p { margin: 24px 0 8px; color: #9a793f; letter-spacing: .18em; font-size: .72rem; }
.startup-error h1 { margin: 0 0 12px; color: #173f35; }
.startup-error span { display: block; margin-bottom: 28px; color: #6c726e; }

.save-recovery { margin: 14px 24px 0; padding: 16px 20px; background: #fff8ed; border: 1px solid #d9ba84; border-radius: 12px; color: #624619; }
.save-recovery[hidden] { display: none; }
.save-recovery p { margin: 0 0 12px; }
.recovery-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.delivery-panel { padding: 24px; margin-top: 24px; background: #f0f5f2; border: 1px solid #ccd9d1; border-radius: 16px; }
.delivery-panel h3, .delivery-panel h4 { margin: 0 0 12px; }
.delivery-panel h4 { margin-top: 24px; }
.delivery-note { color: #6c726e; font-size: .8rem; line-height: 1.6; }
.archived-file { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid #d5dfd9; }
.archived-file strong, .archived-file small { display: block; }
.archived-file small { color: #6c726e; margin-top: 5px; font-size: .75rem; }
@media (max-width: 760px) {
  .save-recovery { margin: 10px; padding: 14px; }
  .delivery-panel { padding: 16px; }
  .delivery-panel .form-actions { display: grid; }
  .archived-file { align-items: flex-start; flex-wrap: wrap; }
}
@media print { .save-recovery, .delivery-panel { display: none !important; } }
