:root {
  color-scheme: light;
  --ink: #252720;
  --muted: #626355;
  --green: #30362b;
  --green-dark: #252720;
  --line: #dedbcf;
  --paper: #fdfcf8;
  --white: #fff;
  --soft-green: #edf0e7;
  --serif: "Noto Serif SC", "Songti SC", "STSong", SimSun, Georgia, serif;
  font: 16px/1.55 "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
button, select, input { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid #88642c; outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }

.masthead { background: var(--paper); border-bottom: 1px solid var(--line); }
.masthead-inner { max-width: 1340px; min-height: 79px; margin: auto; padding: 0 60px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: .8rem; }
.brand b { font: 500 1.85rem/1 Georgia, serif; letter-spacing: .105em; }
.brand span { color: var(--muted); font-size: .875rem; border-left: 1px solid #c6c0ad; padding-left: .8rem; }
.brand:hover span { text-decoration: underline; text-underline-offset: .25em; }
.header-actions { display: flex; align-items: center; gap: 16px; }
.language-control { position: relative; }
.language-control::after { content: ""; position: absolute; right: 11px; top: calc(50% - 4px); width: 6px; height: 6px; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: rotate(45deg); pointer-events: none; }
.language-control select { appearance: none; min-height: 42px; padding: .35rem 1.65rem .35rem .8rem; border: 1px solid var(--line); color: var(--ink); background: transparent; font-size: .875rem; cursor: pointer; }
.quote-toggle { display: inline-flex; align-items: center; gap: 9px; border: 1px solid #a6a28e; background: transparent; min-height: 42px; padding: 8px 13px; font-weight: 700; white-space: nowrap; }
.quote-toggle:hover { border-color: #92ad9b; background: #f2f7f0; }
.quote-badge { display: grid; place-items: center; min-width: 23px; height: 23px; padding: 0 4px; color: var(--white); background: var(--green); border-radius: 20px; font-size: .75rem; font-variant-numeric: tabular-nums; }
.bag-icon { width: 14px; height: 13px; border: 1.5px solid currentColor; border-radius: 2px 2px 3px 3px; position: relative; margin-top: 3px; }
.bag-icon::before { content: ""; width: 7px; height: 5px; border: 1.5px solid currentColor; border-bottom: 0; border-radius: 6px 6px 0 0; position: absolute; transform: translateX(-50%); left: 50%; top: -5px; }

.workspace { max-width: 1340px; margin: auto; padding: 32px 60px 40px; }
.page-title { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 24px; }
.page-title > div { min-width: 0; }
.page-title h1 { color: var(--green-dark); font-family: var(--serif); font-size: clamp(2.05rem, 4vw, 3.35rem); font-weight: 600; line-height: 1.15; letter-spacing: -.045em; }
.page-title p { margin-top: 8px; color: var(--muted); }
.page-title .demo-label { margin: 0 0 .45rem; color: #776239; font-size: .875rem; font-weight: 700; letter-spacing: .08em; }
.page-title .demo-notice { font-size: .875rem; max-width: 46rem; }
.page-title .moq-note { max-width: 100%; margin: 0 0 2px; padding: 8px 13px; background: var(--soft-green); color: var(--green-dark); border: 1px solid var(--line); font-size: .875rem; font-weight: 700; }

.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.17fr) minmax(0, 1fr); align-items: start; gap: 22px; }
.preview-panel, .catalog-panel { background: var(--white); border: 1px solid var(--line); border-radius: 19px; box-shadow: 0 5px 19px #263a2d08; min-width: 0; padding: 20px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; }
.panel-heading h2 { font-weight: 800; font-size: 1.225rem; letter-spacing: -.025em; }
.preview-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.text-button { background: none; border: 0; border-radius: 7px; padding: 3px 7px; color: var(--muted); font-size: .875rem; }
.text-button:hover { color: var(--green-dark); background: var(--soft-green); }
.reset-icon { display: inline-block; vertical-align: -1px; font-size: 1.1em; }
.preview-surface {
  position: relative;
  isolation: isolate;
  display: grid;
  overflow: hidden;
  place-items: center;
  aspect-ratio: 1.43;
  min-height: 220px;
  border: 1px solid #e2e5db;
  border-radius: 13px;
  background: radial-gradient(ellipse at 46% 33%, #f8f9f0 0%, #eaeee3 48%, #dce5d8 100%);
}
.preview-surface::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(125deg, transparent 12%, #fff9 36%, transparent 44%, #fff2 51%, transparent 66%);
  opacity: .75;
}
.preview-surface canvas { display: block; width: 100%; height: 100%; object-fit: contain; }
.preview-stamp { position: absolute; left: 14px; bottom: 13px; padding: 2px 7px; border-radius: 4px; color: #58675a; background: #f6f8efcf; font-size: .75rem; pointer-events: none; }
.preview-meta { display: grid; grid-template-columns: minmax(0, 1fr) minmax(118px, .47fr); gap: 16px; align-items: end; margin-top: 18px; }
.field-title { display: block; margin-bottom: 6px; color: #344a3e; font-size: .875rem; font-weight: 700; }
.finish-options { display: flex; flex-wrap: wrap; gap: 8px; }
.finish-options button, .select-shell { display: flex; justify-content: center; align-items: center; gap: 7px; border: 1px solid var(--line); background: #fbfcf9; border-radius: 8px; min-height: 42px; padding: 0 11px; font-size: .875rem; white-space: nowrap; }
.finish-options button:hover { border-color: #90ab96; }
.finish-options [aria-pressed="true"] { background: #eef5ec; border-color: #68917a; color: var(--green-dark); font-weight: 700; }
.swatch { display: inline-block; width: 14px; height: 14px; flex: none; border-radius: 50%; }
.swatch-gold { background: linear-gradient(145deg, #fdf0bb 9%, #c19143 83%); border: 1px solid #b98d48; }
.swatch-silver { background: linear-gradient(145deg, #f8fafb 10%, #9ba8aa 87%); border: 1px solid #96a3a4; }
.select-shell { display: grid; position: relative; justify-content: stretch; grid-template-columns: 1fr 1fr; gap: 4px; padding: 0; }
.select-shell select { appearance: none; grid-column: 1 / -1; grid-row: 1; min-height: 40px; padding: 0 32px 0 10px; border: 0; border-radius: 7px; background: transparent; cursor: pointer; color: var(--ink); font-variant-numeric: tabular-nums; }
.select-shell span { grid-row: 1; grid-column: 2; color: var(--muted); font-size: .85rem; justify-self: center; pointer-events: none; }
.select-shell::after { content: ""; position: absolute; top: calc(50% - 5px); right: 11px; width: 7px; height: 7px; border-right: 1.5px solid var(--green); border-bottom: 1.5px solid var(--green); transform: rotate(45deg); pointer-events: none; }
.preview-state { min-height: 20px; color: var(--muted); font-size: .875rem; margin-top: 13px; }

.catalog-count, .selected-heading span { color: var(--muted); font-size: .875rem; }
.catalog-tabs { display: grid; grid-template-columns: repeat(2, 1fr); padding: 3px; margin-bottom: 14px; border-radius: 9px; background: #eff2eb; }
.catalog-tabs button { border: 1px solid transparent; border-radius: 7px; background: transparent; min-height: 39px; font-weight: 700; }
.catalog-tabs button:hover { color: #356b50; }
.catalog-tabs [aria-pressed="true"] { border-color: #dbe4d9; background: var(--white); color: var(--green-dark); box-shadow: 0 1px 2px #2a3a2b12; }
.catalog-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.product-card { position: relative; padding: 0; min-width: 0; text-align: left; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--white); transition: border-color 120ms, background 120ms; }
.product-card:hover { border-color: #7b9b83; }
.product-card.is-selected { border-color: #779c83; background: #f1f7ee; box-shadow: inset 0 0 0 1px #779c8340; }
.product-media { display: grid; position: relative; place-items: center; max-height: 87px; min-height: 53px; background: radial-gradient(ellipse at center, #faf9f3 0%, #eff0e8 100%); }
.product-card.is-selected .product-media { background: radial-gradient(ellipse at center, #f3f7ed 0%, #e7efe2 100%); }
.product-media canvas { display: block; height: 87px; max-width: 100%; width: 100%; object-fit: contain; }
.product-meta { display: block; border-top: 1px solid #e9ede6; padding: 7px 8px 8px; }
.product-meta strong { display: block; font-size: .885rem; line-height: 1.25; overflow-wrap: anywhere; }
.product-detail { display: block; margin-top: 3px; color: var(--muted); font-size: .75rem; line-height: 1.3; }
.product-selected { position: absolute; top: 6px; right: 6px; width: 19px; height: 19px; display: grid; place-items: center; background: var(--green); color: var(--white); border-radius: 50%; font: 700 .7rem/1 system-ui, sans-serif; }
.catalog-status { margin-top: 9px; color: #486754; font-size: .875rem; }
.catalog-status:empty { display: none; }

.selections { margin-top: 15px; padding: 12px 0; border-block: 1px solid var(--line); }
.selected-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; margin-bottom: 7px; }
.selected-heading h3 { font-size: .875rem; }
#selectedList { display: flex; flex-wrap: wrap; gap: 6px; }
.selection-chip { display: inline-flex; min-height: 28px; align-items: center; gap: 5px; border-radius: 5px; border: 1px solid #dce6d9; background: #f0f5ed; padding: 0 3px 0 7px; color: #324f3e; font-size: .81rem; }
.selection-chip button { border: 0; border-radius: 4px; padding: 0 4px; min-width: 24px; min-height: 25px; background: transparent; color: #456654; }
.selection-chip button:hover { background: #dceada; }
.selection-empty { color: var(--muted); font-size: .875rem; }
.order-controls { display: grid; grid-template-columns: minmax(125px, .72fr) minmax(0, 1fr); align-items: start; gap: 12px; margin-top: 13px; }
.quantity-control { display: grid; grid-template-columns: 35px minmax(0, 1fr) 35px; min-height: 43px; background: #fbfcf9; border: 1px solid var(--line); border-radius: 8px; }
.quantity-control button, .quantity-control input { padding: 0; min-width: 0; border: 0; background: transparent; text-align: center; color: var(--ink); }
.quantity-control button { font-size: 1.2rem; border-radius: 7px; }
.quantity-control button:hover:enabled { background: #eaf2e8; }
.quantity-control button:disabled { color: #78877d; }
.quantity-control input { appearance: textfield; font-weight: 700; font-variant-numeric: tabular-nums; }
.quantity-control input::-webkit-inner-spin-button, .quantity-control input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.quantity-message { margin-top: 3px; font-size: .8rem; color: var(--muted); }
.quantity-control:has([aria-invalid="true"]) { border-color: #ad5c4a; }
.quantity-control:has([aria-invalid="true"]) + .quantity-message { color: #913b2c; }
.primary-button { display: inline-flex; justify-content: center; align-items: center; gap: 5px; min-height: 44px; border: 1px solid var(--green); border-radius: 8px; background: var(--green); color: #fff; padding: 8px 12px; text-align: center; font-weight: 700; }
.primary-button:hover:enabled { background: #16392c; }
.primary-button:disabled { opacity: .55; }
.order-actions { display: grid; gap: .5rem; margin-top: 27px; }
.order-actions button { min-width: 0; overflow-wrap: anywhere; }
.view-quote-button { min-height: 42px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); padding: 7px 10px; font-size: .875rem; font-weight: 700; }
.view-quote-button:hover { border-color: #92ad9b; background: var(--soft-green); }
.button-plus { font-size: 1.16em; font-weight: 500; line-height: 1; }
dialog { width: min(535px, calc(100vw - 28px)); max-height: calc(100dvh - 36px); padding: 24px; border: 1px solid #dbe3d9; border-radius: 16px; background: #fff; color: var(--ink); box-shadow: 0 20px 90px #122b2152; }
dialog::backdrop { background: #1834286e; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.dialog-eyebrow { color: var(--muted); font-size: .81rem; }
.dialog-head h2 { font-size: 1.55rem; color: var(--green-dark); }
.dialog-close { border: 1px solid var(--line); border-radius: 8px; background: #f6f8f4; width: 39px; height: 39px; font-size: 1.38rem; }
.dialog-close:hover { background: var(--soft-green); }
.quote-row { display: grid; grid-template-columns: 73px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.quote-row-preview { display: block; width: 100%; height: auto; border-radius: 7px; background: #ecf0e7; }
.quote-row h3 { font-size: 1rem; }
.quote-row-copy p, .quote-empty { color: var(--muted); font-size: .875rem; }
.quote-row-actions { display: flex; align-items: center; gap: 5px; }
.quote-row-quantity { font-weight: 700; white-space: nowrap; }
.quote-remove { background: transparent; border: 1px solid transparent; padding: 5px; border-radius: 5px; font-size: .875rem; }
.quote-remove:hover { border-color: var(--line); }
.quote-empty { padding: 18px 0; }
.dialog-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 16px; }
.dialog-foot p { font-weight: 700; }
.dialog-note { margin-top: 9px; color: var(--muted); font-size: .82rem; }
.quote-feedback { margin-top: 12px; padding: 10px; border-radius: 8px; background: var(--soft-green); color: var(--green-dark); font-size: .875rem; }
.toast { position: fixed; z-index: 5; bottom: 22px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 30px); padding: 12px 16px; border-radius: 9px; color: white; background: var(--green-dark); box-shadow: 0 6px 23px #16382e36; font-size: .9rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 1020px) {
  .masthead-inner, .workspace { padding-inline: 24px; }
  .workspace-grid { gap: 15px; }
  .preview-panel, .catalog-panel { padding: 15px; }
  .catalog-grid { gap: 6px; }
}

@media (max-width: 740px) {
  .masthead-inner { min-height: 64px; }
  .masthead-inner, .workspace { padding-inline: 15px; }
  .workspace { padding-top: 20px; }
  .page-title { flex-wrap: wrap; align-items: start; gap: 10px; margin-bottom: 14px; }
  .page-title .moq-note { margin-bottom: 0; padding: 4px 9px; }
  .workspace-grid { display: block; }
  .catalog-panel { margin-top: 14px; }
  .catalog-grid { gap: 8px; }
  .preview-panel, .catalog-panel { padding: 13px; border-radius: 14px; }
  .preview-surface { aspect-ratio: 1.65; min-height: 176px; max-height: 245px; }
  .preview-meta { margin-top: 13px; }
  .preview-state { margin-top: 9px; }
  .preview-panel .panel-heading h2, .preview-actions { min-width: 0; overflow-wrap: anywhere; }
  .preview-actions .text-button { min-height: 36px; max-width: 100%; }
  #previewToggle { border: 1px solid var(--line); }
  .preview-panel.is-compact {
    display: grid;
    grid-template-columns: clamp(78px, 23vw, 108px) minmax(0, 1fr);
    gap: .3rem .85rem;
  }
  .preview-panel.is-compact .panel-heading { grid-column: 1 / -1; margin: 0; }
  .preview-panel.is-compact .preview-surface { aspect-ratio: 1.48; min-height: 0; }
  .preview-panel.is-compact .preview-stamp { display: none; }
  .preview-panel.is-compact .preview-state { align-self: center; min-height: 0; margin: 0; overflow-wrap: anywhere; }
}

@media (max-width: 570px) {
  .masthead-inner { gap: .6rem; }
  .brand b { font-size: 1.35rem; }
  .brand span { display: none; }
  .header-actions { min-width: 0; gap: .55rem; }
  .language-control { flex-shrink: 0; }
  .language-control select { padding-inline: .55rem 1.35rem; }
  .language-control::after { right: 8px; }
  .quote-toggle { min-width: 0; gap: .35rem; padding-inline: .55rem; font-size: .875rem; white-space: normal; text-align: center; }
  .quote-toggle > [data-text] { min-width: 0; overflow-wrap: anywhere; }
  .quote-badge { flex-shrink: 0; }
  .bag-icon { display: none; }
  .dialog-foot { flex-wrap: wrap; }
}

@media (max-width: 740px) and (min-height: 560px) {
  .preview-panel.has-sticky-space { position: sticky; top: 4px; z-index: 2; box-shadow: 0 5px 18px #263a2d16; }
  .catalog-panel button, .catalog-panel input { scroll-margin-top: var(--preview-clearance, 0px); }
}

@media (max-width: 390px) {
  .header-actions { gap: 9px; }
  .masthead-inner, .workspace { padding-inline: 10px; }
  .quote-toggle { padding-inline: 8px; }
  .product-meta { padding-inline: 5px; }
  .catalog-grid { gap: 5px; }
  .preview-meta { gap: 8px; }
  .finish-options { gap: 5px; }
  .finish-options button { padding-inline: 8px; }
  dialog { padding: 15px; }
  .quote-row { grid-template-columns: 46px minmax(0, 1fr) auto; gap: 7px; }
  .quote-row-actions { flex-direction: column; align-items: end; gap: 1px; }
}

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