/* ===== 全局重置 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --primary: #FF6B35;
  --primary-dark: #e85a25;
  --success: #2D6A4F;
  --danger: #E63946;
  --warning: #F4A261;
  --info: #4A90D9;
  --bg: #F5F6F8;
  --card: #FFFFFF;
  --text: #1a1a1a;
  --text-2: #666;
  --text-3: #999;
  --border: #ECECEC;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,.06);
}
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Helvetica, "Microsoft Yahei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: 14px; outline: none; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { display: block; max-width: 100%; }

/* ===== 容器 ===== */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  padding-bottom: 60px;
}
.app.no-tab { padding-bottom: 0; }

/* ===== 顶部标题栏 ===== */
.header {
  background: var(--primary);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header h1 { font-size: 17px; font-weight: 600; }
.header .back { font-size: 20px; width: 30px; }
.header .right { font-size: 13px; opacity: .9; }

/* ===== 底部Tab ===== */
.tabbar {
  position: fixed;
  bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  background: #fff;
  display: flex;
  border-top: 1px solid var(--border);
  z-index: 100;
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
}
.tabbar a {
  flex: 1;
  text-align: center;
  color: var(--text-3);
  font-size: 11px;
  padding: 4px 0;
}
.tabbar a .ico { font-size: 22px; display: block; line-height: 1.2; }
.tabbar a.active { color: var(--primary); }

/* ===== 卡片 ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 12px;
  padding: 14px;
}
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }
.card-title .more { font-size: 12px; color: var(--text-3); font-weight: normal; }

/* ===== 表单 ===== */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
}
.form-group input:focus, .form-group textarea:focus { border-color: var(--primary); }
.form-group textarea { resize: vertical; min-height: 70px; }
.form-row { display: flex; gap: 10px; }
.form-row > * { flex: 1; }

/* ===== 按钮 ===== */
.btn {
  display: inline-block;
  padding: 10px 18px;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  transition: opacity .15s;
}
.btn:active { opacity: .8; }
.btn-block { display: block; width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 13px; font-size: 16px; }
.btn-success { background: var(--success); }
.btn-danger { background: var(--danger); }
.btn-info { background: var(--info); }
.btn-warning { background: var(--warning); }
.btn-outline { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-outline.btn-primary { color: var(--primary); border-color: var(--primary); }
.btn-disabled, .btn:disabled { background: #ccc !important; color: #fff; }

/* ===== 列表 ===== */
.list-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-item .title { flex: 1; font-size: 14px; }
.list-item .sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.list-item .right { font-size: 13px; color: var(--text-2); }

/* ===== 统计卡片 ===== */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px 14px;
  box-shadow: var(--shadow);
}
.stat-card .num { font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-card .num.green { color: var(--success); }
.stat-card .label { font-size: 12px; color: var(--text-2); margin-top: 4px; }

/* ===== 开摊开关 ===== */
.switch-banner {
  margin: 12px;
  padding: 18px 16px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #FF6B35, #FF9558);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 16px rgba(255,107,53,.3);
}
.switch-banner.off { background: linear-gradient(135deg, #888, #aaa); box-shadow: 0 4px 16px rgba(0,0,0,.1); }
.switch-banner .info .big { font-size: 18px; font-weight: 600; }
.switch-banner .info .small { font-size: 12px; opacity: .9; margin-top: 2px; }
.switch {
  width: 54px; height: 30px;
  background: rgba(255,255,255,.4);
  border-radius: 15px;
  position: relative;
  transition: background .2s;
}
.switch::after {
  content: '';
  position: absolute;
  width: 26px; height: 26px;
  background: #fff;
  border-radius: 50%;
  top: 2px; left: 2px;
  transition: left .2s;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.switch.on { background: rgba(255,255,255,.95); }
.switch.on::after { left: 26px; background: var(--primary); }

/* ===== 商品卡片 ===== */
.product-card {
  background: #fff;
  border-radius: var(--radius);
  margin: 8px 12px;
  padding: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  box-shadow: var(--shadow);
}
.product-card .img {
  width: 60px; height: 60px;
  border-radius: 8px;
  background: #f0f0f0;
  object-fit: cover;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: #ccc;
}
.product-card .info { flex: 1; min-width: 0; }
.product-card .name { font-size: 14px; font-weight: 500; }
.product-card .meta { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.product-card .price { color: var(--danger); font-weight: 600; margin-top: 4px; }
.product-card .ops { display: flex; flex-direction: column; gap: 6px; }
.tag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  background: #f0f0f0;
  color: var(--text-2);
  margin-right: 4px;
}
.tag.on { background: #e6f7ff; color: var(--info); }
.tag.off { background: #f5f5f5; color: #ccc; }

/* ===== 订单卡片 ===== */
.order-card {
  background: #fff;
  border-radius: var(--radius);
  margin: 8px 12px;
  padding: 12px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
}
.order-card.pending { border-left-color: var(--danger); animation: pulse 1.5s infinite; }
.order-card.accepted { border-left-color: var(--warning); }
.order-card.cooking { border-left-color: var(--info); }
.order-card.ready { border-left-color: var(--success); }
.order-card.done { border-left-color: #ccc; opacity: .8; }
@keyframes pulse {
  0%,100% { box-shadow: 0 2px 12px rgba(0,0,0,.06); }
  50% { box-shadow: 0 2px 20px rgba(230,57,70,.3); }
}
.order-card .head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.order-card .queue {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
}
.order-card .type {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #f0f0f0;
}
.order-card .type.dine_in { background: #fff3e0; color: #e65100; }
.order-card .type.takeout { background: #e8f5e9; color: #2e7d32; }
.order-card .type.delivery { background: #e3f2fd; color: #1565c0; }
.order-card .items { font-size: 13px; color: var(--text-2); margin: 8px 0; }
.order-card .items .row { padding: 3px 0; display: flex; justify-content: space-between; }
.order-card .foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.order-card .total { color: var(--danger); font-weight: 600; }
.order-card .ops { display: flex; gap: 6px; flex-wrap: wrap; }
.order-card .time { font-size: 11px; color: var(--text-3); }
.order-card .addr { font-size: 12px; color: var(--info); margin-top: 4px; }

/* ===== 状态徽章 ===== */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
}
.badge-pending { background: #ffebee; color: var(--danger); }
.badge-accepted { background: #fff3e0; color: var(--warning); }
.badge-cooking { background: #e3f2fd; color: var(--info); }
.badge-ready { background: #e8f5e9; color: var(--success); }
.badge-delivering { background: #e3f2fd; color: var(--info); }
.badge-done { background: #f5f5f5; color: var(--text-3); }
.badge-canceled { background: #f5f5f5; color: var(--text-3); }

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

/* ===== 登录页 ===== */
.login-page {
  min-height: 100vh;
  background: linear-gradient(160deg, #FF6B35, #FF9558);
  padding: 60px 24px 24px;
  color: #fff;
}
.login-page .brand { text-align: center; margin-bottom: 36px; }
.login-page .brand .logo { font-size: 50px; }
.login-page .brand h1 { font-size: 24px; margin-top: 8px; }
.login-page .brand .sub { font-size: 13px; opacity: .9; margin-top: 4px; }
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 24px 20px;
  color: var(--text);
  box-shadow: 0 8px 30px rgba(0,0,0,.15);
}
.login-card .tabs { display: flex; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.login-card .tabs button {
  flex: 1;
  padding: 10px;
  font-size: 14px;
  color: var(--text-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.login-card .tabs button.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ===== 语音控制 ===== */
.voice-bar {
  margin: 12px;
  padding: 10px 14px;
  background: #fff;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
}
.voice-bar .ico { font-size: 18px; }
.voice-bar .txt { flex: 1; font-size: 13px; margin-left: 8px; }
.voice-bar .pill {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  background: #f0f0f0;
  color: var(--text-2);
}
.voice-bar .pill.on { background: #e8f5e9; color: var(--success); }
.voice-bar .pill.on::before { content: '● '; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .3; } }

/* ===== 工具类 ===== */
.flex { display: flex; }
.between { justify-content: space-between; }
.center { align-items: center; }
.gap8 { gap: 8px; }
.mt12 { margin-top: 12px; }
.mb8 { margin-bottom: 8px; }
.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-right { text-align: right; }
.small { font-size: 12px; }
.bold { font-weight: 600; }
.muted { color: var(--text-3); }
.hide { display: none !important; }

/* ===== 浮动按钮 ===== */
.fab {
  position: fixed;
  right: 16px; bottom: 76px;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 26px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(255,107,53,.4);
  z-index: 50;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,.8);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 9999;
  max-width: 80%;
  text-align: center;
}

/* ===== 二维码弹层 ===== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  max-width: 320px;
  width: 100%;
  text-align: center;
}
.modal h3 { margin-bottom: 12px; }
.modal .qr-box {
  background: #fff;
  padding: 12px;
  border-radius: 8px;
  margin: 12px auto;
  display: inline-block;
}
.modal .tip { font-size: 12px; color: var(--text-3); margin-top: 8px; }

/* ===== 商户列表(用户端/超管端通用) ===== */
.merchant-card {
  background: #fff;
  border-radius: var(--radius);
  margin: 8px 12px;
  padding: 14px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 12px;
}
.merchant-card .avatar {
  width: 50px; height: 50px;
  border-radius: 10px;
  background: linear-gradient(135deg, #FF6B35, #FF9558);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.merchant-card .info { flex: 1; min-width: 0; }
.merchant-card .name { font-size: 15px; font-weight: 600; }
.merchant-card .meta { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.merchant-card .dist { color: var(--primary); font-weight: 500; }

/* ===== 购物车浮动条 ===== */
.cart-bar {
  position: fixed;
  bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  background: #fff;
  display: flex;
  align-items: center;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  z-index: 90;
  gap: 12px;
}
.cart-bar .cart-icon {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  position: relative;
  margin-top: -20px;
}
.cart-bar .cart-icon .count {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.cart-bar .total { flex: 1; color: var(--danger); font-weight: 600; font-size: 16px; }
