/* ============================================================
   吧台点餐 —— 触摸屏专用样式
   目标设备：10 寸左右平板（横向），手指点，戴手套也能按
   ============================================================ */
:root {
  --bg: #F6F4EF;
  --card: #FFFFFF;
  --line: #E4E0D6;
  --text: #23281F;
  --text2: #7C8175;
  --primary: #2E6B4F;
  --primary-d: #235039;
  --accent: #D97B34;
  --danger: #B4453C;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0; height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px; color: var(--text); background: var(--bg);
  overflow: hidden;
}
body { display: flex; flex-direction: column; }

/* ---------------- 顶栏 ---------------- */
.top {
  flex: none; height: 62px; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: space-between; padding: 0 18px;
}
.top-left { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 36px; height: 36px; border-radius: 10px; background: rgba(255,255,255,.18);
  display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 600;
}
.title { font-size: 17px; font-weight: 600; line-height: 1.1; }
.sub { font-size: 12px; opacity: .8; }
.top-right { display: flex; align-items: center; gap: 10px; }
.printer-state { font-size: 13px; opacity: .9; }
.printer-state.ok { color: #B7F0CE; }
.printer-state.bad { color: #FFD3CE; }

/* ---------------- 布局 ---------------- */
.layout { flex: 1; min-height: 0; display: flex; }
.menu { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cart {
  width: 380px; flex: none; background: #fff; border-left: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}

/* 分类 */
.cats { flex: none; display: flex; gap: 10px; overflow-x: auto; padding: 12px 14px; background: #fff; }
.cats button {
  flex: none; height: 46px; padding: 0 22px; border: 1px solid var(--line); background: #fff;
  border-radius: 999px; font-size: 16px; color: var(--text2); font-family: inherit;
}
.cats button.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }

/* 菜品网格 */
.dishes {
  flex: 1; min-height: 0; overflow-y: auto; padding: 14px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px;
  align-content: start;
}
.dish {
  position: relative; background: #fff; border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden; cursor: pointer; transition: transform .06s;
}
.dish:active { transform: scale(.97); }
.dish img { width: 100%; height: 108px; object-fit: cover; display: block; background: #EFECE4; }
.dish .info { padding: 10px 12px 12px; }
.dish .nm { font-size: 16px; font-weight: 600; line-height: 1.25; }
.dish .ds { font-size: 12px; color: var(--text2); margin-top: 3px; height: 32px; overflow: hidden; }
.dish .pr { margin-top: 6px; color: var(--accent); font-weight: 700; font-size: 18px; }
.dish .qty {
  position: absolute; top: 8px; right: 8px; min-width: 28px; height: 28px; line-height: 28px;
  padding: 0 8px; border-radius: 999px; background: var(--primary); color: #fff;
  font-size: 14px; font-weight: 600; text-align: center;
}
.dish .badge {
  position: absolute; top: 8px; left: 8px; background: var(--accent); color: #fff;
  font-size: 11px; padding: 3px 8px; border-radius: 999px;
}
.dish.off { opacity: .45; }

/* ---------------- 购物车 ---------------- */
.cart-head {
  flex: none; height: 54px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; border-bottom: 1px solid var(--line); font-size: 16px;
}
.cart-list { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 12px; }
.cart-item {
  display: flex; align-items: center; gap: 10px; padding: 12px 4px; border-bottom: 1px dashed var(--line);
}
.cart-item .nm { flex: 1; min-width: 0; }
.cart-item .nm .t { font-size: 16px; font-weight: 500; }
.cart-item .nm .s { font-size: 12px; color: var(--text2); }
.cart-item .p { font-size: 15px; color: var(--accent); font-weight: 600; white-space: nowrap; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button {
  width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--line); background: #fff;
  font-size: 22px; line-height: 1; color: var(--text); font-family: inherit;
}
.stepper button:active { background: #F1EFE8; }
.stepper .n { min-width: 30px; text-align: center; font-size: 17px; font-weight: 600; }

.cart-form { flex: none; padding: 10px 16px 6px; border-top: 1px solid var(--line); }
.cart-form .row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.cart-form label { width: 82px; flex: none; font-size: 14px; color: var(--text2); }
.cart-form input {
  flex: 1; height: 46px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px;
  font-size: 16px; font-family: inherit; background: #FCFBF8; color: var(--text); min-width: 0;
}
.seg { display: flex; gap: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button {
  height: 46px; padding: 0 20px; border: none; background: #fff; font-size: 15px;
  color: var(--text2); font-family: inherit;
}
.seg button.on { background: var(--primary); color: #fff; font-weight: 600; }

.cart-foot { flex: none; padding: 10px 16px 16px; border-top: 1px solid var(--line); }
.total { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.total strong { font-size: 30px; color: var(--accent); }
.total .t2 { margin-left: auto; }

/* ---------------- 按钮 ---------------- */
.btn {
  height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent;
  font-size: 15px; font-family: inherit; background: #EFECE4; color: var(--text);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:active { background: var(--primary-d); }
.btn.ghost { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.35); color: #fff; }
.btn.ghost.sm, .btn.sm { height: 36px; padding: 0 14px; font-size: 14px; }
.btn.big { width: 100%; height: 58px; font-size: 18px; font-weight: 600; }
.btn[disabled] { opacity: .5; }

/* ---------------- 弹窗 ---------------- */
.modal { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; }
.modal-mask { position: absolute; inset: 0; background: rgba(24,28,22,.5); }
.modal-box {
  position: relative; width: 520px; max-width: calc(100vw - 32px); max-height: calc(100vh - 40px);
  background: #fff; border-radius: 18px; display: flex; flex-direction: column; overflow: hidden;
}
.modal-box.small-box { width: 400px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-body.center, .modal-foot.center { text-align: center; justify-content: center; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); }
.icon-btn { border: none; background: none; font-size: 18px; color: var(--text2); cursor: pointer; }

.pay-total { display: flex; align-items: baseline; justify-content: space-between; padding: 6px 0 16px; }
.pay-total strong { font-size: 34px; color: var(--accent); }
.pay-methods { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.pay-methods button {
  height: 62px; border: 1px solid var(--line); border-radius: 12px; background: #fff;
  font-size: 17px; font-family: inherit; color: var(--text);
}
.pay-methods button.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.modal-body .row { display: flex; align-items: center; gap: 10px; margin: 16px 0 0; }
.modal-body .row label { width: 120px; flex: none; color: var(--text2); font-size: 14px; }
.modal-body .row input {
  flex: 1; height: 48px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px;
  font-size: 18px; font-family: inherit;
}
.change { margin-top: 10px; font-size: 18px; color: var(--primary); font-weight: 600; min-height: 24px; }
.chk { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 15px; }
.chk input { width: 20px; height: 20px; }
.err { color: var(--danger); font-size: 14px; min-height: 20px; margin-top: 8px; }
.done-no { font-size: 15px; color: var(--text2); }
.done-amount { font-size: 36px; font-weight: 700; color: var(--accent); margin: 6px 0 10px; }

.empty { color: var(--text2); text-align: center; padding: 40px 0; }
.empty.small { padding: 20px 0; font-size: 14px; }
.t2 { color: var(--text2); }
.small { font-size: 13px; }

.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  background: #23301F; color: #fff; padding: 12px 22px; border-radius: 10px; z-index: 50;
  font-size: 15px;
}
.toast.err { background: #7A2C26; }

/* 竖屏/小屏兜底：购物车变成底部抽屉式 */
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .cart { width: 100%; height: 46%; border-left: none; border-top: 1px solid var(--line); }
  .dishes { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
