:root {
  --bg: #faf9f6;
  --card: #ffffff;
  --gold: #d97706;
  --gold-dark: #b45309;
  --text: #292524;
  --muted: #78716c;
  --line: #e7e5e4;
  --green: #16a34a;
  --orange: #ea580c;
  --red: #dc2626;
  --radius: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 15px; line-height: 1.5;
}
.layout { display: flex; min-height: 100vh; }

/* 侧边栏 */
.sidebar {
  width: 220px; background: #292524; color: #faf9f6;
  display: flex; flex-direction: column; flex-shrink: 0;
  position: sticky; top: 0; height: 100vh;
}
.brand { padding: 24px 20px 16px; border-bottom: 1px solid #44403c; }
.brand-logo {
  font-size: 26px; font-weight: 800; color: #fbbf24; letter-spacing: 2px;
}
.brand-sub { font-size: 12px; color: #a8a29e; margin-top: 4px; }
.nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px; color: #d6d3d1; cursor: pointer;
  font-size: 15px; border-left: 3px solid transparent;
  transition: all .15s;
}
.nav-item:hover { background: #44403c; color: #fff; }
.nav-item.active { background: #44403c; color: #fbbf24; border-left-color: #f59e0b; }
.ico { font-size: 16px; width: 20px; text-align: center; }
.sidebar-foot { padding: 16px 20px; font-size: 12px; color: #78716c; border-top: 1px solid #44403c; }

/* 主区 */
.main { flex: 1; padding: 24px 28px; max-width: 1200px; }
.page-title { font-size: 22px; font-weight: 800; margin-bottom: 20px; }

/* 卡片 */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  padding: 20px; margin-bottom: 20px;
}
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.card-head h3 { font-size: 16px; font-weight: 700; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.stat .label { font-size: 13px; color: var(--muted); }
.stat .value { font-size: 26px; font-weight: 800; margin-top: 4px; }
.stat .value.gold { color: var(--gold); }
.stat .value.green { color: var(--green); }
.stat .value.red { color: var(--red); }
.stat .value.orange { color: var(--orange); }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-weight: 600; font-size: 13px; white-space: nowrap; }
tr:hover td { background: #faf9f6; }

/* 按钮 */
.btn {
  display: inline-block; padding: 8px 14px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--text); cursor: pointer;
  font-size: 14px; transition: all .15s;
}
.btn:hover { border-color: var(--gold); color: var(--gold-dark); }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--gold-dark); }
.btn.sm { padding: 4px 9px; font-size: 13px; }
.btn.danger { color: var(--red); }
.btn.danger:hover { border-color: var(--red); }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.orange { background: var(--orange); border-color: var(--orange); color: #fff; }

/* 徽标 */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.green { background: #dcfce7; color: #15803d; }
.badge.orange { background: #ffedd5; color: #c2410c; }
.badge.red { background: #fee2e2; color: #b91c1c; }
.badge.gray { background: #f1f5f9; color: #64748b; }
.badge.gold { background: #fef3c7; color: #b45309; }

/* POS */
.pos-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .pos-grid { grid-template-columns: 1fr; } }
.table-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 12px; }
.table-chip {
  padding: 12px 8px; text-align: center; border-radius: 10px; cursor: pointer;
  border: 2px solid var(--line); background: #fff; transition: all .15s; font-size: 13px;
}
.table-chip .name { font-weight: 700; }
.table-chip .st { font-size: 11px; color: var(--muted); }
.table-chip.idle:hover { border-color: var(--gold); }
.table-chip.occupied { background: #ffedd5; border-color: var(--orange); cursor: not-allowed; }
.table-chip.cleaning { background: #e0e7ff; border-color: #6366f1; }
.table-chip .chip-actions { margin-top: 8px; display: flex; flex-direction: column; gap: 5px; align-items: center; }
.table-chip .chip-actions a { font-size: 12px; cursor: pointer; text-decoration: none; transition: color .12s; }
.table-chip .chip-actions a.edit { color: var(--gold-dark); }
.table-chip .chip-actions a.edit:hover { color: var(--gold); text-decoration: underline; }
.table-chip .chip-actions a.del { color: #cbd5e1; }
.table-chip .chip-actions a.del:hover { color: var(--red); text-decoration: underline; }
.table-chip.selected { border-color: var(--gold); background: #fef3c7; box-shadow: 0 0 0 3px rgba(217,119,6,.15); }
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.member-results {
  margin-top: 6px; max-height: 240px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.member-result {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px;
  cursor: pointer; border-bottom: 1px solid var(--line); font-size: 13px;
}
.member-result:last-child { border-bottom: none; }
.member-result:hover { background: #faf9f6; }
.member-result .mr-name { font-weight: 700; }
.member-result .mr-phone { color: var(--muted); }
.member-result .mr-level { color: var(--gold); font-weight: 600; }
.member-result .mr-bal { margin-left: auto; color: #16a34a; font-weight: 600; }
.member-result.empty { color: var(--muted); cursor: default; }
.menu-chip {
  position: relative;
  padding: 12px; border-radius: 10px; border: 1px solid var(--line); cursor: pointer;
  background: #fff; transition: all .15s; text-align: center;
}
.add-btn {
  position: absolute; right: 6px; bottom: 6px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--gold); color: #fff; border: none;
  font-size: 17px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .12);
}
.add-btn:hover { background: var(--gold-dark); }
.thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; }
.menu-img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; margin: 0 auto 5px; display: block; }
.menu-img.empty { display: flex; align-items: center; justify-content: center; background: #f5f5f4; color: #d6d3d1; font-size: 20px; font-weight: 700; }
.menu-chip:hover { border-color: var(--gold); }
.menu-chip .n { font-weight: 700; font-size: 14px; }
.menu-chip .p { color: var(--gold-dark); font-weight: 700; margin-top: 2px; }
.menu-chip .c { font-size: 11px; color: var(--muted); }
.cart-line { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.cl-name { flex: 1; }
.qty-ctl { display: flex; align-items: center; gap: 6px; }
.qty-ctl b { min-width: 20px; text-align: center; }
.cl-price { font-weight: 700; min-width: 64px; text-align: right; }
.cart-total { display: flex; justify-content: space-between; font-weight: 800; font-size: 16px; padding: 12px 0; }
.confirm-meta { font-size: 14px; margin-bottom: 6px; }
.cm-row { display: flex; justify-content: space-between; padding: 5px 0; }
.cm-row .green { color: #16a34a; }
.confirm-total { font-size: 16px; border-top: 2px solid var(--line); margin-top: 6px; padding-top: 10px; }
.confirm-total b { color: var(--gold-dark); font-size: 20px; }
.pos-actions { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
.pos-actions select { flex: 1; padding: 9px; border-radius: 8px; border: 1px solid var(--line); font-size: 14px; }
.empty { color: var(--muted); text-align: center; padding: 24px 0; font-size: 14px; }

/* 表单 */
input, select {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; width: 100%;
}
input:focus, select:focus { outline: none; border-color: var(--gold); }
.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal-box { background: #fff; border-radius: var(--radius); width: 440px; max-width: 92vw; max-height: 88vh; overflow: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 16px; }
.modal-body { padding: 20px; }
.close { border: none; background: none; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }

.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: #292524; color: #fff; padding: 11px 22px; border-radius: 8px;
  font-size: 14px; z-index: 200; box-shadow: 0 4px 12px rgba(0,0,0,.2); opacity: 0; transition: opacity .2s;
}
.toast.show { opacity: 1; }

/* 提示条 + 棋牌 */
.notice { background: #fef3c7; border: 1px solid #fbbf24; color: #92400e; padding: 12px 16px; border-radius: 10px; font-size: 13px; margin-bottom: 16px; line-height: 1.6; }
.game-box { border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 12px; }
.game-head { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 10px; }
.game-players { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; margin-bottom: 10px; }
.p-row { display: flex; justify-content: space-between; background: #faf9f6; padding: 6px 10px; border-radius: 6px; font-size: 13px; }
.game-actions { display: flex; gap: 8px; }
.muted { color: var(--muted); font-size: 13px; }

/* 登录页 */
.login-wrap { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #292524, #44403c); z-index: 300; }
.login-box { background: #fff; border-radius: 16px; padding: 42px 36px; width: 360px; max-width: 92vw; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.login-logo { font-size: 36px; font-weight: 800; color: var(--gold); letter-spacing: 6px; }
.login-sub { color: var(--muted); margin: 6px 0 26px; font-size: 14px; }
.login-box input { margin-bottom: 12px; text-align: center; padding: 11px; }
.login-btn { width: 100%; padding: 11px; font-size: 15px; }
.login-hint { margin-top: 14px; color: #a8a29e; font-size: 12px; }
.logout { color: #a8a29e; font-size: 12px; cursor: pointer; text-decoration: underline; margin-left: 6px; }
.logout:hover { color: #fbbf24; }
