:root {
  --primary: #f0a0b8;
  --primary-dark: #e07a98;
  --primary-deep: #c95f7e;
  --primary-soft: #fbd5df;
  --primary-tint: #fdeef2;
  --bg: #fff6f9;
  --bg-grad: linear-gradient(180deg, #fff6f9 0%, #fdeef3 100%);
  --surface: #ffffff;
  --surface-2: #fff9fb;
  --text: #4f3b41;
  --text-soft: #8a767c;
  --text-faint: #b3a3a8;
  --border: #f1dde3;
  --divider: #f4e6ea;
  --shadow: 0 6px 20px rgba(224, 122, 152, 0.12);
  --shadow-sm: 0 2px 8px rgba(224, 122, 152, 0.10);
  --radius: 16px;
  --radius-sm: 11px;
  --nav-h: 60px;
  --maxw: 520px;
  --font-size-base: 15px;
  --btn-bg: var(--primary);
  --btn-bg-hover: var(--primary-dark);
}

[data-theme="dark"] {
  --primary: #f0a0b8;
  --primary-dark: #e688a4;
  --primary-deep: #f0a0b8;
  --primary-soft: #5a3543;
  --primary-tint: #3a2a31;
  --bg: #241a1f;
  --bg-grad: linear-gradient(180deg, #241a1f 0%, #2c2026 100%);
  --surface: #2f232a;
  --surface-2: #34272e;
  --text: #f4e6ea;
  --text-soft: #c3aeb5;
  --text-faint: #8d7780;
  --border: #432f38;
  --divider: #3a2a31;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg-grad);
  background-attachment: fixed;
  font-size: var(--font-size-base, 15px);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-grad);
}

/* ---------- Header ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--primary) 14%, var(--surface));
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 18px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
#page-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text);
}
.header-right { margin-left: auto; }
.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--primary-deep);
  background: var(--primary-tint);
  border: 1px solid var(--primary-soft);
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
}
.page-sub {
  font-size: 12.5px;
  color: var(--text-soft);
}

/* ---------- Main ---------- */
.app-main {
  flex: 1;
  padding: 14px 14px calc(var(--nav-h) + 84px);
  overflow-x: hidden;
}

.section-gap { margin-bottom: 12px; }

/* ---------- Bottom Nav ---------- */
.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: var(--maxw);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 30;
  box-shadow: 0 -4px 16px rgba(224, 122, 152, 0.08);
}
.nav-item {
  flex: 1;
  border: none;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-faint);
  font-size: 11px;
  cursor: pointer;
  transition: color 0.15s;
  padding: 0;
}
.nav-item svg { width: 24px; height: 24px; }
.nav-item.active { color: var(--primary-deep); font-weight: 600; }
.nav-item:active { transform: scale(0.94); }

/* ---------- FAB ---------- */
.fab {
  position: fixed;
  right: max(18px, calc(50% - var(--maxw) / 2 + 18px));
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 18px);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--btn-bg);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 22px rgba(224, 122, 152, 0.45);
  cursor: pointer;
  z-index: 35;
  transition: transform 0.12s;
}
.fab:active { transform: scale(0.92); }
.fab[hidden] { display: none !important; }

/* ---------- Order filter bar ---------- */
.ord-filter {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 8px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 5px;
}
.ord-filter .filter-search {
  flex: 0 1 90px;
  min-width: 60px;
  padding: 6px 8px;
  font-size: 12px;
}
.ord-filter .date-input {
  flex: 1 1 0;
  min-width: 0;
  padding: 6px 4px;
  font-size: 11px;
}
.date-sep { color: var(--text-faint); font-size: 11px; flex: 0 0 auto; }
.export-btn {
  flex: 0 0 auto;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.7;
  background: #ffe9ec;
  color: #d6435a;
  border: none;
}

/* ---------- Cards ---------- */
.order-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  align-items: stretch;
}
.order-card .card-bar {
  flex: 0 0 4px;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
}
.order-card .card-main { flex: 1; min-width: 0; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 15px;
  cursor: pointer;
}
.card-info { min-width: 0; flex: 1; display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; overflow: hidden; }
.card-customer {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  min-width: 0;
  max-width: 12em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 1;
}
.card-qty { font-size: 13px; font-weight: 500; color: var(--primary-deep); white-space: nowrap; flex-shrink: 0; }
.card-tags { display: inline-flex; flex-shrink: 0; }
.card-arrow {
  color: var(--primary);
  font-size: 11px;
  align-self: center;
  margin-left: 8px;
  flex: 0 0 auto;
}
.card-detail {
  padding: 0 15px 4px;
  border-top: 1px dashed var(--divider);
}
.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 13.5px;
  border-bottom: 1px solid var(--divider);
}
.detail-row:last-child { border-bottom: none; }
.detail-row .k { color: var(--text-soft); }
.detail-row .v { color: var(--text); font-weight: 500; }
.detail-row .profit-v { color: var(--primary-deep); font-weight: 700; }
.detail-note {
  padding: 8px 0;
  font-size: 13px;
  color: var(--text-soft);
  border-top: 1px solid var(--divider);
}
.card-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 15px;
  border-top: 1px solid var(--divider);
  font-size: 12.5px;
  color: var(--text-soft);
}
.card-footer .foot-date { color: var(--text-faint); }
.card-footer .foot-actions { margin-left: auto; display: flex; gap: 6px; }
.card-footer .foot-actions button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 12.5px;
  cursor: pointer;
}
.card-footer .foot-actions .act-edit:active { color: var(--primary-dark); border-color: var(--primary); }
.card-footer .foot-actions .act-del:active { color: #d9534f; border-color: #f3c9cb; }

/* ---------- Tags ---------- */
.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.7;
}
.tag-xhs { background: #ffe9ec; color: #d6435a; }
.tag-wx { background: #e4f6e9; color: #1f9d4d; }
[data-theme="dark"] .tag-xhs { background: #4a2a30; color: #ff9aab; }
[data-theme="dark"] .tag-wx { background: #22402f; color: #7fe0a0; }

/* ---------- Tables ---------- */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  table-layout: fixed;
}
table.data thead th {
  text-align: left;
  padding: 12px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-soft);
  background: var(--surface-2);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
table.data thead th:first-child,
table.data tbody td:first-child { width: 55%; }
table.data thead th.num,
table.data tbody td.num { width: 22.5%; text-align: right; }
table.data tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--divider);
  color: var(--text);
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:active { background: var(--surface-2); }
.cell-name {
  font-weight: 600;
  display: flex;
  align-items: center;
  min-width: 0;
}
.cell-name > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cell-sub { font-size: 12px; color: var(--text-soft); margin-top: 2px; }
.cell-amount { font-weight: 600; color: var(--primary-deep); }
.rank-no {
  display: inline-block;
  min-width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-deep);
  background: var(--primary-tint);
  border-radius: 6px;
  margin-right: 8px;
}
.cust-link { color: inherit; text-decoration: none; }
.cust-link:active { color: var(--primary-deep); }
.count-bar {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: var(--primary-tint);
  border: 1px solid var(--primary-soft);
  border-radius: 12px;
  padding: 11px 15px;
  margin-bottom: 12px;
}
.color-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.color-dot {
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.12s;
}
.color-dot.active { border-color: var(--text); transform: scale(1.04); }
.color-dot:active { transform: scale(0.95); }
.icon-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.icon-pill {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  padding: 11px;
  text-align: center;
  font-size: 14px;
  cursor: pointer;
  color: var(--text-soft);
}
.icon-pill.active { border-color: var(--primary); background: var(--primary-tint); color: var(--primary-deep); font-weight: 600; }

/* ---------- 历史订单弹窗 ---------- */
.hist-summary {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}
.hist-name { font-size: 17px; font-weight: 700; color: var(--text); }
.hist-meta { font-size: 13px; color: var(--text-soft); margin-top: 4px; }
.hist-addr { font-size: 12.5px; color: var(--text-soft); margin-top: 4px; }
.hist-order {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 10px;
  overflow: hidden;
}
.hist-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
}
.hist-head > div:first-child { flex: 1; min-width: 0; }
.hist-date { font-size: 14px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 6px; }
.hist-sub { font-size: 12.5px; color: var(--text-soft); margin-top: 2px; }
.hist-amt { font-size: 15px; font-weight: 700; color: var(--primary-deep); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.mini-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12.5px;
  cursor: pointer;
}
.mini-btn:active { background: var(--primary-tint); color: var(--primary-dark); }
.mini-btn.danger { color: #d9534f; border-color: #f3c9cb; }

/* ---------- Empty ---------- */
.empty {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-faint);
}
.empty .empty-title { font-size: 15px; color: var(--text-soft); margin-bottom: 6px; }
.empty .empty-sub { font-size: 13px; }

/* ---------- Filter bar (stat) ---------- */
.filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 12px;
  -webkit-overflow-scrolling: touch;
}
.filter-bar::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  border-radius: 999px;
  padding: 7px 15px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.chip.active {
  background: var(--btn-bg);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

/* ---------- Stat: profit big card ---------- */
.profit-card {
  background: var(--btn-bg);
  color: #fff;
  border-radius: var(--radius);
  padding: 22px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.profit-card .label { font-size: 13px; opacity: 0.92; }
.profit-card .value { font-size: 34px; font-weight: 800; margin-top: 6px; letter-spacing: 0.5px; }
.profit-card .meta { font-size: 12.5px; opacity: 0.9; margin-top: 8px; }

/* ---------- Stat grid ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.stat-cell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}
.stat-cell .s-label { font-size: 12.5px; color: var(--text-soft); }
.stat-cell .s-value { font-size: 21px; font-weight: 700; color: var(--text); margin-top: 4px; }
.stat-cell .s-sub { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }
.stat-cell.accent .s-value { color: var(--primary-deep); }

.panel-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin: 4px 2px 10px;
}

/* ---------- 客户详情页 ---------- */
.back-bar { margin-bottom: 10px; }
.back-btn {
  border: none; background: none;
  color: var(--text-soft); font-size: 14px;
  padding: 4px 0; cursor: pointer;
}
.back-btn:active { color: var(--primary-deep); }
.detail-grid { margin-bottom: 14px; }
.detail-grid .s-value { font-size: 18px; }
.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.pc-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}
.pc-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--divider);
}
.pc-row:last-child { border-bottom: none; }
.pc-label { color: var(--text-soft); }
.pc-value { color: var(--text); font-weight: 500; text-align: right; max-width: 60%; }
.hist-table tbody tr { cursor: pointer; }
.hist-table tbody tr:active { background: var(--surface-2); }

/* ---------- 订单详情弹窗 ---------- */
.od-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.od-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--divider);
}
.od-line:last-child { border-bottom: none; }
.od-k { color: var(--text-soft); }
.od-v { color: var(--text); font-weight: 500; }
.od-items { margin-bottom: 14px; }
.od-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  font-size: 14.5px;
  border-bottom: 1px solid var(--divider);
}
.od-row:last-child { border-bottom: none; }
.od-name { color: var(--text); font-weight: 500; }
.od-price { color: var(--text-soft); font-size: 13.5px; }
.od-total {
  background: var(--primary-tint);
  border: 1px solid var(--primary-soft);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text);
  font-weight: 600;
}

/* ---------- 客户购买商品汇总 ---------- */
.product-summary-body {
  display: flex;
  flex-direction: column;
  max-height: 60vh;
  padding: 0;
}
.summary-list {
  overflow-y: auto;
  flex: 1;
  padding: 16px 18px;
}
.summary-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  font-size: 14.5px;
  border-bottom: 1px solid var(--divider);
}
.summary-row:last-child { border-bottom: none; }
.summary-name { flex: 1; min-width: 0; color: var(--text); font-weight: 500; }
.summary-qty { color: var(--text-soft); font-size: 13.5px; white-space: nowrap; }
.summary-price { color: var(--text); font-weight: 600; min-width: 70px; text-align: right; }
.summary-foot {
  border-top: 1px solid var(--divider);
  background: var(--surface-2);
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom, 0px));
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

/* ---------- 渠道表格卡片 ---------- */
.channel-table-card { padding: 0; overflow: hidden; }
.channel-table-card .data { border: none; }
.channel-table-card thead th { background: var(--surface-2); }
.channel-table-card tbody td { padding: 14px; }
.channel-table-card tbody td.num { font-weight: 700; color: var(--primary-deep); }

/* ---------- 统计页渠道卡片 ---------- */
.stat-cell.channel-cell {
  display: flex;
  flex-direction: column;
  padding: 14px;
}
.ch-head {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-soft);
  font-weight: 600;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--divider);
  margin-bottom: 6px;
}
.ch-body { display: flex; flex-direction: column; gap: 8px; flex: 1; justify-content: center; }
.ch-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}
.ch-tag { display: flex; align-items: center; }
.ch-amt { font-size: 16px; font-weight: 700; color: var(--text); }
.empty-channel { justify-content: center; }
.ch-empty { flex: 1; display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--text-faint); padding: 20px 0; }

/* ---------- 优惠摘要 ---------- */
.discount-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 13px;
  color: var(--text-soft);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}
.discount-summary .ds-profit {
  color: var(--primary-deep);
  font-weight: 700;
  margin-left: auto;
}

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field > label {
  display: block;
  font-size: 13px;
  color: var(--text-soft);
  margin-bottom: 6px;
  font-weight: 500;
}
.input, .textarea, .select {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-tint);
}
.textarea { resize: vertical; min-height: 64px; }

/* customer search suggestions */
.suggest {
  position: relative;
}
.suggest-list {
  position: absolute;
  left: 0; right: 0; top: calc(100% + 4px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: 5;
  max-height: 220px;
  overflow-y: auto;
}
.suggest-item {
  padding: 11px 12px;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--divider);
}
.suggest-item:last-child { border-bottom: none; }
.suggest-item:active { background: var(--primary-tint); }

/* channel radio */
.radio-row { display: flex; gap: 10px; }
.radio-pill {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 11px;
  text-align: center;
  font-size: 14px;
  cursor: pointer;
  color: var(--text-soft);
}
.radio-pill.active {
  border-color: var(--primary);
  background: var(--primary-tint);
  color: var(--primary-deep);
  font-weight: 600;
}

/* selected items list in editor */
.pick-list { display: flex; flex-direction: column; gap: 8px; }
.pick-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.pick-item .pi-name { flex: 1; font-size: 14px; }
.pick-item .pi-price { font-size: 13px; color: var(--text-soft); }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button {
  width: 28px; height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--primary-deep);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.stepper .qty { min-width: 22px; text-align: center; font-weight: 600; }
.pick-remove {
  border: none; background: none; color: var(--text-faint);
  font-size: 18px; cursor: pointer; padding: 0 4px;
}

/* ---------- Buttons ---------- */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-primary { background: var(--btn-bg); color: #fff; }
.btn-primary:active { background: var(--btn-bg-hover); }
.btn-ghost { background: var(--surface); color: var(--text-soft); border: 1px solid var(--border); }
.btn-ghost:active { background: var(--surface-2); }
.btn-danger { background: #fff; color: #e74c3c; border: 1px solid #e74c3c; }
.btn-danger:active { background: #ffeaea; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; }

/* ---------- Modal ---------- */
#modal-root { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(79, 59, 65, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  animation: fade 0.16s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideup { from { transform: translateY(28px); opacity: 0.6; } to { transform: translateY(0); opacity: 1; } }
.modal {
  background: var(--surface);
  width: 100%;
  max-width: var(--maxw);
  border-radius: 20px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideup 0.2s ease;
  overflow: hidden;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--divider);
}
.modal-title { font-size: 17px; font-weight: 700; color: var(--text); }
.modal-close {
  border: none; background: none; color: var(--text-faint);
  font-size: 22px; line-height: 1; cursor: pointer; padding: 0 2px;
}
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-foot {
  padding: 12px 18px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--divider);
  display: flex;
  gap: 10px;
}
.modal-foot .btn { flex: 1; }

/* product picker */
.picker-search { margin-bottom: 10px; }
.picker-search .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.picker-list { display: flex; flex-direction: column; }
.picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--divider);
  cursor: pointer;
}
.picker-row:active { background: var(--primary-tint); }
.picker-row .pr-name { flex: 1; font-size: 14.5px; }
.picker-row .pr-name .pr-qty {
  font-size: 12px;
  color: var(--primary-deep);
  margin-left: 6px;
  font-weight: 600;
}
.picker-row .pr-price { font-size: 13px; color: var(--text-soft); margin-right: 4px; }
.picker-empty { text-align: center; padding: 26px 10px; color: var(--text-soft); }
.picker-empty .new-prod-btn {
  margin-top: 12px;
  border: 1px dashed var(--primary);
  background: var(--primary-tint);
  color: var(--primary-deep);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
}

/* ---------- Toast ---------- */
.toast-root {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + 30px);
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: rgba(79, 59, 65, 0.92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  box-shadow: var(--shadow);
  animation: toastin 0.2s ease;
  max-width: 80vw;
}
@keyframes toastin { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- List (profile) ---------- */
.menu-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}
.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 16px;
  border-bottom: 1px solid var(--divider);
  cursor: pointer;
  font-size: 15px;
}
.menu-item:last-child { border-bottom: none; }
.menu-item:active { background: var(--surface-2); }
.menu-item .mi-right { color: var(--text-faint); font-size: 13.5px; display: flex; align-items: center; gap: 6px; }
.menu-item .mi-arrow { color: var(--text-faint); }

.switch {
  position: relative;
  width: 46px; height: 26px;
  background: var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s;
  flex: 0 0 auto;
}
.switch.on { background: var(--primary); }
.switch::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.switch.on::after { transform: translateX(20px); }

.about-text { color: var(--text-soft); font-size: 13.5px; line-height: 1.7; }
.about-text .ver { color: var(--text); font-weight: 600; }

/* ---------- 壁纸层 ---------- */
.wallpaper-layer {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.wallpaper-layer.fit-contain { background-size: contain; background-repeat: no-repeat; }
.wallpaper-layer.fit-center { background-size: auto; background-position: center; background-repeat: no-repeat; }
.wallpaper-layer.fit-cover { background-size: cover; background-repeat: no-repeat; }

/* ---------- 外观设置扩展 ---------- */
.appearance-preview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
  text-align: center;
}
.appearance-preview .pv-text { font-size: var(--font-size-base); color: var(--text); margin-bottom: 10px; }
.appearance-preview .pv-btn {
  display: inline-block;
  background: var(--btn-bg);
  color: #fff;
  border-radius: 10px;
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 600;
}
.appearance-preview .pv-chip {
  display: inline-block;
  background: var(--btn-bg);
  color: #fff;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  margin-left: 6px;
}

.seg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.seg-grid.two-col { grid-template-columns: repeat(2, 1fr); }
.seg-pill {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  font-size: 14px;
  cursor: pointer;
  color: var(--text-soft);
}
.seg-pill.active { border-color: var(--primary); background: var(--primary-tint); color: var(--primary-deep); font-weight: 600; }

.gradient-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.gradient-row .grad-label { font-size: 13px; color: var(--text-soft); white-space: nowrap; }
.gradient-row input[type="color"] { width: 42px; height: 32px; border: none; background: none; cursor: pointer; }
.grad-preview {
  flex: 1; height: 32px; border-radius: 8px; border: 1px solid var(--border);
}

.upload-area {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  color: var(--text-soft);
  font-size: 13px;
}
.upload-area:active { border-color: var(--primary); background: var(--primary-tint); }
.upload-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.upload-preview img { width: 48px; height: 48px; object-fit: contain; border-radius: 8px; border: 1px solid var(--border); }
.upload-preview .up-actions { display: flex; gap: 8px; }
.upload-preview .up-btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-soft);
  border-radius: 8px; padding: 5px 10px; font-size: 12.5px; cursor: pointer;
}
.upload-preview .up-btn.danger { color: #d9534f; border-color: #f3c9cb; }

.nav-icon-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.nav-icon-cell {
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 4px;
  position: relative;
}
.nav-icon-cell .nic-label { font-size: 11px; color: var(--text-soft); margin-top: 4px; }
.nav-icon-cell .nic-icon { width: 24px; height: 24px; margin: 0 auto; }
.nav-icon-cell .nic-icon img { width: 24px; height: 24px; object-fit: contain; }
.nav-icon-cell .nic-icon svg { width: 24px; height: 24px; }
.nav-icon-cell .nic-upload {
  position: absolute; top: 4px; right: 4px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--primary); color: #fff; border: none;
  font-size: 11px; line-height: 18px; text-align: center;
  cursor: pointer; padding: 0;
}
.nav-icon-cell .nic-reset {
  position: absolute; bottom: 4px; right: 4px;
  font-size: 10px; color: var(--text-faint);
  background: none; border: none; cursor: pointer;
}
.nav-icon-cell.has-custom .nic-icon svg { display: none; }

.reset-btn {
  width: 100%; margin-top: 16px;
  border: 1px solid #f3c9cb; background: var(--surface);
  color: #d9534f; border-radius: 10px; padding: 12px;
  font-size: 14px; font-weight: 600; cursor: pointer;
}
