/* 愈心家 · 苹果客户管理体系
   视觉方向：暖米底 + 白色大圆角卡片 + 柔和渐变数据卡 + 黑色胶囊操作
   参考：轻量、留白、低对比边界、单一黑色主色、奶油色侧栏 */

@font-face {
  font-family: "Inter";
  src: url("/fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #efede7;
  --bg: #efede7;
  --surface: #fbfaf7;
  --surface-2: #f4f2ec;
  --surface-3: #e7e4dc;
  --ink: #141413;
  --ink-2: #4a4a45;
  --muted: #8b897f;
  --line: #e1ddd3;
  --line-strong: #d6d1c5;

  --brand: #141413;
  --brand-dark: #000000;
  --brand-soft: #ecebe3;

  --gold: #9c7418;
  --gold-2: #c8a24a;
  --gold-soft: #fbf1d8;

  --red: #b8493e;
  --red-soft: #faeae6;
  --dark-red: #8d241c;

  --amber: #a5741a;
  --amber-soft: #fbf1dd;

  --green: #4d7a4f;
  --green-soft: #e9f0e2;

  --lilac: #ded4f0;
  --lilac-2: #efeaf8;
  --mint: #dcefdc;
  --mint-2: #eef7ea;
  --lime: #d8f24b;
  --lime-ink: #2a3106;
  --sage: #93a878;

  --radius: 22px;
  --radius-sm: 14px;
  --shadow-sm: 0 1px 2px rgba(20, 20, 19, 0.03);
  --shadow-lg: 0 30px 90px rgba(20, 20, 19, 0.16);
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "HarmonyOS Sans SC", "Source Han Sans SC", "Noto Sans SC", "MiSans", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  --num: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei UI", sans-serif;
  --mono: "SF Mono", "Cascadia Code", "JetBrains Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-optical-sizing: auto;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: rgba(217, 239, 122, 0.55); }

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.5px; }
p { margin: 0; }
svg { flex: none; }

/* ---------------- 登录 ---------------- */
.login-wrap { display: grid; grid-template-columns: 1.05fr 0.95fr; min-height: 100vh; background: var(--bg); }
.login-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 52px 56px;
  background: linear-gradient(150deg, #e9e4d6 0%, #f5f2e9 46%, #e6ead9 100%);
  color: var(--ink);
}
.login-brand::before {
  content: "";
  position: absolute;
  width: 520px; height: 520px;
  right: -160px; top: -190px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.9), rgba(222, 212, 240, 0.55) 55%, transparent 72%);
  filter: blur(2px);
}
.login-brand::after {
  content: "";
  position: absolute;
  width: 460px; height: 460px;
  left: -140px; bottom: -220px;
  border-radius: 50%;
  background: radial-gradient(circle at 55% 45%, rgba(255, 255, 255, 0.75), rgba(205, 232, 183, 0.45) 58%, transparent 74%);
}
.login-logo { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.login-logo svg { flex: none; filter: drop-shadow(0 8px 18px rgba(43, 49, 6, 0.14)); }
.login-logo strong { font-size: 18px; letter-spacing: 5px; font-weight: 600; }
.login-hero { position: relative; z-index: 1; max-width: 520px; }
.login-hero .eyebrow {
  display: inline-flex;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(22, 25, 22, 0.08);
  color: var(--ink-2);
  font-size: 11.5px;
  letter-spacing: 1.2px;
  margin-bottom: 22px;
}
.login-hero h1 { font-size: 46px; line-height: 1.22; letter-spacing: -1.8px; font-weight: 600; }
.login-hero h1 em { font-style: normal; color: #7b8f5e; }
.login-hero p { color: #5f6258; font-size: 14.5px; line-height: 1.95; max-width: 430px; margin-top: 18px; }
.login-points { display: flex; gap: 30px; margin-top: 40px; position: relative; z-index: 1; }
.login-points div { border-left: 1px solid rgba(22, 25, 22, 0.16); padding-left: 15px; }
.login-points strong { display: block; font-size: 21px; font-weight: 650; letter-spacing: -0.4px; }
.login-points span { font-size: 11.5px; color: #7c8277; }
.login-brand .foot { position: relative; z-index: 1; font-size: 11.5px; color: #8b9084; letter-spacing: 1px; }

.login-panel { display: grid; place-items: center; padding: 44px 34px; background: var(--surface); }
.login-card { width: 100%; max-width: 400px; }
.login-card h2 { font-size: 28px; letter-spacing: -0.8px; }
.login-card .sub { color: var(--muted); margin: 8px 0 30px; font-size: 13px; }
.login-card .field { margin-bottom: 18px; }
.login-card .btn { width: 100%; margin-top: 8px; padding: 13px; font-size: 14.5px; }
.login-hint {
  margin-top: 25px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.9;
}
.login-hint b { color: var(--ink-2); font-weight: 600; }
.login-error {
  display: none;
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--red-soft);
  border: 1px solid #f0cdc8;
  color: var(--dark-red);
  font-size: 12.5px;
}
.login-error.show { display: block; }

/* ---------------- 框架 ---------------- */
.shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 252px;
  padding: 24px 16px 20px;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #f2f0ea, #ece9e1);
  border-right: 1px solid var(--line);
  z-index: 60;
}
.sidebar .brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px 26px; }
.sidebar .brand svg { flex: none; }
.sidebar .brand strong { display: block; font-size: 16px; letter-spacing: 3px; font-weight: 600; color: var(--ink); }
.sidebar .brand span { display: block; margin-top: 3px; font-size: 9px; letter-spacing: 1.8px; color: var(--muted); text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 6px; }
.nav-group-label { font-size: 10px; letter-spacing: 1.8px; color: #a09d92; margin: 22px 14px 10px; text-transform: uppercase; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 15px;
  border-radius: 14px;
  border: 1px solid transparent;
  color: var(--ink-2);
  font-size: 14.5px;
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}
.nav a svg { width: 19px; height: 19px; opacity: 0.75; }
.nav a:hover { background: rgba(251, 250, 247, 0.72); color: var(--ink); }
.nav a.active {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(20, 20, 19, 0.04);
}
.nav a.active::before { display: none; }
.nav a.active svg { opacity: 1; color: var(--ink); }
.sidebar-foot { margin-top: auto; padding: 16px 8px 0; border-top: 1px solid rgba(20, 20, 19, 0.08); }
.sidebar-foot .who { display: flex; align-items: center; gap: 11px; padding: 6px 4px; }
.sidebar-foot .avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: #dfe8c8;
  color: #2c2c22;
  display: grid; place-items: center;
  font-size: 14px; font-weight: 600; flex: none;
}
.sidebar-foot .who b { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.sidebar-foot .who span { font-size: 11.5px; color: var(--muted); }
.sidebar-foot .logout { margin-top: 12px; width: 100%; }

.main { margin-left: 252px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40;
  min-height: 64px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 32px;
  background: rgba(239, 237, 231, 0.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(20, 20, 19, 0.06);
}
.topbar .crumb { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.topbar .crumb b { color: var(--ink); font-weight: 600; font-size: 15px; letter-spacing: -0.2px; }
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.menu-toggle { display: none; cursor: pointer; }
.drawer-mask { display: none; }
.install-btn { display: none; }
.topbar .right { display: flex; align-items: center; gap: 12px; }
.topbar .today { font-size: 11.5px; color: var(--muted); }
.role-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink-2);
}
.role-pill.admin { background: var(--gold-soft); color: var(--gold); border-color: #eadcba; }
.content { padding: 30px 34px 64px; width: 100%; max-width: 1460px; margin: 0 auto; }

.site-foot {
  margin-top: auto;
  padding: 4px 34px 22px;
  text-align: center;
  font-size: 11.5px;
  letter-spacing: 0.5px;
  color: #8b9084;
}
.site-foot a { color: inherit; text-decoration: none; }
.site-foot a:hover { color: var(--ink-2); text-decoration: underline; }
.login-brand .foot a { color: inherit; text-decoration: none; }
.login-brand .foot a:hover { text-decoration: underline; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 31px; line-height: 1.15; letter-spacing: -1.4px; font-weight: 600; }
.page-head .desc { color: var(--muted); font-size: 12.5px; margin-top: 7px; max-width: 720px; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-title h2 { font-size: 16px; letter-spacing: -0.3px; }
.section-title .sub { font-size: 12px; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card.pad { padding: 22px 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 20px 24px 0; flex-wrap: wrap; }
.card-title { font-size: 14.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; letter-spacing: -0.1px; }
.card-title .hint { font-size: 11px; color: var(--muted); font-weight: 400; }
.card-body { padding: 16px 24px 22px; }
.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.dash-split { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.empty { padding: 54px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.loading { padding: 60px; text-align: center; color: var(--muted); font-size: 13px; }
.loading::before {
  content: "";
  display: inline-block;
  width: 15px; height: 15px;
  margin-right: 9px;
  vertical-align: -2px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- 按钮 / 表单 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 17px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--brand);
  color: #fff;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.4;
  transition: background 0.16s, transform 0.16s, box-shadow 0.16s;
  white-space: nowrap;
}
.btn:hover { background: var(--brand-dark); transform: translateY(-1px); box-shadow: 0 8px 18px rgba(20, 20, 19, 0.14); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.secondary { background: var(--surface); border-color: var(--line); color: var(--ink-2); }
.btn.secondary:hover { background: var(--surface-2); box-shadow: none; }
.btn.ghost { background: transparent; color: var(--ink-2); border-color: transparent; padding: 7px 11px; }
.btn.ghost:hover { background: rgba(20, 20, 19, 0.05); box-shadow: none; }
.btn.danger { background: var(--red); }
.btn.danger:hover { background: #a5372c; }
.btn.danger-outline { background: var(--surface); color: var(--red); border-color: #ecc7c2; }
.btn.danger-outline:hover { background: var(--red-soft); box-shadow: none; }
.btn.gold { background: var(--gold); }
.btn.gold:hover { background: #876313; }
.btn.wechat { background: var(--lime); color: var(--lime-ink); border-color: transparent; }
.btn.wechat:hover { background: #cbe640; box-shadow: 0 8px 18px rgba(120, 140, 20, 0.18); }
.btn.sm { padding: 6px 13px; font-size: 12px; }
.btn.lg { padding: 12px 24px; font-size: 14px; }

.icon-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: inline-grid; place-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  transition: background 0.16s;
}
.icon-btn:hover { background: var(--surface-2); }
.link { color: var(--ink); font-size: 12.5px; cursor: pointer; background: none; border: none; padding: 0; text-decoration: underline; text-decoration-color: #d5d0c4; text-underline-offset: 3px; }
.link:hover { text-decoration-color: var(--ink); }
.link.danger { color: var(--red); }
.link:disabled { color: var(--muted); cursor: not-allowed; text-decoration: none; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12px; color: var(--ink-2); font-weight: 550; }
.field .hint { font-size: 11px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%;
  padding: 10px 13px;
  border-radius: 11px;
  border: 1px solid var(--line-strong);
  background: #fff;
  font-size: 13px;
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s;
}
.input::placeholder, .textarea::placeholder { color: #b0b4aa; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(22, 25, 22, 0.07); }
.input:disabled, .select:disabled { background: var(--surface-2); color: var(--muted); }
.textarea { resize: vertical; min-height: 88px; line-height: 1.7; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b9087' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.input.mini { width: 80px; padding: 7px 9px; text-align: center; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--brand); }
.inline-fields { display: flex; gap: 10px; }
.inline-fields > * { flex: 1; }
.radio-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.radio-card { position: relative; display: block; cursor: pointer; }
.radio-card input { position: absolute; opacity: 0; pointer-events: none; }
.radio-card .inner {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.radio-card .inner .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.radio-card .inner b { display: block; font-size: 13px; font-weight: 600; }
.radio-card .inner small { display: block; font-size: 11px; color: var(--muted); }
.radio-card input:checked + .inner {
  border-color: var(--ink);
  background: #faf9f4;
  box-shadow: 0 0 0 3px rgba(22, 25, 22, 0.07);
}

/* ---------------- 工具栏 / 表格 ---------------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 16px 24px; border-bottom: 1px solid var(--line); }
.toolbar .search { position: relative; flex: 1; min-width: 190px; max-width: 320px; }
.toolbar .search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.toolbar .search .input { padding-left: 36px; height: 37px; border-radius: 999px; background: var(--surface-2); border-color: transparent; }
.toolbar .search .input:focus { background: var(--surface); border-color: var(--line-strong); }
.toolbar .select, .toolbar .input.date { height: 37px; width: auto; min-width: 118px; border-radius: 999px; }
.toolbar .spacer { flex: 1; }
.toolbar .count { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: #97948a;
  background: #f4f2ec;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table th:first-child { border-top-left-radius: 12px; }
.table th:last-child { border-top-right-radius: 12px; }
.table td { padding: 13px 16px; border-bottom: 1px solid #ece8de; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background 0.12s; }
.table tbody tr:hover { background: #f7f5ef; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.overdue-row { background: #fdf2f0; }
.table tbody tr.overdue-row:hover { background: #fbeae7; }
.table tbody tr.overdue-row td:first-child { box-shadow: inset 3px 0 0 var(--dark-red); }
.table .num { font-variant-numeric: tabular-nums; font-family: var(--num); font-size: 14px; letter-spacing: 0; }
.table .right { text-align: right; }
.table .nowrap { white-space: nowrap; }
.table .cust { display: flex; align-items: center; gap: 10px; }
.table .cust .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface-3);
  color: var(--ink-2);
  display: grid; place-items: center;
  font-size: 12.5px; font-weight: 600; flex: none;
}
.table .cust b { display: block; font-weight: 550; font-size: 13.5px; }
.table .cust span { display: block; font-size: 11px; color: var(--muted); }
.table .item-lines { font-size: 12px; color: var(--ink-2); line-height: 1.7; }
.table .item-lines span { display: inline-block; margin-right: 10px; color: var(--muted); }

/* ---------------- 标签 ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-target { color: #5f6b76; background: #eef1f4; border-color: #e0e5ea; }
.status-seed { color: #75762a; background: #f5f4dc; border-color: #e9e7c2; }
.status-green { color: #2f7d51; background: #e7f4ec; border-color: #d2eadc; }
.status-red { color: #b23a33; background: #fbeae8; border-color: #f2d4d1; }
.status-ripe { color: #a8641c; background: #fdf0dd; border-color: #f2dfc2; }
.status-golden {
  color: #7a5a10;
  background: linear-gradient(135deg, #fdf4dd, #f5e2aa);
  border-color: #e8d296;
  font-weight: 600;
}
.tier-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 21px; height: 21px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 650;
}
.follow-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
}
.follow-chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.follow-chip.overdue { background: var(--dark-red); color: #fff; border-color: var(--dark-red); font-weight: 600; }
.follow-chip.overdue::before { background: #ffd9d9; }
.follow-chip.today { background: var(--red-soft); color: var(--red); border-color: #f0cdca; font-weight: 600; }
.follow-chip.tomorrow { background: var(--amber-soft); color: var(--amber); border-color: #f0dcb5; }
.follow-chip.after2 { background: var(--green-soft); color: var(--green); border-color: #cfe8d9; }
.follow-chip.normal, .follow-chip.none { background: var(--surface-2); color: var(--muted); border-color: var(--line); }
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 11px;
  color: var(--ink-2);
}
.tag.add { cursor: pointer; border-style: dashed; color: var(--muted); background: transparent; }
.tag.gold { background: var(--gold-soft); border-color: #eadcba; color: var(--gold); }
.type-tag { font-size: 10.5px; padding: 2px 8px; border-radius: 6px; background: #eef1f4; color: #5f6b76; }
.type-tag.service { background: #f3eef8; color: #76558f; }
.gold-amount { color: var(--gold); font-weight: 650; }
.gold-amount::after { content: " ◆"; font-size: 9px; vertical-align: 2px; color: var(--gold-2); }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; vertical-align: 0; }

/* ---------------- 工作台数据区 ---------------- */
.dash-top { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; }
.hero-card {
  position: relative;
  display: flex; flex-direction: column;
  padding: 22px 24px 20px;
  border-radius: 24px;
  background:
    radial-gradient(120% 90% at 88% 8%, rgba(255, 255, 255, 0.72), transparent 55%),
    linear-gradient(135deg, #cfe37c 0%, #edefb2 46%, #efcf9e 100%);
  color: #23240f;
  overflow: hidden;
  min-height: 196px;
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.hero-card::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 58px;
  background-image: radial-gradient(rgba(35, 36, 15, 0.26) 1px, transparent 1px);
  background-size: 7px 7px;
  opacity: 0.45;
  -webkit-mask-image: linear-gradient(to top, #000, transparent);
  mask-image: linear-gradient(to top, #000, transparent);
  pointer-events: none;
}
.hero-card:hover { transform: translateY(-3px); }
.hero-card .hero-top { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hero-card .label { font-size: 10.5px; letter-spacing: 1.6px; text-transform: uppercase; opacity: 0.72; }
.hero-card .chip {
  display: inline-flex; align-items: center; padding: 4px 10px;
  border-radius: 999px; background: rgba(255, 255, 255, 0.62);
  font-size: 11px; font-weight: 600;
}
.hero-num {
  position: relative; z-index: 1;
  margin-top: auto; padding-top: 18px;
  font-family: var(--num);
  font-size: 54px; line-height: 0.95; letter-spacing: -1.8px;
  display: flex; align-items: baseline; gap: 3px;
  font-variant-numeric: tabular-nums;
}
.hero-num small { font-family: var(--sans); font-size: 17px; font-weight: 500; letter-spacing: 0; }
.hero-sub { position: relative; z-index: 1; display: flex; gap: 22px; flex-wrap: wrap; margin-top: 14px; font-size: 11.5px; opacity: 0.8; }
.hero-sub b { font-family: var(--num); font-size: 14px; font-weight: 600; }

.quick-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.qstat {
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 15px 17px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  color: inherit;
  transition: border-color 0.16s, transform 0.16s;
}
.qstat:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.qstat span { font-size: 11.5px; color: var(--muted); letter-spacing: 0.2px; }
.qstat b { margin-top: 10px; font-family: var(--num); font-size: 30px; font-weight: 600; line-height: 1; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
.qstat b i { font-family: var(--sans); font-style: normal; font-size: 11px; color: var(--muted); font-weight: 500; margin-left: 3px; }
.qstat.alert b { color: var(--red); }

@media (max-width: 900px) {
  .dash-top { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .hero-num { font-size: 46px; }
  .hero-card { min-height: 176px; }
}

/* ---------------- 漏斗 / 跟进列表 ---------------- */
.funnel { display: flex; flex-direction: column; gap: 14px; }
.funnel-row { display: grid; grid-template-columns: 108px 1fr 48px; align-items: center; gap: 12px; }
.funnel-row .name { font-size: 12.5px; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.funnel-row .name i { width: 8px; height: 8px; border-radius: 3px; flex: none; }
.funnel-track { height: 10px; border-radius: 999px; background: #ece9e1; overflow: hidden; }
.funnel-bar { height: 100%; border-radius: 999px; transition: width 0.7s cubic-bezier(0.2, 0.8, 0.2, 1); min-width: 2px; }
.funnel-row .count { text-align: right; font-family: var(--num); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.conversion { display: flex; flex-direction: column; justify-content: center; padding: 0 4px; }
.conversion .big { font-family: var(--num); font-size: 36px; font-weight: 600; letter-spacing: -1.4px; }
.conversion .lbl { font-size: 12px; color: var(--muted); }

.follow-list { display: flex; flex-direction: column; }
.follow-item { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid #efebe2; }
.follow-item:last-child { border-bottom: none; }
.follow-item .avatar {
  width: 38px; height: 38px; border-radius: 14px;
  background: #e3e0d4;
  color: #2c2c22;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 600; flex: none;
}
.follow-list .follow-item:nth-child(3n + 1) .avatar { background: #dfe8c8; }
.follow-list .follow-item:nth-child(3n + 2) .avatar { background: #ecdfc9; }
.follow-list .follow-item:nth-child(3n) .avatar { background: #e2dfe9; }
.follow-item .info { flex: 1; min-width: 0; }
.follow-item .info b { font-size: 13.5px; font-weight: 600; }
.follow-item .info span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.follow-item .act { display: flex; align-items: center; gap: 8px; }
.overdue-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--red-soft);
  border: 1px solid #f0d2cd;
  color: var(--dark-red);
  margin-bottom: 6px;
}
.overdue-head b { font-size: 12px; letter-spacing: 0.2px; display: flex; align-items: center; gap: 7px; }
.overdue-head span { font-size: 11px; opacity: 0.75; }
.pin-flag { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; padding: 2px 8px; border-radius: 999px; background: rgba(184, 73, 62, 0.12); color: var(--dark-red); }

/* ---------------- 客户详情 ---------------- */
.back-link { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); margin-bottom: 14px; cursor: pointer; }
.back-link:hover { color: var(--ink); }
.profile-head {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}
.profile-main { display: flex; gap: 16px; align-items: center; min-width: 0; }
.profile-main .avatar {
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--surface-3);
  color: var(--ink-2);
  display: grid; place-items: center;
  font-size: 21px; font-weight: 650; flex: none;
}
.profile-main .avatar.gold { background: linear-gradient(150deg, #f8ecd2, #efd9a7); color: #8a6414; }
.profile-main h1 { font-size: 23px; letter-spacing: -0.7px; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.profile-main .meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 7px; }
.profile-head .actions { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.golden-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 13px 18px;
  border-radius: 14px;
  background: linear-gradient(120deg, #fdf4dd, #f7e7b8);
  border: 1px solid #ead7a3;
  color: #7a5a10;
  font-size: 12.5px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.golden-banner b { font-weight: 650; }
.golden-banner .left { display: flex; align-items: center; gap: 9px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
.stat-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-box { padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.stat-box .k { font-size: 11px; color: var(--muted); }
.stat-box .v { font-family: var(--num); font-size: 23px; font-weight: 600; letter-spacing: -0.6px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-box .v small { font-size: 11.5px; color: var(--muted); font-weight: 400; }
.stat-box.gold { background: linear-gradient(150deg, #fffdf7, #faf0d8); border-color: #ecdcba; }
.side-card { padding: 18px 20px; }
.side-card + .side-card { margin-top: 16px; }
.side-card .label-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.side-card .label-row b { font-size: 13px; font-weight: 650; }
.info-list { display: flex; flex-direction: column; gap: 10px; }
.info-list .row { display: flex; justify-content: space-between; gap: 14px; font-size: 12.5px; padding-bottom: 9px; border-bottom: 1px dashed #efeae0; }
.info-list .row:last-child { border-bottom: none; padding-bottom: 0; }
.info-list .row span { color: var(--muted); white-space: nowrap; }
.info-list .row b { font-weight: 500; text-align: right; word-break: break-all; }
.follow-plan { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; background: var(--surface-2); border-radius: 12px; border: 1px solid var(--line); }
.follow-plan .date { font-size: 18px; font-weight: 700; letter-spacing: -0.4px; }
.follow-plan .date.overdue { color: var(--dark-red); }
.follow-plan .date.today { color: var(--red); }
.follow-plan .date.tomorrow { color: var(--amber); }
.follow-plan .date.after2 { color: var(--green); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 22px; overflow-x: auto; }
.tabs button {
  padding: 13px 4px;
  margin-right: 18px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  transition: color 0.15s;
}
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
.tab-panel { padding: 18px 22px 22px; }

/* 商品分类筛选 */
.cat-tabs { display: flex; gap: 8px; padding: 16px 20px 4px; flex-wrap: wrap; }
.cat-tabs button {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink-2); font-size: 12.5px; cursor: pointer;
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}
.cat-tabs button span {
  min-width: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
  font-size: 11px; line-height: 18px; text-align: center;
}
.cat-tabs button:hover { border-color: var(--ink); color: var(--ink); }
.cat-tabs button.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.cat-tabs button.active span { background: rgba(255,255,255,0.18); color: #fff; }

.cat-tag { display: inline-block; font-size: 11px; padding: 2px 9px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); }
.cat-tag.essential_oil { background: #eef3e6; color: #55702e; }
.cat-tag.food { background: #fbf0df; color: #8a6122; }
.cat-tag.minor { background: #f1edf8; color: #6b548b; }
.cat-tag.assessment { background: #eaf1fb; color: #3f628c; }
.cat-tag.trial { background: #e8f2f4; color: #316b76; }

.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 14px; }
.tl-rail { display: flex; flex-direction: column; align-items: center; flex: none; width: 14px; }
.tl-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink); margin-top: 6px; flex: none; box-shadow: 0 0 0 3px #efede7; }
.tl-dot.auto { background: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.tl-line { width: 1px; flex: 1; background: var(--line); margin: 4px 0; }
.tl-body { padding-bottom: 20px; flex: 1; min-width: 0; }
.tl-body .txt { font-size: 13px; color: var(--ink-2); line-height: 1.75; white-space: pre-wrap; word-break: break-word; }
.tl-body .meta { font-size: 11.5px; color: var(--muted); margin-top: 5px; display: flex; gap: 10px; flex-wrap: wrap; }
.tl-item:last-child .tl-body { padding-bottom: 0; }
.tl-item:last-child .tl-line { display: none; }

/* ---------------- 弹窗 / 提示 ---------------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 120;
  display: grid; place-items: center;
  padding: 24px;
  background: rgba(20, 20, 19, 0.36);
  backdrop-filter: blur(5px);
  opacity: 0;
  transition: opacity 0.18s;
  overflow-y: auto;
}
.modal-mask.show { opacity: 1; }
.modal {
  width: 100%; max-width: 520px;
  background: var(--surface);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  transform: translateY(14px) scale(0.985);
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
}
.modal-mask.show .modal { transform: none; }
.modal.md { max-width: 680px; }
.modal.lg { max-width: 860px; }
.modal.xl { max-width: 1040px; }
.modal header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 22px 26px 0; }
.modal header h3 { font-size: 19px; letter-spacing: -0.5px; }
.modal header .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--surface-2);
  color: var(--muted);
  display: grid; place-items: center;
  flex: none;
}
.modal-close:hover { background: var(--surface-3); color: var(--ink); }
.modal-body { padding: 20px 26px; overflow-y: auto; }
.modal footer { display: flex; justify-content: flex-end; gap: 10px; padding: 0 26px 24px; }
.modal .section { border-top: 1px dashed var(--line); padding-top: 16px; margin-top: 16px; }
.modal .section:first-child { border-top: none; padding-top: 0; margin-top: 0; }

.toast-root { position: fixed; right: 26px; bottom: 26px; z-index: 200; display: flex; flex-direction: column; gap: 9px; }
.toast {
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  font-size: 12.5px;
  box-shadow: 0 16px 40px rgba(22, 25, 22, 0.24);
  animation: toastIn 0.2s ease;
  max-width: 380px;
}
.toast.error { background: #7d2520; }
.toast.warn { background: #6f5110; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------------- 库存 / 报表 / 设置 ---------------- */
.warning-banner {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 11px 15px;
  border-radius: 12px;
  background: #fdf2f0;
  border: 1px solid #f1d2cd;
  color: #8f2f28;
  font-size: 12.5px;
}
.warning-banner .tag { background: #fff; border-color: #efcfcb; color: #8f2f28; }
.stock-warning { color: var(--red); font-weight: 650; }
.stock-ok { color: var(--green); }
.stock-muted { color: var(--muted); }

.report-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.report-tabs button {
  padding: 7px 15px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.report-tabs button:hover { border-color: var(--ink); }
.report-tabs button.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* 报表分组导航 */
.report-nav {
  display: flex; gap: 26px; flex-wrap: wrap; align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.report-nav-group { display: flex; flex-direction: column; gap: 8px; }
.report-nav-label { font-size: 10.5px; letter-spacing: 0.1em; color: var(--muted); padding-left: 2px; }
.report-nav-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.report-nav-tabs button {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.report-nav-tabs button:hover { border-color: var(--ink); }
.report-nav-tabs button.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* 月净利润报表 */
.profit-toolbar {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.profit-title { font-size: 17px; font-weight: 650; letter-spacing: -0.3px; }
.profit-toolbar .hint { margin-top: 5px; max-width: 620px; line-height: 1.7; }
.month-picker { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.month-picker .input { width: 160px; }
.profit-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; padding: 6px 0 2px; }
.donut-svg { width: 200px; height: 200px; flex: none; }
.donut-track { fill: none; stroke: var(--surface-3); stroke-width: 26; }
.donut-seg { fill: none; stroke-width: 26; stroke-linecap: butt; transition: stroke-dasharray 0.4s ease; }
.donut-center-v { text-anchor: middle; font-family: var(--num); font-size: 27px; font-weight: 600; fill: var(--ink); letter-spacing: -0.6px; }
.donut-center-k { text-anchor: middle; font-size: 11px; fill: var(--muted); }
.donut-legend { flex: 1; min-width: 190px; display: flex; flex-direction: column; gap: 10px; }
.donut-legend-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto auto; align-items: center; gap: 8px; font-size: 12.5px; }
.donut-legend-row i { width: 10px; height: 10px; border-radius: 3px; display: block; }
.donut-legend-row span { color: var(--muted); }
.donut-legend-row b { font-weight: 650; }
.donut-legend-row em { font-style: normal; font-size: 11.5px; color: var(--muted); min-width: 44px; text-align: right; }
.donut-legend-row.total { padding-top: 10px; border-top: 1px dashed var(--line); }
.donut-legend-row.total i { background: transparent; }
.donut-empty { flex: 1; }

.report-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.mini-stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 15px 17px; box-shadow: var(--shadow-sm); }
.mini-stat .k { font-size: 11px; color: var(--muted); }
.mini-stat .v { font-family: var(--num); font-size: 24px; font-weight: 600; letter-spacing: -0.7px; margin-top: 3px; }
.mini-stat .v.gold { color: var(--gold); }
.mini-stat .v.danger { color: var(--dark-red); }
.report-note { font-size: 11.5px; color: var(--muted); padding: 12px 0 0; line-height: 1.8; }
.report-note code { font-family: var(--mono); font-size: 11px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

.settings-layout, .settings-grid { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 18px; align-items: start; }
.settings-nav {
  display: flex; flex-direction: column; gap: 3px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  box-shadow: var(--shadow-sm);
}
.settings-nav button {
  text-align: left;
  padding: 10px 13px;
  border-radius: 11px;
  border: none;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
}
.settings-nav button:hover { background: var(--surface-2); }
.settings-nav button.active { background: var(--brand); color: #fff; font-weight: 550; }
.cycle-table input { width: 78px; text-align: center; }
.ext-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.ext-card { border: 1px solid var(--line); border-radius: 16px; padding: 17px 19px; background: var(--surface-2); }
.ext-card .top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.ext-card h3 { font-size: 14px; letter-spacing: -0.2px; margin-bottom: 5px; }
.ext-card p { font-size: 12px; color: var(--muted); line-height: 1.75; }
.reserved-pill { font-size: 10.5px; padding: 2px 8px; border-radius: 999px; background: #eef1f4; color: #64748b; }

/* ---------------- 订单 / 退款编辑 ---------------- */
.order-customer-box { padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; font-size: 12.5px; }
.order-lines { display: flex; flex-direction: column; gap: 9px; }
.order-line { display: grid; grid-template-columns: minmax(0, 1fr) 64px 88px 92px 32px; gap: 9px; align-items: center; }
.order-line .line-total { text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; font-weight: 550; }
.order-total-bar { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.order-total-bar .amt { font-family: var(--num); font-size: 26px; font-weight: 600; letter-spacing: -0.8px; color: var(--ink); }
.refund-lines { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.refund-line { display: grid; grid-template-columns: 1fr 84px 116px 100px; gap: 10px; align-items: center; padding: 11px 14px; border-bottom: 1px solid #f1eee7; }
.refund-line:last-child { border-bottom: none; }
.refund-line .pname { font-size: 13px; }
.refund-line .pmeta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.refund-line input { padding: 7px 9px; font-size: 12.5px; }
.refund-preview { margin-top: 14px; padding: 12px 15px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--line-strong); font-size: 12.5px; }
.refund-preview b.full { color: var(--red); }
.refund-preview b.partial { color: var(--amber); }
.pill-soft { display: inline-flex; padding: 2px 10px; border-radius: 999px; font-size: 11px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.pill-soft.red { background: var(--red-soft); border-color: #f0cdca; color: var(--red); }
.pill-soft.amber { background: var(--amber-soft); border-color: #f0dcb5; color: var(--amber); }
.pill-soft.green { background: var(--green-soft); border-color: #cfe8d9; color: var(--green); }
.pill-soft.gold { background: var(--gold-soft); border-color: #eadcba; color: var(--gold); }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1240px) {
  .grid.cols-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .detail-grid > * { min-width: 0; }
  .profit-grid { grid-template-columns: minmax(0, 1fr); }
  .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-layout, .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .settings-nav { flex-direction: row; overflow-x: auto; }
  .settings-nav button { white-space: nowrap; }
  .ext-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .sidebar {
    position: sticky; top: 0;
    width: auto; height: auto;
    flex-direction: row; align-items: center;
    padding: 10px 14px;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .sidebar .brand { padding: 0 14px 0 0; flex: none; }
  .sidebar .brand svg { width: 36px; height: 36px; }
  .sidebar .brand span { display: none; }
  .nav { flex-direction: row; flex: none; }
  .nav-group-label, .sidebar-foot { display: none; }
  .main { margin-left: 0; }
  .topbar { padding: 0 18px; }
  .content { padding: 20px 16px 50px; }
  .grid.cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-head h1 { font-size: 24px; }
}
@media (max-width: 640px) {
  .grid.cols-2, .grid.cols-4, .grid.cols-5, .report-kpis { grid-template-columns: 1fr; }
  .dash-split { grid-template-columns: minmax(0, 1fr); }
  .report-nav {
    flex-wrap: nowrap;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .report-nav::-webkit-scrollbar { display: none; }
  .report-nav-group { flex-direction: row; align-items: center; gap: 8px; flex: none; }
  .report-nav-label { padding-left: 0; white-space: nowrap; font-size: 11px; }
  .report-nav-tabs { flex-wrap: nowrap; }
  .report-nav-tabs button { min-height: 40px; padding: 7px 14px; font-size: 12.5px; white-space: nowrap; }
  .donut-wrap { justify-content: center; }
  .profit-toolbar { flex-direction: column; align-items: stretch; }
  .month-picker { justify-content: space-between; }
  .form-grid { grid-template-columns: 1fr; }
  .mini-stat { padding: 12px 12px; }
  .mini-stat .v { font-size: 21px; }
  .mini-stat .k { font-size: 11px; }
  .radio-grid { grid-template-columns: 1fr; }
  .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-head { align-items: flex-start; flex-direction: column; }
  .toolbar { padding: 14px 16px; }
  .toolbar .search { max-width: none; }
  .card-head, .card-body { padding-left: 16px; padding-right: 16px; }
  .modal-body { padding: 18px; }
  .modal header, .modal footer { padding-left: 18px; padding-right: 18px; }
  .order-line { grid-template-columns: minmax(0, 1fr) 52px 68px 70px 26px; gap: 6px; }
  .refund-line { grid-template-columns: 1fr 70px 90px; }
  .refund-line > :last-child { grid-column: 1 / -1; }
  .toast-root { right: 14px; left: 14px; bottom: 14px; }
  .toast { max-width: none; }
}

/* ---------------- 客户附件 ---------------- */
.attach-list { display: flex; flex-direction: column; gap: 10px; }
.attach-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}
.attach-icon {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--muted); flex: none;
}
.attach-icon.img { color: #3f628c; background: #eaf1fb; border-color: #dbe7f6; }
.attach-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.attach-main b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-main span { font-size: 11.5px; color: var(--muted); }
.attach-actions { display: flex; align-items: center; gap: 14px; flex: none; }
.attach-preview { display: grid; place-items: center; background: var(--surface-2); border-radius: 12px; padding: 8px; }
.attach-preview img { max-width: 100%; max-height: 62vh; border-radius: 8px; display: block; }
.attach-pdf { width: 100%; height: 66vh; border: 0; border-radius: 12px; background: var(--surface-2); }
.attach-no-preview { padding: 32px 18px; text-align: center; color: var(--muted); font-size: 13px; background: var(--surface-2); border-radius: 12px; }

/* ---------------- 平板适配：抽屉侧栏 + 卡片表格 + 触控尺寸 ----------------
   只在窄视口或触屏设备生效，桌面（鼠标 + 宽屏）保持原有布局 */
.install-guide { display: flex; flex-direction: column; gap: 13px; }
.install-guide .step { display: flex; align-items: flex-start; gap: 12px; font-size: 13.5px; color: var(--ink-2); line-height: 1.7; }
.install-guide .step b {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand); color: var(--lime);
  display: grid; place-items: center;
  font-size: 12.5px; flex: none; margin-top: 1px;
}

@media (max-width: 1180px), (hover: none) and (pointer: coarse) and (max-width: 1400px) {
  body.drawer-open { overflow: hidden; }

  /* 侧栏改为抽屉 */
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 84vw);
    height: 100dvh;
    flex-direction: column;
    align-items: stretch;
    padding: 22px 14px calc(18px + env(safe-area-inset-bottom));
    overflow-y: auto;
    border-right: 1px solid var(--line);
    border-bottom: none;
    transform: translateX(-104%);
    transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 90;
  }
  body.drawer-open .sidebar {
    transform: translateX(0);
    box-shadow: 0 20px 60px rgba(20, 20, 19, 0.22);
  }
  .sidebar .brand { padding: 6px 12px 24px; }
  .sidebar .brand svg { width: 40px; height: 40px; }
  .sidebar .brand span { display: block; }
  .nav { flex-direction: column; gap: 5px; }
  .nav-group-label { display: block; }
  .sidebar-foot { display: block; margin-top: auto; }
  .nav a { min-height: 50px; padding: 13px 15px; font-size: 15px; }
  .main { margin-left: 0; }

  .drawer-mask {
    display: block;
    position: fixed; inset: 0;
    background: rgba(20, 20, 19, 0.36);
    backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s;
    z-index: 80;
  }
  body.drawer-open .drawer-mask { opacity: 1; pointer-events: auto; }

  .menu-toggle {
    display: inline-grid; place-items: center;
    width: 44px; height: 44px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    flex: none;
  }
  .topbar { min-height: 64px; padding: 0 18px; gap: 10px; }
  .content { padding: 22px 20px calc(56px + env(safe-area-inset-bottom)); }
  .install-btn:not([hidden]) { display: inline-flex; width: 100%; margin-top: 10px; }

  /* 按钮、输入框放大到手指可点 */
  .btn { min-height: 44px; padding: 11px 20px; font-size: 14px; }
  .btn.sm { min-height: 38px; padding: 8px 16px; font-size: 13px; }
  .btn.ghost { min-height: 40px; }
  .btn.lg { min-height: 50px; font-size: 15px; }
  .link {
    display: inline-flex; align-items: center;
    min-height: 40px; padding: 0 4px;
    font-size: 13.5px;
  }
  .icon-btn { width: 44px; height: 44px; }
  .input, .select, .textarea {
    min-height: 46px;
    padding: 12px 14px;
    font-size: 16px;
    border-radius: 12px;
  }
  .input.mini { width: 96px; }
  .check input { width: 22px; height: 22px; }
  .toolbar { padding: 14px 16px; }
  .toolbar .search { max-width: none; }
  .toolbar .search .input,
  .toolbar .select,
  .toolbar .input.date { height: 46px; font-size: 16px; }
  .cat-tabs button { min-height: 42px; padding: 8px 16px; font-size: 13.5px; }
  .report-tabs button { min-height: 44px; padding: 9px 17px; font-size: 13px; }
  .settings-nav button { min-height: 46px; }
  .modal-close { width: 44px; height: 44px; }
  .modal { width: 94vw; max-height: 90dvh; }
  .modal footer { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }

  /* 宽表格改为卡片（仅页面内容区，弹窗内表格保持原样） */
  .content .table-wrap { overflow: visible; padding: 14px; }
  .content .table { display: block; width: 100%; font-size: 14px; }
  .content .table thead { display: none; }
  .content .table tbody {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .content .table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 16px;
    align-content: start;
    padding: 15px 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
  }
  .content .table tbody tr:hover { background: var(--surface); }
  .content .table tbody tr.overdue-row { background: #fdf2f0; border-color: #f0cdc8; }
  .content .table tbody tr.overdue-row td:first-child { box-shadow: none; }
  .content .table td {
    display: block;
    padding: 0;
    border: none;
    text-align: left !important;
    white-space: normal;
    vertical-align: top;
    min-width: 0;
  }
  .content .table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    font-size: 10.5px;
    letter-spacing: 0.4px;
    color: var(--muted);
  }
  .content .table td[data-label=""] { grid-column: 1 / -1; }
  .content .table td[data-label=""]::before { display: none; }
  .content .table td[data-label="操作"] {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    grid-column: 1 / -1;
    gap: 6px 18px;
    padding-top: 10px;
    border-top: 1px dashed var(--line);
  }
  .content .table td[data-label="操作"]::before { display: none; }
  .content .table .cust b { font-size: 15px; }
  .content .table .item-lines { font-size: 12.5px; }
  .content .table td[style*="max-width"] { max-width: none !important; }
  .attach-item { flex-wrap: wrap; }
  .attach-actions { gap: 18px; }
}

@media (max-width: 900px) {
  .content .table tbody { grid-template-columns: 1fr; }
  .topbar .today { display: none; }
}
@media (max-width: 640px) {
  .content .table tbody tr { grid-template-columns: 1fr; }
}

/* 悬停解析气泡：移入显示，移出消失 */
[data-tip] { cursor: help; }
.tip-pop {
  position: fixed;
  z-index: 5000;
  max-width: 280px;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(22, 25, 22, 0.96);
  color: #fff;
  font-size: 12.5px;
  line-height: 1.65;
  box-shadow: 0 14px 40px rgba(22, 25, 22, 0.24);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.14s ease, transform 0.14s ease;
  white-space: pre-line;
}
.tip-pop.show { opacity: 1; visibility: visible; transform: translateY(0); }
.tip-pop b { display: block; margin-bottom: 2px; color: #d9ef7a; font-weight: 650; }
.tip-pop span { display: block; color: rgba(255, 255, 255, 0.88); }

/* ---------------- 主题切换按钮 ---------------- */
.theme-toggle {
  width: 34px; height: 34px;
  display: inline-grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.25s;
}
.theme-toggle:hover { background: var(--surface-3); color: var(--ink); transform: rotate(-14deg); }
.theme-toggle:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.theme-toggle.floating {
  position: fixed; right: 20px; top: 20px; z-index: 50;
  box-shadow: var(--shadow-sm);
}

/* ---------------- 鼠标柔光 ---------------- */
.spotlight {
  position: fixed;
  top: 0; left: 0;
  width: 620px; height: 620px;
  margin: -310px 0 0 -310px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.45s ease;
  background: radial-gradient(circle, rgba(217, 239, 122, 0.62) 0%, rgba(168, 201, 79, 0.26) 34%, rgba(168, 201, 79, 0) 68%);
  filter: blur(26px);
  mix-blend-mode: soft-light;
  will-change: transform, opacity;
}
.spotlight.on { opacity: 1; }

/* ---------------- 滚动浮现 ---------------- */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
  transition-delay: var(--reveal-delay, 0ms);
}
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .spotlight { display: none; }
}

/* ================= 暗调皮肤 ================= */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #131311;
  --surface: #1c1c19;
  --surface-2: #232320;
  --surface-3: #2b2b27;
  --ink: #f2f0e8;
  --ink-2: #cfccc1;
  --muted: #8f8c83;
  --line: #2e2e29;
  --line-strong: #3d3d36;
  --brand: #2c2c27;
  --brand-dark: #3a3a34;
  --brand-soft: #24241f;
  --gold: #d9ae4e;
  --gold-2: #e8c977;
  --gold-soft: #2c2517;
  --red: #e0756c;
  --red-soft: #33201e;
  --dark-red: #f0958c;
  --amber: #d9a545;
  --amber-soft: #2f2718;
  --green: #8fb87c;
  --green-soft: #23291d;
  --lilac: #36304a;
  --lilac-2: #292540;
  --mint: #24352a;
  --mint-2: #1d2822;
  --lime: #d8f24b;
  --sage: #a3b588;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 30px 90px rgba(0, 0, 0, 0.6);
}
:root[data-theme="dark"] .spotlight {
  background: radial-gradient(circle, rgba(217, 239, 122, 0.34) 0%, rgba(120, 170, 255, 0.14) 38%, transparent 70%);
  mix-blend-mode: screen;
}

/* 登录页 */
:root[data-theme="dark"] .login-brand {
  background: linear-gradient(150deg, #1c1a15 0%, #16150f 46%, #1b2117 100%);
}
:root[data-theme="dark"] .login-brand::before {
  background: radial-gradient(circle at 35% 35%, rgba(216, 242, 75, 0.16), rgba(120, 140, 80, 0.1) 55%, transparent 72%);
}
:root[data-theme="dark"] .login-brand::after {
  background: radial-gradient(circle at 55% 45%, rgba(147, 168, 120, 0.18), rgba(70, 90, 50, 0.12) 58%, transparent 74%);
}
:root[data-theme="dark"] .login-hero .eyebrow {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
  color: #c2c8bf;
}
:root[data-theme="dark"] .login-hero h1 em { color: #b9d36a; }
:root[data-theme="dark"] .login-hero p { color: #9aa196; }
:root[data-theme="dark"] .login-points div { border-left-color: rgba(255, 255, 255, 0.14); }
:root[data-theme="dark"] .login-points span { color: #8b9187; }
:root[data-theme="dark"] .login-brand .foot { color: #737a70; }
:root[data-theme="dark"] .login-hint { background: #232320; border-color: #34342e; }
:root[data-theme="dark"] .login-hint b { color: #c2c8bf; }
:root[data-theme="dark"] .login-error { border-color: #4a2b28; }

/* 框架 */
:root[data-theme="dark"] .sidebar { background: linear-gradient(180deg, #1a1a17, #161613); border-right-color: #242420; }
:root[data-theme="dark"] .sidebar .brand strong { color: var(--ink); }
:root[data-theme="dark"] .sidebar .brand span { color: var(--muted); }
:root[data-theme="dark"] .nav-group-label { color: #6f6c63; }
:root[data-theme="dark"] .nav a { color: #a9a69d; }
:root[data-theme="dark"] .nav a:hover { background: rgba(255, 255, 255, 0.05); color: var(--ink); }
:root[data-theme="dark"] .nav a.active {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--ink);
  box-shadow: none;
}
:root[data-theme="dark"] .nav a.active svg { color: var(--lime); }
:root[data-theme="dark"] .sidebar-foot { border-top-color: rgba(255, 255, 255, 0.08); }
:root[data-theme="dark"] .sidebar-foot .avatar { background: #2f3527; color: #d8e6b0; }
:root[data-theme="dark"] .sidebar-foot .who span { color: #7d847b; }
:root[data-theme="dark"] .topbar { background: rgba(19, 19, 17, 0.86); border-bottom-color: rgba(255, 255, 255, 0.06); }
:root[data-theme="dark"] .role-pill { background: #1f1f1c; border-color: #34342e; }
:root[data-theme="dark"] .role-pill.admin { border-color: #4a3e22; }

/* 表单 / 按钮 */
:root[data-theme="dark"] .btn { background: #f0eee7; color: #141413; }
:root[data-theme="dark"] .btn:hover { background: #ffffff; box-shadow: 0 10px 22px rgba(0, 0, 0, 0.4); }
:root[data-theme="dark"] .btn.secondary { background: var(--surface); border-color: var(--line); color: var(--ink-2); }
:root[data-theme="dark"] .btn.secondary:hover { background: var(--surface-2); }
:root[data-theme="dark"] .btn.ghost { background: transparent; color: var(--ink-2); }
:root[data-theme="dark"] .btn.ghost:hover { background: rgba(255, 255, 255, 0.07); box-shadow: none; }
:root[data-theme="dark"] .btn.danger { background: #8a352e; color: #fff; }
:root[data-theme="dark"] .btn.danger:hover { background: #c05a50; }
:root[data-theme="dark"] .btn.danger-outline { background: var(--surface); border-color: #4a2b28; }
:root[data-theme="dark"] .btn.gold { background: #8a6a1e; color: #fdf3d2; }
:root[data-theme="dark"] .btn.gold:hover { background: #b98c2e; }
:root[data-theme="dark"] .btn.wechat { background: var(--lime); color: var(--lime-ink); }
:root[data-theme="dark"] .btn.wechat:hover { background: #cbe640; }
:root[data-theme="dark"] .link { text-decoration-color: #4a5058; }
:root[data-theme="dark"] .input,
:root[data-theme="dark"] .select,
:root[data-theme="dark"] .textarea { background: #232320; }
:root[data-theme="dark"] .input::placeholder,
:root[data-theme="dark"] .textarea::placeholder { color: #6b7278; }
:root[data-theme="dark"] .input:focus,
:root[data-theme="dark"] .select:focus,
:root[data-theme="dark"] .textarea:focus { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08); }
:root[data-theme="dark"] .radio-card .inner { background: #232320; }
:root[data-theme="dark"] .radio-card input:checked + .inner {
  background: #232830;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

/* 表格 */
:root[data-theme="dark"] .toolbar .search .input { background: #232320; }
:root[data-theme="dark"] .toolbar .search .input:focus { background: #2a2a26; }
:root[data-theme="dark"] .table th { background: #232320; color: #9a978d; }
:root[data-theme="dark"] .table td { border-bottom-color: var(--line); }
:root[data-theme="dark"] .table tbody tr:hover { background: #242421; }
:root[data-theme="dark"] .table tbody tr.overdue-row { background: #2a1d1c; }
:root[data-theme="dark"] .table tbody tr.overdue-row:hover { background: #33211f; }

/* 状态徽章 / 标签 */
:root[data-theme="dark"] .status-target { color: #9fb0c3; background: #20262e; border-color: #2c343e; }
:root[data-theme="dark"] .status-seed { color: #c9cd7a; background: #2a2b1b; border-color: #3b3c26; }
:root[data-theme="dark"] .status-green { color: #7fd3a1; background: #1c2c23; border-color: #2a4436; }
:root[data-theme="dark"] .status-red { color: #f09a92; background: #341f1d; border-color: #4a2b28; }
:root[data-theme="dark"] .status-ripe { color: #e0a765; background: #2e2418; border-color: #463422; }
:root[data-theme="dark"] .status-golden {
  color: #f0cd7a;
  background: linear-gradient(135deg, #3a2f16, #2d2410);
  border-color: #4a3e22;
}
:root[data-theme="dark"] .follow-chip.today { border-color: #4a2b28; }
:root[data-theme="dark"] .follow-chip.tomorrow { border-color: #473722; }
:root[data-theme="dark"] .follow-chip.after2 { border-color: #2a4436; }
:root[data-theme="dark"] .tag.gold { border-color: #4a3e22; }
:root[data-theme="dark"] .type-tag { background: #262620; color: #b9b7a9; }
:root[data-theme="dark"] .type-tag.service { background: #2a2334; color: #c0a0da; }
:root[data-theme="dark"] .cat-tag.essential_oil { background: #242b1e; color: #a9c47c; }
:root[data-theme="dark"] .cat-tag.food { background: #2c2418; color: #d0a765; }
:root[data-theme="dark"] .cat-tag.minor { background: #272132; color: #b6a0d4; }
:root[data-theme="dark"] .cat-tag.assessment { background: #1e2733; color: #8fb0d6; }
:root[data-theme="dark"] .cat-tag.trial { background: #1c282b; color: #82bcc4; }
:root[data-theme="dark"] .pill-soft.red { border-color: #4a2b28; }
:root[data-theme="dark"] .pill-soft.amber { border-color: #473722; }
:root[data-theme="dark"] .pill-soft.green { border-color: #2a4436; }
:root[data-theme="dark"] .pill-soft.gold { border-color: #4a3e22; }
:root[data-theme="dark"] .reserved-pill { background: #262620; color: #b9b7a9; }
:root[data-theme="dark"] .attach-icon.img { background: #1e2733; border-color: #263444; color: #8fb0d6; }

/* 工作台数据区 */
:root[data-theme="dark"] .hero-card {
  background:
    radial-gradient(120% 90% at 88% 8%, rgba(255, 255, 255, 0.45), transparent 55%),
    linear-gradient(135deg, #b9cc66 0%, #d8dc96 46%, #d8b98a 100%);
  color: #23240f;
}
:root[data-theme="dark"] .hero-card .chip { background: rgba(255, 255, 255, 0.55); }
:root[data-theme="dark"] .qstat:hover { border-color: var(--line-strong); }
:root[data-theme="dark"] .qstat.alert b { color: var(--red); }
:root[data-theme="dark"] .tabbar {
  background: rgba(28, 28, 25, 0.94);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}
:root[data-theme="dark"] .tabbar a.active span::after { box-shadow: 0 0 0 2px rgba(28, 28, 25, 0.94); }

/* 漏斗 / 跟进 / 详情 */
:root[data-theme="dark"] .funnel-track { background: #2b2b27; }
:root[data-theme="dark"] .follow-item { border-bottom-color: var(--line); }
:root[data-theme="dark"] .info-list .row { border-bottom-color: var(--line); }
:root[data-theme="dark"] .refund-line { border-bottom-color: var(--line); }
:root[data-theme="dark"] .tl-dot { box-shadow: 0 0 0 3px #2b2b27; }
:root[data-theme="dark"] .profile-main .avatar.gold { background: linear-gradient(150deg, #3a3220, #2f2818); color: #e3c26f; }
:root[data-theme="dark"] .golden-banner {
  background: linear-gradient(120deg, #2c2617, #251f13);
  border-color: #4a3e22;
  color: #e3c26f;
}
:root[data-theme="dark"] .stat-box.gold { background: linear-gradient(150deg, #2b2618, #262013); border-color: #40371f; }
:root[data-theme="dark"] .warning-banner { background: #2a1d1c; border-color: #4a2b28; color: #f0a59d; }
:root[data-theme="dark"] .warning-banner .tag { background: #33211f; border-color: #4a2b28; color: #f0a59d; }

/* 弹窗 / 提示 */
:root[data-theme="dark"] .toast { box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5); }
:root[data-theme="dark"] .toast.error { background: #7d2520; }
:root[data-theme="dark"] .toast.warn { background: #6f5110; }

/* 选项卡：暗色下 --ink 变浅，原来的深底白字要换色，不然看不清 */
:root[data-theme="dark"] .cat-tabs button:hover,
:root[data-theme="dark"] .report-tabs button:hover,
:root[data-theme="dark"] .report-nav-tabs button:hover { border-color: #47505b; color: var(--ink); }
:root[data-theme="dark"] .cat-tabs button.active,
:root[data-theme="dark"] .report-tabs button.active,
:root[data-theme="dark"] .report-nav-tabs button.active,
:root[data-theme="dark"] .settings-nav button.active {
  background: #f0eee7;
  border-color: #f0eee7;
  color: #141413;
}
:root[data-theme="dark"] .cat-tabs button.active span {
  background: rgba(20, 20, 19, 0.1);
  color: #141413;
}

/* 平板卡片表格：逾期卡片原来写死了浅粉底 */
:root[data-theme="dark"] .content .table tbody tr.overdue-row {
  background: #2a1d1c;
  border-color: #4a2b28;
}

/* 逾期标记：暗色下 --dark-red 是浅鲑红，白字压上去看不清，换成深红底浅字 */
:root[data-theme="dark"] .follow-chip.overdue {
  background: #7d2b24;
  border-color: #4a2b28;
  color: #ffd9d4;
}
:root[data-theme="dark"] .follow-chip.overdue::before { background: #ffb3ab; }
:root[data-theme="dark"] .overdue-head {
  background: #3a201d;
  border-color: #4a2b28;
  color: #f3b0a8;
}

/* 实心按钮：红/金两色底子偏浅，白字对比度不够，压暗一档 */
:root[data-theme="dark"] .btn.danger { background: #8a352e; }
:root[data-theme="dark"] .btn.gold { background: #8a6a1e; color: #fdf3d2; }

/* ---------------- 手机端优化 ---------------- */
/* 触控设备统一去掉双击缩放的等待和点击高亮 */
a, button, .btn, .link, input, select, textarea {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* 数字框在小屏上的上下箭头太挤，直接去掉 */
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.back-btn {
  display: none;
  width: 40px; height: 40px;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  flex: none;
}
.tabbar { display: none; }

@media (max-width: 900px) {
  .back-btn:not([hidden]) { display: inline-grid; }
}

@media (max-width: 640px) {
  body { overflow-x: clip; }
  .content { padding: 14px 16px calc(96px + env(safe-area-inset-bottom)); }
  .page-head { margin-bottom: 16px; }
  .page-head h1 { font-size: 26px; letter-spacing: -1px; }
  .page-head .desc { font-size: 12.5px; }
  .topbar { min-height: 58px; padding: 0 14px; }
  .topbar .today, .role-pill { display: none; }
  .topbar .theme-toggle { width: 40px; height: 40px; }

  /* 弹窗改成从底部升起的抽屉，手机上更好点 */
  .modal-mask {
    place-items: end center;
    padding: 0;
    backdrop-filter: none;
    background: rgba(20, 20, 19, 0.42);
  }
  .modal, .modal.md, .modal.lg, .modal.xl {
    max-width: none;
    width: 100%;
    max-height: 88dvh;
    border-radius: 22px 22px 0 0;
    transform: translateY(28px);
  }
  .modal-mask.show .modal { transform: none; }
  .modal header { padding: 18px 18px 0; }
  .modal header h3 { font-size: 17px; }
  .modal-body { padding: 16px 18px; overscroll-behavior: contain; }
  .modal footer { padding: 0 18px calc(16px + env(safe-area-inset-bottom)); }
  .toast-root { bottom: calc(92px + env(safe-area-inset-bottom)); }

  /* 底部主导航：悬浮胶囊，像 App 的 tabbar */
  .site-foot { padding: 4px 16px calc(86px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    position: fixed;
    left: 12px; right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 70;
    height: 64px;
    padding: 6px;
    border-radius: 24px;
    background: rgba(251, 250, 247, 0.94);
    border: 1px solid var(--line);
    backdrop-filter: blur(14px);
    box-shadow: 0 12px 30px rgba(20, 20, 19, 0.1);
  }
  .tabbar a, .tabbar button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 52px;
    padding: 4px 2px;
    border: 0;
    border-radius: 18px;
    background: transparent;
    color: #a3a096;
    font-size: 9.5px;
    line-height: 1.2;
  }
  .tabbar a.active { color: var(--ink); background: transparent; font-weight: 600; }
  .tabbar a.active span::after {
    content: "";
    display: inline-block;
    width: 4px; height: 4px;
    margin-left: 4px;
    border-radius: 50%;
    background: var(--lime);
    vertical-align: 3px;
  }
  .tabbar a:active, .tabbar button:active { background: var(--surface-2); }

  /* 订单商品行：手机上改成两行，别把五个控件挤成一排 */
  .order-line {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) 40px;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-2);
  }
  .order-line > select { grid-column: 1 / 4; }
  .order-line > [data-qty] { grid-column: 1; }
  .order-line > [data-price] { grid-column: 2; }
  .order-line > .line-total { grid-column: 3; text-align: right; align-self: center; }
  .order-line > [data-remove] { grid-column: 4; grid-row: 1; justify-self: end; }
  .refund-line { grid-template-columns: minmax(0, 1fr) 72px 96px; }

  /* 卡片表格：手机上保持两列排布，卡片高度砍掉一半，徽章不再被拉成横条 */
  .content .table tbody tr {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px 14px;
    padding: 14px 15px;
  }
  .content .table td:first-child { grid-column: 1 / -1; }
  .content .table td[data-label="商品 / 项目"],
  .content .table td[data-label="退款内容"],
  .content .table td[data-label="退款原因"] { grid-column: 1 / -1; }
  .content .table td::before { font-size: 11px; }
  .follow-chip { font-size: 11.5px; padding: 3px 10px; }
  .tag, .type-tag { font-size: 11.5px; }
  .btn.sm { min-height: 42px; }
  .back-link { display: inline-flex; align-items: center; min-height: 40px; font-size: 13px; }
  .tabbar a, .tabbar button { font-size: 10px; }
  .settings-nav { scrollbar-width: none; }
  .settings-nav::-webkit-scrollbar { display: none; }
}

/* iOS 上输入框小于 16px 会被自动放大，触屏设备统一抬到 16px */
@media (hover: none) and (pointer: coarse) {
  html, body { touch-action: pan-x pan-y; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea { font-size: 16px !important; }
}

/* 触屏设备上面糊、动画、悬停阴影都省掉，滚动更顺 */
@media (hover: none) {
  .topbar { background: var(--bg); backdrop-filter: none; }
  .drawer-mask { backdrop-filter: none; }
  .spotlight { display: none; }
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
  .btn:hover { transform: none; box-shadow: var(--shadow-sm); }
  .btn:active { transform: scale(0.975); }
}

/* 手机端锁死缩放：不许双指放大缩小，页面始终 1:1，像 App 一样 */
@media (hover: none) and (pointer: coarse) {
  html, body {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    touch-action: pan-x pan-y;
    overscroll-behavior-y: contain;
  }
  /* 导航、按钮这些不让长按选中，避免误触弹出复制菜单 */
  .topbar, .tabbar, .nav, .sidebar, .btn, .cat-tabs, .report-nav, .report-tabs, .page-head {
    -webkit-user-select: none;
    user-select: none;
  }
}
