:root {
  --bg: #fbf6ef; --card: #ffffff; --ink: #2b2118; --muted: #8a7a6b; --line: #efe5d8;
  --pri: #c8602a; --pri-ink: #fff; --pri-soft: #fbe9dc; --ok: #3f8f5a; --warn: #b7791f; --bad: #c0392b;
  --r: 14px; --tab-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  color: var(--ink); background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); }
body { font-size: 16px; line-height: 1.5; min-height: 100vh; }
body.noscroll { overflow: hidden; }
button { font: inherit; color: inherit; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.row { display: flex; align-items: center; } .between { justify-content: space-between; } .gap { gap: 10px; } .wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; } .col-end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.one-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ok-text { color: var(--ok); } .warn-text { color: var(--warn); }

/* 顶栏 + 底部标签 */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + var(--safe-t)) 16px 10px; background: rgba(251,246,239,.94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.head-title { font-size: 22px; font-weight: 700; }
.main { padding: 14px 16px calc(var(--tab-h) + var(--safe-b) + 24px); max-width: 560px; margin: 0 auto; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; background: #fffdf9; border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b); }
.tab { flex: 1; height: var(--tab-h); border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; color: var(--muted); }
.tab.active { color: var(--pri); font-weight: 600; }
.tab-icon { font-size: 22px; line-height: 1; position: relative; filter: grayscale(.6); }
.tab.active .tab-icon { filter: none; }
.badge { position: absolute; top: -6px; right: -14px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; line-height: 18px; font-weight: 700; text-align: center; }
.icon-btn { width: 44px; height: 44px; border: 0; background: none; font-size: 22px; border-radius: 22px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.icon-btn:active { background: var(--line); }

/* 按钮 / 表单 */
.btn { min-height: 46px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-size: 16px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: var(--ink); cursor: pointer; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--pri); border-color: var(--pri); color: var(--pri-ink); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger-ghost { background: transparent; color: var(--bad); border-color: #f1d3cf; }
.btn.block { display: flex; width: 100%; margin-top: 12px; }
.btn.big { min-height: 54px; font-size: 18px; }
.btn[disabled] { opacity: .5; }
.small-btn { min-height: 38px; font-size: 14px; padding: 0 12px; }
.input { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #e4d7c6; border-radius: 12px; background: #fff; font: inherit; font-size: 16px; color: var(--ink); }
textarea.input { min-height: 80px; resize: vertical; }
.input:focus { outline: 2px solid var(--pri-soft); border-color: var(--pri); }
.search { margin: 12px 0 8px; }
.form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 14px; color: var(--muted); font-weight: 600; }
.error { background: #fdecea; color: var(--bad); padding: 10px 12px; border-radius: 12px; font-size: 14px; display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.empty.big { padding: 80px 20px; font-size: 18px; }

/* 分段 / 标签 */
.seg { display: flex; background: #f3eadf; border-radius: 12px; padding: 3px; gap: 3px; margin-bottom: 12px; }
.seg-btn { flex: 1; min-height: 40px; border: 0; border-radius: 10px; background: none; font-weight: 600; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 6px; }
.seg-btn.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.seg-n { font-size: 12px; background: var(--line); border-radius: 8px; padding: 0 6px; color: var(--muted); }
.small-seg { margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 10px; }
.chip { min-height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid #e4d7c6; background: #fff; font-size: 14px; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.tag { font-size: 11px; background: var(--pri-soft); color: var(--pri); border-radius: 6px; padding: 1px 6px; margin-left: 6px; vertical-align: 2px; font-weight: 600; }
.badge-s { font-size: 12px; border-radius: 8px; padding: 2px 8px; font-weight: 600; white-space: nowrap; }
.s-low { background: #e5f3e9; color: #2f7a48; } .s-mid { background: #fdf0d9; color: #a3660d; } .s-high { background: #fbe1dd; color: #b03a2e; }

/* 列表 */
.list { background: var(--card); border-radius: var(--r); border: 1px solid var(--line); overflow: hidden; }
.row-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; min-height: 60px; border: 0; border-bottom: 1px solid var(--line); background: none; width: 100%; text-align: left; }
.row-item:last-child { border-bottom: 0; }
.row-item.out .item-name { color: var(--muted); text-decoration: line-through; }
.row-main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; border: 0; background: none; text-align: left; padding: 0; min-height: 44px; }
.emoji { width: 34px; height: 34px; border-radius: 10px; background: #f6efe6; display: inline-flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; color: var(--muted); }
.emoji.faint { filter: grayscale(1); opacity: .45; font-size: 17px; }
.item-name { font-weight: 600; }
.sec { font-size: 17px; margin: 18px 2px 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }

/* 开关 */
.switch { width: 52px; height: 32px; border-radius: 16px; border: 0; background: #ddd2c4; position: relative; flex-shrink: 0; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 13px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: left .2s; }
.switch.on { background: var(--ok); } .switch.on::after { left: 23px; }

/* 弹层 */
.sheet-back { position: fixed; inset: 0; background: rgba(43,33,24,.4); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 560px; max-height: 88vh; border-radius: 20px 20px 0 0; display: flex; flex-direction: column; animation: up .2s ease-out; }
.sheet.full { height: 92vh; max-height: 92vh; }
@keyframes up { from { transform: translateY(40px); opacity: .5; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 4px 18px; }
.sheet-title { font-size: 18px; font-weight: 700; }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 18px calc(20px + var(--safe-b)); }
.sheet-body h4 { margin: 16px 0 4px; }
.confirm-msg { font-size: 16px; }
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + 24px + var(--safe-b)); transform: translateX(-50%) translateY(20px); background: rgba(43,33,24,.92); color: #fff;
  padding: 10px 16px; border-radius: 12px; font-size: 15px; opacity: 0; pointer-events: none; transition: all .2s; z-index: 100; max-width: 86vw; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%); }

/* 配方 */
.recipe-detail h4 { margin: 14px 0 6px; }
.flavor { font-size: 16px; margin: 8px 0; }
.ing { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ing.miss { color: var(--bad); }
.steps { padding-left: 22px; margin: 0; } .steps li { margin-bottom: 4px; }
.kv { margin: 12px 0; } .kv-row { display: flex; gap: 12px; padding: 4px 0; font-size: 14px; } .kv-k { color: var(--muted); width: 64px; flex-shrink: 0; } .kv-v { word-break: break-all; }
.ing-edit { display: flex; flex-direction: column; gap: 8px; }
.ing-row { display: grid; grid-template-columns: 1fr 88px auto 36px; gap: 6px; align-items: center; }
.ing-row .icon-btn { width: 36px; height: 36px; font-size: 16px; }
.opt { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 2px; white-space: nowrap; }
.help-table { width: 100%; border-collapse: collapse; font-size: 14px; } .help-table td, .help-table th { border-bottom: 1px solid var(--line); padding: 6px 4px; text-align: left; vertical-align: top; }
.pre { white-space: pre-wrap; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px; word-break: break-all; }

/* 酒单 / 二维码 */
.qr-card { text-align: center; margin-bottom: 12px; }
.qr-title { font-size: 22px; font-weight: 800; } .qr-sub { color: var(--muted); margin-bottom: 6px; }
.qr-img { width: 100%; max-width: 300px; aspect-ratio: 1; image-rendering: pixelated; -webkit-touch-callout: default; }
.qr-url { color: var(--muted); word-break: break-all; margin-top: 4px; }
.pub-status { font-size: 13px; color: var(--ok); margin: 10px 0; } .pub-status.err { color: var(--bad); } .pub-status.busy { color: var(--muted); }

/* 订单 */
.orders { display: flex; flex-direction: column; gap: 12px; }
.order { display: flex; flex-direction: column; gap: 6px; border-left: 5px solid var(--line); }
.order.st-new { border-left-color: var(--bad); } .order.st-making { border-left-color: var(--warn); } .order.st-done { border-left-color: var(--ok); opacity: .8; } .order.st-cancelled { opacity: .55; }
.order-note.none { background: none; padding: 0; color: var(--muted); font-size: 14px; }
.order-name { font-size: 18px; font-weight: 700; }
.order-items { font-size: 17px; }
.order-note { background: #fff6e6; border-radius: 8px; padding: 6px 10px; font-size: 15px; }
.status-pill { font-size: 13px; padding: 3px 10px; border-radius: 12px; font-weight: 700; white-space: nowrap; }
.status-pill.st-new { background: #fbe1dd; color: var(--bad); } .status-pill.st-making { background: #fdf0d9; color: #a3660d; }
.status-pill.st-done { background: #e5f3e9; color: var(--ok); } .status-pill.st-cancelled { background: #eee; color: #777; }

/* PIN */
.pin-screen { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px 24px calc(30px + var(--safe-b)); gap: 10px; }
.pin-logo { font-size: 56px; } .pin-title { font-size: 22px; font-weight: 800; } .pin-msg { color: var(--muted); min-height: 24px; }
.pin-dots { display: flex; gap: 14px; margin: 10px 0 18px; } .pin-dots .dot { width: 14px; height: 14px; border-radius: 7px; border: 2px solid var(--pri); }
.pin-dots .dot.on { background: var(--pri); }
.shake { animation: shake .35s; } @keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 76px); gap: 14px; }
.key { width: 76px; height: 76px; border-radius: 38px; border: 0; background: #fff; font-size: 28px; font-weight: 500; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.key:active { background: var(--pri-soft); } .key.ghost { background: transparent; box-shadow: none; } .key.ok { font-size: 18px; background: var(--pri); color: #fff; font-weight: 700; }

/* 客人页 */
.guest { max-width: 560px; margin: 0 auto; padding: calc(16px + var(--safe-t)) 16px 0; }
.g-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.g-logo { font-size: 38px; width: 56px; height: 56px; background: #fff; border-radius: 16px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); }
.g-title { font-size: 22px; font-weight: 800; }
.g-menu { display: flex; flex-direction: column; gap: 10px; }
.g-drink { background: var(--card); border: 2px solid var(--line); border-radius: var(--r); overflow: hidden; }
.g-drink.picked { border-color: var(--pri); background: #fffaf6; }
.g-drink-main { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 14px; min-height: 64px; }
.g-name { font-size: 18px; font-weight: 700; }
.g-flavor { margin: 4px 0 2px; color: #5c4c3e; font-size: 15px; }
.qty { display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 0 14px 12px; }
.qty-btn { width: 40px; height: 40px; border-radius: 20px; border: 1px solid var(--pri); background: #fff; color: var(--pri); font-size: 22px; font-weight: 700; }
.qty-n { font-size: 18px; font-weight: 700; min-width: 20px; text-align: center; }
.g-form { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.g-bar { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 16px calc(10px + var(--safe-b)); background: rgba(251,246,239,.96); border-top: 1px solid var(--line); z-index: 10; }
.g-bar .btn { margin: 0 auto; max-width: 528px; }
.g-spacer { height: calc(96px + var(--safe-b)); }
.my-orders { margin-bottom: 14px; } .sec-title { font-weight: 700; margin-bottom: 6px; }
.my-order { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }

/* 打印：只打二维码卡片 */
@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { position: absolute; left: 0; top: 0; width: 100%; border: 0; }
  .qr-img { max-width: 12cm; }
  .tabbar, .top { display: none; }
}

/* 客人页（精简版） */
.g-title { font-size: 21px; font-weight: 800; }
.g-head { display: block; margin-bottom: 10px; }
.g-filters { display: flex; flex-direction: column; gap: 8px; padding: 2px 0 12px; }
.g-filter-row { display: flex; flex-wrap: wrap; gap: 8px; }
.g-filter-row .chip { flex-shrink: 0; }
.g-card { display: block; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; min-height: 64px; }
.g-card:active { background: #fffaf6; }
.g-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.g-tag { font-size: 12px; color: #6b5a4a; background: #f6efe6; border-radius: 6px; padding: 1px 7px; }
.g-card-ings { margin-top: 6px; line-height: 1.4; }
.g-menu { display: flex; flex-direction: column; gap: 8px; padding-bottom: calc(24px + var(--safe-b)); }
.g-desc { margin: 0; color: #5c4c3e; }
.g-ings { font-size: 15px; }
.g-status { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 4px 14px; margin-bottom: 10px; }
.g-status-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 40px; }
.g-status-line + .g-status-line { border-top: 1px solid var(--line); }

/* 建议购买 */
.suggest-item { border-bottom: 1px solid var(--line); }
.suggest-item:last-child { border-bottom: 0; }
.suggest-main { border-bottom: 0 !important; }
.suggest-detail { padding: 0 14px 12px 60px; display: flex; flex-direction: column; gap: 8px; }
.suggest-detail .btn { align-self: flex-start; }
