/* ================= 基础 ================= */
:root {
  --bg: #f4f6f3;
  --paper-warm: #faf8f4;
  --panel: #fcfaf4;
  --ink: #1f2c27;
  --ink-2: #4c5d55;
  --muted: #8a9d94;
  --line: #e0e7e3;
  --line-2: #ecf2ee;
  --brand: #3d8f7a;
  --brand-2: #2f7263;
  --brand-soft: #e6f1ec;
  --brand-soft-2: #f1f7f4;
  --ok: #4b9b7e;
  --ok-soft: #eaf5f0;
  --warn: #d08a3c;
  --warn-soft: #fdf3e6;
  --danger: #c4554e;
  --danger-soft: #fbeeed;
  --shadow: 0 1px 2px rgba(32, 63, 55, .05), 0 6px 20px rgba(32, 63, 55, .06);
  --shadow-lg: 0 20px 60px rgba(32, 63, 55, .18);
  --radius: 14px;
}

* { box-sizing: border-box; }

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

body {
  background-color: var(--bg);
  /* 浅色纸感：细噪点 + 纸纤维光晕（纯 CSS，无图片文件） */
  background-image:
    radial-gradient(1400px 700px at 8% -8%, rgba(255, 255, 255, .75) 0%, rgba(255, 255, 255, 0) 55%),
    radial-gradient(1100px 600px at 105% 112%, rgba(61, 143, 122, .06) 0%, rgba(61, 143, 122, 0) 60%),
    linear-gradient(160deg, rgba(255, 255, 255, .5), rgba(233, 229, 220, .35));
  background-attachment: fixed, fixed, fixed;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

input, select, textarea, button { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--brand-2); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #dce8e2; border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #ccdcd5; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ================= 登录 ================= */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 10% -10%, #e5f0ea 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 110%, #eaf3ee 0%, transparent 55%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 36px 32px 28px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  width: 54px; height: 54px;
  border-radius: 16px;
  display: grid; place-items: center;
  margin: 0 auto 18px;
  background: linear-gradient(145deg, #7ab8a5, #3d8f7a);
  color: #fff;
  font-size: 24px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(61, 143, 122, .3);
}

.login-logo img, .brand-mark img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

.login-card h1 { text-align: center; font-size: 20px; }
.login-card .sub { text-align: center; color: var(--muted); font-size: 13px; margin: 6px 0 26px; }

/* ================= 布局 ================= */
.shell {
  display: grid;
  grid-template-columns: 226px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
}

.brand-mark {
  width: 36px; height: 36px;
  border-radius: 11px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #7ab8a5, #3d8f7a);
  color: #fff;
  font-size: 17px;
  flex: none;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(61, 143, 122, .28);
}

.brand-text { min-width: 0; }
.brand-text b { display: block; font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text span { display: block; font-size: 11px; color: var(--muted); letter-spacing: .06em; }

/* Logo 上传 */
.logo-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo-preview {
  width: 64px; height: 64px;
  border-radius: 16px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #7ab8a5, #3d8f7a);
  color: #fff;
  font-size: 26px;
  flex: none;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(61, 143, 122, .28);
}
.logo-preview img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}
.logo-actions { display: flex; flex-direction: column; gap: 8px; }
.logo-actions .row { gap: 8px; flex-wrap: wrap; }

/* 客户等级 */
.level-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.lv-no { width: 18px; text-align: center; font-size: 12px; color: var(--muted); flex: none; }
.lv-input { max-width: 240px; }
.level-row .btn { flex: none; }

.nav { padding: 8px 10px; overflow-y: auto; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background .15s, color .15s;
  user-select: none;
  position: relative;
}
.nav-item svg { width: 18px; height: 18px; flex: none; color: var(--ink-2); }
.nav-item:hover { background: var(--line-2); }
.nav-item.active { background: var(--brand-soft); color: var(--brand-2); font-weight: 600; }
.nav-item.active svg { color: var(--brand-2); }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 3px;
  background: var(--brand-2);
}

/* 分组小标题：底色块标签 + 加粗分隔线，组与组一眼分开 */
.nav-group {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 4px 0 5px;
  margin: 15px 6px 5px;
}
.nav-group:first-child { margin-top: 4px; }
.nav-group span {
  font-size: 11px;
  color: var(--brand-2);
  letter-spacing: .2em;
  font-weight: 800;
  background: var(--brand-soft);
  padding: 3px 9px 3px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.nav-group::after {
  content: '';
  flex: 1;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, #d7e6df, rgba(215, 230, 223, 0));
}

.side-foot {
  border-top: 1px solid var(--line);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-2);
  display: grid; place-items: center;
  font-size: 13px; font-weight: 600; flex: none;
}
.side-foot .who { flex: 1; min-width: 0; }
.side-foot .who b { display: block; font-size: 13px; font-weight: 600; }
.side-foot .who span { display: block; font-size: 11px; color: var(--muted); }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 62px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 30;
}
.topbar h2 { font-size: 16.5px; }
.topbar .spacer { flex: 1; }
.topbar .date { font-size: 12.5px; color: var(--muted); }

.content { padding: 22px 26px 60px; flex: 1; max-width: 1400px; width: 100%; }

.hamburger { display: none; }

/* ================= 通用组件 ================= */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line-2);
}
.card-head h3 { font-size: 14px; }
.card-head .spacer { flex: 1; }
.card-body { padding: 18px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-2);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .08s;
  user-select: none;
}
.btn:hover { background: #f5f9f7; border-color: #dde9e3; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }

.btn.primary {
  background: linear-gradient(180deg, #55a18d, #3d8f7a);
  border-color: #357f6f;
  color: #fff;
  box-shadow: 0 2px 8px rgba(61, 143, 122,.28);
}
.btn.primary:hover { background: linear-gradient(180deg, #4d9d89, #3a8070); }

.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--line-2); color: var(--ink-2); }

.btn.danger { color: var(--danger); border-color: #efd9d7; background: var(--panel); }
.btn.danger:hover { background: var(--danger-soft); }

.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.lg { height: 40px; font-size: 14px; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.input, .select, .textarea {
  width: 100%;
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; padding: 9px 11px; resize: vertical; min-height: 72px; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus {
  border-color: #a8cdbc;
  box-shadow: 0 0 0 3px rgba(61, 143, 122,.12);
}
.input::placeholder, .textarea::placeholder { color: #aebcb5; }

.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.search .input { padding-left: 33px; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field > label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.field > label .req { color: var(--danger); }
.field .hint { font-size: 11.5px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .field.full { grid-column: 1 / -1; }
@media (max-width: 620px) { .form-grid { grid-template-columns: 1fr; } }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }

/* 表格 */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.tb { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tb th {
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
  padding: 11px 14px;
  background: #f5f9f7;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  position: sticky; top: 0; z-index: 1;
}
table.tb td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.tb tr:last-child td { border-bottom: none; }
table.tb tbody tr:hover td { background: #f5f9f7; }
table.tb .num { text-align: right; font-variant-numeric: tabular-nums; }
table.tb th.num { text-align: right; }
table.tb .nowrap { white-space: nowrap; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 21px; padding: 0 8px;
  border-radius: 999px;
  font-size: 11.5px;
  background: var(--line-2); color: var(--ink-2);
  white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.brand { background: var(--brand-soft); color: var(--brand-2); }
.badge svg { width: 12px; height: 12px; }

.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.empty svg { width: 34px; height: 34px; opacity: .3; display: inline-block; margin-bottom: 8px; }
.empty .big { font-size: 30px; opacity: .35; margin-bottom: 8px; }

.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; }
.tr { text-align: right; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }

/* 统计卡 */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}
.stat .label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 25px; font-weight: 600; margin-top: 6px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.stat .sub { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.stat .ico {
  position: absolute; right: 14px; top: 14px;
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
}
.stat .ico svg { width: 17px; height: 17px; }

/* 盈亏大卡（经营报表） */
.pnl-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.pnl-card {
  position: relative; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px 16px; box-shadow: var(--shadow);
}
.pnl-card.surplus { background: var(--panel); border-color: var(--line); }
.pnl-card.loss { background: var(--panel); border-color: var(--line); }
.pnl-head { display: flex; align-items: baseline; gap: 10px; }
.pnl-head .pnl-t { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.pnl-head .pnl-range { font-size: 11.5px; color: var(--muted); }
.pnl-big { font-size: 34px; font-weight: 700; letter-spacing: -.02em; line-height: 1.25; margin-top: 2px; font-variant-numeric: tabular-nums; }
.pnl-card.surplus .pnl-big { color: var(--ok); }
.pnl-card.loss .pnl-big { color: var(--danger); }
.pnl-card.flat .pnl-big { color: var(--ink-2); }
.pnl-tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; margin: 2px 0 12px; }
.pnl-card.surplus .pnl-tag { background: var(--ok); color: #fff; }
.pnl-card.loss .pnl-tag { background: var(--danger); color: #fff; }
.pnl-card.flat .pnl-tag { background: var(--line); color: var(--ink-2); }
.pnl-rows { border-top: 1px dashed rgba(0,0,0,.12); padding-top: 10px; display: flex; flex-direction: column; gap: 5px; }
.pnl-rows > div { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); }
.pnl-rows b { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); }
.pnl-rows b.pos { color: var(--ok); }
.pnl-rows b.neg { color: var(--danger); }
.pnl-note { margin-top: 10px; font-size: 11px; color: var(--muted); line-height: 1.6; }

/* 资金账户卡片 */
.acc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.acc-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.acc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.acc-name { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-balance { font-size: 24px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--brand-2); margin-top: 2px; }
.acc-sub { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-stat { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 7px; font-size: 12px; font-variant-numeric: tabular-nums; }
.acc-stat .in { color: var(--ok); }
.acc-stat .out { color: var(--danger); }
.acc-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line-2); }
.acc-actions .btn { flex: 0 0 auto; }

/* 分栏 */
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cols-3 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }

/* 列表项 */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 11px; padding: 11px 18px; border-bottom: 1px solid var(--line-2); }
.list-item:last-child { border-bottom: none; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .t { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .s { font-size: 11.5px; color: var(--muted); }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(24, 50, 44, .38);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  z-index: 100;
  animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

.modal {
  background: var(--panel);
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: pop .18s cubic-bezier(.2,.9,.3,1.1);
}
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.985) } to { opacity: 1; transform: none } }

.modal.wide { max-width: 860px; }
.modal.narrow { max-width: 420px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line-2); }
.modal-head h3 { font-size: 15px; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line-2); background: #f5f9f7; border-radius: 0 0 16px 16px; }

.x-btn {
  margin-left: auto;
  width: 30px; height: 30px; border-radius: 8px;
  border: none; background: transparent; cursor: pointer;
  display: grid; place-items: center; color: var(--muted);
}
.x-btn:hover { background: var(--line-2); color: var(--ink); }

/* toast */
#toast-root { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: #22332e; color: #fff;
  padding: 9px 18px; border-radius: 999px;
  font-size: 13px; box-shadow: var(--shadow-lg);
  animation: toastIn .2s ease;
  max-width: 80vw;
}
.toast.ok { background: #38735c; }
.toast.err { background: #a8453f; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px) } to { opacity: 1; transform: none } }

/* ================= 开单 ================= */
.billing { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.catalog-tabs { display: flex; gap: 6px; padding: 0 0 12px; }
.tab {
  padding: 6px 14px; border-radius: 999px; font-size: 13px; cursor: pointer;
  background: transparent; border: 1px solid transparent; color: var(--muted);
}
.tab.active { background: var(--brand-soft); color: var(--brand-2); font-weight: 600; }

/* 客户档案：三个彩色标签（储值 / 次卡 / 消费记录），一眼可辨 */
.cu-tabs-row { display: flex; gap: 10px; flex-wrap: wrap; }
.cu-tab {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1.5px solid var(--line); background: var(--panel); color: var(--ink-2);
  border-radius: 12px; padding: 10px 16px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: border-color .15s, background .15s, color .15s, box-shadow .15s;
}
.cu-tab .n { font-weight: 700; padding: 0 8px; border-radius: 999px; font-size: 12px; background: rgba(0,0,0,.06); }
.cu-tab.ledger { border-color: #c3ddd2; color: #2f7263; background: #f4f9f6; }
.cu-tab.cards { border-color: #c9e7d8; color: #3e8f6b; background: #f2fbf7; }
.cu-tab.sales { border-color: #f0dcbd; color: #bd7d2e; background: #fffaf2; }
.cu-tab:hover { transform: translateY(-1px); }
.cu-tab.on { color: #fff; box-shadow: 0 2px 10px rgba(32, 63, 55, .14); }
.cu-tab.on .n { background: rgba(255,255,255,.25); }
.cu-tab.on.ledger { border-color: #3d8f7a; background: #3d8f7a; }
.cu-tab.on.cards { border-color: #43a97f; background: #43a97f; }
.cu-tab.on.sales { border-color: #d08a3c; background: #d08a3c; }

/* ============ 首页卡片布局：顺序与大小可调整，同一行卡片自动等高 ============ */
.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: stretch; }
.home-grid .home-card { height: 100%; }
.home-grid .home-card.wide { grid-column: 1 / -1; }
.home-card { position: relative; }
.home-editbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--brand-soft); border: 1px dashed var(--brand);
  border-radius: 12px; padding: 8px 12px; margin: -2px 0 12px;
}
.home-card.editing { outline: 2px dashed var(--brand); outline-offset: 4px; }
.home-card.dragging { opacity: .45; outline-color: var(--muted); }
.home-tools {
  position: absolute; top: -13px; right: 12px; display: none;
  gap: 4px; z-index: 5; background: var(--panel);
  border-radius: 10px; padding: 4px 6px; box-shadow: var(--shadow);
}
.home-tools .btn { padding: 2px 9px; font-size: 13px; }
.home-card.editing .home-tools { display: flex; }
/* 经营指标卡：格子按数量自动铺满整行 */
.stats-kpi { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
/* 卡片高度三档（编辑模式按钮循环切换） */
.home-card.hgt-tall { min-height: 520px; }
.home-card.hgt-short { height: 300px; overflow: auto; border-radius: var(--radius); }
/* ============ 店员功能权限勾选（员工账号弹窗内） ============ */
.perm-box { display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--brand-soft-2); }
.perm-group { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.perm-group-t { grid-column: 1 / -1; font-size: 12px; font-weight: 600; color: var(--muted); margin: 2px 0 1px; }
.perm-chip { display: flex; align-items: center; gap: 7px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; cursor: pointer; font-size: 13px; }
.perm-chip input { width: 15px; height: 15px; accent-color: #b4717b; margin: 0; flex: none; }
.perm-chip:has(input:checked) { border-color: #b4717b; background: var(--brand-soft); }

@media (max-width: 620px) {
  .perm-group { grid-template-columns: 1fr; }
}

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.cat-item {
  border: 1px solid var(--line); border-radius: 11px;
  padding: 11px 12px; cursor: pointer; background: var(--panel);
  transition: border-color .15s, box-shadow .15s, transform .1s;
  text-align: left;
}
.cat-item:hover { border-color: #b2d2c5; box-shadow: 0 4px 14px rgba(61, 143, 122,.12); }
.cat-item:active { transform: scale(.985); }
.cat-item.disabled { opacity: .45; cursor: not-allowed; }
.cat-item .n { font-size: 13.5px; font-weight: 500; margin-bottom: 3px; }
.cat-item .p { font-size: 13px; color: var(--brand-2); font-variant-numeric: tabular-nums; }
.cat-item .m { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* 手机开单专用：桌面端一律隐藏，电脑界面不变 */
.cat-add { display: none; }
.cat-qty { display: none; }
.cart-jump { display: none; }

.cart { position: sticky; top: 78px; }
.cart-list { max-height: 42vh; overflow-y: auto; }
.cart-row { display: block; padding: 10px 16px 11px; border-bottom: 1px solid var(--line-2); }
.cart-row:last-child { border-bottom: none; }
.cart-row .row-top { display: flex; align-items: center; gap: 8px; }
.cart-row .row-top .nm { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart-row .row-top .btn { flex: none; }
.cart-row .cd { font-size: 11px; color: var(--muted); margin-top: 3px; }
.cart-row .row-ctrl { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.qty-box { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; height: 28px; }
.qty-box button { width: 24px; height: 100%; border: none; background: #f5f9f7; cursor: pointer; color: var(--ink-2); font-size: 14px; }
.qty-box button:hover { background: var(--brand-soft); }
.qty-box span { width: 30px; text-align: center; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.qty-box input.qty-in { width: 40px; border: none; background: var(--panel); text-align: center; font-size: 12.5px; font-variant-numeric: tabular-nums; padding: 0 2px; height: 100%; }
.qty-box input.qty-in:focus { outline: none; background: var(--brand-soft); }
.qty-box input.qty-in::-webkit-outer-spin-button, .qty-box input.qty-in::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.price-input { width: 74px; height: 28px; text-align: right; padding: 0 7px; border: 1px solid var(--line); border-radius: 8px; font-variant-numeric: tabular-nums; }

/* 进货表单 */
.pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 8px;
  max-height: 190px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px;
  background: var(--panel);
}
.pick-item {
  text-align: left; border: 1px solid var(--line); background: var(--panel);
  border-radius: 9px; padding: 8px 10px; cursor: pointer;
  transition: border-color .13s, background .13s;
}
.pick-item:hover { border-color: #b2d2c5; background: var(--brand-soft-2); }
.pick-item.on { border-color: var(--brand); background: var(--brand-soft); }
.pick-item .n { font-size: 12.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-item .n .pick-n { color: var(--brand-2); font-weight: 600; }
.pick-item .m { font-size: 11px; color: var(--muted); margin-top: 2px; }
.p-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.p-row:last-child { border-bottom: none; }
.p-row .grow { flex: 1 1 130px; min-width: 130px; }
.p-row .nm { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-row .cd { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-row .pad-top { padding-top: 2px; }
.p-row .mono.pad-top { min-width: 74px; }

/* 其他支出：类别点选 */
.chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 7px;
  max-height: 176px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  background: var(--panel);
}
.chip-grid .pick-item { text-align: center; padding: 7px 6px; }
.disc-select {
  width: 82px; height: 28px; padding: 0 6px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); font-size: 11.5px; color: var(--ink-2);
  cursor: pointer; flex: none; text-overflow: ellipsis;
}
.disc-select:focus { outline: none; border-color: #b2d2c5; }
.disc-select.on { border-color: #f3c98c; background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.disc-select.lg { width: 92px; }

.sum { padding: 14px 16px; }
.sum-line { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; font-size: 13px; color: var(--ink-2); }
.sum-line.total { font-size: 15px; color: var(--ink); font-weight: 600; padding-top: 10px; margin-top: 6px; border-top: 1px dashed var(--line); }
.sum-line .big { font-size: 24px; font-weight: 600; color: var(--brand-2); font-variant-numeric: tabular-nums; }

.pay-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.pay-opt {
  height: 34px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--panel); cursor: pointer; font-size: 12.5px; color: var(--ink-2);
}
.pay-opt.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-2); font-weight: 600; }

/* 客户选择器 */
.picker-search { margin-bottom: 0; }
.picker-meta { font-size: 11.5px; color: var(--muted); padding: 9px 2px 6px; }
.picker-list { max-height: 52vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.picker-row {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 13px; cursor: pointer;
  border-bottom: 1px solid var(--line-2);
  transition: background .14s ease;
}
.picker-row:last-child { border-bottom: none; }
.picker-row:hover { background: var(--brand-soft-2); }
.picker-row.on { background: var(--brand-soft); }
.picker-row .avatar { width: 36px; height: 36px; font-size: 14px; }
.picker-row .grow { flex: 1; min-width: 0; }
.picker-row .nm { display: flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 500; color: var(--ink); }
.picker-row .nm .lvl {
  flex: none; font-size: 10.5px; font-weight: 500; line-height: 1.6;
  color: var(--brand-2); background: var(--brand-soft); border-radius: 99px; padding: 0 7px;
}
.picker-row.on .nm .lvl { background: var(--panel); }
.picker-row .cd { font-size: 11.5px; color: var(--muted); }
.picker-row .grow .cd { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-row .picker-side { flex: none; text-align: right; }
.picker-row .bal { font-size: 13px; font-weight: 600; color: var(--brand-2); font-variant-numeric: tabular-nums; }
.picker-row .picker-side .cd { font-size: 10.5px; }
.picker-row .picker-go { flex: none; display: grid; place-items: center; width: 16px; color: var(--muted); }
.picker-row .picker-go svg { width: 15px; height: 15px; transition: transform .14s ease; }
.picker-row:hover .picker-go svg { transform: translateX(2px); }
.picker-row.on .picker-go { color: var(--ok); }
.picker-row.on:hover .picker-go svg { transform: none; }

/* 图表 */
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 74px; align-items: center; gap: 10px; font-size: 12.5px; }
.bar-track { height: 8px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #7ab8a5, #3d8f7a); }
.bar-row .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }

/* 详情 */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.kv { padding: 7px 0; border-bottom: 1px dashed var(--line-2); }
.kv .k { font-size: 11.5px; color: var(--muted); }
.kv .v { font-size: 13.5px; }

.avatar-lg { width: 46px; height: 46px; border-radius: 14px; font-size: 18px; }

/* 响应式 */
@media (max-width: 960px) {
  .cols { grid-template-columns: 1fr; }
}

@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .acc-grid { grid-template-columns: repeat(2, 1fr); }
  .billing { grid-template-columns: minmax(0,1fr) 320px; }
  .cols-3 { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: 250px;
    transform: translateX(-100%);
    transition: transform .22s ease;
    background: var(--panel);
    box-shadow: 12px 0 40px rgba(24, 50, 44, .22);
  }
  .sidebar.open { transform: none; }
  .hamburger { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; }
  .nav-mask { position: fixed; inset: 0; background: rgba(24, 50, 44,.34); z-index: 35; }
  .topbar { padding: 0 14px; height: 56px; }
  .content { padding: 14px 12px 118px; }
  .billing { grid-template-columns: 1fr; }
  .cart { position: static; }
}

/* ---------- 手机端增强（小屏才显示） ---------- */
.tabbar { display: none; }
.m-cards { display: none; }

@media (max-width: 860px) {
  .tabbar {
    display: flex;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--panel);
    border-top: 1px solid var(--line);
    padding: 4px 0 calc(5px + env(safe-area-inset-bottom));
    transition: transform .2s ease;
  }
  .tabbar.hide { transform: translateY(115%); }
  .tab-item {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 6px 0 3px;
    font-size: 10.5px; color: var(--ink-2);
    cursor: pointer; user-select: none;
  }
  .tab-item svg { width: 21px; height: 21px; }
  .tab-item.active { color: var(--brand-2); font-weight: 600; }

  /* 手机上用卡片列表代替表格 */
  .d-only { display: none !important; }
  .m-cards { display: block; }
  .m-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px 10px;
    margin-bottom: 10px;
    cursor: pointer;
  }
  .m-card:active { background: #f5f9f7; }
  .m-card-head { display: flex; align-items: flex-start; gap: 10px; }
  .m-card .avatar { width: 38px; height: 38px; font-size: 15px; }
  .m-card .grow { flex: 1; min-width: 0; }
  .m-name { font-size: 15px; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
  .m-sub { font-size: 12px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
  .m-right { flex: none; text-align: right; }
  .m-amt { font-size: 17px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
  .m-amt-label { font-size: 10.5px; color: var(--muted); margin-top: 1px; }
  .m-card-foot { display: flex; align-items: center; gap: 6px; margin-top: 9px; padding-top: 8px; border-top: 1px dashed var(--line-2); }
  .m-chev { color: #b7c4bd; font-weight: 400; font-size: 18px; line-height: 1; }
  .m-card-foot .btn.sm { flex: none; }

  /* 触控目标加高 */
  .input, .select, .textarea { font-size: 15px; }
  .input, .select { height: 42px; }
  .btn { height: 40px; }
  .btn.sm { height: 34px; }
  .card-head { flex-wrap: wrap; row-gap: 9px; }

  /* ---------- 开单收银手机版 ---------- */
  /* 项目/产品改成整行横条卡，右侧大 ＋ 按钮，点一下加 1 数量 */
  .cat-grid { grid-template-columns: 1fr; gap: 8px; }
  .cat-item { position: relative; padding: 11px 68px 11px 14px; }
  .cat-item .n { font-size: 15px; margin-bottom: 2px; }
  .cat-item .p { font-size: 14px; }
  .cat-add {
    display: flex; align-items: center; justify-content: center;
    position: absolute; right: 10px; top: 50%;
    width: 42px; height: 42px; margin-top: -21px;
    border-radius: 50%;
    background: var(--brand-soft); color: var(--brand-2);
    font-size: 24px; font-weight: 600; line-height: 1;
    box-sizing: border-box;
    user-select: none;
    transition: transform .12s, background .12s, color .12s;
  }
  .cat-add:active { transform: scale(.8); background: var(--brand-2); color: #fff; }
  .cat-qty {
    display: inline-flex; align-items: center;
    margin-left: 7px; padding: 1px 8px;
    border-radius: 999px;
    background: var(--brand-2); color: #fff;
    font-size: 12px; font-weight: 600; vertical-align: 2px;
  }
  .cat-item.just-added { animation: cat-flash .6s ease; }
  .cat-item.just-added .cat-add { animation: cat-pop .45s ease; }
  @keyframes cat-flash { 0% { background: #dfece6; border-color: #b2d2c5; } 100% { background: var(--panel); } }
  @keyframes cat-pop { 0% { transform: scale(.5); } 55% { transform: scale(1.3); } 100% { transform: scale(1); } }

  /* 当前单据：手机上不再限高内滚，数量/价格/折扣按钮加大好按 */
  .cart-list { max-height: none; }
  .qty-box { height: 40px; }
  .qty-box button { width: 36px; font-size: 17px; }
  .qty-box input.qty-in { width: 48px; font-size: 14.5px; }
  .price-input, .disc-select, .cart-row select { height: 36px; }
  .sum .input { height: 36px; }
  .pay-opt { height: 40px; font-size: 13.5px; }

  /* 目录加满后悬浮的「去当前单据结算」按钮（浮在底部快捷栏上方） */
  .cart-jump {
    display: flex; align-items: center; justify-content: center;
    position: fixed; left: 12px; right: 12px;
    bottom: calc(72px + env(safe-area-inset-bottom));
    z-index: 39;
    height: 48px; border: none; border-radius: 999px;
    background: linear-gradient(180deg, #55a18d, #3d8f7a);
    color: #fff; font-size: 14.5px; font-weight: 600;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 6px 18px rgba(61, 143, 122,.4);
    cursor: pointer; animation: fade .18s ease;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .cart-jump:active { transform: translateY(1px); opacity: .9; }
}

/* ================= 小票打印 ================= */
/* 平时完全隐藏；只有打印时才显示，避免透明层挡住所有点击 */
#print-root { display: none; }

.receipt-paper { display: inline-block; max-width: 100%; font-size: 13px; }

.receipt {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 10px 14px;
  background: var(--panel);
  color: #222;
  font-size: 12px;
  line-height: 1.45;
}
.receipt.preview { border-color: transparent; box-shadow: none; }
.receipt .rc-shop { font-weight: 700; font-size: 15px; text-align: center; margin-bottom: 2px; }
.receipt .rc-type { text-align: center; font-size: 13px; font-weight: 700; letter-spacing: 2px; margin: 1px 0 3px; }
.receipt .rc-logo { text-align: center; margin-bottom: 4px; }
.receipt .rc-logo img { max-width: 130px; max-height: 48px; object-fit: contain; }
.receipt .rc-sub { text-align: center; font-size: 11px; color: var(--muted); margin: 1px 0; }
.receipt .rc-hr { border: 0; border-top: 1px solid #aaa; margin: 7px 0; }
.receipt .rc-hr.dashed { border-top: 1px dashed #aaa; }
.receipt .rc-line { display: flex; justify-content: space-between; padding: 2px 0; font-size: 12px; }
.receipt .rc-line span:first-child { color: #666; }
.receipt .rc-line.rc-total { font-weight: 700; font-size: 14px; border-top: 2px solid #333; padding-top: 4px; margin-top: 3px; }
.receipt .rc-items { margin: 4px 0; }
.receipt .rc-item { display: block; font-size: 11.5px; padding: 2px 0; }
.receipt .rc-item-main { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.receipt .rc-item-name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.receipt .rc-item-spec { font-style: normal; font-size: 10.5px; color: #888; margin-left: 3px; }
.receipt .rc-item-amt { flex: 0 0 auto; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.receipt .rc-item-num { font-size: 10.5px; color: #888; margin-top: 1px; font-variant-numeric: tabular-nums; }
.receipt .rc-usage-list { margin: 3px 0 2px; padding: 2px 0 2px 6px; border-left: 2px solid #ddd; }
.receipt .rc-usage-title { font-size: 10px; color: #888; margin-bottom: 1px; }
.receipt .rc-usage-row { display: flex; justify-content: space-between; gap: 6px; font-size: 10.5px; color: #666; line-height: 1.55; font-variant-numeric: tabular-nums; }
.receipt .rc-usage-row.cur { color: #333; font-weight: 700; }
.receipt .rc-note { font-size: 11px; color: var(--muted); margin-top: 6px; }
.receipt .rc-foot { text-align: center; font-size: 11px; color: #666; margin-top: 8px; }

/* 预约芯片 */
.chips-pick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); font-size: 12px; cursor: pointer; user-select: none; }
.chip input { display: none; }
.chip.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-2); font-weight: 600; }

/* ============ 预约表单：客户搜索 + 项目大卡片 ============ */
.cust-list { position: relative; z-index: 5; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); max-height: 250px; overflow: auto; margin-top: 8px; box-shadow: var(--shadow); }
.cust-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; border-bottom: 1px solid var(--line-2); }
.cust-item:last-child { border-bottom: 0; }
.cust-item:hover { background: var(--brand-soft-2); }
.cust-item .t { font-size: 14px; font-weight: 600; }
.cust-item .s { font-size: 12px; color: var(--muted); margin-top: -2px; }
.cust-item .grow, .cust-chip .grow { flex: 1; min-width: 0; }
.cust-empty { padding: 16px 14px; font-size: 13px; color: var(--muted); text-align: center; }
.cust-chip { display: flex; align-items: center; gap: 10px; background: var(--brand-soft-2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin-bottom: 8px; }
.cust-chip .t { font-size: 15px; font-weight: 700; }
.cust-chip .s { font-size: 12px; color: var(--muted); }
.svc-cat { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: 2px; margin: 12px 0 8px; }
.svc-cat:first-child { margin-top: 2px; }
.svc-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.svc-tile { position: relative; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 10px 12px; cursor: pointer; user-select: none; display: block; transition: border-color .12s, background .12s; }
.svc-tile:hover { border-color: var(--brand); }
.svc-tile input { position: absolute; opacity: 0; pointer-events: none; }
.svc-tile b { display: block; font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 2px; line-height: 1.4; }
.svc-tile .ss { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.svc-tile.on { border-color: var(--brand); background: var(--brand-soft); }
.svc-tile.on::after { content: '✓'; position: absolute; top: 8px; right: 10px; width: 18px; height: 18px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 12px; line-height: 18px; text-align: center; }
.svc-tile.on b { color: var(--brand-2); }

/* 收银台：可用次卡 */
.bill-cards { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin: 0 0 12px; }
.card-chip { gap: 7px; border-color: var(--brand); background: var(--brand-soft); color: var(--brand-2); }
.card-chip b { font-size: 12px; font-weight: 600; }
.card-chip span { font-size: 11px; color: var(--muted); }
.card-chip:hover { background: #e6f0eb; }

/* 次卡核销记录 */
.usage-list { display: flex; flex-direction: column; gap: 3px; }
.usage-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 12px;
  font-size: 12px;
  line-height: 1.65;
}
.usage-item .mono { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.usage-item > span:first-child { min-width: 118px; }
.tb td.nowrap .btn + .btn { margin-left: 6px; }

/* 预约日期条 */
.day-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px; scrollbar-width: thin; }
.day-chip { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 72px; padding: 8px 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--ink-2); font-size: 12px; cursor: pointer; }
.day-chip span { font-size: 13px; font-weight: 600; color: var(--brand-2); }
.day-chip b { font-size: 16px; color: var(--ink); }
.day-chip i { font-size: 11px; color: var(--muted); }
.day-chip.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-2); }

/* ---------- 预约月历视图 ---------- */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-wk { text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); padding: 2px 0 4px; }
.cal-cell {
  position: relative; min-height: 96px; border: 1px solid var(--line); border-radius: 9px;
  padding: 5px 6px; background: var(--panel); cursor: pointer; overflow: hidden;
  display: flex; flex-direction: column; gap: 1px; text-align: left;
  transition: border-color .14s, box-shadow .14s;
}
.cal-cell:hover { border-color: var(--brand); box-shadow: 0 3px 10px rgba(61, 124, 109, .12); }
.cal-cell.dim { background: #f9fbfa; cursor: default; pointer-events: none; }
.cal-cell.dim .cal-day { color: #c6cdc8; }
.cal-cell.dim:hover { border-color: var(--line); box-shadow: none; }
.cal-cell.today { border-color: var(--brand); background: var(--brand-soft); }
.cal-cell.today .cal-day { background: var(--brand); color: #fff; border-radius: 99px; }
.cal-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.cal-day { font-size: 12.5px; font-weight: 700; color: var(--ink); min-width: 20px; }
.cal-cnt { font-size: 10.5px; font-weight: 600; color: #fff; background: var(--brand-2); border-radius: 99px; padding: 0 6px; line-height: 16px; }
.cal-cnt.muted { background: #bcc5bf; }
.cal-evt { font-size: 11px; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-evt b { font-weight: 700; color: var(--brand-2); margin-right: 3px; font-variant-numeric: tabular-nums; }
.cal-evt span { color: var(--ink-2); }
.cal-evt.done { opacity: .62; }
.cal-evt.done span { text-decoration: line-through; }
.cal-evt.cancel { opacity: .5; }
.cal-evt.cancel::before { content: '✕ '; color: var(--danger); }
.cal-evt.arrived { color: #9a6b1f; }
.cal-svc { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 2px; }
.cal-more { font-size: 10.5px; color: var(--brand-2); font-weight: 600; margin-top: auto; }

/* ---------- 手机端：点日期在日历内展开的详情面板 ----------
   桌面 display:none 不占格；手机上点开的日期所在周，其面板整行展开 */
.cal-detail {
  display: none; grid-column: 1 / -1;
  background: var(--brand-soft); border: 1px solid var(--brand);
  border-radius: 9px; padding: 7px 10px 5px; text-align: left;
}
.cd-title { display: flex; align-items: center; gap: 6px; font-size: 13px; margin-bottom: 2px; }
.cd-title b { color: var(--brand-2); }
.cd-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px dashed rgba(160, 100, 110, .18); font-size: 12.5px; min-width: 0; }
.cd-item:first-of-type { border-top: none; }
.cd-item b { flex: none; color: var(--brand-2); font-variant-numeric: tabular-nums; }
.cd-item .cd-who { flex: none; font-weight: 600; color: var(--ink); }
.cd-item .cd-svc { flex: 1; min-width: 0; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-item .badge { flex: none; }
.cd-item.cancel { opacity: .55; }
.cd-item.cancel .cd-who { text-decoration: line-through; font-weight: 400; }
.cd-empty { padding: 8px 0 6px; font-size: 12.5px; color: var(--muted); }
.cal-cell.sel { border-color: var(--brand); border-width: 2px; background: var(--brand-soft); }

@media (max-width: 620px) {
  .cal-grid { gap: 3px; }
  .cal-cell { min-height: 46px; padding: 3px 4px; border-radius: 7px; }
  .cal-day { font-size: 11.5px; }
  .cal-cnt { font-size: 9px; padding: 0 4px; line-height: 14px; }
  .cal-evt, .cal-more { display: none; } /* 手机格子只留日期+角标，点日期展开完整信息 */
  .cal-svc { display: none; }
  .cal-wk { font-size: 10.5px; }
  .cal-detail.open { display: block; margin: 2px 0; }
}

@media (max-width: 620px) {
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .acc-grid { grid-template-columns: 1fr; gap: 10px; }
  .acc-card { padding: 13px 14px 10px; }
  .acc-balance { font-size: 21px; }
  .stat { padding: 13px 14px; }
  .stat .value { font-size: 20px; }
  .stat .ico { width: 28px; height: 28px; right: 10px; top: 10px; }
  .cols { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .pnl-grid { grid-template-columns: 1fr; gap: 10px; }
  .pnl-card { padding: 15px 16px 13px; }
  .pnl-big { font-size: 27px; }
  .modal { max-height: 92vh; }
  .modal-mask { padding: 10px; align-items: flex-end; }
  .modal { border-radius: 16px 16px 0 0; }
  .topbar h2 { font-size: 15px; }
  .topbar .date { display: none; }
  .cat-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 80px 1fr 66px; }
  .hide-sm { display: none !important; }
  .svc-pick { grid-template-columns: repeat(2, 1fr); }
}

/* ================= 手机快览：店长在外面，手机一眼看懂今日情况 ================= */
@media (max-width: 620px) {
  /* 首页 KPI：四张卡 2×2，数字放大，色块图标藏起省空间 */
  .stats-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stats-kpi .stat { padding: 14px 13px 12px; border-radius: 12px; }
  .stats-kpi .stat .label { font-size: 12.5px; }
  .stats-kpi .stat .value { font-size: 27px; margin-top: 3px; letter-spacing: 0; }
  .stats-kpi .stat .sub { font-size: 11.5px; line-height: 1.55; margin-top: 2px; }
  .stats-kpi .stat .ico { display: none; }
  /* 今日预约 / 最近开单表：字号加大，行距放宽，指头好点 */
  .home-card .table-wrap .tb td { font-size: 14.5px; padding-top: 7px; padding-bottom: 7px; }
  .home-card .table-wrap .tb td.num b { font-size: 16.5px; }
  /* 未收款相关徽标醒目些 */
  .badge.warn { font-weight: 600; }
}

/* ================= 打印：只显示小票 ================= */
@page { margin: 4mm; }

@media print {
  html, body { margin: 0; padding: 0; background: #fff; }
  body * { visibility: hidden !important; }
  #print-root, #print-root * { visibility: visible !important; }
  #print-root {
    display: block !important;
    position: absolute !important;
    left: 0; top: 0;
    width: 100%;
  }
  #print-root .receipt {
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    margin: 0 auto;
  }
  #print-root .receipt.preview { box-shadow: none; }
}

/* ������������searchselect�� */
.searchselect { position: relative; }
.searchselect .ss-list { position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; right: 0; max-height: 220px; overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08); }
.searchselect .ss-row { display: block; width: 100%; text-align: left; border: none; background: none; padding: 9px 12px; font-size: 13px; color: var(--ink); cursor: pointer; border-bottom: 1px solid var(--line); }
.searchselect .ss-row:last-child { border-bottom: none; }
.searchselect .ss-row:hover { background: var(--brand-soft-2); }
.searchselect .ss-row.on { background: var(--brand-soft); }
.searchselect .ss-empty { padding: 14px 12px; font-size: 12px; color: var(--muted); }
.chip-cb.on { border-color: var(--brand) !important; background: var(--brand-soft); color: var(--brand-2); font-weight: 600; }
.chip-cb.on input { accent-color: var(--brand); }

/* ---------- 客户经营看板 ---------- */
/* 等级资产条：各等级人数 + 储值余额合计，点击=筛选该等级 */
.cu-level-strip { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 14px; }
.cu-level-strip .lv-asset { display: inline-flex; align-items: baseline; gap: 7px; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 15px; font-size: 12.5px; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.cu-level-strip .lv-asset:hover { border-color: var(--brand); }
.cu-level-strip .lv-asset.on { border-color: var(--brand); background: var(--brand-soft); }
.cu-level-strip .lv-asset .lv-name { font-weight: 600; color: var(--ink); }
.cu-level-strip .lv-asset.on .lv-name { color: var(--brand-2); }
.cu-level-strip .lv-asset .lv-nums { color: var(--ink-2); }
.cu-level-strip .lv-asset .lv-bal { font-weight: 700; color: var(--brand-2); font-variant-numeric: tabular-nums; }
.cu-level-strip .lv-asset .lv-month { color: var(--muted); }

/* 客户详情：近 12 个月消费小柱图 */
.cu-spark-wrap { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 10px; margin-bottom: 14px; background: #fff; }
.cu-spark { display: flex; gap: 7px; align-items: flex-end; height: 128px; }
.cu-spark-col { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100%; justify-content: flex-end; align-items: stretch; }
.cu-spark-col .v { font-size: 10px; color: var(--muted); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cu-spark-col .v.z { color: var(--line); }
.cu-spark-col .v.on { color: var(--brand-2); font-weight: 700; }
.cu-spark-col .cu-spark-bar { flex: 1; display: flex; align-items: flex-end; justify-content: center; }
.cu-spark-col .cu-spark-fill { width: 100%; max-width: 46px; background: var(--brand-soft-2); border-radius: 5px 5px 2px 2px; min-height: 2px; }
.cu-spark-col.now .cu-spark-fill { background: var(--brand); }
.cu-spark-col .cu-spark-lb { font-size: 10px; color: var(--muted); text-align: center; margin-top: 4px; white-space: nowrap; }
.cu-spark-col.now .cu-spark-lb { color: var(--brand-2); font-weight: 700; }

/* ================================================================== */
/* 质感层：阴影层次 / 字重对比 / 进出场动效 / 玻璃化                     */
/* 纯 CSS 覆写层（后置优先生效），不动任何结构与功能                      */
/* ================================================================== */

:root {
  /* 阴影分层：贴地细影 + 漂浮柔影，卡片像「放」在纸上而不是「印」在纸上 */
  --shadow: 0 1px 2px rgba(31, 53, 48, .035), 0 6px 18px rgba(31, 53, 48, .045), 0 16px 40px rgba(31, 53, 48, .03);
  --shadow-lg: 0 10px 28px rgba(31, 53, 48, .12), 0 30px 80px rgba(31, 53, 48, .18);
  --radius: 16px;
}

/* ---- 卡片：更浮的层次 + 渐隐头部分隔 ---- */
.card {
  border-color: rgba(224, 234, 243, .75);
  box-shadow: var(--shadow);
}
.card-head { border-bottom-color: rgba(224, 231, 226, .65); }
.card-head h3 { font-size: 14.5px; font-weight: 700; letter-spacing: .015em; color: var(--ink); }
.card-body { padding: 18px 20px; }

/* 页面切换：轻轻地浮起来，不抢眼 */
.content { animation: rise .22s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: none } }

/* ---- 按钮：白按钮带一点浮起，主按钮带顶部高光 ---- */
.btn { box-shadow: 0 1px 2px rgba(31, 53, 48, .05); }
.btn:hover { box-shadow: 0 2px 6px rgba(31, 53, 48, .08); }
.btn.primary {
  box-shadow: 0 3px 10px rgba(61, 143, 122, .28), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.btn.primary:hover { box-shadow: 0 4px 14px rgba(61, 143, 122, .34), inset 0 1px 0 rgba(255, 255, 255, .35); }

/* ---- 顶栏 / 侧栏：玻璃纸，页内上下连成一体（手机抽屉必须不透明，否则看不清菜单） ---- */
.topbar {
  background: rgba(253, 252, 250, .72);
  border-bottom: none;
  box-shadow: 0 1px 0 rgba(224, 231, 226, .7), 0 8px 24px rgba(31, 53, 48, .03);
}
.topbar h2 { font-size: 17px; font-weight: 700; letter-spacing: -.015em; }
@media (min-width: 861px) {
  .sidebar {
    background: rgba(252, 251, 248, .55);
  }
}
.side-foot { border-top-color: rgba(224, 231, 226, .7); }
.brand { border-bottom: 1px solid rgba(224, 231, 226, .55); }

/* ---- 表格：表头去色块，靠字重和字距分区，行 hover 更柔 ---- */
table.tb th { background: transparent; color: #9daca5; font-weight: 600; letter-spacing: .05em; border-bottom: 1px solid rgba(224, 231, 226, 1); }
table.tb tbody tr:hover td { background: rgba(238, 246, 242, .6); }
table.tb td { border-bottom: 1px solid rgba(224, 231, 226, .55); }

/* ---- 弹窗：更大的圆角与投影，页脚去色块 ---- */
.modal { border-radius: 18px; box-shadow: var(--shadow-lg); }
.modal-head h3 { font-size: 15.5px; font-weight: 700; }
.modal-foot { background: transparent; border-top-color: rgba(224, 231, 226, .6); }

/* ---- advise 小字更有呼吸 ---- */
.muted { opacity: .95; }

/* ================================================================== */
/* 美工层：标题标记 / 排名徽标 / 数字排版 / 细节精修                      */
/* ================================================================== */

/* 卡片标题：玉青菱形小标记，替代Emoji，全系统统一节奏 */
.card-head h3::before {
  content: '';
  display: inline-block;
  width: 6.5px;
  height: 6.5px;
  border-radius: 2px;
  background: linear-gradient(135deg, var(--brand) 20%, var(--brand-2) 100%);
  transform: rotate(45deg);
  margin-right: 9px;
  vertical-align: 1px;
  opacity: .92;
}

/* TOP10 排名徽标（原 🥇🥈🥉） */
.rk {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  padding: 0 4px;
  border-radius: 6px 6px 6px 2px;
  font-size: 11px;
  font-weight: 800;
  font-style: normal;
  background: var(--line-2);
  color: var(--ink-2);
  margin-right: 5px;
  vertical-align: 2px;
}
.rk.r1 {
  min-width: 21px;
  height: 21px;
  font-size: 12px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #fff;
  box-shadow: 0 2px 7px rgba(61, 143, 122, .35);
}
.rk.r2 { background: var(--brand-soft); color: var(--brand-2); }
.rk.r3 { background: var(--brand-soft-2); color: var(--brand-2); border: 1px solid var(--brand-soft); }

/* 全系统数字等宽排版：金额、统计读起来整齐笔直 */
table.tb td, table.tb th, .badge, .m-amt, .pnl-big, .pnl-tag, .big-num,
.bar-row .v, .cu-spark-col .v, .cu-tab .n, .topbar .date, .muted.num, .num {
  font-variant-numeric: tabular-nums;
}

/* 页签（客户详情 cu-tabs / 报表）字距与选中态更利落 */
.cu-tab { letter-spacing: .01em; }
.cu-tab .n { opacity: .75; margin-left: 2px; }

/* 侧栏品牌区：菱形标记与卡片标题呼应 */
.brand-text b { letter-spacing: .02em; }

/* 选择框/输入框 focus 更柔（与玉青呼应） */
.input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(61, 143, 122, .13); }

/* 日历事件点 / 状态徽标的圆点统一小一号 */
.badge { font-size: 11.5px; }

/* ================================================================== */

/* 回纹细条：顶栏下沿的中式压边 */
.topbar::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 6px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7'%3E%3Cpath d='M0.5 6.5 V0.5 H11.5 V6.5 H4.5 V3 H8' fill='none' stroke='%233d8f7a' stroke-opacity='0.32'/%3E%3C/svg%3E") repeat-x left bottom;
  background-size: 12px 6px;
  pointer-events: none;
}

/* ================================================================== */
