:root {
  color-scheme: light;
  --bg: #f7f4ef;
  --surface: #ffffff;
  --surface-2: #fbfaf7;
  --surface-3: #f1ede5;
  --text: #20211d;
  --muted: #6e716a;
  --line: #e5ded4;
  --line-strong: #d3cabd;
  --brand: #8a653e;
  --brand-2: #213528;
  --brand-soft: #f2e8dc;
  --danger: #b64a42;
  --ok: #2e7951;
  --warning: #a87324;
  --shadow: 0 16px 42px rgba(46, 38, 26, 0.06);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #11130f;
  --surface: #191b17;
  --surface-2: #151713;
  --surface-3: #22261f;
  --text: #f2eee6;
  --muted: #a9aba4;
  --line: #30342b;
  --line-strong: #43483c;
  --brand: #d4a15f;
  --brand-2: #e8dec8;
  --brand-soft: rgba(212, 161, 95, 0.13);
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255,255,255,.42), transparent 320px),
    var(--bg);
}
body.modal-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
.bg-orb { display: none; }

.shell {
  width: min(1080px, calc(100% - 32px));
  margin-inline: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 0 14px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  font-weight: 900;
}
.brand strong {
  display: block;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.02em;
}
.brand small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 12px;
}
.topnav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}
.topnav a,
.topnav button {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  background: transparent;
}
.topnav a:hover,
.topnav button:hover,
.topnav a.active {
  color: var(--text);
  border-color: var(--line);
  background: var(--surface);
}

.primary-btn,
.secondary-btn,
.ghost-btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  padding: 9px 15px;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--surface);
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.primary-btn:hover,
.secondary-btn:hover,
.ghost-btn:hover { transform: translateY(-1px); border-color: var(--line-strong); }
.primary-btn {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  font-weight: 800;
}
.secondary-btn { background: var(--brand-soft); border-color: transparent; color: var(--text); }
.ghost-btn { background: transparent; }
.ghost-btn.danger { color: var(--danger); border-color: rgba(182, 74, 66, 0.28); }
.primary-btn.big,
.secondary-btn.big,
.ghost-btn.big { min-height: 48px; padding: 12px 18px; }
.full { width: 100%; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.elevated { box-shadow: var(--shadow); }

.eyebrow {
  color: var(--brand);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.eyebrow::before { display: none; }
.lead {
  color: var(--muted);
  line-height: 1.7;
  font-size: clamp(15px, 1.7vw, 18px);
}
.muted { color: var(--muted); }
code {
  border: 1px solid var(--line);
  background: var(--surface-3);
  border-radius: 8px;
  padding: 2px 7px;
}
small { color: var(--muted); font-weight: 500; }
.hidden { display: none !important; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, .8fr);
  gap: 18px;
  align-items: stretch;
  padding: 26px 0 18px;
}
.hero-copy { padding: clamp(26px, 5vw, 48px); }
.hero-copy h1,
.shop-hero h1,
.login-panel h1,
.order-query-panel h1 {
  margin: 8px 0 12px;
  font-size: clamp(34px, 5.5vw, 58px);
  line-height: 1;
  letter-spacing: -0.055em;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 24px 0 0;
}
.notice {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  line-height: 1.7;
}
.notice.soft { background: var(--surface-2); }
.notice.small { font-size: 14px; color: var(--muted); }
.hero-copy .notice { margin-top: 18px; }
.preview-card { padding: 24px; overflow: hidden; }
.paper-stack { height: 170px; position: relative; margin-bottom: 8px; }
.paper-stack span {
  position: absolute;
  inset: 38px 34px auto;
  height: 92px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, #fffdf7, #e2d0b4);
  transform: rotate(-7deg);
}
.paper-stack span:nth-child(2) { transform: translate(16px, 18px) rotate(2deg); background: linear-gradient(135deg, #faf7ef, #bec7b7); }
.paper-stack span:nth-child(3) { transform: translate(32px, 36px) rotate(9deg); background: linear-gradient(135deg, #fff, #c7aa82); }
.preview-card h2,
.section-title h2,
.summary-header h2 { margin: 5px 0 0; letter-spacing: -0.035em; }
.feature-list { display: grid; gap: 10px; margin: 16px 0; }
.feature-list article {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}
.feature-list p { margin: 5px 0 0; color: var(--muted); line-height: 1.6; }
.inline-code { color: var(--muted); }
.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 26px 0 34px;
  color: var(--muted);
  font-size: 14px;
}
.footer a { color: var(--brand); font-weight: 800; }

/* 买家页 */
.buyer-layout { padding: 16px 0 20px; }
.shop-hero {
  padding: 22px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 18px;
  align-items: center;
}
.shop-hero h1 { font-size: clamp(30px, 4.8vw, 48px); }
.shop-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.shop-meta span,
.pill {
  border: 1px solid var(--line);
  background: var(--surface-2);
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
}
.shop-cover {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-3);
}
.builder-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}
.form-panel { padding: 22px; }
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}
.section-title.with-line {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  margin-top: 22px;
}
.groups-container { display: grid; gap: 14px; }
.choice-group {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}
.choice-group-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.choice-group h3 { margin: 0; letter-spacing: -0.03em; }
.choice-group p { margin: 5px 0 0; color: var(--muted); line-height: 1.55; font-size: 14px; }
.required-badge { color: var(--brand); font-size: 12px; font-weight: 900; white-space: nowrap; }
.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
  gap: 10px;
}
.choice-card { position: relative; display: block; }
.choice-card input { position: absolute; opacity: 0; pointer-events: none; }
.choice-inner {
  min-height: 100%;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.choice-card:hover .choice-inner { transform: translateY(-1px); border-color: var(--line-strong); }
.choice-card input:checked + .choice-inner { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.choice-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--surface-3);
  margin: 0;
}
.choice-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  font-weight: 850;
  line-height: 1.35;
}
.choice-price { color: var(--brand); white-space: nowrap; }
.choice-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
  margin-top: 4px;
}
.choice-tag { display: inline-flex; margin-top: 6px; font-size: 12px; color: var(--muted); }
.text-choice textarea { width: 100%; }

.form-grid { display: grid; gap: 13px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid label,
.backup-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}
.span-2 { grid-column: 1 / -1; }
input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  padding: 11px 13px;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}
input:focus,
textarea:focus,
select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea { resize: vertical; }
input[type="file"] { padding: 9px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 18px; }
.sticky-submit {
  position: static;
  padding: 0;
  margin: 18px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
}
.summary-panel { padding: 20px; position: static; }
.summary-list { display: grid; gap: 8px; margin: 14px 0; }
.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  color: var(--muted);
  font-size: 14px;
}
.summary-row strong { color: var(--text); text-align: right; }
.price-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 18px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.price-card div { display: flex; justify-content: space-between; gap: 12px; }
.price-card span { color: var(--muted); }
.price-card .total {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  font-size: 20px;
}
.price-card .total strong { color: var(--brand); }
.order-lookup { padding: 22px; margin-top: 16px; }
.inline-form { display: flex; gap: 10px; align-items: center; }
.inline-form input { flex: 1; }
.inline-check { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 800; }
.inline-check input { width: auto; accent-color: var(--brand); }
.lookup-result { margin-top: 14px; }

/* 对话框 */
.modal {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: min(600px, calc(100% - 28px));
}
.modal::backdrop { background: rgba(0,0,0,.42); backdrop-filter: blur(4px); }
.modal-card {
  position: relative;
  padding: 24px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
}
.order-ticket {
  display: grid;
  gap: 8px;
  margin: 14px 0;
  padding: 14px;
  border-radius: 16px;
  background: var(--brand-soft);
  border: 1px solid var(--line);
}
.order-ticket code { font-size: 18px; font-weight: 900; }

.centered-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
}
.centered-page .panel { padding: 32px; max-width: 660px; }
.login-panel {
  max-width: 520px;
  margin: 44px auto;
  padding: 30px;
}

/* 商家页 */
.seller-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
  padding: 16px 0 20px;
}
.side-panel {
  position: static;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  overflow: hidden;
}
.seller-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px 0 0;
  border-right: 1px solid var(--line);
  min-width: 220px;
}
.seller-mini strong,
.seller-mini small { display: block; }
.seller-mini small { color: var(--muted); margin-top: 1px; }
.side-nav {
  display: flex;
  flex: 1;
  gap: 6px;
  margin: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}
.side-nav button {
  width: auto;
  white-space: nowrap;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  text-align: center;
  border-radius: 999px;
  padding: 9px 13px;
}
.side-nav button.active,
.side-nav button:hover {
  background: var(--brand-soft);
  color: var(--text);
  border-color: transparent;
}
.side-panel .full { width: auto; flex: 0 0 auto; }
.seller-content { display: grid; gap: 16px; min-width: 0; }
.tab-view { display: none; }
.tab-view.active { display: block; }
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.metric-card { padding: 18px; }
.metric-card span,
.metric-card small { color: var(--muted); display: block; }
.metric-card strong { display: block; font-size: 34px; margin: 3px 0; letter-spacing: -0.05em; }
.rich-text { color: var(--muted); line-height: 1.75; padding: 0 22px 20px; }
.toast {
  position: static;
  z-index: auto;
  justify-self: end;
  padding: 11px 14px;
  border-radius: 999px;
  background: var(--brand-2);
  color: #fff;
}
.cover-preview-wrap { margin-top: 14px; }
.cover-preview {
  width: min(380px, 100%);
  height: 150px;
  object-fit: cover;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-3);
}
.group-editor-list { display: grid; gap: 14px; }
.group-editor-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  overflow: hidden;
}
.group-editor-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}
.group-editor-head h3 { margin: 0; }
.group-editor-head p { margin: 6px 0 0; }
.group-editor-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.group-editor-body { padding: 16px; display: grid; gap: 14px; }
.option-editor-list { display: grid; gap: 10px; }
.option-editor {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}
.option-editor-thumb {
  width: 86px;
  height: 86px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--surface-3);
}
.option-editor-fields { display: grid; gap: 8px; }
.option-editor-fields .row { display: grid; grid-template-columns: 1fr 120px; gap: 10px; }
.option-editor-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.option-add-form {
  display: grid;
  gap: 10px;
  padding: 13px;
  border-radius: 16px;
  border: 1px dashed var(--line-strong);
  background: var(--surface);
}
.option-add-form .row { display: grid; grid-template-columns: 1fr 120px; gap: 10px; }
.order-toolbar {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.orders-list { display: grid; gap: 12px; }
.order-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 16px;
}
.order-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  margin-bottom: 10px;
}
.order-head h3 { margin: 0; }
.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 9px;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 900;
  font-size: 12px;
  white-space: nowrap;
}
.status-badge.pending { color: var(--warning); }
.status-badge.accepted,
.status-badge.making { color: var(--brand); }
.status-badge.shipped,
.status-badge.completed { color: var(--ok); }
.status-badge.cancelled { color: var(--danger); }
.order-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, .75fr);
  gap: 14px;
}
.kv-list { display: grid; gap: 7px; color: var(--muted); line-height: 1.55; }
.kv-list b { color: var(--text); }
.selection-lines { display: grid; gap: 7px; }
.selection-line { border-bottom: 1px dashed var(--line); padding-bottom: 7px; }
.order-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.shipping-box {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 12px;
  border-radius: 16px;
  background: var(--surface-2);
}
.empty-state {
  padding: 22px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  color: var(--muted);
  text-align: center;
  background: var(--surface-2);
}
.backup-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.backup-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  display: grid;
  gap: 11px;
  align-content: start;
}
.backup-card h3 { margin: 0; }
.backup-card p { margin: 0; color: var(--muted); line-height: 1.6; }
.danger-zone { border-color: rgba(182, 74, 66, .24); }

/* 订单页 */
.order-page-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding: 22px 0 20px;
}
.order-query-panel,
.order-result-panel,
.recent-orders-panel { padding: 22px; }
.order-query-panel { position: static; }
.recent-orders-panel { grid-column: 1 / -1; }
.timeline-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  border-radius: 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.timeline-list div {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) 150px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}
.timeline-list span { color: var(--brand); font-weight: 900; }
.timeline-list strong { color: var(--text); }
.timeline-list small { color: var(--muted); text-align: right; }

@media (max-width: 960px) {
  .hero-grid,
  .builder-grid,
  .shop-hero,
  .order-body,
  .backup-grid,
  .order-page-grid { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shop-cover { height: 170px; }
  .side-panel { align-items: stretch; flex-wrap: wrap; }
  .seller-mini { width: 100%; border-right: 0; border-bottom: 1px solid var(--line); padding: 0 0 12px; }
  .side-nav { order: 2; width: 100%; flex: 1 1 100%; }
  .side-panel .full { width: auto; }
}

@media (max-width: 680px) {
  .shell { width: min(100% - 22px, 1080px); }
  .topbar { align-items: flex-start; flex-direction: column; }
  .topnav { width: 100%; justify-content: flex-start; }
  .topnav a, .topnav button { padding: 7px 10px; min-height: 34px; }
  .hero-copy h1,
  .shop-hero h1,
  .order-query-panel h1 { font-size: 34px; }
  .hero-copy,
  .preview-card,
  .form-panel,
  .summary-panel,
  .order-query-panel,
  .order-result-panel,
  .recent-orders-panel { padding: 18px; }
  .form-grid.two,
  .option-editor,
  .option-editor-fields .row,
  .option-add-form .row,
  .order-toolbar { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .inline-form { flex-direction: column; align-items: stretch; }
  .choice-grid { grid-template-columns: 1fr; }
  .choice-inner { grid-template-columns: 56px minmax(0, 1fr); }
  .choice-thumb { width: 56px; height: 56px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .option-editor-thumb { width: 100%; height: 160px; }
  .section-title,
  .group-editor-head,
  .order-head { flex-direction: column; align-items: stretch; }
  .group-editor-actions { justify-content: flex-start; }
  .footer { flex-direction: column; }
  .timeline-list div { grid-template-columns: 1fr; }
  .timeline-list small { text-align: left; }
}

/* 小图选项卡的文字统一放在右侧，避免图片与文字错位 */
.choice-thumb { grid-row: 1 / 4; }
.choice-title,
.choice-desc,
.choice-tag { grid-column: 2; }
