/* ============================================================
   自助烤肉店会员系统 · 全局样式
   白底 + 淡蓝主色 / 毛玻璃弹窗 / 紧凑布局
   ============================================================ */
:root {
  --primary: #3d7eff;
  --primary-light: #eaf1ff;
  --primary-soft: #f4f8ff;
  --primary-dark: #2b5fd9;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #232b3a;
  --text-2: #6b7688;
  --text-3: #9aa5b5;
  --border: #e6eaf2;
  --danger: #f5484d;
  --success: #21b573;
  --warning: #ff9f2e;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(35, 62, 120, 0.07);
  --shadow-lg: 0 12px 40px rgba(35, 62, 120, 0.18);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d5dceb; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

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

.card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .sub { font-size: 12px; color: var(--text-3); font-weight: 400; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-danger { background: #fff; border-color: #ffd6d8; color: var(--danger, #f5484d); }
.btn-danger:hover { background: #fff3f3; border-color: var(--danger, #f5484d); color: var(--danger, #f5484d); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #1aa266; color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--primary-light); color: var(--primary); }

.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }

/* 输入框 */
.input, .select, .textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(61, 126, 255, 0.12);
}
.input::placeholder { color: var(--text-3); }
.textarea { resize: vertical; min-height: 64px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }

/* 表格 */
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; }
.table th {
  background: #f8fafd;
  color: var(--text-2);
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-size: 12px;
}
.table td {
  padding: 9px 12px;
  border-bottom: 1px solid #f0f3f9;
  color: var(--text);
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--primary-soft); }

/* 标签 */
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
.tag-blue { background: var(--primary-light); color: var(--primary); }
.tag-green { background: #e6f9f0; color: var(--success); }
.tag-red { background: #ffecec; color: var(--danger, #f5484d); }
.tag-orange { background: #fff3e4; color: var(--warning); }
.tag-gray { background: #eef1f6; color: var(--text-2); }

.tag-gold { background: #fff7e0; color: #b8860b; }
.tag-silver { background: #eef1f6; color: #5b6b84; }
.tag-copper { background: #fdeee0; color: #b06a2b; }

/* 徽标 */
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px; font-size: 11px; font-weight: 600;
  background: var(--primary); color: #fff;
}

/* ============ 登录页 ============ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #eef4ff 0%, #e3ecff 55%, #f0f6ff 100%);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.login-wrap::before, .login-wrap::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.5;
}
.login-wrap::before { width: 420px; height: 420px; background: #c9dbff; top: -120px; right: -80px; }
.login-wrap::after { width: 360px; height: 360px; background: #b9d2ff; bottom: -100px; left: -60px; }

.login-card {
  position: relative;
  z-index: 1;
  width: 400px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: 36px 34px 30px;
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.login-logo .icon {
  width: 46px; height: 46px;
  background: linear-gradient(135deg, var(--primary), #6ea2ff);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.login-title { font-size: 21px; font-weight: 700; }
.login-sub { font-size: 13px; color: var(--text-2); margin-bottom: 26px; }

.login-tabs {
  display: flex;
  background: #eef2fa;
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 20px;
}
.login-tab {
  flex: 1;
  text-align: center;
  padding: 8px 0;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
}
.login-tab.active { background: #fff; color: var(--primary); box-shadow: 0 1px 6px rgba(35,62,120,0.1); }

.login-hint {
  margin-top: 16px;
  padding: 10px 12px;
  background: var(--primary-soft);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.8;
}
.login-hint b { color: var(--primary); font-weight: 600; }
.login-error {
  display: none;
  background: #ffecec;
  color: var(--danger, #f5484d);
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 14px;
}
.login-error.show { display: block; }

/* ============ 应用布局 ============ */
.app { display: none; height: 100vh; }
.app.show { display: flex; }

.sidebar {
  width: 208px;
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo .icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), #6ea2ff);
  border-radius: 10px;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo .name { font-size: 15px; font-weight: 700; line-height: 1.2; }
.sidebar-logo .sub { font-size: 11px; color: var(--text-3); }

.sidebar-menu { flex: 1; padding: 12px 10px; overflow: auto; }
.menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text-2);
  cursor: pointer;
  margin-bottom: 2px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.12s;
}
.menu-item:hover { background: var(--primary-soft); color: var(--primary); }
.menu-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.menu-item .lucide { width: 17px; height: 17px; }

.sidebar-user {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
  flex-shrink: 0;
}
.sidebar-user .info { flex: 1; min-width: 0; }
.sidebar-user .info .n { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user .info .r { font-size: 11px; color: var(--text-3); }
.sidebar-user .logout { color: var(--text-3); cursor: pointer; padding: 4px; border-radius: 6px; }
.sidebar-user .logout:hover { color: var(--danger, #f5484d); background: #ffecec; }

.main {
  flex: 1;
  overflow: auto;
  padding: 20px 22px;
  min-width: 0;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 10px;
}
.page-head h2 { font-size: 18px; font-weight: 700; }
.page-head .desc { font-size: 12px; color: var(--text-3); margin-top: 3px; }

/* ============ 统计卡片 ============ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 14px;
}
.stat-card .ic {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-card .ic .lucide { width: 21px; height: 21px; }
.stat-card .num { font-size: 22px; font-weight: 700; line-height: 1.2; }
.stat-card .label { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.ic-blue { background: var(--primary-light); color: var(--primary); }
.ic-green { background: #e6f9f0; color: var(--success); }
.ic-orange { background: #fff3e4; color: var(--warning); }
.ic-purple { background: #f0ecff; color: #7a5cf0; }
.ic-red { background: #ffecec; color: #f5484d; }
.ic-cyan { background: #e4f7fb; color: #0e9db5; }

/* ============ 弹窗 ============ */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(30, 40, 60, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
  width: 520px;
  max-width: 96vw;
  max-height: 88vh;
  overflow: auto;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow-lg);
  padding: 24px;
}
.modal.wide { width: 760px; }
.modal.narrow { width: 380px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.modal-head h3 { font-size: 16px; font-weight: 700; }
.modal-close { cursor: pointer; color: var(--text-3); padding: 4px; border-radius: 6px; }
.modal-close:hover { background: #f0f2f7; color: var(--text); }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 20px;
}

/* ============ 工具条 ============ */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.toolbar .input { width: 220px; }
.toolbar .grow { flex: 1; }

/* 分页 */
.pager {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-2);
}
.pager .btn { padding: 5px 12px; }

/* 空态 */
.empty {
  text-align: center;
  color: var(--text-3);
  padding: 48px 0;
  font-size: 13px;
}
.empty .lucide { width: 40px; height: 40px; opacity: 0.35; margin-bottom: 8px; }

/* 折叠面板/选项卡 */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.tab {
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* 双栏 */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* 徽章 数字 */
.big-num { font-size: 30px; font-weight: 800; }

/* 会员卡 */
.member-card {
  display: flex;
  gap: 16px;
  background: linear-gradient(135deg, #e8f0ff, #f5f8ff);
  border: 1px solid #d5e3ff;
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 14px;
}
.member-card .m-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #6ea2ff);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700;
  flex-shrink: 0;
}
.member-card .m-name { font-size: 17px; font-weight: 700; }
.member-card .m-info { color: var(--text-2); font-size: 12px; margin-top: 3px; }
.member-card .m-stats { display: flex; gap: 28px; margin-top: 12px; }
.member-card .m-stats .s { }
.member-card .m-stats .v { font-size: 18px; font-weight: 700; }
.member-card .m-stats .k { font-size: 11px; color: var(--text-2); }

/* Toast */
.toast-wrap {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 18px;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.25s;
  max-width: 360px;
}
.toast.success .lucide { color: var(--success); }
.toast.error .lucide { color: var(--danger, #f5484d); }
.toast.info .lucide { color: var(--primary); }
@keyframes slideIn {
  from { transform: translateX(30px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* 商品网格 */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.product-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
}
.product-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(35,62,120,0.12); }
.product-card .p-img {
  height: 110px;
  background: linear-gradient(135deg, var(--primary-soft), #e8f2ff);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary); font-size: 30px;
}
.product-card .p-body { padding: 12px 14px; flex: 1; display: flex; flex-direction: column; }
.product-card .p-name { font-weight: 600; font-size: 14px; }
.product-card .p-desc { font-size: 11px; color: var(--text-3); margin-top: 3px; flex: 1; }
.product-card .p-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.product-card .p-points { color: var(--warning); font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 4px; }
.product-card .p-stock { font-size: 11px; color: var(--text-3); }

/* 等级色块 */
.lv-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600;
  padding: 2px 10px; border-radius: 20px;
}
.lv-badge i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* 消息列表 */
.flow-list { display: flex; flex-direction: column; gap: 8px; max-height: 380px; overflow: auto; }
.flow-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  background: #fafbfe;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.flow-item .amount { font-weight: 700; font-size: 14px; }
.flow-item .amount.pos { color: var(--success); }
.flow-item .amount.neg { color: var(--danger, #f5484d); }
.flow-item .remark { font-size: 12px; color: var(--text-2); flex: 1; }
.flow-item .time { font-size: 11px; color: var(--text-3); }

/* 消费键盘区 */
.consume-panel { display: flex; flex-direction: column; gap: 14px; }
.keypad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.keypad .key {
  padding: 14px 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 17px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  background: #fff;
  transition: all 0.1s;
}
.keypad .key:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.keypad .key:active { transform: scale(0.96); }
.keypad .key.act { background: var(--primary); color: #fff; border-color: var(--primary); }
.keypad .key.back { font-size: 13px; }

.pay-summary {
  background: var(--primary-soft);
  border: 1px solid #d5e3ff;
  border-radius: var(--radius);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.pay-summary .ps-item .ps-label { font-size: 11px; color: var(--text-2); }
.pay-summary .ps-item .ps-value { font-size: 17px; font-weight: 700; }
.pay-summary .ps-item .ps-value.primary { color: var(--primary); }
.pay-summary .ps-item .ps-value.warn { color: var(--warning); }

/* 图表容器 */
.chart-box { height: 260px; position: relative; }
.bar-chart { display: flex; align-items: flex-end; gap: 12px; height: 200px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar-col .bar {
  width: 60%;
  max-width: 40px;
  border-radius: 6px 6px 0 0;
  min-height: 2px;
  transition: height 0.4s;
}
.bar-col .bar.blue { background: linear-gradient(180deg, #6ea2ff, var(--primary)); }
.bar-col .bar.green { background: linear-gradient(180deg, #5ad6a4, var(--success)); }
.bar-col .label { font-size: 11px; color: var(--text-3); }

/* 隐藏 */
.hidden { display: none !important; }

@media (max-width: 900px) {
  .sidebar { width: 64px; }
  .sidebar-logo .name, .sidebar-logo .sub, .menu-item span, .sidebar-user .info { display: none; }
  .menu-item { justify-content: center; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .pay-summary { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   手机端适配 (<=640px)
   ============================================================ */
@media (max-width: 640px) {
  /* 整体 */
  body { font-size: 13px; }

  /* 侧边栏变为底部导航 */
  .app { flex-direction: column-reverse; height: 100vh; }
  .sidebar {
    width: 100%;
    height: auto;
    flex-direction: row;
    border-right: none;
    border-top: 1px solid var(--border);
    padding: 0;
    flex-shrink: 0;
    overflow-x: auto;
  }
  .sidebar-logo { display: none; }
  .sidebar-menu {
    flex: 1;
    display: flex;
    flex-direction: row;
    padding: 0;
    gap: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .menu-item {
    flex: 1 0 auto;
    flex-direction: column;
    gap: 3px;
    padding: 8px 6px;
    margin: 0;
    font-size: 10px;
    min-width: 56px;
    border-radius: 0;
    justify-content: center;
  }
  .menu-item span { display: block; font-size: 10px; }
  .menu-item .lucide { width: 18px; height: 18px; }
  .sidebar-user { display: none; }
  .sidebar > div:last-child { display: none; }

  /* 主区域 */
  .main { flex: 1; padding: 12px; overflow: auto; -webkit-overflow-scrolling: touch; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .page-head h2 { font-size: 17px; }

  /* 统计卡片 */
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 12px; }
  .stat-card .num { font-size: 18px; }
  .stat-card .ic { width: 36px; height: 36px; }

  /* 表格 */
  .table { font-size: 12px; }
  .table th, .table td { padding: 7px 8px; }

  /* 弹窗 */
  .modal { width: 96vw; padding: 16px; border-radius: 12px; }
  .modal.wide { width: 96vw; }

  /* 工具条 */
  .toolbar { flex-wrap: wrap; }
  .toolbar .input { width: 100%; }
  .toolbar .select { width: 100%; }

  /* 消费结算 */
  .keypad { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .keypad .key { padding: 10px 0; font-size: 16px; }
  .pay-summary { grid-template-columns: repeat(2, 1fr); }

  /* 会员卡片 */
  .member-card { flex-direction: column; gap: 10px; }
  .member-card .m-stats { gap: 16px; }

  /* 登录页 */
  .login-card { width: 94vw; padding: 28px 22px 24px; }
  .login-title { font-size: 18px; }

  /* 商品网格 */
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  /* 分页 */
  .pager { justify-content: center; }

  /* 双栏变单栏 */
  .grid-2, .grid-3 { grid-template-columns: 1fr; }

  /* 图表 */
  .bar-chart { gap: 4px; }
  .bar-col .bar { max-width: 20px; }
}