/* +----------------------------------------------------------------------
   | 云收银 SaaS —— 设计系统（设计令牌 + 通用组件）
   | 与官网/管理后台/商家后台共用同一套色板，支持多主题切换
   +---------------------------------------------------------------------- */

/* ============ 1. 多主题色板 ============ */
:root,
html[data-theme='green'] {
  --brand: #1d9e75;  --brand-2: #0f6e56;  --brand-deep: #085041;  --brand-deeper: #04342c;
  --tint: #e1f5ee;   --ink: #17302a;      --muted: #4b6159;        --ink-3: #7d918a;
  --bg: #f4f7f5;     --card: #fff;        --line: #e4eae7;         --gold: #E8B339;
  --radius: 16px;    --radius-sm: 10px;   --radius-lg: 22px;
  --shadow: 0 1px 2px rgba(16,40,32,.05), 0 8px 24px rgba(16,40,32,.06);
  --shadow-sm: 0 1px 3px rgba(16,40,32,.07);
  --danger: #d94a4a; --success: #1d9e75;  --warn: #e8a33d;         --info: #3b82c4;
}
html[data-theme='blue'] {
  --brand: #185fa5;  --brand-2: #0c447c;  --brand-deep: #042c53;  --brand-deeper: #021a30;
  --tint: #e6f1fb;   --ink: #14283c;      --muted: #45596b;        --ink-3: #7d8f9e;
  --bg: #f4f7fa;     --card: #fff;        --line: #e3e9ef;         --gold: #E8B339;
}
html[data-theme='purple'] {
  --brand: #534ab7;  --brand-2: #3c3489;  --brand-deep: #26215c;  --brand-deeper: #191540;
  --tint: #eeedfe;   --ink: #241f45;      --muted: #4e4977;        --ink-3: #8b87a8;
  --bg: #f6f5fa;     --card: #fff;        --line: #e7e5f1;
}
html[data-theme='coral'] {
  --brand: #d85a30;  --brand-2: #993c1d;  --brand-deep: #712b13;  --brand-deeper: #4a1b0c;
  --tint: #faece7;   --ink: #382019;      --muted: #6e5148;        --ink-3: #a08b83;
  --bg: #faf6f4;     --card: #fff;        --line: #efe5e0;
}
html[data-theme='dark'] {
  --brand: #2f8f6f;  --brand-2: #1d9e75;  --brand-deep: #0f6e56;  --brand-deeper: #085041;
  --tint: #1e2b26;   --ink: #e6efea;      --muted: #a3b5ad;        --ink-3: #7d918a;
  --bg: #12171a;     --card: #1a2124;     --line: #2a3338;         --gold: #E8B339;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.35);
}
html[data-theme='dark'] .card,
html[data-theme='dark'] .panel,
html[data-theme='dark'] .stat,
html[data-theme='dark'] .tbl th,
html[data-theme='dark'] .topbar,
html[data-theme='dark'] .sidebar { background: var(--card); color: var(--ink); }
html[data-theme='dark'] .tbl td { border-color: var(--line); color: var(--muted); }
html[data-theme='dark'] .inp, html[data-theme='dark'] select.inp, html[data-theme='dark'] textarea.inp {
  background: #141a1d; color: var(--ink); border-color: var(--line);
}

/* ============ 2. 基础 ============ */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; color: var(--ink); background: var(--bg); line-height: 1.65;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.15); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ============ 3. 布局 ============ */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row-nowrap { display: flex; gap: 14px; flex-wrap: nowrap; }
.col { flex: 1; min-width: 0; }
.between { display: flex; align-items: center; justify-content: space-between; }
.center { display: flex; align-items: center; }
.gap-6 { gap: 6px; } .gap-10 { gap: 10px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.mt-8{margin-top:8px} .mt-12{margin-top:12px} .mt-16{margin-top:16px} .mt-24{margin-top:24px}
.mb-8{margin-bottom:8px} .mb-12{margin-bottom:12px} .mb-16{margin-bottom:16px}
.mr-8{margin-right:8px} .ml-8{margin-left:8px}
.flex-1 { flex: 1; }
.text-r { text-align: right; } .text-c { text-align: center; }
.muted { color: var(--muted); } .ink3 { color: var(--ink-3); }
.brand-c { color: var(--brand); }
.f12 { font-size: 12px; } .f13 { font-size: 13px; } .f15 { font-size: 15px; } .f18{font-size:18px}
.f22 { font-size: 22px; } .f28 { font-size: 28px; } .f32 { font-size: 32px; }
.bold { font-weight: 700; } .w600 { font-weight: 600; }
.nowrap { white-space: nowrap; }

/* ============ 4. 卡片 / 面板 ============ */
.card, .panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.panel { padding: 20px; }
.panel-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.panel-hd h3 { margin: 0; font-size: 16px; font-weight: 700; }
.panel-bd { padding: 20px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1100px) { .g4,.g5 { grid-template-columns: repeat(2,1fr); } .g3 { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 720px)  { .g2,.g3,.g4,.g5 { grid-template-columns: 1fr; } }

/* ============ 5. 按钮 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--radius-sm); font-weight: 600; font-size: 14px;
  cursor: pointer; border: 1px solid transparent; transition: .15s; white-space: nowrap;
  font-family: inherit;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); color: #fff; }
.btn-ghost { border-color: var(--line); color: var(--brand); background: var(--card); }
.btn-ghost:hover { border-color: var(--brand); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warn { background: var(--warn); color: #fff; }
.btn-info { background: var(--info); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ============ 6. 标签 ============ */
.tag {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--tint); color: var(--brand-2);
}
.tag-gray { background: #eef1f0; color: var(--muted); }
html[data-theme='dark'] .tag-gray { background: #232b2e; color: var(--ink-3); }
.tag-green { background: #e1f5ee; color: #0f6e56; }
.tag-brand { background: var(--tint); color: var(--brand-2); }
.tag-red { background: #fdeaea; color: #b23c3c; }
.tag-orange { background: #fdf1e0; color: #a06d1c; }
.tag-blue { background: #e6f1fb; color: #0c447c; }
.tag-purple { background: #eeedfe; color: #3c3489; }

/* ============ 7. 表格 ============ */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th {
  background: var(--bg); color: var(--muted); font-weight: 600; text-align: left;
  padding: 12px 14px; white-space: nowrap; font-size: 13px; border-bottom: 1px solid var(--line);
}
table.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--muted); }
table.tbl tbody tr:hover td { background: rgba(29,158,117,.045); }
html[data-theme='dark'] table.tbl tbody tr:hover td { background: rgba(255,255,255,.03); }
table.tbl td strong { color: var(--ink); }
.empty { padding: 50px 20px; text-align: center; color: var(--ink-3); }
.empty i { font-size: 40px; display: block; margin-bottom: 10px; opacity: .45; }

/* ============ 8. 表单 ============ */
.inp, select.inp, textarea.inp {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 14px; color: var(--ink); background: var(--card); outline: none; transition: .15s;
  font-family: inherit;
}
.inp:focus, select.inp:focus, textarea.inp:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--tint); }
textarea.inp { min-height: 88px; resize: vertical; }
select.inp { cursor: pointer; appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%237d918a' d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 12px; }
.form-item { margin-bottom: 16px; }
.form-item > label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 13px; }
.form-item .tip { font-size: 12px; color: var(--ink-3); margin-top: 5px; }
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 16px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
@media (max-width: 720px) { .form-row, .form-row-3 { grid-template-columns: 1fr; } }
.req::after { content: ' *'; color: var(--danger); }

/* 会员检索列表（开卡弹窗） */
.mc-pick-list { margin-top: 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.mc-pick-item {
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  padding: 9px 12px; font-size: 13px; cursor: pointer; border-bottom: 1px solid var(--line);
}
.mc-pick-item:last-child { border-bottom: 0; }
.mc-pick-item:hover { background: rgba(29,158,117,.07); }
.mc-pick-item .ink3 { flex: 1; }

/* 开关 */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; cursor: pointer; inset: 0; background: #cfd8d4; border-radius: 24px; transition: .2s;
}
.switch .slider::before {
  content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s;
}
.switch input:checked + .slider { background: var(--brand); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* 单选 / 复选 */
.radio, .checkbox { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; margin-right: 16px; }
.radio input, .checkbox input { accent-color: var(--brand); width: 15px; height: 15px; cursor: pointer; }

/* ============ 9. 统计卡片 ============ */
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow-sm);
}
.stat .ico {
  width: 46px; height: 46px; border-radius: 13px; display: flex; align-items: center; justify-content: center;
  font-size: 21px; background: var(--tint); color: var(--brand); flex-shrink: 0;
}
.stat .num { font-size: 25px; font-weight: 800; line-height: 1.2; color: var(--ink); }
.stat .lbl { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.stat .sub { font-size: 12px; margin-top: 4px; }
.up { color: #d94a4a; } .down { color: #1d9e75; }

/* ============ 10. 弹窗 ============ */
.mask {
  position: fixed; inset: 0; background: rgba(12,24,20,.45); z-index: 900;
  display: none; align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(2px);
}
.mask.show { display: flex; }
.modal {
  background: var(--card); border-radius: var(--radius); width: 100%; max-width: 620px;
  max-height: 88vh; display: flex; flex-direction: column; box-shadow: var(--shadow);
  animation: pop .18s ease;
}
.modal-lg { max-width: 940px; }
.modal-sm { max-width: 420px; }
@keyframes pop { from { transform: scale(.96); opacity: 0 } to { transform: scale(1); opacity: 1 } }
.modal-hd { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal-hd h3 { margin: 0; font-size: 16px; font-weight: 700; }
.modal-bd { padding: 20px; overflow-y: auto; flex: 1; }
.modal-ft { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.modal-close { background: none; border: 0; font-size: 20px; cursor: pointer; color: var(--ink-3); line-height: 1; }

/* ============ 11. 提示 Toast ============ */
#Toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 2000;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,.18); animation: tin .2s ease;
}
.toast.ok { background: var(--brand); }
.toast.err { background: var(--danger); }
@keyframes tin { from { transform: translateY(-10px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }

/* ============ 12. 分页 ============ */
.pager { display: flex; justify-content: flex-end; align-items: center; gap: 6px; padding: 16px 0 0; flex-wrap: wrap; }
.pager a, .pager span {
  min-width: 32px; height: 32px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 8px; font-size: 13px; color: var(--muted); background: var(--card);
}
.pager a:hover { border-color: var(--brand); color: var(--brand); }
.pager .cur { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 700; }
.pager .dis { opacity: .45; }

/* ============ 13. 筛选栏 ============ */
.filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px;
}
.filters .fi { display: flex; flex-direction: column; gap: 4px; }
.filters .fi label { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.filters .inp, .filters select.inp { width: auto; min-width: 150px; }

/* 快捷时间按钮 */
.quick-date { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--card); }
.quick-date a { padding: 8px 14px; font-size: 13px; color: var(--muted); border-right: 1px solid var(--line); }
.quick-date a:last-child { border-right: 0; }
.quick-date a.on { background: var(--brand); color: #fff; font-weight: 600; }

/* ============ 14. 面包屑 / 页面头 ============ */
.page-hd { margin-bottom: 18px; }
.page-hd h2 { margin: 0 0 4px; font-size: 21px; font-weight: 800; }
.crumb { font-size: 13px; color: var(--ink-3); }
.crumb a:hover { color: var(--brand); }

/* ============ 15. 其它 ============ */
.hr { height: 1px; background: var(--line); margin: 16px 0; border: 0; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--tint); color: var(--brand);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.img-preview {
  width: 100px; height: 100px; border: 1px dashed var(--line); border-radius: 10px;
  display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink-3);
  background: var(--bg); overflow: hidden;
}
.img-preview img { width: 100%; height: 100%; object-fit: cover; }
.loading { text-align: center; padding: 40px; color: var(--ink-3); }
.progress { height: 8px; background: var(--line); border-radius: 8px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--brand); border-radius: 8px; transition: width .4s; }
