/* ==================== 霜岚茶社点单系统 - 全局样式 ==================== */
:root {
  --bg: #f7f3ec;
  --bg-soft: #fdfbf7;
  --card: #ffffff;
  --ink: #2b2b26;
  --ink-soft: #6b6a63;
  --ink-faint: #a3a29a;
  --green: #3a7d5c;
  --green-deep: #2c6046;
  --green-soft: #eaf3ee;
  --gold: #c9a86a;
  --gold-soft: #f3ead8;
  --line: #eae4d8;
  --danger: #c0554b;
  --danger-soft: #f7e6e3;
  --warn: #c98a3b;
  --warn-soft: #f7ecdd;
  --shadow-sm: 0 1px 3px rgba(60, 50, 30, 0.06);
  --shadow: 0 4px 18px rgba(60, 50, 30, 0.08);
  --shadow-lg: 0 10px 36px rgba(60, 50, 30, 0.14);
  --radius: 16px;
  --radius-sm: 10px;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "SimSun", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, sans-serif;
}

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

html, body { height: 100%; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

/* ---------- 通用布局 ---------- */
.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(247, 243, 236, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1120px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--green), var(--green-deep));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 20px;
  box-shadow: var(--shadow-sm);
}
.brand .name { font-family: var(--serif); font-size: 20px; font-weight: 700; letter-spacing: 1px; }
.brand .sub { font-size: 12px; color: var(--ink-faint); letter-spacing: 2px; }

.topbar-actions { display: flex; align-items: center; gap: 14px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 999px;
  padding: 9px 20px; font-size: 14px; font-weight: 500;
  transition: all .18s ease; white-space: nowrap;
}
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-deep); box-shadow: var(--shadow); }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { filter: brightness(0.94); box-shadow: var(--shadow); }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 1px solid var(--line); }
.btn-ghost:hover { background: #fff; color: var(--ink); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
}

/* ---------- 徽章 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500;
}
.badge-pending { background: var(--warn-soft); color: var(--warn); }
.badge-confirmed { background: #e3edf7; color: #3a6ea5; }
.badge-completed { background: var(--green-soft); color: var(--green-deep); }
.badge-cancelled { background: #eeece6; color: var(--ink-faint); }

/* ---------- 认证页 ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 30px 16px;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(201,168,106,.18), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(58,125,92,.16), transparent 60%),
    var(--bg);
}
.auth-card { width: 400px; max-width: 100%; padding: 38px 34px; }
.auth-card .logo-row { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 26px; }
.auth-card .logo-row .logo {
  width: 56px; height: 56px; border-radius: 16px; font-size: 28px;
  background: linear-gradient(135deg, var(--green), var(--green-deep));
  color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow);
}
.auth-card h1 { font-family: var(--serif); font-size: 24px; letter-spacing: 2px; }
.auth-card .sub { color: var(--ink-faint); font-size: 13px; letter-spacing: 1px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--bg-soft);
  font-size: 15px; transition: border .15s, box-shadow .15s;
}
.field input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }

.auth-footer { text-align: center; margin-top: 18px; font-size: 13px; color: var(--ink-soft); }
.auth-footer a { color: var(--green); font-weight: 500; }

.msg { font-size: 13px; padding: 9px 12px; border-radius: 8px; margin-bottom: 14px; display: none; }
.msg.error { display: block; background: var(--danger-soft); color: var(--danger); }
.msg.success { display: block; background: var(--green-soft); color: var(--green-deep); }

.demo-tip {
  margin-top: 22px; padding: 14px; border-radius: var(--radius-sm);
  background: var(--gold-soft); font-size: 12.5px; color: #8a6a34; line-height: 1.8;
}
.demo-tip b { font-weight: 600; }

/* ---------- 顾客端首页 ---------- */
.page { padding-bottom: 60px; }
.hero {
  text-align: center; padding: 46px 20px 30px;
}
.hero h1 { font-family: var(--serif); font-size: 32px; letter-spacing: 3px; margin-bottom: 8px; }
.hero p { color: var(--ink-soft); }

.cat-nav {
  display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
  margin: 4px 0 26px;
}
.cat-pill {
  padding: 7px 18px; border-radius: 999px; font-size: 14px;
  background: #fff; border: 1px solid var(--line); color: var(--ink-soft);
  transition: all .15s;
}
.cat-pill:hover { color: var(--green); border-color: var(--green); }
.cat-pill.active { background: var(--green); color: #fff; border-color: var(--green); }

.section-title {
  font-family: var(--serif); font-size: 20px; letter-spacing: 1px;
  margin: 30px 0 16px; display: flex; align-items: center; gap: 10px;
}
.section-title::before {
  content: ""; width: 4px; height: 20px; border-radius: 2px;
  background: var(--gold);
}

.menu-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px;
}
.menu-item {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
  transition: transform .18s, box-shadow .18s;
}
.menu-item:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.menu-item .thumb {
  height: 120px; display: flex; align-items: center; justify-content: center;
  font-size: 46px; position: relative;
}
.menu-item .thumb .cat-tag {
  position: absolute; top: 10px; left: 10px;
  font-size: 11px; padding: 2px 9px; border-radius: 999px;
  background: rgba(255,255,255,.85); color: var(--green-deep);
}
.menu-item .body { padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1; }
.menu-item .row { display: flex; align-items: baseline; justify-content: space-between; }
.menu-item .title { font-family: var(--serif); font-size: 17px; font-weight: 600; }
.menu-item .price { color: var(--danger); font-weight: 600; font-size: 16px; }
.menu-item .price::before { content: "¥"; font-size: 12px; margin-right: 1px; }
.menu-item .desc { font-size: 12.5px; color: var(--ink-faint); margin: 6px 0 12px; flex: 1; }
.menu-item .add-btn {
  align-self: flex-end;
  width: 34px; height: 34px; border-radius: 50%; border: none;
  background: var(--green); color: #fff; font-size: 20px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.menu-item .add-btn:hover { background: var(--green-deep); transform: scale(1.08); }

/* 分类配色 */
.cat-green .thumb { background: linear-gradient(135deg, #e8f0e5, #d3e4d0); }
.cat-oolong .thumb { background: linear-gradient(135deg, #f0e7d6, #e2d3b8); }
.cat-red .thumb { background: linear-gradient(135deg, #f3e0d8, #e7c9bd); }
.cat-white .thumb { background: linear-gradient(135deg, #f1f0eb, #e2e2da); }
.cat-black .thumb { background: linear-gradient(135deg, #e9e2d6, #d6cbb8); }
.cat-flower .thumb { background: linear-gradient(135deg, #f3e3ec, #e6cbd9); }
.cat-snack .thumb { background: linear-gradient(135deg, #f4eada, #eadcc2); }

/* ---------- 购物车 ---------- */
.cart-fab {
  position: fixed; right: 26px; bottom: 26px; z-index: 60;
  display: flex; align-items: center; gap: 10px;
  background: var(--green-deep); color: #fff; border: none;
  padding: 15px 22px; border-radius: 999px; font-size: 15px; font-weight: 500;
  box-shadow: var(--shadow-lg); transition: transform .18s;
}
.cart-fab:hover { transform: translateY(-2px); }
.cart-fab .count {
  background: var(--gold); color: #fff; border-radius: 999px;
  min-width: 22px; height: 22px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 13px;
}

.cart-drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 400px; max-width: 92vw;
  background: var(--card); z-index: 100; box-shadow: var(--shadow-lg);
  transform: translateX(100%); transition: transform .3s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
}
.cart-drawer.open { transform: translateX(0); }
.drawer-head {
  padding: 20px 22px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.drawer-head h3 { font-family: var(--serif); font-size: 19px; letter-spacing: 1px; }
.drawer-head .close { border: none; background: none; font-size: 22px; color: var(--ink-faint); }
.drawer-body { flex: 1; overflow-y: auto; padding: 8px 22px; }
.cart-item {
  display: flex; align-items: center; gap: 12px; padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.cart-item .info { flex: 1; }
.cart-item .name { font-weight: 500; }
.cart-item .price { font-size: 13px; color: var(--ink-faint); }
.qty-ctrl { display: flex; align-items: center; gap: 2px; }
.qty-ctrl button {
  width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; font-size: 16px; color: var(--ink-soft);
}
.qty-ctrl button:hover { background: var(--bg); }
.qty-ctrl span { min-width: 28px; text-align: center; font-weight: 600; }
.cart-item .rm { border: none; background: none; color: var(--ink-faint); font-size: 18px; }
.cart-empty { text-align: center; color: var(--ink-faint); padding: 60px 0; }

.drawer-foot { padding: 18px 22px; border-top: 1px solid var(--line); }
.drawer-foot .total-row { display: flex; justify-content: space-between; margin-bottom: 8px; }
.drawer-foot .total { font-size: 18px; font-weight: 700; color: var(--danger); }
.drawer-foot textarea {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--bg-soft);
  font-size: 13px; resize: none; height: 56px; margin-bottom: 10px;
}
.drawer-foot textarea:focus { outline: none; border-color: var(--green); }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(40, 34, 24, .42);
  z-index: 120; display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-mask.show { display: flex; }
.modal { background: #fff; border-radius: var(--radius); width: 480px; max-width: 100%; padding: 28px; box-shadow: var(--shadow-lg); }
.modal h3 { font-family: var(--serif); font-size: 20px; margin-bottom: 16px; }
.modal .order-list { max-height: 300px; overflow-y: auto; margin-bottom: 12px; }
.modal .order-line { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }

/* ---------- 订单页 ---------- */
.orders-tabs { display: flex; gap: 10px; margin: 0 0 22px; flex-wrap: wrap; }
.order-card { padding: 18px 20px; margin-bottom: 14px; }
.order-card .head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.order-card .no { font-weight: 600; font-size: 14px; }
.order-card .time { color: var(--ink-faint); font-size: 12px; }
.order-card .items { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.order-card .items .it { background: var(--bg); border-radius: 8px; padding: 4px 10px; font-size: 13px; }
.order-card .foot { display: flex; justify-content: space-between; align-items: center; }
.order-card .total { font-weight: 700; color: var(--danger); }

/* ---------- 后台 ---------- */
.admin-wrap { min-height: 100vh; display: flex; }
.sidebar {
  width: 220px; background: #24312a; color: #cfd8d2;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: 22px 20px; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .brand .logo { background: var(--gold); }
.sidebar nav { flex: 1; padding: 14px 0; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px; padding: 12px 22px;
  color: #b8c4bc; font-size: 14px; transition: all .15s;
}
.sidebar nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.sidebar nav a.active { background: rgba(201,168,106,.16); color: #fff; border-left: 3px solid var(--gold); }
.sidebar .foot { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.08); font-size: 13px; color: #8fa096; }
.admin-main { flex: 1; padding: 26px 30px; min-width: 0; }
.admin-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.admin-head h1 { font-family: var(--serif); font-size: 24px; letter-spacing: 1px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card { padding: 20px; display: flex; align-items: center; gap: 16px; }
.stat-card .icon {
  width: 50px; height: 50px; border-radius: 14px; font-size: 24px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-card .label { font-size: 13px; color: var(--ink-faint); }
.stat-card .value { font-size: 26px; font-weight: 700; font-family: var(--serif); }
.stat-card .value.small { font-size: 20px; }
.stat-card .unit { font-size: 13px; color: var(--ink-soft); margin-left: 2px; }

.icon-green { background: var(--green-soft); }
.icon-gold { background: var(--gold-soft); }
.icon-red { background: var(--danger-soft); }
.icon-blue { background: #e3edf7; }

.chart-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 16px; }
.chart-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.chart-card { padding: 20px; }
.chart-card h3 { font-family: var(--serif); font-size: 17px; margin-bottom: 14px; letter-spacing: 1px; }
.chart-box { position: relative; height: 260px; }

.filter-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-pill {
  padding: 7px 16px; border-radius: 999px; font-size: 13px;
  background: #fff; border: 1px solid var(--line); color: var(--ink-soft);
}
.filter-pill.active { background: var(--green); color: #fff; border-color: var(--green); }

.order-table { width: 100%; border-collapse: collapse; }
.order-table th, .order-table td { padding: 13px 14px; text-align: left; font-size: 14px; }
.order-table th { color: var(--ink-faint); font-weight: 500; font-size: 12.5px; border-bottom: 1px solid var(--line); }
.order-table td { border-bottom: 1px solid var(--line); }
.order-table tr:hover td { background: var(--bg-soft); }
.order-table .cust { font-weight: 500; }
.order-table .actions { display: flex; gap: 6px; }
.mini-list { list-style: none; font-size: 13px; color: var(--ink-soft); }
.mini-list li { padding: 2px 0; }

.new-row td { background: #fdf6e3 !important; animation: fadeHighlight 3s ease; }
@keyframes fadeHighlight { 0% { background: #fbe6b0; } 100% { background: transparent; } }

.empty-state { text-align: center; color: var(--ink-faint); padding: 50px 0; }
.empty-state .big { font-size: 44px; margin-bottom: 10px; }

/* 响应式 */
@media (max-width: 860px) {
  .chart-grid, .chart-grid-2 { grid-template-columns: 1fr; }
  .sidebar { width: 64px; }
  .sidebar .brand .name, .sidebar .brand .sub, .sidebar nav a span, .sidebar .foot { display: none; }
  .sidebar nav a { justify-content: center; padding: 14px; }
  .admin-main { padding: 18px 14px; }
  .order-table { display: block; overflow-x: auto; }
}

.toast {
  position: fixed; top: 24px; left: 50%; transform: translateX(-50%) translateY(-80px);
  background: var(--ink); color: #fff; padding: 11px 22px; border-radius: 999px;
  font-size: 14px; z-index: 200; box-shadow: var(--shadow-lg);
  transition: transform .3s; opacity: 0;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ---------- 认证页 Tab 与验证码 ---------- */
.auth-tabs {
  display: flex; gap: 6px; background: var(--bg); border-radius: 12px;
  padding: 5px; margin-bottom: 20px;
}
.auth-tabs button {
  flex: 1; border: none; background: transparent; padding: 9px 0;
  border-radius: 9px; font-size: 14px; color: var(--ink-soft);
  transition: all .15s;
}
.auth-tabs button.active {
  background: #fff; color: var(--green-deep); font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.auth-form { margin-top: 4px; }
.otp-row { display: flex; gap: 10px; align-items: center; }
.otp-row input { flex: 1; min-width: 0; }
.otp-row .btn { flex-shrink: 0; }
