/* ============ 宴席预点餐 全局样式（微信 H5 移动端优先） ============ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --primary: #014377;
  --primary-2: #0d5fa0;
  --primary-grad: linear-gradient(135deg, #0d5fa0 0%, #014377 100%);
  --danger: #f43f3f;
  --success: #00b578;
  --warning: #ff9f0a;
  --text: #2b2b2b;
  --text-2: #6b7280;
  --text-3: #a3aab5;
  --bg: #f6f7fb;
  --card: #ffffff;
  --line: #eef0f4;
  --header-h: 56px;
  --tab-h: 62px;
  --cart-h: 58px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --shadow: 0 8px 24px rgba(17, 24, 39, .07);
  --shadow-sm: 0 2px 10px rgba(17, 24, 39, .05);
  --radius: 16px;
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: #edeff5;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

/* 手机居中容器 */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  padding-bottom: calc(var(--tab-h) + var(--safe-bottom) + 20px);
  box-shadow: 0 0 30px rgba(0, 0, 0, .08);
}
.app.has-cart { padding-bottom: calc(var(--tab-h) + var(--cart-h) + var(--safe-bottom) + 20px); }

/* ============ 顶部标题栏 ============ */
.header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  display: flex; align-items: center; padding: 0 10px;
  background: var(--primary-grad);
  color: #fff;
  box-shadow: 0 4px 18px rgba(1, 67, 119, .28);
}
.header::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120px 60px at 85% 0%, rgba(255,255,255,.25), transparent 70%);
}
.header .back {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 22px; line-height: 1;
  transition: background .15s;
}
.header .back:active { background: rgba(255, 255, 255, .18); }
.header .title { flex: 1; text-align: center; font-size: 17px; font-weight: 700; letter-spacing: .5px; }
.header .right { width: 38px; text-align: center; font-size: 13px; }

/* 点餐页标题（名称 + 副标题） */
.header .title-block { flex: 1; text-align: center; overflow: hidden; }
.header .t-name { font-size: 18px; font-weight: 800; letter-spacing: .5px; }
.header .t-sub { font-size: 11px; opacity: .85; margin-top: 1px; }

.header.plain { background: #fff; color: var(--text); border-bottom: 1px solid var(--line); box-shadow: none; }
.header.plain::after { display: none; }
.header.plain .back { color: var(--text); }

/* ============ 公告 / 打烊提示 ============ */
.notice {
  background: linear-gradient(90deg, #fff7e6, #fff1d6);
  color: #d46b08; font-size: 14px; padding: 9px 16px;
  border-bottom: 1px solid #ffe7ba;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.closed-bar {
  background: linear-gradient(90deg, #ffe9e7, #ffdedb);
  color: #d43a2e; font-size: 13px; font-weight: 600;
  padding: 11px 16px; text-align: center; border-bottom: 1px solid #ffd2cc;
}
.closed-bar .closed-sub { display: block; font-size: 11px; font-weight: 400; opacity: .8; margin-top: 2px; }

.add-bar {
  background: linear-gradient(90deg, #e8f8f0, #d7f3e4);
  color: #009962; font-size: 13px; font-weight: 600;
  padding: 11px 16px; text-align: center; border-bottom: 1px solid #c6e9d6;
}

/* ============ 卡片 ============ */
.card {
  background: var(--card); border-radius: var(--radius);
  margin: 12px; padding: 16px; box-shadow: var(--shadow);
}
.card-title { font-size: 15px; font-weight: 800; margin-bottom: 12px; }

/* ============ 按钮 ============ */
.btn {
  display: inline-block; border: none; border-radius: 12px;
  padding: 12px 16px; font-size: 15px; cursor: pointer; font-weight: 600;
  transition: opacity .15s, transform .08s; text-align: center; user-select: none;
}
.btn:active { opacity: .72; transform: scale(.98); }
.btn.primary { background: var(--primary-grad); color: #fff; box-shadow: 0 6px 16px rgba(1, 67, 119, .3); }
.btn.primary[disabled] { background: #a9c1d6; box-shadow: none; color: #fff; }
.btn.danger { background: linear-gradient(135deg, #ff6b6d, #f43f3f); color: #fff; }
.btn.outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn.gray { background: #f2f4f8; color: var(--text-2); }
.btn.block { display: block; width: 100%; }
.btn.sm { padding: 7px 13px; font-size: 13px; border-radius: 9px; }

/* ============ 表单 ============ */
.form-item { margin-bottom: 15px; }
.form-item .label { font-size: 14px; color: var(--text-2); margin-bottom: 7px; display: block; }
.form-item .label b { color: var(--danger); margin-right: 2px; }
.input, .select, .textarea {
  width: 100%; border: 1px solid #e4e7ee; border-radius: 12px;
  padding: 11px 13px; font-size: 15px; background: #fafbfc; color: var(--text);
  outline: none; appearance: none; transition: border .15s, background .15s;
}
.input:focus, .textarea:focus { border-color: var(--primary); background: #fff; }
.textarea { min-height: 76px; resize: vertical; }
.select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a3aab5' fill='none' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }

/* 复选 / 开关 */
.checkbox-group { display: flex; flex-wrap: wrap; gap: 9px; }
.checkbox-item {
  display: flex; align-items: center; gap: 5px; padding: 8px 14px;
  border: 1px solid #e4e7ee; border-radius: 22px; cursor: pointer; font-size: 14px;
  background: #fff; transition: all .15s;
}
.checkbox-item.on { border-color: var(--primary); color: var(--primary); background: #e8f2fa; font-weight: 600; }

.switch { position: relative; width: 50px; height: 28px; border-radius: 14px; background: #d5dbe3; cursor: pointer; transition: background .2s; flex-shrink: 0; }
.switch.on { background: var(--primary); }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: left .2s; }
.switch.on::after { left: 25px; }

/* ============ 底部 Tab 栏（选中高亮 / 未选中灰） ============ */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; margin: 0 auto;
  width: 100%; max-width: 480px;
  height: calc(var(--tab-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: #ffffff;
  border-top: 1px solid var(--line);
  box-shadow: 0 -3px 14px rgba(17, 24, 39, .06);
  display: flex; z-index: 100;
}
.tabbar .tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--text-3); cursor: pointer; text-decoration: none;
  position: relative; user-select: none;
  transition: color .2s;
}
.tabbar .tab .ico { display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; line-height: 0; }
.tabbar .tab .lb { font-size: 11px; line-height: 1; font-weight: 500; letter-spacing: .3px; }
.tabbar .tab.active { color: var(--primary); }
.tabbar .tab.active .lb { font-weight: 700; }
.tabbar .tab .badge {
  position: absolute; top: 5px; left: 50%; margin-left: 7px; background: var(--danger); color: #fff;
  font-size: 10px; min-width: 16px; height: 16px; line-height: 16px; border-radius: 8px; text-align: center; padding: 0 4px;
}

/* ============ 购物车栏 ============ */
.cartbar {
  position: fixed; bottom: calc(var(--tab-h) + var(--safe-bottom)); left: 0; right: 0; margin: 0 auto;
  width: 100%; max-width: 480px; height: var(--cart-h);
  background: #1f2937; display: flex; align-items: center; padding: 0 12px; z-index: 99;
}
.cartbar .cart-ico {
  position: relative; width: 46px; height: 46px; border-radius: 50%;
  background: var(--primary-grad); box-shadow: 0 6px 16px rgba(1, 67, 119, .45);
  display: flex; align-items: center; justify-content: center; font-size: 22px; color: #fff;
  margin-right: 11px; margin-top: -22px; cursor: pointer; flex-shrink: 0;
}
.cartbar .cart-ico .cnt { position: absolute; top: -5px; right: -6px; background: var(--danger); color: #fff; font-size: 11px; min-width: 18px; height: 18px; line-height: 18px; border-radius: 9px; text-align: center; padding: 0 4px; }
.cartbar .cart-info { flex: 1; color: #fff; min-width: 0; }
.cartbar .cart-info .total { font-size: 17px; font-weight: 800; color: #7ed0f0; }
.cartbar .cart-info .tip { font-size: 11px; color: #9aa5b1; }
.cartbar .go-btn { background: var(--primary-grad); color: #fff; border: none; border-radius: 22px; padding: 10px 20px; font-size: 14px; font-weight: 700; cursor: pointer; flex-shrink: 0; }
.cartbar .go-btn[disabled] { background: #374151; color: #6b7280; }

/* ============ 点餐页 ============ */
.menu-wrap { display: flex; height: calc(100vh - var(--header-h) - var(--tab-h) - var(--safe-bottom) - var(--cart-h)); }
.cat-nav { width: 86px; background: #eef1f6; overflow-y: auto; flex-shrink: 0; }
.cat-nav .cat { padding: 17px 8px; text-align: center; font-size: 13px; color: var(--text-2); cursor: pointer; position: relative; }
.cat-nav .cat.active { background: #fff; color: var(--primary); font-weight: 700; }
.cat-nav .cat.active::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 22px; background: var(--primary); border-radius: 2px; }

.dish-list { flex: 1; overflow-y: auto; padding: 12px; }
.dish-item { display: flex; gap: 12px; background: #fff; border-radius: var(--radius); padding: 12px; margin-bottom: 12px; box-shadow: var(--shadow-sm); }
.dish-item .dish-img { width: 88px; height: 88px; border-radius: 12px; background: #f2f4f8; flex-shrink: 0; object-fit: cover; }
.dish-item .dish-img.placeholder { display: flex; align-items: center; justify-content: center; color: #ccd3dd; }
.dish-item .dish-body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.dish-item .dish-name { font-size: 15px; font-weight: 700; }
.dish-item .dish-desc { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.dish-item .dish-price { margin-top: 4px; line-height: 1.2; }
.dish-item .dish-price .cur { color: var(--primary); font-weight: 800; font-size: 17px; }
.dish-item .dish-price .orig { color: var(--text-3); font-size: 12px; text-decoration: line-through; margin-left: 6px; }
.dish-item .dish-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; }
.dish-item.sold-out { opacity: .55; }
.dish-item.sold-out .sold-tag { color: var(--text-3); font-size: 13px; }
.dish-item .stepper { display: flex; align-items: center; gap: 8px; }

.stepper .step-btn {
  width: 28px; height: 28px; border-radius: 50%; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 17px; line-height: 1;
  color: #fff; transition: opacity .15s, transform .1s;
}
.stepper .step-btn:active { opacity: .7; transform: scale(.9); }
.stepper .step-btn.minus { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.stepper .step-btn.plus { background: var(--primary-grad); box-shadow: 0 3px 8px rgba(1, 67, 119, .32); }
.stepper .qty { min-width: 20px; text-align: center; font-size: 15px; font-weight: 700; }

/* ============ 弹窗 ============ */
.mask { position: fixed; inset: 0; background: rgba(17, 24, 39, .5); z-index: 200; display: none; }
.mask.show { display: block; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  position: fixed; left: 0; right: 0; margin: 0 auto; bottom: 0;
  width: 100%; max-width: 480px; background: #fff;
  border-radius: 22px 22px 0 0; z-index: 201; display: none;
  padding-bottom: var(--safe-bottom);
}
.sheet.show { display: block; animation: slideUp .24s cubic-bezier(.2, .8, .3, 1); }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet .sheet-head { padding: 16px 18px 12px; display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.sheet .sheet-head .t { font-size: 16px; font-weight: 800; flex: 1; }
.sheet .sheet-head .clear { color: var(--text-3); font-size: 13px; cursor: pointer; }
.sheet .sheet-body { max-height: 58vh; overflow-y: auto; padding: 10px 18px; }
.sheet .sheet-foot { padding: 12px 18px calc(12px + var(--safe-bottom)); border-top: 1px solid var(--line); }

/* 居中确认框 */
.dialog { position: fixed; left: 0; right: 0; top: 42%; margin: 0 auto; transform: translateY(-50%); width: 82%; max-width: 340px; background: #fff; border-radius: 18px; z-index: 201; display: none; overflow: hidden; box-shadow: 0 14px 44px rgba(0,0,0,.2); }
.dialog.show { display: block; animation: pop .2s ease; }
@keyframes pop { from { transform: translateY(-50%) scale(.92); opacity: .4; } to { transform: translateY(-50%) scale(1); opacity: 1; } }
.dialog .dialog-body { padding: 24px 18px 14px; text-align: center; font-size: 15px; }
.dialog .dialog-body .d-title { font-weight: 800; margin-bottom: 8px; font-size: 16px; }
.dialog .dialog-body > div:last-child { color: var(--text-2); }
.dialog .dialog-foot { display: flex; border-top: 1px solid var(--line); }
.dialog .dialog-foot button { flex: 1; padding: 14px; border: none; background: #fff; font-size: 15px; cursor: pointer; color: var(--text-2); }
.dialog .dialog-foot button:first-child { border-right: 1px solid var(--line); }
.dialog .dialog-foot button.ok { color: var(--primary); font-weight: 700; }
.dialog .dialog-foot button.danger { color: var(--danger); font-weight: 700; }

/* ============ Toast ============ */
.toast {
  position: fixed; left: 0; right: 0; top: 42%; margin: 0 auto; transform: translateY(-50%);
  width: max-content; max-width: 76%;
  background: rgba(17, 24, 39, .88); color: #fff; padding: 11px 20px; border-radius: 24px;
  font-size: 14px; z-index: 300; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .2s; backdrop-filter: blur(4px);
}
.toast.show { opacity: 1; }

/* ============ 订单卡片 ============ */
.time-tabs { display: flex; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: var(--header-h); z-index: 40; }
.time-tabs .ttab { flex: 1; text-align: center; padding: 13px 0; font-size: 14px; color: var(--text-2); cursor: pointer; position: relative; }
.time-tabs .ttab.active { color: var(--primary); font-weight: 700; }
.time-tabs .ttab.active::after { content: ''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: 22px; height: 3px; background: var(--primary); border-radius: 2px; }

.order-card { background: #fff; border-radius: var(--radius); margin: 12px; padding: 15px; box-shadow: var(--shadow); cursor: pointer; }
.order-card:active { background: #fafbfd; }
.order-card .oc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.order-card .oc-no { font-weight: 800; font-size: 15px; }
.order-card .oc-meta { color: var(--text-2); font-size: 13px; margin: 4px 0; }
.order-card .oc-summary { color: var(--text); font-size: 13px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }

.tag { display: inline-block; padding: 3px 9px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.tag.pending { background: #fff4e0; color: #d48806; }
.tag.done { background: #e8f8f0; color: #009962; }
.tag.cancel { background: #ffecec; color: #e5484d; }

/* ============ 列表单元 / 分组 ============ */
.cell { display: flex; align-items: center; padding: 14px 16px; background: #fff; border-bottom: 1px solid var(--line); cursor: pointer; }
.cell:active { background: #f7f9fc; }
.cell .cell-ico { width: 36px; height: 36px; border-radius: 11px; margin-right: 13px; font-size: 18px; display: flex; align-items: center; justify-content: center; color: var(--primary); background: #e8f2fa; flex-shrink: 0; }
.cell .cell-label { flex: 1; font-size: 15px; }
.cell .cell-arrow { color: #c7ced8; font-size: 18px; }
.cell-group { margin: 12px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.cell-group .cell:last-child { border-bottom: none; }

/* ============ 我的页面 ============ */
.profile {
  display: flex; align-items: center; gap: 14px;
  background: var(--primary-grad); color: #fff; padding: 30px 20px 34px;
  position: relative; overflow: hidden;
}
.profile::after { content: ''; position: absolute; right: -34px; top: -34px; width: 150px; height: 150px; border-radius: 50%; background: rgba(255,255,255,.1); }
.profile::before { content: ''; position: absolute; right: 40px; bottom: -50px; width: 110px; height: 110px; border-radius: 50%; background: rgba(255,255,255,.07); }
.profile .avatar { width: 58px; height: 58px; border-radius: 50%; background: rgba(255,255,255,.24); display: flex; align-items: center; justify-content: center; font-size: 28px; flex-shrink: 0; border: 2px solid rgba(255,255,255,.34); }
.profile .nick { font-size: 19px; font-weight: 800; }
.profile .sub { font-size: 12px; opacity: .85; margin-top: 3px; }

.group-title { padding: 16px 18px 8px; font-size: 13px; color: var(--text-3); }

/* ============ 空状态 ============ */
.empty { text-align: center; color: var(--text-3); padding: 64px 20px; font-size: 14px; }
.empty .empty-ico { font-size: 44px; margin-bottom: 12px; opacity: .5; }

/* ============ 商家后台 ============ */
.admin-body { padding: 10px 0 40px; }
.stat-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.stat-box { flex: 1 1 45%; background: #fff; border-radius: var(--radius); padding: 16px 12px; text-align: center; box-shadow: var(--shadow-sm); }
.stat-box .num { font-size: 24px; font-weight: 800; color: var(--primary); }
.stat-box .label { font-size: 12px; color: var(--text-3); margin-top: 3px; }

/* 后台首页菜单网格 */
.home-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 14px; }
.home-item {
  background: #fff; border-radius: var(--radius); padding: 16px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  box-shadow: var(--shadow-sm); cursor: pointer; transition: transform .08s;
}
.home-item:active { transform: scale(.96); }
.home-item .ic { width: 46px; height: 46px; border-radius: 14px; display: flex; align-items: center; justify-content: center; color: #fff; }
.home-item .lb { font-size: 12px; color: var(--text-2); }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 18px; border: 1px solid #e4e7ee; margin: 0 8px 10px 0; cursor: pointer; font-size: 13px; user-select: none; background: #fff; transition: all .15s; }
.chip:active { opacity: .7; }
.chip.on { background: #e8f2fa; color: var(--primary); border-color: var(--primary); }
.chip .chip-tag { font-size: 10px; color: var(--text-3); }
.chip.on .chip-tag { color: var(--primary); }

.row { display: flex; align-items: center; justify-content: space-between; }
.flex { display: flex; }
.gap8 { gap: 8px; }
.mt10 { margin-top: 10px; }
.mb10 { margin-bottom: 10px; }

.thumb { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: #f2f4f8; }

/* 登录页 */
.login-wrap { max-width: 480px; margin: 0 auto; min-height: 100vh; background: #fff; padding: 48px 28px; position: relative; }
.login-wrap .logo { width: 64px; height: 64px; border-radius: 18px; background: var(--primary-grad); display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; color: #fff; box-shadow: 0 8px 22px rgba(1, 67, 119,.35); }
.login-wrap .ltitle { text-align: center; font-size: 21px; font-weight: 800; margin-bottom: 6px; }
.login-wrap .lsub { text-align: center; font-size: 13px; color: var(--text-3); margin-bottom: 34px; }
.login-wrap .foot-tip { text-align: center; color: #b7bec7; font-size: 12px; margin-top: 20px; }
