/* ==========================================================================
   雨林购商品分销 · 设计系统
   1. 设计令牌 (tokens)
   2. 基础重置 (reset)
   3. 布局 (layout)
   4. 导航 (topbar / drawer)
   5. 表单控件 (button / input / field / segmented)
   6. 容器组件 (card / stat / badge / table / empty / skeleton)
   7. 业务组件 (product grid / offer list / stepper / cartbar)
   8. 浮层 (modal / sheet / toast / country picker)
   9. 工具类 & 响应式
   ========================================================================== */

/* ---------- 1. 设计令牌 ---------- */
:root {
  /* 品牌 */
  --brand: #fd6800;
  --brand-hover: #e85f00;
  --brand-active: #cf5500;
  --brand-soft: #fff3ea;
  --brand-soft-border: #ffd9bd;
  --brand-ring: rgba(253, 104, 0, .18);

  /* 语义色 */
  --success: #16a34a;
  --success-soft: #ecfdf3;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-soft: #fef2f2;
  --info: #2563eb;
  --info-soft: #eff6ff;

  /* 中性 */
  --bg: #f4f5f7;
  --bg-sunken: #eceef1;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --surface-hover: #f6f7f9;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #17181c;
  --text-2: #4b5563;
  --text-3: #6b7280;
  --text-4: #9ca3af;
  --on-brand: #ffffff;

  /* 排版 */
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-num: "SF Mono", "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 18px;
  --fs-2xl: 22px;
  --fs-3xl: 28px;

  /* 间距 (4px 基准) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;

  /* 圆角 */
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-full: 999px;

  /* 阴影 */
  --sh-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --sh-sm: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --sh-md: 0 4px 12px rgba(16, 24, 40, .08), 0 2px 4px rgba(16, 24, 40, .04);
  --sh-lg: 0 12px 32px rgba(16, 24, 40, .12), 0 4px 8px rgba(16, 24, 40, .04);
  --sh-xl: 0 24px 56px rgba(16, 24, 40, .18);

  /* 其它 */
  --topbar-h: 60px;
  --page-max: 1360px;
  --ease: cubic-bezier(.4, 0, .2, 1);
  --dur: .18s;
  --z-drawer: 40;
  --z-sticky: 30;
  --z-modal: 60;
  --z-toast: 90;
}

/* 深色模式：跟随系统，也可由 [data-theme] 强制 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115;
    --bg-sunken: #0a0c0f;
    --surface: #181b21;
    --surface-2: #1e2128;
    --surface-hover: #23272f;
    --border: #2a2f38;
    --border-strong: #3a4150;
    --text: #eceef2;
    --text-2: #b6bcc8;
    --text-3: #8b93a1;
    --text-4: #6b7381;
    --brand-soft: #2a1a0d;
    --brand-soft-border: #5a3517;
    --success-soft: #0d2318;
    --warning-soft: #2a1f08;
    --danger-soft: #2a1213;
    --info-soft: #101c33;
    --sh-xs: 0 1px 2px rgba(0, 0, 0, .4);
    --sh-sm: 0 1px 3px rgba(0, 0, 0, .5);
    --sh-md: 0 4px 12px rgba(0, 0, 0, .5);
    --sh-lg: 0 12px 32px rgba(0, 0, 0, .6);
    --sh-xl: 0 24px 56px rgba(0, 0, 0, .7);
  }
}

:root[data-theme="dark"] {
  --bg: #0f1115;
  --bg-sunken: #0a0c0f;
  --surface: #181b21;
  --surface-2: #1e2128;
  --surface-hover: #23272f;
  --border: #2a2f38;
  --border-strong: #3a4150;
  --text: #eceef2;
  --text-2: #b6bcc8;
  --text-3: #8b93a1;
  --text-4: #6b7381;
  --brand-soft: #2a1a0d;
  --brand-soft-border: #5a3517;
  --success-soft: #0d2318;
  --warning-soft: #2a1f08;
  --danger-soft: #2a1213;
  --info-soft: #101c33;
  --sh-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --sh-sm: 0 1px 3px rgba(0, 0, 0, .5);
  --sh-md: 0 4px 12px rgba(0, 0, 0, .5);
  --sh-lg: 0 12px 32px rgba(0, 0, 0, .6);
  --sh-xl: 0 24px 56px rgba(0, 0, 0, .7);
}

/* ---------- 2. 基础重置 ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; line-height: 1.3; }
p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

::selection { background: var(--brand-ring); }

/* 滚动条 */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--r-full); }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- 3. 布局 ---------- */
.page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--sp-6) var(--sp-5) var(--sp-10);
}
.page--narrow { max-width: 640px; }
.page--mid { max-width: 960px; }

.page-head {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
  flex-wrap: wrap;
  margin-bottom: var(--sp-5);
}
.page-head__main { min-width: 0; flex: 1; }
.page-title {
  font-size: var(--fs-2xl);
  letter-spacing: -.01em;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}
.page-sub { color: var(--text-3); font-size: var(--fs-sm); margin-top: var(--sp-1); }
.page-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }

.toolbar {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: var(--sp-4);
}
.toolbar__grow { flex: 1 1 200px; min-width: 0; }
.toolbar__divider { width: 1px; height: 22px; background: var(--border); }

.stack { display: flex; flex-direction: column; gap: var(--sp-4); }
.cluster { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }

/* ---------- 4. 导航 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  height: var(--topbar-h);
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar__inner {
  max-width: var(--page-max);
  height: 100%;
  margin: 0 auto;
  padding: 0 var(--sp-5);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
  flex-shrink: 0;
}
.brand__mark {
  width: 30px;
  height: 30px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--brand), #ff9a3d);
  color: #fff;
  font-weight: 800;
  font-size: var(--fs-md);
  display: grid;
  place-items: center;
  box-shadow: 0 2px 8px var(--brand-ring);
}
.brand__text {
  font-weight: 700;
  font-size: var(--fs-lg);
  letter-spacing: -.01em;
  color: var(--text);
  white-space: nowrap;
}

.nav { display: flex; align-items: center; gap: var(--sp-1); }
.nav-link {
  border: 0;
  background: none;
  padding: 7px var(--sp-3);
  border-radius: var(--r-md);
  color: var(--text-2);
  font-size: var(--fs-md);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav-link:hover { background: var(--surface-hover); color: var(--text); }
.nav-link.is-active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }

.nav-tools { display: flex; align-items: center; gap: var(--sp-2); margin-left: auto; }

.icon-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text-2);
  font-size: var(--fs-md);
  transition: all var(--dur) var(--ease);
}
.icon-btn:hover { border-color: var(--border-strong); color: var(--text); background: var(--surface-hover); }

.lang-pill {
  display: inline-flex;
  padding: 3px;
  background: var(--bg-sunken);
  border-radius: var(--r-full);
}
.lang-pill button {
  border: 0;
  background: none;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-3);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.lang-pill button.is-active { background: var(--surface); color: var(--text); box-shadow: var(--sh-xs); }

.nav-toggle { display: none; }

.drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 17, 21, .45);
  z-index: var(--z-drawer);
  animation: fade-in var(--dur) var(--ease);
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(280px, 82vw);
  background: var(--surface);
  z-index: calc(var(--z-drawer) + 1);
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  box-shadow: var(--sh-xl);
  animation: slide-left .22s var(--ease);
}
.drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--border);
}
.drawer .nav-link {
  width: 100%;
  text-align: left;
  padding: 11px var(--sp-3);
  font-size: var(--fs-lg);
}

/* ---------- 5. 表单控件 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: 36px;
  padding: 0 var(--sp-4);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: var(--brand);
  color: var(--on-brand);
  font-size: var(--fs-md);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--brand-hover); }
.btn:active { background: var(--brand-active); transform: translateY(1px); }

.btn--ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn--ghost:hover { background: var(--surface-hover); border-color: var(--border-strong); color: var(--text); }
.btn--ghost:active { background: var(--bg-sunken); }

.btn--soft { background: var(--brand-soft); color: var(--brand); border-color: var(--brand-soft-border); }
.btn--soft:hover { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }

.btn--danger { background: var(--danger); }
.btn--danger:hover { background: var(--danger-hover); }

.btn--quiet { background: none; color: var(--text-3); }
.btn--quiet:hover { background: var(--surface-hover); color: var(--text); }
.btn--quiet-danger { background: none; color: var(--danger); }
.btn--quiet-danger:hover { background: var(--danger-soft); color: var(--danger); }

.btn--sm { height: 30px; padding: 0 var(--sp-3); font-size: var(--fs-sm); }
.btn--lg { height: 44px; padding: 0 var(--sp-6); font-size: var(--fs-lg); }
.btn--block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.is-loading { color: transparent !important; position: relative; pointer-events: none; }
.btn.is-loading::after {
  content: '';
  position: absolute;
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin .6s linear infinite;
  color: var(--on-brand);
}
.btn--ghost.is-loading::after, .btn--soft.is-loading::after { color: var(--text-2); }

.link-btn {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand);
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  cursor: pointer;
  text-align: left;
  transition: color var(--dur) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.link-btn:hover { color: var(--brand-hover); text-decoration: underline; }
.link-btn:active { color: var(--brand-active); }

.input, .select, .textarea {
  width: 100%;
  height: 36px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: var(--fs-md);
  outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.textarea { height: auto; min-height: 80px; padding: var(--sp-2) var(--sp-3); resize: vertical; line-height: 1.6; }
.input::placeholder, .textarea::placeholder { color: var(--text-4); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}
.input:disabled, .select:disabled {
  background: var(--bg-sunken);
  color: var(--text-4);
  cursor: not-allowed;
}
.input--sm { height: 30px; font-size: var(--fs-sm); padding: 0 var(--sp-2); }
.input--num { font-family: var(--font-num); text-align: right; }
.input--inline { width: auto; }
.input.is-error { border-color: var(--danger); }
.input.is-error:focus { box-shadow: 0 0 0 3px rgba(220, 38, 38, .15); }

.select {
  appearance: none;
  padding-right: var(--sp-8);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%236b7280' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--sp-3) center;
  cursor: pointer;
}
.select.is-error { border-color: var(--danger); }
.select.is-error:focus { box-shadow: 0 0 0 3px rgba(220, 38, 38, .15); }

.field { display: block; margin-bottom: var(--sp-4); }
.field:last-child { margin-bottom: 0; }
.field__label {
  display: block;
  margin-bottom: 6px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-2);
}
.field__label.is-required::after { content: ' *'; color: var(--danger); }
.field__hint { margin-top: 5px; font-size: var(--fs-xs); color: var(--text-4); }
.field__error { margin-top: 5px; font-size: var(--fs-xs); color: var(--danger); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--sp-5); }
.field-grid--3 { grid-template-columns: repeat(3, 1fr); }

.search { position: relative; flex: 1 1 240px; min-width: 0; max-width: 340px; }
.search .input { padding-left: 34px; }
.search__icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-4);
  pointer-events: none;
  line-height: 0;
}
.search__clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: var(--bg-sunken);
  color: var(--text-3);
  font-size: 11px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.search__clear:hover { background: var(--border-strong); color: var(--text); }

.checkbox { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: var(--fs-sm); color: var(--text-2); }
.checkbox input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; margin: 0; }

.segmented {
  display: inline-flex;
  padding: 3px;
  background: var(--bg-sunken);
  border-radius: var(--r-md);
  gap: 2px;
}
.segmented button {
  border: 0;
  background: none;
  padding: 5px var(--sp-3);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-3);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--dur) var(--ease);
}
.segmented button.is-active { background: var(--surface); color: var(--brand); box-shadow: var(--sh-xs); }

.input-group { display: flex; }
.input-group .input { border-radius: var(--r-md) 0 0 var(--r-md); }
.input-group .btn { border-radius: 0 var(--r-md) var(--r-md) 0; margin-left: -1px; }
.input-affix {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 var(--sp-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.input-affix:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.input-affix__unit { color: var(--text-4); font-size: var(--fs-xs); flex-shrink: 0; }
.input-affix .input {
  border: 0;
  box-shadow: none !important;
  height: 34px;
  padding: 0;
  background: none;
}

/* ---------- 6. 容器组件 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xs);
}
.card--flat { box-shadow: none; }
.card__head {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}
.card__title { font-size: var(--fs-lg); font-weight: 650; }
.card__body { padding: var(--sp-5); }
.card__body--tight { padding: var(--sp-3) var(--sp-4); }
.card__foot {
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  box-shadow: var(--sh-xs);
}
.stat__label {
  font-size: var(--fs-xs);
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 600;
}
.stat__value {
  margin-top: 6px;
  font-size: var(--fs-2xl);
  font-weight: 700;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.stat__value--brand { color: var(--brand); }
.stat__sub { font-size: var(--fs-xs); color: var(--text-4); margin-top: 2px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 var(--sp-2);
  border-radius: var(--r-sm);
  background: var(--bg-sunken);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  white-space: nowrap;
  line-height: 1;
}
.badge--ok { background: var(--success-soft); color: var(--success); }
.badge--warn { background: var(--warning-soft); color: var(--warning); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge--info { background: var(--info-soft); color: var(--info); }
.badge--brand { background: var(--brand-soft); color: var(--brand); }
.badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xs);
  overflow: hidden;
}
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th, .table td {
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}
.table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--dur) var(--ease); }
.table tbody tr:hover { background: var(--surface-hover); }
.table tbody tr.is-expanded { background: var(--brand-soft); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.actions { text-align: right; white-space: nowrap; }
.table tfoot td {
  background: var(--surface-2);
  font-weight: 700;
  border-top: 2px solid var(--border);
  border-bottom: 0;
}
.table__thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--r-md);
  object-fit: contain;
  background: var(--bg-sunken);
  flex-shrink: 0;
}
.table__detail td { background: var(--surface-2); padding: var(--sp-4) var(--sp-5); }

.cell-product { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.cell-product__name {
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}
.cell-product__sku { font-size: var(--fs-xs); color: var(--text-4); font-family: var(--font-num); }

.cell-user { display: flex; align-items: center; gap: var(--sp-2); }
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-sunken);
  flex-shrink: 0;
}
.avatar--fallback {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--brand), #ff9a3d);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 700;
}

.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--sp-3) var(--sp-5); }
.kv__k { font-size: var(--fs-xs); color: var(--text-4); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.kv__v { margin-top: 2px; word-break: break-word; }

/* 订单明细 */
.order-detail {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding: var(--sp-2) 0;
}
.order-detail__session {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--brand);
  font-size: var(--fs-lg);
  padding-bottom: var(--sp-3);
  border-bottom: 2px solid var(--border);
}
.order-detail__card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  box-shadow: var(--sh-xs);
}
.order-detail__title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-md);
  font-weight: 650;
  margin: 0 0 var(--sp-3) 0;
  color: var(--text-2);
}

/* 地址等信息的行内复制图标 */
.icon-btn--xs {
  width: 24px;
  height: 24px;
  border-color: transparent;
  background: transparent;
  color: var(--text-4);
  flex: 0 0 auto;
}
.icon-btn--xs:hover {
  border-color: transparent;
  background: var(--surface-hover);
  color: var(--brand);
}

.kv-grid__full { grid-column: 1 / -1; }

.order-items {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.order-item {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: var(--sp-3);
  align-items: center;
  padding: var(--sp-3);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: border-color var(--dur) var(--ease);
}
.order-item:hover {
  border-color: var(--border-strong);
}
.order-item__thumb {
  width: 60px;
  height: 60px;
  border-radius: var(--r-sm);
  overflow: hidden;
  flex-shrink: 0;
}
.order-item__info {
  min-width: 0;
}
.order-item__name {
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
/* 箱数 / 箱价 / 小计 与商品名同块，排在原 SKU 那一行 */
.order-item__meta {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2) var(--sp-4);
  flex-wrap: wrap;
}
.order-item__fact {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}
.order-item__fact i {
  font-style: normal;
  font-size: var(--fs-xs);
  color: var(--text-4);
}
.order-item__fact b { font-weight: 600; }
.order-item__fact--total { margin-left: auto; color: var(--brand); }
.order-item__label {
  font-size: var(--fs-xs);
  color: var(--text-4);
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.order-item__value {
  font-size: var(--fs-md);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.order-summary {
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
}
.order-summary__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-2) 0;
  font-size: var(--fs-md);
}
.order-summary__row .strong {
  color: var(--brand);
  font-size: var(--fs-lg);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 768px) {
  .order-item {
    grid-template-columns: 50px 1fr;
    gap: var(--sp-2);
  }
  .order-item__thumb {
    width: 50px;
    height: 50px;
  }
  .order-item__info {
    grid-column: 2;
  }
  /* 窄屏下小计换行到左侧，避免与箱价挤在一起 */
  .order-item__meta { gap: var(--sp-1) var(--sp-3); }
  .order-item__fact--total { margin-left: 0; }
  .order-item__label {
    font-size: 10px;
  }
  .order-item__value {
    font-size: var(--fs-sm);
  }
}

.empty { padding: var(--sp-10) var(--sp-5); text-align: center; }
.empty__icon { font-size: 40px; line-height: 1; opacity: .35; margin-bottom: var(--sp-3); }
.empty__title { font-weight: 650; font-size: var(--fs-lg); }
.empty__text { color: var(--text-3); font-size: var(--fs-sm); margin-top: var(--sp-1); }
.empty__action { margin-top: var(--sp-4); }

.skeleton {
  background: linear-gradient(90deg, var(--bg-sunken) 25%, var(--surface-hover) 37%, var(--bg-sunken) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
  border-radius: var(--r-sm);
}
.skel-line { height: 12px; margin-bottom: 8px; }
.skel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.skel-card__media { height: 180px; }
.skel-card__body { padding: var(--sp-3); }
.skel-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  margin-top: var(--sp-5);
  flex-wrap: wrap;
}
.pager__info { color: var(--text-3); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }

.tabs {
  display: flex;
  gap: var(--sp-1);
  padding: 4px;
  background: var(--bg-sunken);
  border-radius: var(--r-lg);
  margin-bottom: var(--sp-4);
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
}
.tab {
  border: 0;
  background: none;
  padding: 7px var(--sp-4);
  border-radius: var(--r-md);
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text-3);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--dur) var(--ease);
}
.tab:hover { color: var(--text); }
.tab.is-active { background: var(--surface); color: var(--brand); box-shadow: var(--sh-xs); }
.tab__count {
  margin-left: 5px;
  font-size: var(--fs-xs);
  padding: 1px 5px;
  border-radius: var(--r-full);
  background: var(--bg-sunken);
  color: var(--text-3);
}
.tab.is-active .tab__count { background: var(--brand-soft); color: var(--brand); }

/* ---------- 7. 业务组件 ---------- */
/* 7.1 管理端商品网格 */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: var(--sp-4);
}
.product-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  padding: 0;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.product-card:hover { border-color: var(--border-strong); box-shadow: var(--sh-md); transform: translateY(-2px); }
.product-card.is-selected { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-ring), var(--sh-sm); }
.product-card__check {
  position: absolute;
  top: var(--sp-2);
  left: var(--sp-2);
  z-index: 2;
  width: 22px;
  height: 22px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border-strong);
  background: rgba(255, 255, 255, .92);
  display: grid;
  place-items: center;
  color: transparent;
  font-size: 13px;
  font-weight: 700;
  transition: all var(--dur) var(--ease);
}
.product-card.is-selected .product-card__check {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.product-card__media {
  height: 180px;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  padding: var(--sp-2);
  border-bottom: 1px solid var(--border);
}
.product-card__media img { max-height: 164px; width: auto; object-fit: contain; }
.product-card__body { padding: var(--sp-3); }
.product-card__title {
  font-weight: 600;
  font-size: var(--fs-sm);
  line-height: 1.45;
  height: 2.9em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.product-card__price {
  margin-top: var(--sp-2);
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}
.price-main {
  color: var(--brand);
  font-weight: 750;
  font-size: var(--fs-lg);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.price-alt { color: var(--text-3); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.product-card__meta {
  margin-top: var(--sp-2);
  padding-top: var(--sp-2);
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: var(--fs-xs);
  color: var(--text-3);
}
.product-card__meta span { display: flex; gap: 5px; align-items: center; }
.product-card__meta b { color: var(--text-2); font-weight: 600; }
.thumb-ph {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--text-4);
  font-size: var(--fs-xs);
  background: var(--bg-sunken);
}

/* 7.2 底部选择栏 */
.selection-bar {
  position: fixed;
  left: 50%;
  bottom: var(--sp-5);
  transform: translateX(-50%);
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  box-shadow: var(--sh-lg);
  animation: rise .22s var(--ease);
  max-width: calc(100vw - var(--sp-8));
}
.selection-bar__count { font-size: var(--fs-sm); color: var(--text-2); white-space: nowrap; }
.selection-bar__count b { color: var(--brand); font-size: var(--fs-lg); font-variant-numeric: tabular-nums; }

/* 7.3 场次编辑行内价格编辑 */
.price-cell { display: flex; flex-direction: column; gap: 3px; }
.price-cell__hint { font-size: 11px; color: var(--text-4); font-variant-numeric: tabular-nums; }
.row-saving { color: var(--brand); font-size: 11px; }

.bulk-panel {
  padding: var(--sp-3) var(--sp-4);
  background: var(--brand-soft);
  border: 1px solid var(--brand-soft-border);
  border-radius: var(--r-lg);
  margin-bottom: var(--sp-4);
}
/* 分享页正文左右有留白，面板需自带内缩 */
.bulk-panel--inset { margin: var(--sp-4) var(--sp-4) 0; }

.bulk-panel__row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}
.bulk-panel__label { font-weight: 650; font-size: var(--fs-sm); color: var(--brand); white-space: nowrap; }
.bulk-panel__actions { margin-left: auto; }
.bulk-panel__input { width: 96px; }

.bulk-panel__head {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.bulk-panel__intro { min-width: 0; }
.bulk-panel__title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: var(--fs-md);
  font-weight: 650;
  color: var(--brand);
}
.bulk-panel__hint {
  margin: 3px 0 0;
  font-size: var(--fs-xs);
  color: var(--text-3);
  line-height: 1.4;
}
.bulk-panel__head .icon-btn { margin-left: auto; }

.bulk-panel__foot {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--brand-soft-border);
}
.bulk-panel__foot .cluster { margin-left: auto; }

/* 分享页加价面板：两个模式按钮与输入框始终同一行 */
.bulk-panel--inset .bulk-panel__row { flex-wrap: nowrap; }
.bulk-panel--inset .bulk-panel__row .segmented { flex: 0 1 auto; min-width: 0; }
.bulk-panel--inset .bulk-panel__row .segmented button { min-width: 0; white-space: nowrap; }
.bulk-panel--inset .bulk-panel__row .input-affix { flex: 1 1 88px; min-width: 0; }
.bulk-panel--inset .bulk-panel__input { width: 100%; min-width: 0; }

@media (max-width: 640px) {
  .bulk-panel--inset { margin: var(--sp-3) var(--sp-3) 0; }
  .bulk-panel--inset .bulk-panel__row { gap: var(--sp-2); }
  .bulk-panel--inset .bulk-panel__row .segmented button { padding-left: 9px; padding-right: 9px; }
  .bulk-panel--inset .bulk-panel__row .input-affix { flex: 1 1 72px; }
  .bulk-panel__foot { align-items: stretch; }
  .bulk-panel__foot .cluster { margin-left: 0; display: flex; gap: var(--sp-2); }
  .bulk-panel__foot .cluster .btn { flex: 1; }
  .bulk-panel__actions { margin-left: 0; width: 100%; display: flex; gap: var(--sp-2); }
  .bulk-panel__actions .btn { flex: 1; }
}

/* 7.4 客户分享页 */
.share-page {
  max-width: 880px;
  margin: 0 auto;
  padding-bottom: 96px;
  min-height: calc(100vh - var(--topbar-h));
}
.share-hero {
  position: relative;
  padding: var(--sp-5);
  background: linear-gradient(135deg, #fff6ef, #ffffff 62%);
  border-bottom: 1px solid var(--border);
}
:root[data-theme="dark"] .share-hero,
.share-hero { background: linear-gradient(135deg, var(--brand-soft), var(--surface) 62%); }
.share-hero__title {
  font-size: var(--fs-2xl);
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.25;
}
.share-hero__row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-top: var(--sp-2);
  font-size: var(--fs-sm);
  color: var(--text-3);
}
.share-hero__actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-4); }
.countdown {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  color: var(--warning);
}
.alert {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  font-weight: 600;
  margin-top: var(--sp-3);
  border: 1px solid transparent;
}
.alert--danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert--warn { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 25%, transparent); }
.alert--info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 25%, transparent); }

.share-toolbar {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: var(--topbar-h);
  z-index: 10;
  flex-wrap: wrap;
}

.offer-list { padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); }
.offer {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xs);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.offer:hover { box-shadow: var(--sh-sm); }
.offer.is-picked { border-color: var(--brand); background: linear-gradient(180deg, var(--brand-soft), var(--surface) 60%); }
.offer__media {
  width: 104px;
  height: 104px;
  flex-shrink: 0;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.offer__media img { width: 100%; height: 100%; object-fit: contain; }
.offer__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.offer__title {
  font-size: var(--fs-md);
  font-weight: 650;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.offer__price { display: flex; align-items: baseline; gap: var(--sp-2); margin-top: 6px; flex-wrap: wrap; }
.offer__price-main {
  color: var(--brand);
  font-size: var(--fs-2xl);
  font-weight: 750;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.offer__price-unit { font-size: var(--fs-xs); color: var(--text-4); }
.offer__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 3px var(--sp-3);
  margin-top: 6px;
  font-size: var(--fs-xs);
  color: var(--text-2);
}
.offer__facts span { display: inline-flex; gap: 4px; }
.offer__facts i { color: var(--text-4); font-style: normal; }
.offer__tags { display: flex; flex-wrap: wrap; gap: var(--sp-1); margin-top: 6px; }
.offer__side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-2);
  flex-shrink: 0;
}
.offer__subtotal {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: var(--fs-xs);
  color: var(--brand);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.offer__edit {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
  padding-top: var(--sp-2);
  border-top: 1px dashed var(--border);
}
.offer__edit-item { display: flex; align-items: center; gap: 5px; font-size: var(--fs-xs); color: var(--text-3); }
.offer__edit-item .input { width: 78px; }

.stepper {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  background: var(--bg-sunken);
  border-radius: var(--r-full);
}
.stepper button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: var(--fs-xl);
  line-height: 1;
  padding: 0;
  transition: all var(--dur) var(--ease);
}
.stepper__minus { background: var(--surface); color: var(--text-2); box-shadow: var(--sh-xs); }
.stepper__minus:hover:not(:disabled) { color: var(--danger); }
.stepper__plus { background: var(--brand); color: #fff; }
.stepper__plus:hover:not(:disabled) { background: var(--brand-hover); }
.stepper button:disabled { opacity: .35; cursor: not-allowed; }
.stepper input {
  width: 56px;
  height: 30px;
  border: 0;
  background: transparent;
  text-align: center;
  font-size: var(--fs-md);
  font-weight: 650;
  color: var(--text);
  outline: none;
  -moz-appearance: textfield;
  appearance: textfield;
  font-variant-numeric: tabular-nums;
}
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:disabled { color: var(--text-4); }

.cartbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-sticky);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(16, 24, 40, .06);
  padding-bottom: env(safe-area-inset-bottom);
}
.cartbar__inner {
  max-width: 880px;
  margin: 0 auto;
  padding: var(--sp-3) var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.cartbar__summary { flex: 1; min-width: 0; }
.cartbar__line1 { font-size: var(--fs-xs); color: var(--text-3); display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.cartbar__total {
  font-size: var(--fs-xl);
  font-weight: 750;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.cartbar__total small { font-size: var(--fs-xs); color: var(--text-3); font-weight: 500; margin-left: 5px; }

.login-card {
  max-width: 400px;
  margin: 8vh auto;
  padding: var(--sp-8);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-md);
}
.login-card__logo {
  width: 44px;
  height: 44px;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--brand), #ff9a3d);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: var(--fs-xl);
  margin-bottom: var(--sp-4);
  box-shadow: 0 4px 12px var(--brand-ring);
}
.login-card__title { font-size: var(--fs-2xl); letter-spacing: -.02em; }
.login-card__sub { color: var(--text-3); font-size: var(--fs-sm); margin: 6px 0 var(--sp-5); }
.divider {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: var(--sp-4) 0;
  color: var(--text-4);
  font-size: var(--fs-xs);
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.success-panel { text-align: center; padding: var(--sp-6) var(--sp-4); }
.success-panel__icon {
  width: 60px;
  height: 60px;
  margin: 0 auto var(--sp-4);
  border-radius: 50%;
  background: var(--success-soft);
  color: var(--success);
  display: grid;
  place-items: center;
  font-size: 30px;
}

/* ---------- 8. 浮层 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(15, 17, 21, .5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  overflow-y: auto;
  animation: fade-in var(--dur) var(--ease);
}
.modal {
  width: 460px;
  max-width: 100%;
  max-height: calc(100vh - var(--sp-8));
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: pop .2s var(--ease);
}
.modal--wide { width: 720px; }
.modal--xl { width: 880px; }
.modal__head {
  padding: var(--sp-5) var(--sp-5) var(--sp-3);
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  flex-shrink: 0;
}
.modal__title { font-size: var(--fs-xl); letter-spacing: -.01em; }
.modal__sub { color: var(--text-3); font-size: var(--fs-sm); margin-top: 3px; }
.modal__close {
  margin-left: auto;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: var(--r-md);
  background: none;
  color: var(--text-3);
  font-size: var(--fs-lg);
  cursor: pointer;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}
.modal__close:hover { background: var(--surface-hover); color: var(--text); }
.modal__body { padding: 0 var(--sp-5) var(--sp-5); overflow-y: auto; flex: 1; }
.modal__foot {
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  gap: var(--sp-2);
  justify-content: flex-end;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.modal__foot--split { justify-content: space-between; }

.summary-list { display: flex; flex-direction: column; }
.summary-list__row {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-md);
}
.summary-list__row:last-child { border-bottom: 0; }
.summary-list__row dt { color: var(--text-3); }
.summary-list__row dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.summary-list__row--total { border-top: 2px solid var(--border); margin-top: var(--sp-1); }
.summary-list__row--total dd { color: var(--brand); font-size: var(--fs-xl); font-weight: 750; }

.pick-list { max-height: 380px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--r-md); }
.pick-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.pick-row:last-child { border-bottom: 0; }
.pick-row:hover { background: var(--surface-hover); }
.pick-row.is-picked { background: var(--brand-soft); }
.pick-row img { width: 40px; height: 40px; object-fit: contain; border-radius: var(--r-sm); background: var(--bg-sunken); flex-shrink: 0; }
.pick-row__name { flex: 1; min-width: 0; font-size: var(--fs-sm); }
.pick-row__name small { display: block; color: var(--text-4); font-family: var(--font-num); font-size: 11px; }

.copy-field { display: flex; gap: var(--sp-2); }
.copy-field .input { cursor: pointer; font-family: var(--font-num); font-size: var(--fs-sm); }
.qr-box {
  display: grid;
  place-items: center;
  padding: var(--sp-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.qr-box img { width: 190px; height: 190px; border-radius: var(--r-md); background: #fff; }

.country-picker { position: relative; }
.country-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 240px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--sh-lg);
  z-index: 5;
  padding: 4px;
}
.country-option {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: 7px var(--sp-2);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: var(--fs-sm);
}
.country-option:hover, .country-option.is-active { background: var(--brand-soft); color: var(--brand); }
.country-option code { color: var(--text-4); font-family: var(--font-num); font-size: var(--fs-xs); }
.country-menu__empty { padding: var(--sp-3); text-align: center; color: var(--text-4); font-size: var(--fs-sm); }

.toast-stack {
  position: fixed;
  top: var(--sp-5);
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  align-items: center;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - var(--sp-8));
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-3);
  border-radius: var(--r-md);
  box-shadow: var(--sh-lg);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
  animation: drop .2s var(--ease);
  max-width: 100%;
}
.toast--ok { border-left-color: var(--success); }
.toast--ok .toast__icon { color: var(--success); }
.toast--err { border-left-color: var(--danger); }
.toast--err .toast__icon { color: var(--danger); }
.toast--info { border-left-color: var(--info); }
.toast--info .toast__icon { color: var(--info); }
.toast__icon { flex-shrink: 0; line-height: 0; }

.confirm-dialog .modal__body { padding-top: var(--sp-2); }
.confirm-dialog__text { color: var(--text-2); line-height: 1.6; }

/* ---------- 9. 工具类 & 动画 ---------- */
.muted { color: var(--text-3); }
.muted-2 { color: var(--text-4); }
.strong { font-weight: 650; }
.small { font-size: var(--fs-sm); }
.tiny { font-size: var(--fs-xs); }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-num); }
.nowrap { white-space: nowrap; }
.right { margin-left: auto; }
.center { text-align: center; }
.brand-text { color: var(--brand); }
.danger-text { color: var(--danger); }
.success-text { color: var(--success); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mt-5 { margin-top: var(--sp-5); }
.mb-0 { margin-bottom: 0; }
.mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); }
.w-full { width: 100%; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes drop { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 14px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes slide-left { from { transform: translateX(100%); } to { transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  .page { padding: var(--sp-5) var(--sp-4) var(--sp-10); }
  .topbar__inner { padding: 0 var(--sp-4); }
}

@media (max-width: 860px) {
  .topbar > .topbar__inner > .nav { display: none; }
  .nav-toggle { display: grid; }
  .brand__text { font-size: var(--fs-md); }
  .field-grid, .field-grid--3 { grid-template-columns: 1fr; }
  .modal--wide, .modal--xl { width: 100%; }
}

@media (max-width: 640px) {
  :root { --topbar-h: 54px; --fs-2xl: 20px; }
  .page { padding: var(--sp-4) var(--sp-3) 96px; }
  .page-head { margin-bottom: var(--sp-4); }
  .search { max-width: none; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--sp-3); }
  .product-card__media { height: 140px; }
  .product-card__media img { max-height: 124px; }

  /* 表格转卡片 */
  .table-wrap.is-stacked { border: 0; background: none; box-shadow: none; }
  .table-wrap.is-stacked .table-scroll { overflow: visible; }
  .table.is-stacked thead { display: none; }
  .table.is-stacked, .table.is-stacked tbody, .table.is-stacked tfoot { display: block; }
  .table.is-stacked tbody tr, .table.is-stacked tfoot tr {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-xs);
    padding: var(--sp-2) var(--sp-3);
    margin-bottom: var(--sp-3);
  }
  .table.is-stacked td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--sp-3);
    padding: 7px 0;
    border-bottom: 1px dashed var(--border);
    text-align: right;
  }
  .table.is-stacked td:last-child { border-bottom: 0; }
  .table.is-stacked td::before {
    content: attr(data-label);
    font-size: var(--fs-xs);
    font-weight: 700;
    color: var(--text-4);
    text-transform: uppercase;
    letter-spacing: .03em;
    text-align: left;
    flex-shrink: 0;
  }
  .table.is-stacked td[data-label=""]::before { content: none; }
  .table.is-stacked td.cell-full { display: block; text-align: left; }
  .table.is-stacked td.cell-full::before { display: block; margin-bottom: 5px; }
  .table.is-stacked .cell-product { justify-content: flex-end; }

  .offer-list { padding: var(--sp-3); gap: var(--sp-2); }
  .offer { padding: var(--sp-2); gap: var(--sp-2); flex-wrap: wrap; }
  .offer__media { width: 82px; height: 82px; }
  .offer__price-main { font-size: var(--fs-xl); }
  .offer__side { flex-direction: row; align-items: center; width: 100%; justify-content: space-between; }
  .share-hero { padding: var(--sp-4) var(--sp-3); }
  .share-toolbar { padding: var(--sp-2) var(--sp-3); }
  .cartbar__inner { padding: var(--sp-2) var(--sp-3); }
  .selection-bar { left: var(--sp-3); right: var(--sp-3); bottom: var(--sp-3); transform: none; max-width: none; border-radius: var(--r-lg); }
  .selection-bar .btn { flex: 1; }
  .login-card { margin: var(--sp-6) var(--sp-3); padding: var(--sp-5); }
  .modal { border-radius: var(--r-lg); }
  .modal__head { padding: var(--sp-4) var(--sp-4) var(--sp-2); }
  .modal__body { padding: 0 var(--sp-4) var(--sp-4); }
  .modal__foot { padding: var(--sp-3) var(--sp-4); }
  .modal__foot .btn { flex: 1; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: var(--sp-2); }
  .stat { padding: var(--sp-3); }
  .stat__value { font-size: var(--fs-xl); }
  .qr-box img { width: 160px; height: 160px; }
}

@media print {
  .topbar, .cartbar, .selection-bar, .page-actions, .toolbar, .share-toolbar { display: none !important; }
  body { background: #fff; }
  .table-wrap, .card { box-shadow: none; border-color: #ccc; }
}


/* ========================================================================
   Address Card
   ======================================================================== */
/* ========================================================================
   金额显示（<Money> 组件唯一样式来源）
   ======================================================================== */
.money {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.money--end { display: inline-block; text-align: right; }

/* 一键下单带过来的收件地址 */
.addr-carry {
  padding: var(--sp-3);
  background: var(--brand-soft);
  border: 1px solid var(--brand);
  border-radius: var(--radius);
}
.addr-carry__head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-bottom: var(--sp-2);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--c-border);
}
.addr-carry__head .btn-text { margin-left: auto; }
.addr-carry__body { line-height: 1.5; }

/* 地址区块：标题行 + 卡片网格 */
.addr-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.addr-section__title {
  margin: 0;
  font-size: var(--fs-md);
  font-weight: 600;
}
.addr-section__count {
  font-size: var(--fs-xs);
  color: var(--text-4);
  font-variant-numeric: tabular-nums;
}
.addr-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.address-card {
  display: flex;
  flex-direction: column;
  padding: var(--sp-3);
  background: var(--c-bg);
  border: 2px solid var(--c-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.address-card:hover {
  border-color: var(--c-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.address-card:focus-visible {
  outline: 2px solid var(--c-primary);
  outline-offset: 2px;
}

.address-card.is-selected {
  border-color: var(--c-primary);
  background: var(--c-primary-light);
}

.address-card__head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--c-border);
}

/* 单选指示点：仅靠边框色区分选中态不够明显 */
.address-card__head::before {
  content: '';
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border: 2px solid var(--c-border);
  border-radius: 50%;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.address-card.is-selected .address-card__head::before {
  border-color: var(--c-primary);
  background: var(--c-primary);
  box-shadow: inset 0 0 0 3px var(--surface-2);
}

.address-card__name {
  font-weight: 600;
  font-size: var(--fs-md);
  margin-right: auto;
}

.address-card__body {
  flex: 1 1 auto;
  margin-bottom: var(--sp-2);
  font-size: var(--fs-sm);
  line-height: 1.5;
  color: var(--c-text);
}
.address-card__phone { font-variant-numeric: tabular-nums; }
.address-card__company {
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
}
.address-card__lines {
  margin-top: 4px;
  font-size: var(--fs-xs);
  line-height: 1.5;
  color: var(--text-2);
}

.address-card__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  padding-top: var(--sp-2);
  border-top: 1px solid var(--c-border);
}
.address-card__foot .btn-text--danger { margin-left: auto; }

/* 新增 / 编辑表单底部：设为默认 + 保存 */
.addr-form__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-top: var(--sp-4);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--c-border);
}

.addr-foot__total {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.btn-text {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--c-primary);
  font-size: 13px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-text:hover {
  opacity: 0.7;
}

.btn-text:active {
  opacity: 0.5;
}

.btn-text:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-text--danger { color: var(--c-danger); }

.badge--xs {
  padding: 1px 6px;
  font-size: 11px;
}

/* Responsive */
@media (max-width: 768px) {
  .addr-list { grid-template-columns: 1fr; }

  .address-card { padding: var(--sp-3); }

  /* 触摸端把操作按钮拉开，避免误触删除 */
  .address-card__foot { gap: var(--sp-4); }

  .addr-form__foot { align-items: stretch; }
  .addr-form__foot .btn { width: 100%; }
}


/* ========================================================================
   --c-* 变量别名（地址卡片等组件使用）
   ======================================================================== */
:root {
  --c-bg: var(--surface-2);
  --c-bg-sub: var(--bg-sunken);
  --c-border: var(--border);
  --c-primary: var(--brand);
  --c-primary-light: var(--brand-soft);
  --c-danger: var(--danger);
  --c-text: var(--text);
  --c-text-muted: var(--text-3);
  --radius: var(--r-lg);
  --radius-sm: var(--r-md);
}


/* ========================================================================
   分享端顶栏：无品牌标题，菜单左置（含移动端）
   ======================================================================== */
.topbar--share .topbar__inner > .nav { display: flex; }
@media (max-width: 860px) {
  .topbar--share .topbar__inner > .nav { display: flex; }
  .topbar--share .nav-tools .nav-toggle { display: none; }
}


/* ========================================================================
   运费计算结果
   ======================================================================== */
.ship-result {
  padding: var(--sp-3);
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.ship-result__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 4px 0;
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.ship-result__row--sub { font-size: var(--fs-xs); color: var(--text-3); }
.ship-result__total {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}

/* 底栏按钮在窄屏下自适应：汇总占一行，按钮均分一行 */
@media (max-width: 640px) {
  .cartbar__inner { flex-wrap: wrap; }
  .cartbar__summary { flex-basis: 100%; }
  .cartbar .btn--lg { flex: 1; min-width: 0; padding-left: var(--sp-2); padding-right: var(--sp-2); font-size: var(--fs-sm); }
}


/* ========================================================================
   客户清单页：无页头标题，tabs 上移；清单卡片列表
   ======================================================================== */
.page--customer { padding-top: var(--sp-3); }
.page--customer > .tabs { margin-bottom: var(--sp-4); }

.order-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--sp-4);
  align-items: start;
}
.order-cards .pager { grid-column: 1 / -1; }
.order-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.order-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 4px 14px rgba(16, 24, 40, .06);
}
.order-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}
.order-card__head .cell-user { min-width: 0; flex: 1; }
.order-card__sub {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--text-3);
}
.order-card__sub > .truncate { color: var(--text-2); }
.order-card__meta {
  display: flex;
  align-items: baseline;
  gap: var(--sp-4);
  font-size: var(--fs-sm);
  color: var(--text-3);
  flex-wrap: wrap;
}
.order-card__meta b { color: var(--text); font-variant-numeric: tabular-nums; }
.order-card__amount {
  margin-left: auto;
  font-weight: 700;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}
.order-card__amount small { color: var(--text-3); font-weight: 500; margin-left: 4px; }
.order-card__recv {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--sp-2) var(--sp-3);
  padding-right: var(--sp-8);
  background: var(--bg-sunken);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
}
/* 复制图标压在右上角，不占正文行宽 */
.order-card__copy {
  position: absolute;
  top: 4px;
  right: 4px;
}
.order-card__foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.order-card__detail {
  border-top: 1px solid var(--border);
  padding-top: var(--sp-3);
}
@media (max-width: 640px) {
  .order-cards { grid-template-columns: 1fr; gap: var(--sp-3); }
}
