/* ===== app/styles/tokens.css ===== */
/* 设计令牌：唯一允许出现颜色/字号/圆角的地方
   改主题 = 改 app/config/theme.js，不要改这个文件 */
:root {
  --lime: #9fe870;
  --lime-dark: #7fd24f;
  --lime-tint: #eaf8df;
  --green-900: #163300;
  --green-800: #0f3b2a;
  --green-700: #17533b;
  --ink: #0e0f0c;
  --ink-2: #454745;
  --muted: #83877f;
  --line: #e7e9e4;
  --line-strong: #d6d9d2;
  --bg: #f4f5f2;
  --surface: #ffffff;
  --danger: #d64545;
  --warn: #c98a12;

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;

  --shadow-sm: 0 1px 2px rgba(14, 15, 12, 0.05);
  --shadow: 0 8px 24px -12px rgba(14, 15, 12, 0.18);
  --shadow-lg: 0 24px 60px -24px rgba(14, 15, 12, 0.32);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  --font-size: 14px;

  /* 间距：只用这几档，组件里不要再写 13/17/23 这种随手值 */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* 字号：正文/辅助/标题分档 */
  --text-xs: 11.5px;
  --text-sm: 12.5px;
  --text-md: 13px;
  --text-base: 14px;
  --text-lg: 16px;
  --text-xl: 20px;
  --text-2xl: 26px;

  /* 层级：页面 < 吸顶 < 抽屉 < 弹窗 < 提示 */
  --z-sticky: 20;
  --z-drawer: 55;
  --z-modal: 100;
  --z-toast: 200;

  --radius-pill: 999px;

  /* 控件高度：输入框和普通按钮同一档，避免同一行高低不齐 */
  --control-h: 44px;
  --control-h-sm: 34px;
  --control-h-lg: 50px;
}

/* ===== app/styles/components.css ===== */
/* =========================================================
   门店后台 · 样式层
   设计令牌沿用其公开站点的色彩体系（青柠绿 + 深墨绿 + 近黑）
   ========================================================= */



* { box-sizing: border-box; }

html, body { height: 100%; }

/* 后台外壳：页面本身不滚动，左右两栏各自滚，避免 iPad 上整页回弹/串动 */
body.ba-shell { overflow: hidden; overscroll-behavior: none; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-size: var(--font-size, 14px);
  line-height: 1.5;
}

button, input, select { font: inherit; color: inherit; }
input[type="range"], input[type="color"], input[type="checkbox"], input[type="radio"] { accent-color: var(--green-700); }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d8dbd4; border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #c2c6bd; background-clip: padding-box; border: 3px solid transparent; }

/* ---------------------------------------------------------
   登录
   --------------------------------------------------------- */
/* 登录页固定在一屏内：不允许整页上下滑动，避免 iOS 回弹把表单带跑 */
body.ba-login { height: 100%; overflow: hidden; overscroll-behavior: none; }
.login-screen {
  position: fixed; inset: 0;
  height: 100vh; height: 100dvh;
  min-height: 0; overflow: hidden;
  display: grid;
  grid-template-columns: minmax(420px, 1.05fr) minmax(380px, 1fr);
}

.login-art {
  position: relative;
  overflow: hidden;
  background: radial-gradient(120% 90% at 15% 0%, #1d4a30 0%, var(--green-800) 42%, #0b2418 100%);
  color: #f3f7ef;
  padding: 56px 56px 44px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.login-art::before,
.login-art::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(0px);
  pointer-events: none;
}
.login-art::before {
  width: 640px; height: 640px;
  right: -220px; top: -180px;
  background: radial-gradient(circle at 35% 35%, rgba(159, 232, 112, 0.5), rgba(159, 232, 112, 0) 68%);
}
.login-art::after {
  width: 460px; height: 460px;
  left: -160px; bottom: -220px;
  background: radial-gradient(circle at 60% 40%, rgba(159, 232, 112, 0.22), rgba(159, 232, 112, 0) 70%);
}

.login-brand-logo {
  display: block; width: 170px; max-width: 42vw; height: auto; margin: 0 0 7px;
}
.login-hero { position: relative; z-index: 1; max-width: 520px; }
.login-hero h1 {
  font-size: 38px; line-height: 1.2; letter-spacing: -0.02em; font-weight: 700;
  margin-bottom: 18px;
}
.login-hero h1 em { font-style: normal; color: var(--lime); }
.login-hero p { color: rgba(243, 247, 239, 0.72); font-size: 15px; line-height: 1.7; }

.login-points { position: relative; z-index: 1; display: grid; gap: 14px; margin-top: 38px; }
.login-point { display: flex; gap: 12px; align-items: flex-start; }
.login-point .dot {
  width: 26px; height: 26px; border-radius: 9px; flex: none;
  background: rgba(159, 232, 112, 0.16); color: var(--lime);
  display: grid; place-items: center; margin-top: 1px;
}
.login-point b { display: block; font-size: 14px; font-weight: 600; }
.login-point span { font-size: 13px; color: rgba(243, 247, 239, 0.6); }

.login-foot {
  position: relative; z-index: 1;
  font-size: 12px; color: rgba(243, 247, 239, 0.42);
  display: flex; gap: 18px; flex-wrap: wrap;
}

.login-form-wrap {
  display: grid; place-items: center; padding: 40px 32px; background: var(--surface);
  height: 100%; min-height: 0; overflow: hidden;
}
.login-form {
  width: 100%; max-width: 380px; max-height: 100%;
  /* 整体上移约 1 厘米，保持整页固定不动 */
  transform: translateY(-38px);
}
.login-form h2 { font-size: 26px; letter-spacing: -0.01em; margin-bottom: 6px; }
.login-form .sub { color: var(--muted); margin-bottom: 30px; font-size: 13.5px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 7px; }
.input {
  width: 100%; height: var(--control-h); border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--surface); padding: 0 14px; font-size: 14px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: #a9ada5; }
.input:focus { border-color: var(--green-700); box-shadow: 0 0 0 4px rgba(23, 83, 59, 0.08); }
.input-row { display: flex; gap: 10px; }
.input-row .input { flex: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--control-h); padding: 0 16px; border-radius: 11px; font-size: 13.5px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink);
  transition: transform .08s, background .15s, border-color .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover { background: #fafbf9; border-color: #c8ccc4; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.btn-primary:hover { background: #22241f; border-color: #22241f; }
.btn-lime { background: var(--lime); border-color: var(--lime); color: var(--green-900); }
.btn-lime:hover { background: var(--lime-dark); border-color: var(--lime-dark); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: #f1f3ef; border-color: transparent; }
.btn-danger { color: var(--danger); border-color: #f0d6d6; background: #fff7f7; }
.btn-danger:hover { background: #fdeeee; border-color: #e8c4c4; }
.btn-block { width: 100%; }
.btn-lg { height: var(--control-h-lg); font-size: 15px; border-radius: 13px; }
.btn-sm { height: var(--control-h-sm); padding: 0 11px; font-size: 12.5px; border-radius: 9px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.login-code-hint {
  margin-top: 14px; font-size: 12.5px; color: var(--muted);
  background: var(--bg); border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm); padding: 10px 12px;
}
.login-code-hint b { color: var(--green-700); font-family: var(--mono); letter-spacing: .12em; }
.login-terms { margin-top: 18px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.login-terms a { color: var(--green-700); text-decoration: underline; text-underline-offset: 2px; }

/* ---------------------------------------------------------
   应用外壳
   --------------------------------------------------------- */
.app-shell {
  display: grid; grid-template-columns: 248px minmax(0, 1fr);
  height: 100vh; height: 100dvh;
  height: calc(var(--vh, 1vh) * 100);
  min-height: 0; overflow: hidden;
}

.sidebar {
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  height: 100%; min-height: 0; overflow: hidden;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px; background: var(--lime);
  display: grid; place-items: center; color: var(--green-900); flex: none;
}
.brand-name { font-weight: 700; letter-spacing: -0.01em; font-size: 15px; line-height: 1.15; }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: .04em; }

.store-switch {
  margin: 14px 12px 10px; padding: 9px 11px; border-radius: 11px; border: 1px solid var(--line);
  background: #fbfcfa; display: flex; align-items: center; gap: 9px; width: calc(100% - 24px);
  text-align: left;
}
.store-switch:hover { background: #f6f8f3; }
.store-switch .meta { flex: 1; min-width: 0; }
.store-switch .meta b { display: block; font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.store-switch .meta span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav {
  flex: 1; min-height: 0; overflow-y: auto; padding: 4px 12px 16px; scrollbar-width: thin;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: rgba(22, 51, 0, .14); border-radius: 99px; }
.nav-group { margin-top: 9px; }
.nav-group:first-child { margin-top: 2px; }
.nav-group + .nav-group {
  margin-top: 12px; padding-top: 9px; border-top: 1px solid var(--line);
}
.nav-label {
  font-size: 11px; letter-spacing: .10em; text-transform: uppercase;
  color: #8d9288; padding: 0 10px 6px; font-weight: 600;
  display: flex; align-items: center; gap: 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 7px 10px; border-radius: 9px; color: var(--ink-2); font-size: 13.5px; font-weight: 500;
  transition: background .13s, color .13s;
  position: relative;
}
.nav-item svg { flex: none; opacity: .8; }
.nav-item:hover { background: #f3f5f0; color: var(--ink); }
.nav-item.active { background: var(--lime-tint); color: var(--green-900); font-weight: 600; }
.nav-item.active svg { opacity: 1; }
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--lime-dark);
}
.nav-item .count {
  margin-left: auto; font-size: 11.5px; background: #eef0eb; color: var(--ink-2);
  border-radius: 99px; padding: 1px 7px; font-weight: 600;
}
.nav-item.active .count { background: rgba(22, 51, 0, .1); color: var(--green-900); }

.sidebar-foot { padding: 10px; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.sidebar-settings { width: 100%; height: 34px; font-size: 12.5px; }
.sidebar-logout { width: 100%; height: 34px; justify-content: flex-start; font-size: 12.5px; color: var(--danger); }
.sidebar-logout:hover { border-color: var(--danger); color: var(--danger); }

.main {
  min-width: 0; display: flex; flex-direction: column;
  height: 100%; overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.topbar {
  height: 62px; flex: none; display: flex; align-items: center; gap: 14px;
  padding: 0 26px; background: rgba(244, 245, 242, .82); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.crumb { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.crumb b { color: var(--ink); font-weight: 600; }
.topbar .spacer { flex: 1; }
.icon-btn {
  width: 36px; height: 36px; border-radius: var(--radius-sm); display: grid; place-items: center;
  color: var(--ink-2); position: relative; border: 1px solid transparent;
}
.icon-btn:hover { background: var(--surface); border-color: var(--line); }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 4px 8px 4px 4px; border-radius: 99px; }
.user-chip:hover { background: var(--surface); }
.user-chip .av {
  width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(140deg, var(--green-900), #2f6b1f);
  color: var(--lime); display: grid; place-items: center; font-size: 12px; font-weight: 700;
  padding: 0; border: 0; cursor: pointer; overflow: hidden;
}
.user-chip .av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.user-chip .meta b { display: block; font-size: 12.5px; line-height: 1.1; }
.user-chip .meta span { font-size: 11px; color: var(--muted); }

.view { padding: 26px 26px 48px; flex: 1; animation: viewIn .26s cubic-bezier(.2,.7,.3,1); }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 23px; letter-spacing: -0.02em; font-weight: 700; }
.page-head p { color: var(--muted); font-size: 13px; margin-top: 3px; }
.page-head .actions { margin-left: auto; display: flex; gap: 9px; }

/* ---------------------------------------------------------
   通用块
   --------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.card-head h3 { font-size: 14.5px; font-weight: 650; letter-spacing: -0.01em; }
.card-head .sub { font-size: 12px; color: var(--muted); }
.card-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 18px; }

.grid { display: grid; gap: 16px; }
.kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { padding: 18px; position: relative; overflow: hidden; }
.kpi .label { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; margin-top: 9px; font-variant-numeric: tabular-nums; }
.kpi .value small { font-size: 14px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.kpi .foot { margin-top: 10px; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.kpi .spark { position: absolute; right: 14px; bottom: 12px; opacity: .8; }

.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 650; padding: 2px 7px; border-radius: 99px; }
.delta.up { color: #1f7a3d; background: #eaf7ec; }
.delta.down { color: #b44242; background: #fbeeee; }
.delta.flat { color: var(--ink-2); background: #f0f1ee; }

.pill {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600;
  padding: 3px 9px; border-radius: 99px; background: #f0f1ee; color: var(--ink-2); white-space: nowrap;
}
.pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill.on { background: var(--lime-tint); color: #256b16; }
.pill.warn { background: #fdf3e2; color: #9a6a0c; }
.pill.off { background: #f0f1ee; color: #7c8079; }
.pill.danger { background: #fdeeee; color: #b44242; }
.pill.no-dot::before { display: none; }

.layout-2 { display: grid; grid-template-columns: minmax(0, 1.62fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
.layout-2 > .card { height: 100%; display: flex; flex-direction: column; }
.layout-2 > .card > .card-body { height: 100%; flex: 1; }
.layout-2.wide { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr); }

.chart-wrap { padding: 8px 6px 2px; }
.chart-legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.chart-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 3px; margin-right: 5px; }
svg.chart { width: 100%; height: 208px; display: block; overflow: visible; }
.chart-grid line { stroke: #eef0ea; stroke-width: 1; }
.chart-axis text { fill: #a2a69e; font-size: 10.5px; font-family: var(--font); }
.chart-line { fill: none; stroke: var(--green-700); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.chart-area { fill: url(#areaFill); }
.chart-dot { fill: var(--surface); stroke: var(--green-700); stroke-width: 2; }

/* 酒头卡片 */
.tap-list { display: grid; gap: 10px; }
.tap-row { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 11px 6px; border-radius: 12px; transition: background .13s; }
.tap-row:hover { background: #fafbf8; }
.tap-no {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; color: var(--green-900); background: var(--lime-tint);
  letter-spacing: -0.02em; line-height: 1;
}
.tap-no b { display: block; font-size: 15px; }
.tap-no span { font-size: 9px; font-weight: 600; opacity: .55; letter-spacing: .06em; }
.tap-main { min-width: 0; }
.tap-main .name { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.tap-main .sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.level { height: 5px; border-radius: 99px; background: #eef0ea; margin-top: 7px; overflow: hidden; width: 100%; }
.level i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #b6e88f, var(--lime-dark)); }
.level.low i { background: linear-gradient(90deg, #f0b46a, #d9853f); }
.tap-right { display: flex; align-items: center; gap: 10px; }
.tap-price { font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--ink-2); }

/* 数据表 */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted);
  padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fbfcfa; white-space: nowrap;
}
.data-table th:first-child { border-top-left-radius: 0; }
.data-table td { padding: 12px 14px; border-bottom: 1px solid #f1f3ee; vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fbfcf9; }
.data-table .num { font-variant-numeric: tabular-nums; }
.data-table .strong { font-weight: 600; }
.table-wrap { overflow-x: auto; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

.quick-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.quick {
  display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 13px;
  border: 1px solid var(--line); background: var(--surface); text-align: left; transition: all .14s;
}
.quick:hover { border-color: #cfe5bb; background: #fbfdf7; transform: translateY(-1px); box-shadow: var(--shadow); }
.quick .ic { width: 32px; height: 32px; border-radius: var(--radius-sm); background: #f2f4ef; display: grid; place-items: center; color: var(--green-800); flex: none; }
.quick b { font-size: 12.8px; font-weight: 600; display: block; }
.quick span { font-size: 11px; color: var(--muted); }

/* 电视预览 */
.tv-frame {
  container-type: inline-size;
  border-radius: 16px; overflow: hidden; background: #0b1410; color: #f2f6ee;
  aspect-ratio: 16 / 9; padding: 18px 20px; display: flex; flex-direction: column;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06), var(--shadow-lg);
  position: relative;
}
.tv-frame::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 80% at 80% 0%, rgba(159,232,112,.12), transparent 60%);
}
.tv-frame .tv-head { display: flex; align-items: baseline; gap: 10px; border-bottom: 1px solid rgba(255,255,255,.1); padding-bottom: 10px; }
.tv-frame .tv-head b { font-size: 14px; letter-spacing: .02em; }
.tv-frame .tv-head span { font-size: 10px; color: rgba(242,246,238,.5); margin-left: auto; letter-spacing: .14em; text-transform: uppercase; }
.tv-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; margin-top: 12px; flex: 1; min-width: 0; }
.tv-cols > div { min-width: 0; }
.tv-item { display: flex; align-items: baseline; gap: 8px; padding: 5px 0; border-bottom: 1px dashed rgba(255,255,255,.07); }
.tv-item .n { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.tv-item .m { font-size: 9.5px; color: rgba(242,246,238,.45); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.tv-item .p { margin-left: auto; font-size: 12px; color: var(--lime); font-variant-numeric: tabular-nums; flex: none; }
.tv-item.sold .n, .tv-item.sold .p { color: rgba(242,246,238,.3); text-decoration: line-through; }

/* 空状态 / 占位 */
.placeholder {
  display: grid; place-items: center; gap: 12px; padding: 70px 20px; text-align: center;
  border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); background: #fbfcf9;
}
.placeholder .ic { width: 46px; height: 46px; border-radius: var(--radius); background: #eef1ea; display: grid; place-items: center; color: var(--ink-2); }
.placeholder h3 { font-size: 15px; }
.placeholder p { font-size: 13px; color: var(--muted); max-width: 380px; }

/* ---------------------------------------------------------
   POS（平板全屏）
   --------------------------------------------------------- */
.pos-shell {
  height: 100vh; height: 100dvh;
  height: calc(var(--vh, 1vh) * 100);
  display: flex; flex-direction: column; background: var(--bg);
}

.pos-top {
  height: 60px; flex: none; display: flex; align-items: center; gap: 14px; padding: 0 18px;
  background: var(--ink); color: var(--bg);
}
.pos-top .pstore { display: flex; align-items: center; gap: 9px; font-size: 13.5px; font-weight: 600; white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.pos-top .pstore .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 3px rgba(159,232,112,.18); }
.pos-tabs { display: flex; flex-wrap: nowrap; gap: 4px; margin-left: 10px; background: rgba(255,255,255,.07); padding: 4px; border-radius: 12px; overflow-x: auto; max-width: 100%; }
.pos-tab { flex: 0 0 auto; white-space: nowrap; padding: 7px 16px; border-radius: 9px; font-size: 13px; font-weight: 600; color: rgba(244,245,242,.62); display: flex; align-items: center; gap: 6px; }
.pos-tab:hover { color: var(--surface); }
.pos-tab.active { background: var(--surface); color: var(--ink); }
.pos-tab .count { font-size: 10.5px; background: var(--lime); color: var(--green-900); border-radius: 99px; padding: 0 5px; font-weight: 700; }
.pos-top .spacer { flex: 1; }
.pos-clock { font-family: var(--mono); font-size: 12px; color: rgba(244,245,242,.55); }
.pos-who {
  display: inline-flex; align-items: center; gap: 7px; flex: none; max-width: 180px;
  color: rgba(244,245,242,.82); font-size: 12.5px;
}
.pos-who .avatar { width: 24px; height: 24px; font-size: 10px; }
.pos-who-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-btn {
  height: 32px; padding: 0 11px; border-radius: 9px; font-size: 12.5px; font-weight: 600;
  background: rgba(255,255,255,.08); color: var(--bg); display: inline-flex; align-items: center; gap: 6px;
}
.chip-btn:hover { background: rgba(255,255,255,.14); }
.chip-btn.lime { background: var(--lime); color: var(--green-900); }
.chip-btn.lime:hover { background: var(--lime-dark); }

.pos-body { flex: 1; min-height: 0; overflow: hidden; }

/* 桌台 */
.tables-view { height: 100%; overflow-y: auto; padding: 18px 20px 26px; }
.area-head { display: flex; align-items: center; gap: 10px; margin: 6px 0 12px; }
.area-head h3 { font-size: 13px; font-weight: 650; color: var(--ink-2); }
.area-head .line { flex: 1; height: 1px; background: var(--line); }
.area-head .meta { font-size: 11.5px; color: var(--muted); }
.table-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: 12px; }
.table-card {
  text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 14px; min-height: 116px; display: flex; flex-direction: column; gap: 4px;
  transition: transform .1s, box-shadow .16s, border-color .16s; position: relative;
}
.table-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #d9e6cc; }
.table-card .tn { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; }
.table-card .seats { font-size: 11.5px; color: var(--muted); }
.table-card .amt { margin-top: auto; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.table-card .meta { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.table-card.busy { background: linear-gradient(165deg, #f3fbe9, var(--lime-tint)); border-color: #cfe7b8; }
.table-card.busy .amt { color: var(--green-900); }
.table-card .flag { position: absolute; top: 12px; right: 12px; font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: #fff0ee; color: #b44242; }
.table-card.bar { border-style: dashed; }

/* 点单 */
.order-view { display: grid; grid-template-columns: 372px minmax(0, 1fr); height: 100%; min-height: 0; }
.order-view > * { min-height: 0; }
.cart-pane { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.cart-head { padding: 14px 16px 12px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.cart-head .back { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: var(--ink-2); background: #f2f4ef; }
.cart-head .back:hover { background: #e9ece5; }
.cart-head b { font-size: 14.5px; }
.cart-head span { font-size: 11.5px; color: var(--muted); display: block; }
.cart-items { flex: 1; overflow-y: auto; padding: 8px 10px; }
.cart-empty { display: grid; place-items: center; gap: 8px; padding: 60px 20px; color: var(--muted); text-align: center; font-size: 12.5px; }
.cart-item { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 4px 10px; padding: 10px 8px; border-radius: 12px; }
.cart-item:hover { background: #fafbf8; }
.cart-item .n { font-size: 13.5px; font-weight: 600; }
.cart-item .s { font-size: 11.5px; color: var(--muted); }
.cart-item .p { font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; }
.qty { display: inline-flex; align-items: center; gap: 8px; background: #f2f4ef; border-radius: 99px; padding: 2px 4px; }
.qty button { width: 22px; height: 22px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 14px; color: var(--ink-2); box-shadow: var(--shadow-sm); }
.qty button:hover { background: var(--lime); color: var(--green-900); }
.qty span { min-width: 16px; text-align: center; font-size: 12.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
.cart-foot {
  border-top: 1px solid var(--line); background: #fdfefb; flex: none;
  padding: 12px 16px max(16px, env(safe-area-inset-bottom));
}
.cart-total { display: flex; align-items: baseline; margin-bottom: 10px; }
.cart-total span { font-size: 12.5px; color: var(--muted); }
.cart-total b { margin-left: auto; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.cart-actions { display: grid; grid-template-columns: 1fr 1.5fr; gap: 8px; }

.menu-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--bg); overflow: hidden; }
.menu-head { padding: 12px 18px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); background: #f9faf7; }
.cat-tabs { display: flex; gap: 6px; overflow-x: auto; }
.cat { padding: 7px 13px; border-radius: 99px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); white-space: nowrap; }
.cat:hover { border-color: #cfe5bb; }
.cat.active { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.menu-grid {
  padding: 16px 18px 24px; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  grid-auto-rows: max-content;
  gap: 12px; overflow-y: auto; align-content: start; flex: 1; min-height: 0;
}
.menu-item {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; text-align: left;
  display: flex; flex-direction: column; transition: transform .1s, box-shadow .16s, border-color .16s;
}
.menu-item:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #d9e6cc; }
.menu-item .art { flex: 0 0 88px; height: 88px; position: relative; display: grid; place-items: center; font-size: 30px; overflow: hidden; }
.menu-item .info { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1 0 auto; }
.menu-item .n { font-size: 13px; font-weight: 650; line-height: 1.3; }
.menu-item .m { font-size: 11px; color: var(--muted); }
.menu-item .row { display: flex; align-items: center; margin-top: auto; padding-top: 8px; }
.menu-item .pr { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.menu-item .add { margin-left: auto; width: 26px; height: 26px; border-radius: 50%; background: var(--lime); color: var(--green-900); display: grid; place-items: center; font-weight: 700; }
.menu-item.sold-out { opacity: .55; }
.menu-item.sold-out .art::after { content: "售罄"; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255,255,255,.6); font-size: 12px; font-weight: 700; color: var(--ink-2); }
.menu-item .badge { position: absolute; top: 8px; left: 8px; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: var(--ink); color: var(--surface); }
.menu-item .badge.new { background: var(--green-800); color: var(--lime); }

/* 订单列表（POS） */
.pos-orders { height: 100%; overflow-y: auto; padding: 16px 18px; }
.order-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.order-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.order-card .top { display: flex; align-items: center; gap: 8px; }
.order-card .top b { font-size: 14px; }
.order-card .top .pill { margin-left: auto; }
.order-card ul { margin: 10px 0; display: grid; gap: 3px; font-size: 12.5px; color: var(--ink-2); }
.order-card ul li { display: flex; }
.order-card ul li span { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.order-card .sum { display: flex; align-items: center; padding-top: 10px; border-top: 1px dashed var(--line); }
.order-card .sum b { font-size: 16px; font-variant-numeric: tabular-nums; }
.order-card .sum .btn { margin-left: auto; }

/* Toast / Modal */
.toast-root { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 200; pointer-events: none; }
/* 新订单横幅：不依赖浏览器通知权限，页面开着就能看到/听到 */
.order-alert-root {
  position: fixed; top: calc(env(safe-area-inset-top) + 10px); left: 50%; transform: translateX(-50%);
  width: min(420px, calc(100vw - 24px)); z-index: 320; display: grid; gap: 8px; pointer-events: none;
}
.order-alert {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px;
  background: var(--ink); color: var(--surface); border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.22); pointer-events: auto;
  animation: orderAlertIn .2s ease both;
}
.order-alert .ic {
  flex: none; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  background: var(--lime); color: var(--green-900);
}
.order-alert .txt { flex: 1; min-width: 0; }
.order-alert .txt b { display: block; font-size: 13px; line-height: 1.3; }
.order-alert .txt span { display: block; margin-top: 2px; font-size: 11.5px; color: rgba(255,255,255,.7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order-alert .go {
  flex: none; border: 1px solid rgba(255,255,255,.2); background: transparent; color: var(--surface);
  height: 30px; padding: 0 10px; border-radius: 9px; font: inherit; font-size: 12px; font-weight: 600;
}
.order-alert .x {
  flex: none; width: 28px; height: 28px; border: 0; border-radius: 8px; background: rgba(255,255,255,.1);
  color: var(--surface); font: inherit; font-size: 16px; line-height: 1;
}
.order-alert.leaving { animation: orderAlertOut .16s ease forwards; }
@keyframes orderAlertIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes orderAlertOut { to { opacity: 0; transform: translateY(-6px); } }

.toast {
  background: var(--ink); color: var(--bg); padding: 11px 16px; border-radius: 12px; font-size: 13px;
  box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 9px;
  animation: toastIn .22s cubic-bezier(.2,.8,.3,1); max-width: 92vw;
}
.toast .ic { color: var(--lime); display: grid; place-items: center; }
.toast.leaving { animation: toastOut .18s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px) scale(.98); } }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(14,15,12,.42);
  display: grid; place-items: center; padding: 20px; z-index: var(--z-modal);
}
.modal {
  background: var(--surface); border-radius: var(--radius-lg); width: min(520px, 100%);
  max-height: 88vh; display: block;
  box-shadow: var(--shadow-lg);
  overflow-y: auto; overscroll-behavior: contain;
}
.modal-head {
  padding: 18px 20px 0; display: flex; align-items: flex-start; gap: 12px;
  position: sticky; top: 0; z-index: 2; background: var(--surface);
}
.modal-head h3 { font-size: 16px; font-weight: 650; }
.modal-head p { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.modal-body { padding: 16px 20px; }
.modal-foot {
  padding: 14px 20px 18px; display: flex; gap: 9px; justify-content: flex-end;
  border-top: 1px solid var(--line); background: var(--surface);
  position: sticky; bottom: 0; z-index: 2;
}
.modal .x { margin-left: auto; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); }
.modal .x:hover { background: #f2f4ef; }

@media (max-height: 700px) {
  .login-art { padding: 32px 40px 28px; }
  .login-hero h1 { font-size: 30px; margin-bottom: 12px; }
  .login-points { margin-top: 22px; gap: 10px; }
  .login-form-wrap { padding: 20px 24px; }
  .login-form .sub { margin-bottom: 18px; }
  .login-form .field { margin-bottom: 12px; }
  .login-terms { margin-top: 12px; }
}

@media (max-width: 1080px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .layout-2, .layout-2.wide { grid-template-columns: minmax(0, 1fr); }
  .app-shell { grid-template-columns: 72px minmax(0, 1fr); }
  .nav-label, .store-switch .meta, .nav-item span, .sidebar-foot { display: none; }
  .nav-item { justify-content: center; }
  .order-view { grid-template-columns: 320px minmax(0, 1fr); }
  .login-screen { grid-template-columns: 1fr; }
  .login-art { display: none; }
}

/* 窄容器里隐藏酒款副标题，避免价格被挤出可视区 */
@container (max-width: 560px) {
  .tv-item .m { display: none; }
}

/* ---------------------------------------------------------
   全流程演示
   --------------------------------------------------------- */
.flow-page { min-height: 100vh; background: var(--bg); padding: 26px 26px 40px; }
.flow-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.flow-head h1 { font-size: 24px; letter-spacing: -0.02em; }
.flow-head p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.flow-head-actions { margin-left: auto; display: flex; gap: 9px; }
.flow-tip {
  display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2);
  background: var(--lime-tint); border: 1px solid #d7ecc4; border-radius: 12px;
  padding: 10px 13px; margin-bottom: 18px;
}
.flow-grid { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(300px, 1fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1180px) { .flow-grid { grid-template-columns: 1fr; } }
.flow-col-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 650; margin-bottom: 10px; }
.flow-dot { width: 8px; height: 8px; border-radius: 50%; }
.flow-dot.customer { background: var(--lime); box-shadow: 0 0 0 3px rgba(159,232,112,.22); }
.flow-dot.staff { background: var(--green-700); box-shadow: 0 0 0 3px rgba(23,83,59,.16); }
.flow-dot.data { background: var(--ink); box-shadow: 0 0 0 3px rgba(14,15,12,.12); }
.flow-link { margin-left: auto; font-size: 11.5px; color: var(--green-700); text-decoration: underline; text-underline-offset: 2px; font-weight: 500; }

.phone-shell {
  width: 100%; max-width: 392px; margin: 0 auto; aspect-ratio: 392 / 800;
  background: var(--ink); border-radius: 42px; padding: 10px;
  box-shadow: 0 30px 60px -30px rgba(14,15,12,.55), inset 0 0 0 1px rgba(255,255,255,.08);
}
.phone-screen { width: 100%; height: 100%; border: 0; border-radius: 34px; background: var(--surface); display: block; }

.flow-data { padding: 14px; }
.flow-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.flow-stats > div { background: #fafbf8; border: 1px solid var(--line); border-radius: 11px; padding: 9px 10px; }
.flow-stats b { display: block; font-size: 19px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.flow-stats span { font-size: 11px; color: var(--muted); }
.flow-orders { display: grid; gap: 8px; }
.flow-order { border: 1px solid var(--line); border-radius: 12px; padding: 10px 11px; background: var(--surface); }
.flow-order-top { display: flex; align-items: center; gap: 7px; }
.flow-order-top b { font-size: 13px; }
.flow-order-no { margin-left: auto; font-size: 10.5px; color: var(--muted); font-family: var(--mono); }
.flow-order-sub { font-size: 11.5px; color: var(--muted); margin: 5px 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow-order-foot { display: flex; align-items: center; font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.flow-order-foot .pill { margin-left: auto; font-weight: 600; }
.flow-empty { color: var(--muted); font-size: 12.5px; text-align: center; padding: 24px 0; }
.flow-note { margin-top: 10px; font-size: 11.5px; color: var(--muted); line-height: 1.6; }

/* ---------------------------------------------------------
   响应式：每个断点只保留一个 @media 块，新增规则写进对应断点
   ≤900px 抽屉导航 / ≤560px 手机精简；颜色一律走 design token
   --------------------------------------------------------- */
.menu-toggle { display: none; }
.nav-scrim { display: none; }

@media (max-width: 900px) {
  .pos-top { gap: 8px; padding: 0 10px; }
  .pos-tab { padding: 6px 7px; font-size: 11.5px; gap: 4px; }
  .pos-tabs { margin-left: 4px; }
  .pos-who-name { display: none; }

  .app-shell { grid-template-columns: minmax(0, 1fr); }

  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0;
    height: 100vh; height: 100dvh;
    width: 248px; max-width: 82vw; z-index: 60;
    transform: translateX(-100%);
    transition: transform .22s cubic-bezier(.2, .7, .3, 1);
    box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: none; }

  /* 1080px 起的图标栏在本断点还原为完整抽屉 */
  .nav-label, .store-switch .meta, .sidebar-foot { display: block; }
  .nav-item span { display: inline; }
  .nav-item { justify-content: flex-start; }

  .nav-scrim {
    display: block; position: fixed; inset: 0; z-index: 55;
    background: var(--ink); opacity: 0; visibility: hidden;
    transition: opacity .2s ease, visibility .2s ease;
  }
  body.nav-open .nav-scrim { opacity: .42; visibility: visible; }
  body.nav-open { overflow: hidden; }

  .menu-toggle {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 36px; padding: 0 11px; border-radius: var(--radius-sm); flex: none;
    background: var(--surface); border: 1px solid var(--line);
    color: var(--ink-2); font-size: 13px; font-weight: 600;
  }
  .menu-toggle:active { background: var(--bg); }

  .topbar { height: 56px; padding: 0 14px; gap: 10px; }
  .topbar .search-wrap { display: none; }

  .view { padding: 12px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .layout-2, .layout-2.wide { grid-template-columns: minmax(0, 1fr); }

  /* 表格横向滚动：父级允许收缩，滚动交给 .table-wrap；
     给表格保底宽度，宁可横向滚动，也不要把中文挤成竖排。
     最后一行操作列不换行，避免「详情/充值/发券」叠成四行。 */
  .view .card, .view .card-body, .view .layout-2 > *, .view .grid > * { min-width: 0; }
  .table-wrap {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }
  .table-wrap > .data-table { min-width: 680px; }
  .table-wrap .data-table th,
  .table-wrap .data-table td:first-child,
  .table-wrap .data-table td:last-child { white-space: nowrap; }
  /* 操作列里的 inline-flex 按钮组：窄屏保持一行，按钮不再叠成四行 */
  .table-wrap .data-table td:last-child > span[style*="inline-flex"] {
    flex-wrap: nowrap !important;
  }
}

@media (max-width: 560px) {
  .page-head { align-items: flex-start; gap: 10px; margin-bottom: 16px; }
  .page-head h1 { font-size: 20px; }
  .page-head .actions { margin-left: 0; width: 100%; flex-basis: 100%; flex-wrap: wrap; }

  /* 手机端所有概览卡片统一紧凑 2×2，避免四个卡片竖排占满首屏 */
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
  }
  .kpi { padding: 9px 11px; border-radius: 12px; }
  .kpi .label { font-size: 10.5px; gap: 4px; white-space: nowrap; }
  .kpi .value { font-size: 20px; margin-top: 4px; line-height: 1.1; }
  .kpi .value small { font-size: 10px; }
  .kpi .foot {
    margin-top: 3px;
    font-size: 9.5px;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .card-body { padding: 13px; }
  .card-head { padding: 13px 14px; flex-wrap: wrap; align-items: flex-start; gap: 10px 12px; }
  .user-chip .meta { display: none; }

  /* 卡片头：窄屏让标题独占一行，操作区（含搜索框）落到下一行铺满，
     这样 .card-head 的标题、副标题不会再被 pill / 搜索框挤成逐字换行。 */
  .card-head > :first-child { flex: 1 1 100%; min-width: 0; }
  .card-head .actions {
    margin-left: 0;
    width: 100%;
    flex-wrap: wrap;
    row-gap: 8px;
  }
  .card-head .actions .search { flex: 1 1 100%; min-width: 0; }
  .card-head .actions .search .input { flex: 1 1 0; width: auto; min-width: 0; }

  /* 页头按钮：等宽铺满一行，避免长短按钮混排时换行错位 */
  .page-head .actions > .btn { flex: 1 1 0; min-width: 0; }
  .page-head .actions > .btn:only-child { flex: 0 1 auto; }
  .page-head .actions > * { min-width: 0; }
}

/* ---------------------------------------------------------
   可访问性：统一键盘焦点态（2px 主题色描边）
   --------------------------------------------------------- */
:where(
  a[href], button, input, select, textarea, summary,
  [role="button"], [tabindex]:not([tabindex="-1"])
):focus-visible {
  outline: 2px solid var(--green-700);
  outline-offset: 2px;
}

/* 深色容器内改用亮色描边，保证对比度 */
:where(.tv-frame, .pos-top) :where(
  a[href], button, input, select, textarea, summary,
  [role="button"], [tabindex]:not([tabindex="-1"])
):focus-visible {
  outline-color: var(--lime);
}

/* ---------------------------------------------------------
   深色容器里的滚动条：不要露出浅色 thumb / track
   --------------------------------------------------------- */
.tv-frame,
.pos-top {
  scrollbar-width: thin;
  scrollbar-color: rgba(244, 245, 242, .32) transparent;
}
.tv-frame::-webkit-scrollbar,
.tv-frame *::-webkit-scrollbar,
.pos-top::-webkit-scrollbar,
.pos-top *::-webkit-scrollbar {
  width: 8px;
  height: 8px;
  background: transparent;
}
.tv-frame::-webkit-scrollbar-track,
.tv-frame *::-webkit-scrollbar-track,
.pos-top::-webkit-scrollbar-track,
.pos-top *::-webkit-scrollbar-track {
  background: transparent;
}
.tv-frame::-webkit-scrollbar-thumb,
.tv-frame *::-webkit-scrollbar-thumb,
.pos-top::-webkit-scrollbar-thumb,
.pos-top *::-webkit-scrollbar-thumb {
  background: rgba(244, 245, 242, .28);
  background-clip: padding-box;
  border: 2px solid transparent;
  border-radius: 99px;
}
.tv-frame::-webkit-scrollbar-thumb:hover,
.tv-frame *::-webkit-scrollbar-thumb:hover,
.pos-top::-webkit-scrollbar-thumb:hover,
.pos-top *::-webkit-scrollbar-thumb:hover {
  background: rgba(244, 245, 242, .45);
  background-clip: padding-box;
  border: 2px solid transparent;
}

/* ---------------------------------------------------------
   打印：#/menuprint 打印酒单 / 其他页面打印
   应用外壳与浮层不参与排版，卡片去阴影
   --------------------------------------------------------- */
@media print {
  .sidebar,
  .topbar,
  .nav-scrim,
  .menu-toggle,
  .toast-root,
  #toast-root,
  #modal-root,
  .modal-backdrop,
  .menu-toolbar {
    display: none !important;
  }

  html, body { background: var(--surface) !important; }
  .app-shell, .main { display: block !important; min-height: 0 !important; }
  .view { padding: 0 !important; animation: none !important; }

  .card,
  .kpi,
  .tv-frame,
  .table-card,
  .menu-item,
  .order-card,
  .quick,
  .menu-sheet {
    box-shadow: none !important;
    break-inside: avoid;
  }

  /* 打印时表格完整铺开，不沿用窄屏的 min-width / nowrap */
  .table-wrap { overflow: visible !important; max-width: none !important; }
  .data-table { min-width: 0 !important; }
  .data-table th,
  .data-table td { white-space: normal !important; }
  .data-table thead { display: table-header-group; }
  .data-table tr { break-inside: avoid; }
}

/* ---------------------------------------------------------
   启动骨架屏 / 首屏失败（QA-17：慢网下不白屏）
   只用主题令牌，保证换主题时一起变
   --------------------------------------------------------- */
.boot-screen {
  min-height: 100vh;
  padding: 48px 24px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}
.boot-head {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12.5px;
}
.boot-head b { display: block; color: var(--ink); font-size: 14px; font-weight: 650; }
.boot-head span { display: block; margin-top: 2px; }
.boot-spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--green-700);
  animation: bootSpin .8s linear infinite;
}
.boot-grid {
  width: 100%;
  max-width: 860px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.boot-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.boot-line {
  height: 12px;
  border-radius: 6px;
  background: var(--line);
  animation: bootPulse 1.2s ease-in-out infinite;
}
.boot-line.w40 { width: 40%; }
.boot-line.w55 { width: 55%; }
.boot-line.w70 { width: 70%; }
.boot-error { max-width: 420px; align-items: center; text-align: center; gap: 12px; }
.boot-error .ic {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--lime-tint);
  color: var(--green-800);
}
.boot-error h1 { font-size: 17px; font-weight: 700; }
.boot-error p { color: var(--muted); font-size: 13px; line-height: 1.6; }
@keyframes bootSpin { to { transform: rotate(360deg); } }
@keyframes bootPulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .boot-spinner, .boot-line { animation: none !important; }
}

/* ---------------------------------------------------------
   顶栏内联搜索：输入框 + 下方浮层结果
   --------------------------------------------------------- */
.search-wrap {
  position: relative; display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 12px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--muted);
  min-width: 260px; font-size: 13px;
}
.search-wrap:focus-within {
  border-color: var(--green-700);
  box-shadow: 0 0 0 3px rgba(159, 232, 112, .22);
}
.search-input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font-family: inherit; font-size: 13px; color: var(--ink);
}
.search-wrap kbd {
  font-family: var(--font); font-size: 10.5px; border: 1px solid var(--line);
  border-radius: 5px; padding: 1px 5px; color: var(--muted); background: var(--surface);
}
.search-panel {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 18px 44px rgba(16, 24, 12, .2);
  max-height: min(64vh, 460px); overflow-y: auto; padding: 8px; z-index: 45;
}
.search-panel[hidden] { display: none; }
.search-group { margin-bottom: 4px; }
.search-group-title {
  font-size: 11px; color: var(--muted); letter-spacing: .04em;
  padding: 6px 10px 4px;
}
.search-row {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 0; border-radius: var(--radius-sm); background: transparent; font-family: inherit;
  text-align: left; cursor: pointer; color: var(--ink);
}
.search-row:hover, .search-row.is-on { background: rgba(159, 232, 112, .26); }
.search-row-ico {
  width: 26px; height: 26px; flex: none; border-radius: 8px;
  background: rgba(22, 51, 0, .06); display: grid; place-items: center; color: var(--green-700);
}
.search-row-main { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.search-row-main b { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-row-main span { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-row-meta { font-size: 12px; color: var(--muted); flex: none; font-variant-numeric: tabular-nums; }
.search-tip {
  display: flex; flex-direction: column; gap: 4px; padding: 18px 14px;
  color: var(--muted); font-size: 12.5px;
}
.search-tip b { color: var(--ink); font-size: 13.5px; }

/* POS 收款码弹窗 */
.pay-qr {
  width: 100%; max-width: 420px; margin: 14px auto 0;
  padding: 22px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); display: grid; justify-items: center; gap: 12px;
  /* 顾客站在收银台对面：整块付款模板倒置，便于顾客正向扫码 */
  transform: rotate(180deg);
}
.pay-qr[hidden] { display: none; }
.pay-qr-head {
  width: 100%; display: flex; align-items: baseline; justify-content: center;
  padding-bottom: 8px; color: var(--ink); font-size: 13px; text-align: center;
}
.pay-qr-head span {
  font-size: clamp(22px, 2.4vw, 34px); line-height: 1.2;
  font-weight: 700; letter-spacing: -0.01em;
}
.pay-qr-img { width: 100%; display: flex; align-items: center; justify-content: center; }
.pay-qr img {
  /* 收款码原图常是竖版海报，不能强制压成正方形，否则二维码本体被缩得很小 */
  width: min(360px, 72vw); height: auto; max-width: 100%; object-fit: contain;
  border-radius: var(--radius-sm); background: var(--surface);
}
.pay-qr b.pay-qr-amount { font-size: 30px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.pay-qr > span { font-size: 13px; color: var(--muted); text-align: center; line-height: 1.5; }

/* 主屏网页应用 / 手机端：禁止双击、双指缩放 */
html.ba-standalone *,
html.ba-zoom-lock * { touch-action: manipulation; }
html.ba-standalone,
html.ba-zoom-lock,
html.ba-standalone body,
html.ba-zoom-lock body {
  touch-action: manipulation;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

/* 手机端 POS：菜单占满，已选菜品收成底部条，可展开 */
.cart-toggle {
  display: none; flex: none; width: 30px; height: 30px; margin-left: auto;
  border-radius: 9px; place-items: center; color: var(--ink-2);
  background: #f2f4ef; border: 1px solid var(--line);
}
.cart-toggle svg { transition: transform .2s ease; }
.cart-pane.is-open .cart-toggle svg { transform: rotate(180deg); }

@media (max-width: 720px) {
  .order-view { display: block; height: 100%; min-height: 0; }
  .menu-pane { height: 100%; min-height: 0; }
  /* 手机端：已选菜品固定在底部，收起时只占一条，展开后成底部面板 */
  .cart-pane {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    max-height: 72vh; display: flex; flex-direction: column;
    border-right: 0; border-top: 1px solid var(--line);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -10px 30px rgba(16, 24, 12, .16);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .cart-toggle { display: grid; }
  .cart-pane:not(.is-open) .cart-items { display: none; }
  .cart-pane.is-open .cart-items { flex: 1; min-height: 0; max-height: none; }
  .cart-head { padding: 10px 12px; }
  .cart-foot { padding: 8px 12px 10px; background: var(--surface); flex: none; }
  .cart-total { margin-bottom: 6px; }
  .cart-total b { font-size: 20px; }
  .cart-actions { grid-template-columns: 1fr 1.6fr; }
  .menu-head { padding: 8px 12px; }
  .menu-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 10px 12px 190px; gap: 8px;
  }
  .menu-item .art { flex-basis: 64px; height: 64px; font-size: 24px; }
  .menu-item .info { padding: 8px 10px 10px; }
  /* 手机端：顶栏分两行，第一行店铺 + 锁定/退出，第二行标签横向滚动 */
  .pos-top {
    height: auto; flex-wrap: wrap; row-gap: 6px;
    padding: 6px 10px; gap: 6px;
  }
  .pos-top .spacer { display: none; }
  .pos-clock { display: none; }
  .pstore { flex: 0 1 auto; max-width: 160px; min-width: 0; font-size: 11.5px; }
  .pname { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; }
  .pos-tabs { order: 20; flex: 0 0 100%; margin-left: 0; padding: 4px; }
  .pos-tab { padding: 6px 7px; font-size: 11.5px; gap: 4px; }
  .chip-btn .lbl { display: none; }
  .chip-btn[data-exit] .lbl { display: inline; }
  .chip-btn { padding: 7px 9px; }
}

/* 结算台右侧详情：只在宽屏吸顶，手机上跟随内容滚动，避免悬浮遮挡 */
.settle-side { align-content: start; }
@media (min-width: 1081px) {
  .settle-side { position: sticky; top: 0; }
}

/* 退款记录：桌面用表格，手机用逐条卡片 */
.refund-cards { display: none; }
.refund-empty { padding: 24px 14px; text-align: center; color: var(--muted); font-size: 12.5px; }

/* 商品页：分类树固定窄栏，列表占满剩余宽度；表格只在列表内部横向滚动 */
.catalog-layout {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.catalog-layout > * { min-width: 0; }
@media (max-width: 1100px) {
  .catalog-layout { grid-template-columns: 240px minmax(0, 1fr); }
  .quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .catalog-layout { grid-template-columns: minmax(0, 1fr); }
  /* 手机端点商品名即可弹出操作，隐藏最右侧操作列 */
  .catalog-layout .data-table th:last-child,
  .catalog-layout .data-table td:last-child { display: none; }
  /* 手机端不要固定操作列：固定列会把商品名/勾选盖住，改为跟随表格横向滚动 */
  .data-table.has-sticky-last th:last-child,
  .data-table.has-sticky-last td:last-child {
    position: static !important;
    right: auto !important;
    box-shadow: none !important;
  }
}

/* 商品表：操作列固定在右侧，左边横向滚动时也能直接编辑/下架 */
.data-table.has-sticky-last th:last-child,
.data-table.has-sticky-last td:last-child {
  position: sticky;
  right: 0;
  z-index: 2;
  background: var(--surface);
  box-shadow: -10px 0 14px -12px rgba(16, 24, 12, .28);
}
.data-table.has-sticky-last thead th:last-child { z-index: 3; }

/* 商品图片：POS / 手机 POS 卡片内完整显示 */
.menu-photo { width: 100%; height: 100%; object-fit: contain; display: block; }
.mpos-mitem .art img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* 设置页信息行：label 左、value 右 */
.settings-info-row {
  display: flex;
  gap: var(--space-4);
  justify-content: space-between;
  padding: 7px 0;
}

/* POS 结算明细行：名称左、金额右 */
.pos-detail-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 12.5px;
}

/* 商品列表/弹窗海报缩略图 */
.catalog-thumb {
  width: 34px; height: 46px; object-fit: contain; flex: none;
  border: 1px solid var(--line); border-radius: 6px; background: #f7f3ea;
}

/* POS 结算台/订单卡固定结构 */
.pos-order-main { flex: 1; min-width: 0; display: grid; gap: 1px; }
.pos-action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 10px; }
.pos-urge-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.pos-qty-input { width: 72px; height: 36px; padding: 0 8px; text-align: center; }

/* =========================================================
   组件统一层：按钮 / 卡片 / 表格 / 弹窗
   ========================================================= */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.card-foot {
  padding: 12px 18px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
}

.data-table.is-compact th, .data-table.is-compact td { padding: 8px 10px; }
.table-empty { text-align: center; color: var(--muted); padding: 32px 14px; }

.modal-sm { width: min(420px, 100%); }
.modal-lg { width: min(720px, 100%); }
.modal-wide { width: min(960px, 100%); }
.modal-body.is-flush { padding: 0; }

/* 预订与排队：日期、tab、状态统一同一条基线和同一控件高度 */
.bookings-toolbar {
  display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap;
}
.bookings-date { width: 168px; flex: none; }
.bookings-date .field { margin-bottom: 0; }
.bookings-tabs { display: flex; align-items: center; gap: 8px; }
.bookings-stats { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-self: center; }

/* 实时电视预览：固定 960×540 画布，按容器宽度整体缩放 */
.tv-live {
  position: relative; width: 100%; overflow: hidden;
  border-radius: var(--radius); border: 1px solid var(--line);
  background: #0b120a;
}
.tv-live-frame {
  width: 960px; height: 540px;
  transform-origin: top left;
  position: absolute; left: 0; top: 0;
}
.tv-live iframe { width: 960px; height: 540px; border: 0; display: block; background: #0b120a; }

/* 卡片直接放空状态（noBodyPad）时补上与其他卡片一致的内边距 */
.card > .placeholder { margin: 18px; }

/* 两栏并排卡片：卡片头等高、内容区撑满，空状态内框上下左右一致 */
.layout-2 > .card > .card-head { min-height: 84px; box-sizing: border-box; }
.layout-2 > .card > .card-body > .placeholder { height: 100%; box-sizing: border-box; }

/* 头像 */
.avatar {
  display: inline-grid; place-items: center; flex: none;
  border-radius: 50%; overflow: hidden;
  background: linear-gradient(140deg, var(--green-900), #2f6b1f);
  color: var(--lime); font-size: 12px; font-weight: 700;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-editor { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 8px 0 4px; }
.avatar-editor-preview .avatar { width: 96px !important; height: 96px !important; font-size: 30px; }
.avatar-editor .u-hint { text-align: center; }

/* 员工列表头像 */
.staff-person { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.staff-person .avatar { width: 30px; height: 30px; font-size: 12px; }
.staff-name-btn { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.staff-name-btn:hover > span:last-child { text-decoration: underline; text-underline-offset: 2px; }

/* ---------------------------------------------------------
   门店档案：门店 LOGO 与自定义封面
   --------------------------------------------------------- */
.store-logo {
  display: flex; align-items: center; gap: var(--space-4);
}
.store-logo-preview {
  width: 96px; height: 96px; flex: none;
  overflow: hidden; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: radial-gradient(120% 120% at 20% 0%, var(--green-700), var(--green-900));
  box-shadow: var(--shadow-sm);
}
.store-logo-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.store-logo-initial {
  color: var(--lime); font-size: 32px; line-height: 1;
  font-weight: 700; letter-spacing: -0.02em;
}
.store-logo-info { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.store-logo-info b { font-size: var(--text-md); font-weight: 600; color: var(--ink); }
.store-logo-actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }

.store-cover {
  position: relative; width: 100%; max-width: 760px; aspect-ratio: 5 / 2;
  overflow: hidden; display: flex; align-items: flex-end;
  padding: var(--space-5); border-radius: var(--radius); color: var(--surface);
  background:
    radial-gradient(120% 120% at 88% 6%, rgba(159, 232, 112, .34) 0%, rgba(159, 232, 112, 0) 56%),
    radial-gradient(100% 120% at 6% 100%, rgba(159, 232, 112, .16) 0%, rgba(159, 232, 112, 0) 58%),
    linear-gradient(135deg, var(--green-900) 0%, var(--green-700) 58%, var(--green-800) 100%);
}
.store-cover::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(115deg, rgba(255, 255, 255, .055) 0 1px, rgba(255, 255, 255, 0) 1px 18px);
}
.store-cover::after {
  content: ""; position: absolute; width: 46%; aspect-ratio: 1;
  right: -7%; top: -26%; border-radius: 50%; pointer-events: none;
  border: 1px solid rgba(159, 232, 112, .26);
  box-shadow: 0 0 0 28px rgba(159, 232, 112, .06), 0 0 0 56px rgba(159, 232, 112, .035);
}
.store-cover-body {
  position: relative; z-index: 1; min-width: 0;
  display: flex; align-items: center; gap: var(--space-4);
}
.store-cover-logo {
  width: 64px; height: 64px; flex: none; overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .38); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow);
}
.store-cover-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.store-cover-text { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.store-cover-name {
  color: var(--surface); font-size: var(--text-2xl); line-height: 1.2;
  font-weight: 700; letter-spacing: -0.02em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.store-cover-tag {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .12);
  color: var(--lime-tint); font-size: var(--text-xs); font-weight: 600;
}

/* 自定义门店封面：有图时用图片铺满，并压暗保证文字可读 */
.store-cover.has-image {
  background-size: cover;
  background-position: center;
}
.store-cover.has-image::before {
  background: linear-gradient(180deg, rgba(0, 0, 0, .06), rgba(0, 0, 0, .42));
}
.store-cover.has-image::after { display: none; }
.store-cover-actions {
  position: absolute; right: 16px; bottom: 16px; z-index: 2;
  display: flex; gap: 8px; flex-wrap: wrap;
}

.store-switch-logo {
  width: 30px; height: 30px; flex: none; overflow: hidden;
  border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--green-900), var(--green-700));
  color: var(--lime); font-size: 12px; font-weight: 700;
}
.store-switch-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* 手机：640 断点统一收口 */
@media (max-width: 640px) {
  .table-wrap .data-table td { white-space: nowrap; }

  .modal-backdrop { padding: 12px; }
  .modal-sm, .modal-lg, .modal-wide, .modal { width: 100%; }
  .modal-foot { flex-wrap: wrap; }
  .modal-foot .btn { flex: 1; }

  .quick-actions { grid-template-columns: minmax(0, 1fr); }

  .store-logo { align-items: flex-start; }
  .store-logo-preview { width: 72px; height: 72px; }
  .store-cover { padding: var(--space-4); }
  .store-cover-logo { width: 48px; height: 48px; }
  .store-cover-name { font-size: var(--text-xl); }

  .refund-table-wrap { display: none; }
  .refund-cards { display: grid; gap: 8px; padding: 12px; }
  .refund-item {
    display: grid; gap: 6px; padding: 10px 12px;
    border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  }
  .refund-item-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .refund-item-top b { font-size: 13px; }
  .refund-item-amount { margin-left: auto; font-size: 15px; font-variant-numeric: tabular-nums; }
  .refund-item-meta { font-size: 11.5px; color: var(--muted); line-height: 1.5; }
  .refund-item-reason {
    padding: 6px 8px; border-radius: 8px; background: var(--bg);
    color: var(--ink-2); font-size: 12px; line-height: 1.5;
  }

  .pay-qr { padding: 10px; gap: 6px; margin-top: 8px; }
  /* 手机上尽量把二维码铺满弹窗，同时给确认按钮留出空间 */
  .pay-qr img { width: min(360px, calc(100vw - 40px)); }
  .pay-qr b.pay-qr-amount { font-size: 25px; }
  .pay-qr > span { font-size: 12px; }
  .pay-qr-head { padding-bottom: 7px; font-size: 12px; }

  /* 收款码全屏页在手机上的间距与安全区 */
  .modal.is-pay-qr {
    --pay-qr-pad: 8px;
    --pay-qr-gap: 6px;
    --pay-qr-body-bottom: 8px;
    --pay-qr-foot-top: 10px;
    --pay-qr-foot-bottom: 10px;
  }
}

/* 收款码：直接全屏展示，关闭标题与订单摘要，保留支付方式切换 */
.modal-backdrop.is-pay-qr {
  display: block; padding: 0; background: var(--surface);
}
.modal.is-pay-qr {
  width: 100vw; max-width: none; height: 100vh; height: 100dvh; max-height: none;
  border-radius: 0; box-shadow: none; overflow: hidden;
  display: flex; flex-direction: column;
}
.modal.is-pay-qr .modal-head {
  flex: none; position: static; justify-content: flex-end;
  padding: 8px 12px;
}
.modal.is-pay-qr .modal-head > div:first-child { display: none; }
.modal.is-pay-qr .modal-head .x { width: 36px; height: 36px; }
.modal.is-pay-qr .modal-body {
  flex: 1; min-height: 0; overflow: hidden;
  display: flex; flex-direction: column; align-items: center;
  padding: 0 var(--pay-qr-pad, 16px) var(--pay-qr-body-bottom, 10px);
}
.modal.is-pay-qr .modal-foot {
  flex: none; position: static; justify-content: center;
  padding: var(--pay-qr-foot-top, 12px) var(--pay-qr-pad, 16px)
    calc(var(--pay-qr-foot-bottom, 12px) + env(safe-area-inset-bottom));
}
.modal.is-pay-qr .modal-foot .btn { min-width: 140px; }
.modal.is-pay-qr .pay-summary { display: none; }
.modal.is-pay-qr .pay-extra {
  flex: none; width: 100%; max-width: 760px;
}
.modal.is-pay-qr .pay-methods {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; flex-wrap: wrap; margin: 0 0 8px;
}
.modal.is-pay-qr .pay-methods .cat-tabs { justify-content: center; }
.modal.is-pay-qr .mpos-paymethods { justify-content: center; margin: 0 0 8px; }
.modal.is-pay-qr .pay-qr {
  flex: 1; min-height: 0; width: 100%; max-width: none; margin: 0;
  padding: 0; border: 0; background: transparent; gap: var(--pay-qr-gap, 8px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.modal.is-pay-qr .pay-qr-head { flex: none; width: 100%; max-width: 760px; }
.modal.is-pay-qr .pay-qr-img {
  flex: 1 1 0; min-height: 0; width: 100%; max-width: 100%;
}
.modal.is-pay-qr .pay-qr-img img {
  width: 100%; height: 100%; max-width: 100%; max-height: 100%;
  object-fit: contain;
}
.modal.is-pay-qr .pay-qr b.pay-qr-amount {
  flex: none; font-size: clamp(40px, 6vw, 64px);
}
.modal.is-pay-qr .pay-qr > span { flex: none; font-size: 14px; }

/* 日期字段：年 / 月 / 日独立选择，避免原生日期弹层逐月翻 */
.ba-date-picker {
  display: grid;
  grid-template-columns: 1.15fr .85fr .85fr;
  gap: 8px;
}
.ba-date-picker .input {
  width: 100%;
  min-width: 0;
}

/* 时间字段：时 / 分独立选择，手机上也能直接改营业时间 */
.ba-time-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.ba-time-picker .input {
  width: 100%;
  min-width: 0;
}

/* ===== app/styles/mpos.css ===== */
/* 手机 POS 视图样式（从 mpos.js 抽出，统一放在 styles 层） */
.mpos-shell {
    position: fixed;
    inset: 0;
    height: auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg);
    color: var(--ink);
    -webkit-tap-highlight-color: transparent;
  }
  .mpos-top {
    flex: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: calc(env(safe-area-inset-top) + 10px) 14px 10px;
    background: var(--ink);
    color: var(--surface);
  }

  /* 顶部手机通知引导：只在不支持/未订阅/未拒绝时出现 */
  .mpos-pushbar {
    flex: none; display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; background: var(--lime-tint); color: var(--green-900);
    border-bottom: 1px solid var(--line); font-size: 11.5px; line-height: 1.45;
  }
  .mpos-pushbar.is-denied { background: #fdeeee; color: var(--danger); }
  .mpos-pushbar .ic { flex: none; display: grid; place-items: center; }
  .mpos-pushbar .txt { flex: 1; min-width: 0; }
  .mpos-pushbar .btn { flex: none; white-space: nowrap; }
  .mpos-pushbar-x {
    flex: none; width: 24px; height: 24px; border: 0; border-radius: 7px;
    background: transparent; color: var(--green-900); font: inherit; font-size: 16px; line-height: 1;
  }

  /* 每日现金对账（进入手机 POS 的第一页） */
  .mpos-gate {
    flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
    display: flex; align-items: center; justify-content: center;
    padding: 20px 16px calc(24px + env(safe-area-inset-bottom));
    background: var(--bg);
  }
  .mpos-gate-card {
    width: 100%; max-width: 420px; display: grid; gap: 13px;
    padding: 22px; background: var(--surface); border: 1px solid var(--line);
    border-radius: 18px; box-shadow: var(--shadow-lg);
  }
  .mpos-gate-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .mpos-gate-brand > div { min-width: 0; }
  .mpos-gate-brand b {
    display: block; font-size: 14px; font-weight: 650;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .mpos-gate-brand span { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); }
  .mpos-gate-card h1 { font-size: 22px; line-height: 1.25; letter-spacing: -0.02em; }
  .mpos-gate-card p { font-size: 13px; line-height: 1.6; color: var(--muted); }
  .mpos-gate-summary {
    display: grid; gap: 6px; padding: 11px 12px;
    background: var(--bg); border-radius: 12px;
  }
  .mpos-gate-row { display: flex; align-items: baseline; gap: 12px; font-size: 12.5px; color: var(--ink-2); }
  .mpos-gate-row b { margin-left: auto; color: var(--ink); font-variant-numeric: tabular-nums; }
  .mpos-gate-form { display: grid; gap: 9px; }
  .mpos-gate-form label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
  .mpos-gate-form .input { height: 48px; font-size: 19px; font-variant-numeric: tabular-nums; }
  .mpos-gate-diff {
    padding: 8px 10px; border-radius: 9px; background: var(--bg);
    font-size: 12.5px; color: var(--muted);
  }
  .mpos-gate-diff.over { color: var(--green-800); background: var(--lime-tint); }
  .mpos-gate-diff.short { color: var(--danger); background: #fdeeee; }
  .mpos-gate-hint { font-size: 11.5px; line-height: 1.6; color: var(--muted); }
  .mpos-store { display: flex; align-items: center; gap: 8px; min-width: 0; }
  .mpos-user-av { flex: none; }
  .mpos-store .dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--lime); }
  .mpos-store-txt { min-width: 0; }
  .mpos-store-txt b {
    display: block; font-size: 14px; font-weight: 650; letter-spacing: -0.01em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .mpos-store-txt span {
    display: block; margin-top: 2px; font-size: 11px; color: var(--line-strong);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .mpos-top .spacer { flex: 1; }
  .mpos-clock {
    flex: none; font-family: var(--mono); font-size: 12.5px;
    font-variant-numeric: tabular-nums; color: var(--line-strong);
  }
  .mpos-alert {
    flex: none; display: inline-flex; align-items: center; gap: 4px; height: 28px;
    padding: 0 9px; border-radius: 99px; background: var(--danger);
    color: var(--surface); font-size: 12px; font-weight: 700;
  }
  .mpos-alert b { font-variant-numeric: tabular-nums; }

  .mpos-main {
    flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: 12px 12px 20px;
  }
  .mpos-pagehead { display: flex; align-items: baseline; gap: 8px; margin: 2px 2px 10px; }
  .mpos-pagehead h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
  .mpos-pagehead span { margin-left: auto; font-size: 11px; color: var(--muted); }

  .mpos-area { margin-bottom: 16px; }
  .mpos-area:last-child { margin-bottom: 0; }
  .mpos-area-head { display: flex; align-items: baseline; gap: 8px; margin: 4px 2px 8px; }
  .mpos-area-head h3 { font-size: 13px; font-weight: 650; color: var(--ink-2); }
  .mpos-area-head .meta {
    margin-left: auto; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums;
  }

  .mpos-table-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .mpos-tcard {
    position: relative; display: flex; flex-direction: column; gap: 2px;
    min-height: 96px; padding: 11px 12px; text-align: left;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
  }
  .mpos-tcard:active { transform: translateY(1px); }
  .mpos-tcard .tn { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; }
  .mpos-tcard .seats { font-size: 11px; color: var(--muted); }
  .mpos-tcard .st {
    margin-top: auto; display: inline-flex; align-items: center; gap: 5px;
    font-size: 11px; font-weight: 650; color: var(--muted);
  }
  .mpos-tcard .st .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
  .mpos-tcard .amt {
    font-size: 13.5px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--green-900);
  }
  .mpos-tcard .amt.hint { font-size: 10.5px; font-weight: 500; color: var(--muted); }
  .mpos-tcard.busy { background: var(--lime-tint); border-color: var(--lime); }
  .mpos-tcard.busy .st { color: var(--green-900); }
  .mpos-tcard.busy .st .dot { background: var(--green-700); }
  .mpos-tcard.is-new { border-color: var(--danger); box-shadow: inset 3px 0 0 var(--danger); }
  .mpos-tcard.is-new .st { color: var(--danger); }
  .mpos-tcard.is-new .st .dot { background: var(--danger); }

  .mpos-list { display: grid; gap: 10px; }
  .mpos-ocard {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow-sm);
  }
  .mpos-ocard.is-new { border-color: var(--lime-dark); box-shadow: inset 3px 0 0 var(--lime-dark); }
  .mpos-ocard .top { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
  .mpos-ocard .top b { font-size: 15px; }
  .mpos-ocard .no { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
  .mpos-tags { margin-left: auto; display: flex; align-items: center; gap: 5px; }
  .mpos-scan {
    display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 99px;
    background: var(--lime); color: var(--green-900); font-size: 10.5px;
    font-weight: 800; letter-spacing: 0.02em; white-space: nowrap;
  }
  .mpos-ocard .meta {
    display: flex; align-items: center; gap: 5px; margin-top: 4px;
    font-size: 11px; color: var(--muted);
  }
  .mpos-lines { display: grid; gap: 3px; margin: 9px 0; font-size: 12.5px; color: var(--ink-2); }
  .mpos-lines li { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
  .mpos-lines .q { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
  .mpos-lines .n { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mpos-lines .p { flex: none; margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
  .mpos-ocard .sum {
    display: flex; align-items: center; gap: 8px;
    padding-top: 9px; border-top: 1px dashed var(--line);
  }
  .mpos-ocard .due { display: flex; flex-direction: column; }
  .mpos-ocard .due span { font-size: 10.5px; color: var(--muted); }
  .mpos-ocard .due b {
    font-size: 17px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
  }
  .mpos-ocard .acts { display: flex; gap: 6px; margin-left: auto; }

  .mpos-empty {
    display: grid; justify-items: center; gap: 6px; padding: 54px 20px; text-align: center;
    border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface);
  }
  .mpos-empty .ic { color: var(--muted); }
  .mpos-empty b { font-size: 14px; }
  .mpos-empty span { font-size: 12px; color: var(--muted); max-width: 230px; }

  .mpos-order { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .mpos-subhead {
    flex: none; display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; background: var(--surface); border-bottom: 1px solid var(--line);
  }
  .mpos-back {
    flex: none; width: 34px; height: 34px; border-radius: var(--radius-sm);
    display: grid; place-items: center; background: var(--bg); color: var(--ink-2);
  }
  .mpos-subhead .info { min-width: 0; }
  .mpos-subhead .info b { display: block; font-size: 14px; }
  .mpos-subhead .info span {
    display: block; font-size: 11px; color: var(--muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .mpos-subhead .pill { margin-left: auto; flex: none; }
  .mpos-subhead > .btn { flex: none; }
  .mpos-cats { flex: none; display: flex; gap: 6px; overflow-x: auto; padding: 9px 12px; }
  .mpos-cats .cat { padding: 6px 12px; font-size: 12px; }

  /* 酒头管理 */
  .mpos-taps { display: grid; gap: 10px; }
  .mpos-tap {
    display: grid; gap: 9px; padding: 12px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  }
  .mpos-tap.is-empty { border-style: dashed; background: var(--bg); }
  .mpos-tap-head { display: flex; align-items: flex-start; gap: 10px; }
  .mpos-tap-no {
    flex: none; width: 38px; height: 38px; border-radius: 11px;
    display: grid; place-items: center; background: var(--lime-tint);
    color: var(--green-900); font-size: 13px; font-weight: 700;
  }
  .mpos-tap-info { flex: 1; min-width: 0; }
  .mpos-tap-info b {
    display: block; font-size: 14px; font-weight: 650;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .mpos-tap-info span {
    display: block; margin-top: 2px; font-size: 11px; color: var(--muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .mpos-tap-head .pill { flex: none; margin-left: auto; }
  .mpos-tap .level { margin-top: 0; }
  .mpos-tap-meta { display: flex; align-items: baseline; gap: 8px; font-size: 11px; color: var(--muted); }
  .mpos-tap-meta b { margin-left: auto; font-size: 12.5px; color: var(--ink); font-variant-numeric: tabular-nums; }
  .mpos-tap-actions { display: flex; gap: 6px; flex-wrap: wrap; }
  .mpos-tap-actions .btn { flex: 0 0 auto; }
  .mpos-menu {
    flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
    display: grid; gap: 8px; align-content: start; padding: 2px 12px 12px;
  }
  .mpos-mitem {
    display: flex; align-items: center; gap: 10px; padding: 10px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  }
  .mpos-mitem.sold { opacity: 0.55; }
  .mpos-mitem .info { min-width: 0; flex: 1; }
  .mpos-mitem .n {
    font-size: 13px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .mpos-mitem .m {
    font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .mpos-mitem .pr { margin-top: 2px; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
  .mpos-stepper { flex: none; display: flex; align-items: center; gap: 6px; }
  .mpos-step {
    width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
    background: var(--bg); color: var(--ink-2);
  }
  .mpos-step.add { background: var(--lime); color: var(--green-900); }
  .mpos-step:disabled { opacity: 0.4; }
  .mpos-qtynum { min-width: 16px; text-align: center; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
  .mpos-cartbar {
    flex: none; display: flex; align-items: center; gap: 10px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--line);
  }
  .mpos-cartbar .tot { min-width: 0; display: flex; flex-direction: column; }
  .mpos-cartbar .tot span { font-size: 10.5px; color: var(--muted); }
  .mpos-cartbar .tot b {
    font-size: 20px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
  }
  .mpos-cartbar .btn { margin-left: auto; flex: none; }
  .mpos-loading { padding: 30px 0; text-align: center; font-size: 12px; color: var(--muted); }

  .mpos-section { margin-bottom: 14px; }
  .mpos-profile, .mpos-storecard {
    display: flex; align-items: center; gap: 12px; padding: 14px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  }
  .mpos-avatar {
    flex: none; width: 44px; height: 44px; border-radius: 50%;
    display: grid; place-items: center; background: var(--green-800);
    color: var(--lime); font-size: 17px; font-weight: 700;
  }
  .mpos-avatar.sq { border-radius: 12px; background: var(--lime); color: var(--green-900); }
  .mpos-who { min-width: 0; }
  .mpos-who b { display: block; font-size: 15px; font-weight: 650; }
  .mpos-who span { font-size: 11.5px; color: var(--muted); }
  .mpos-storecard .who { min-width: 0; }
  .mpos-storecard .who b {
    display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .mpos-storecard .who span { font-size: 11px; color: var(--muted); }
  .mpos-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .mpos-stat {
    padding: 12px 14px; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius);
  }
  .mpos-stat span { display: block; font-size: 11px; color: var(--muted); }
  .mpos-stat b {
    display: block; margin-top: 4px; font-size: 22px; font-weight: 700;
    letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
  }
  .mpos-rows {
    margin-top: 14px; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  }
  .mpos-row {
    width: 100%; display: flex; align-items: center; gap: 10px; padding: 13px 12px;
    text-align: left; background: var(--surface); border-bottom: 1px solid var(--line);
  }
  .mpos-row:last-child { border-bottom: 0; }
  .mpos-row .ic {
    flex: none; width: 30px; height: 30px; border-radius: 9px;
    display: grid; place-items: center; background: var(--bg); color: var(--ink-2);
  }
  .mpos-row .txt { flex: 1; min-width: 0; }
  .mpos-row .txt b { display: block; font-size: 13.5px; font-weight: 600; }
  .mpos-row .txt span { display: block; font-size: 11px; color: var(--muted); }
  .mpos-row > svg { color: var(--muted); }
  .mpos-row.danger .ic { color: var(--danger); }
  .mpos-row.danger .txt b { color: var(--danger); }

  .mpos-tabbar {
    flex: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--line);
  }
  .mpos-tab {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 5px 0 3px; border-radius: 12px; color: var(--muted); font-size: 11px; font-weight: 600;
  }
  .mpos-tab.active { color: var(--green-900); background: var(--lime-tint); }
  .mpos-badge {
    position: absolute; top: 0; right: calc(50% - 24px); min-width: 16px; height: 16px;
    padding: 0 4px; border-radius: 99px; display: grid; place-items: center;
    background: var(--danger); color: var(--surface); font-size: 10px; font-weight: 700;
    font-variant-numeric: tabular-nums;
  }

  .mpos-lines-lg { margin: 0 0 12px; font-size: 13px; }
  .mpos-totals { display: grid; gap: 6px; padding-top: 10px; border-top: 1px dashed var(--line); }
  .mpos-totals > div { display: flex; align-items: baseline; gap: 8px; font-size: 13px; color: var(--ink-2); }
  .mpos-totals span { color: var(--muted); }
  .mpos-totals b { margin-left: auto; font-variant-numeric: tabular-nums; }
  .mpos-totals .due { padding-top: 8px; border-top: 1px solid var(--line); }
  .mpos-totals .due b { font-size: 20px; color: var(--ink); }
  .mpos-due-row { display: flex; align-items: baseline; gap: 8px; margin-bottom: 12px; }
  .mpos-due-row span { font-size: 12px; color: var(--muted); }
  .mpos-due-row b {
    margin-left: auto; font-size: 24px; font-weight: 700;
    letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
  }
  .mpos-paymethods { display: flex; flex-wrap: wrap; gap: 6px; }
  .mpos-paymethods .cat { flex: 1 1 auto; text-align: center; }

  @media (min-width: 560px) {
    .mpos-shell { max-width: 520px; margin: 0 auto; box-shadow: var(--shadow-lg); }
  }
.mpos-avatar img { width: 100%; height: 100%; display: block; border-radius: inherit; object-fit: cover; }

/* 手机 POS 紧凑排版：一屏能看到更多桌台、订单和商品 */
.mpos-shell .mpos-main { padding: 9px 10px 16px; }
.mpos-shell .mpos-pagehead { margin: 0 2px 8px; }
.mpos-shell .mpos-pagehead h2 { font-size: 16px; }
.mpos-shell .mpos-area { margin-bottom: 12px; }
.mpos-shell .mpos-area-head { margin: 2px 2px 6px; }
.mpos-shell .mpos-area-head h3 { font-size: 12px; }
.mpos-shell .mpos-table-grid { gap: 6px; }
.mpos-shell .mpos-tcard { min-height: 80px; padding: 9px 10px; border-radius: 10px; }
.mpos-shell .mpos-tcard .tn { font-size: 14.5px; }
.mpos-shell .mpos-tcard .seats { font-size: 10px; }
.mpos-shell .mpos-tcard .amt { font-size: 12.5px; }
.mpos-shell .mpos-tcard .st { font-size: 10px; gap: 4px; }
.mpos-shell .mpos-list { gap: 8px; }
.mpos-shell .mpos-ocard { padding: 10px; border-radius: 10px; }
.mpos-shell .mpos-ocard .top b { font-size: 14px; }
.mpos-shell .mpos-ocard .meta { margin-top: 3px; font-size: 10.5px; }
.mpos-shell .mpos-lines { gap: 2px; margin: 7px 0; font-size: 11.5px; }
.mpos-shell .mpos-ocard .sum { padding-top: 7px; gap: 6px; }
.mpos-shell .mpos-ocard .due b { font-size: 15.5px; }
.mpos-shell .mpos-ocard .due span { font-size: 10px; }
.mpos-shell .mpos-cats { gap: 5px; padding: 7px 10px; }
.mpos-shell .mpos-cats .cat { padding: 5px 10px; font-size: 11.5px; }
.mpos-shell .mpos-subhead { padding: 8px 10px; gap: 8px; }
.mpos-shell .mpos-subhead .info b { font-size: 13px; }
.mpos-shell .mpos-subhead .info span { font-size: 10.5px; }
.mpos-shell .mpos-menu { gap: 6px; padding: 2px 10px 10px; }
.mpos-shell .mpos-mitem { gap: 8px; padding: 8px; border-radius: 10px; }
.mpos-shell .mpos-mitem .n { font-size: 12.5px; }
.mpos-shell .mpos-mitem .m { font-size: 10.5px; }
.mpos-shell .mpos-mitem .pr { margin-top: 1px; font-size: 12px; }
.mpos-shell .mpos-stepper { gap: 4px; }
.mpos-shell .mpos-step { width: 28px; height: 28px; }
.mpos-shell .mpos-qtynum { font-size: 12px; min-width: 14px; }
.mpos-shell .mpos-taps { gap: 8px; }
.mpos-shell .mpos-tap { gap: 7px; padding: 10px; border-radius: 12px; }
.mpos-shell .mpos-tap-no { width: 34px; height: 34px; border-radius: 9px; font-size: 12px; }
.mpos-shell .mpos-tap-info b { font-size: 13.5px; }
.mpos-shell .mpos-tap-info span { margin-top: 1px; font-size: 10.5px; }
.mpos-shell .mpos-tap-meta { font-size: 10.5px; }
.mpos-shell .mpos-tap-actions { gap: 5px; }
.mpos-shell .mpos-profile, .mpos-storecard { gap: 9px; padding: 10px; border-radius: 10px; }
.mpos-shell .mpos-avatar { width: 38px; height: 38px; font-size: 15px; }
.mpos-shell .mpos-who b { font-size: 14px; }
.mpos-shell .mpos-storecard .who b { font-size: 13px; }
.mpos-shell .mpos-stats { gap: 6px; }
.mpos-shell .mpos-stat { padding: 9px 11px; border-radius: 10px; }
.mpos-shell .mpos-stat span { font-size: 10.5px; }
.mpos-shell .mpos-stat b { margin-top: 2px; font-size: 18px; }
.mpos-shell .mpos-section { margin-bottom: 10px; }
.mpos-shell .mpos-rows { margin-top: 10px; }
.mpos-shell .mpos-row { gap: 8px; padding: 10px; }
.mpos-shell .mpos-row .ic { width: 28px; height: 28px; }
.mpos-shell .mpos-row .txt b { font-size: 13px; }
.mpos-shell .mpos-row .txt span { font-size: 10.5px; }
.mpos-shell .mpos-gate-card { gap: 10px; padding: 16px; border-radius: 14px; }
.mpos-shell .mpos-gate-card h1 { font-size: 20px; }
.mpos-shell .mpos-gate-card p { font-size: 12px; }
.mpos-shell .mpos-gate-summary { padding: 9px 10px; }
.mpos-shell .mpos-gate-form .input { height: 42px; font-size: 17px; }
.mpos-shell .mpos-empty { padding: 36px 16px; }
.mpos-shell .mpos-cartbar { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
.mpos-shell .mpos-cartbar .tot b { font-size: 18px; }

/* ===== app/styles/scan.css ===== */
/* 顾客扫码点单页样式（从 scan.js 抽出，统一放在 styles 层） */
.scan-page {
    position: relative;
    touch-action: pan-y;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--ink);
    overflow: hidden;
  }
  .scan-scroll {
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .scan-scroll::-webkit-scrollbar { display: none; }
  .scan-page button { -webkit-tap-highlight-color: transparent; }

  /* ---------- hero ---------- */
  .scan-hero {
    position: relative;
    overflow: hidden;
    padding: calc(env(safe-area-inset-top) + 1.05rem) 1.15rem 1.3rem;
    background: linear-gradient(160deg, var(--green-900), var(--green-800) 58%, var(--green-700));
    color: var(--surface);
  }
  .scan-hero::before {
    content: "";
    position: absolute;
    top: -7rem;
    right: -5rem;
    width: 17rem;
    height: 17rem;
    border-radius: 50%;
    pointer-events: none;
    background: radial-gradient(circle, color-mix(in srgb, var(--lime) 36%, transparent), transparent 68%);
  }
  .scan-hero-top { position: relative; display: flex; align-items: center; gap: .6rem; }
  .scan-logo {
    flex: none;
    width: 2.3rem;
    height: 2.3rem;
    border-radius: .8rem;
    display: grid;
    place-items: center;
    background: var(--lime);
    color: var(--green-900);
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -.02em;
  }
  .scan-store { flex: 1; min-width: 0; }
  .scan-store b {
    display: block;
    font-size: .98rem;
    font-weight: 700;
    letter-spacing: .01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .scan-store span {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .7rem;
    opacity: .62;
    letter-spacing: .04em;
  }
  .scan-logo-img {
    object-fit: cover;
    background: var(--surface);
  }
  .scan-badge-link {
    text-decoration: none;
    cursor: pointer;
  }

  .scan-badge {
    position: relative;
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: .28rem;
    padding: .32rem .6rem;
    border-radius: 99px;
    background: var(--lime);
    color: var(--green-900);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .03em;
    white-space: nowrap;
  }
  .scan-table { position: relative; display: flex; align-items: flex-end; gap: .7rem; margin-top: 1.15rem; }
  .scan-table-main { display: flex; flex-direction: column; gap: .1rem; }
  .scan-table-k { font-size: .68rem; letter-spacing: .2em; opacity: .6; }
  .scan-table-no {
    font-size: 2.35rem;
    line-height: .95;
    font-weight: 800;
    letter-spacing: -.04em;
    font-variant-numeric: tabular-nums;
  }
  .scan-table-side {
    margin-left: auto;
    display: grid;
    gap: .18rem;
    text-align: right;
    font-size: .71rem;
    line-height: 1.45;
    opacity: .8;
  }

  /* ---------- categories ---------- */
  .scan-cats {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    flex-wrap: nowrap;
    gap: .4rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    padding: .7rem 1.15rem;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    scrollbar-width: none;
  }
  .scan-cats::-webkit-scrollbar { display: none; }
  .scan-cats .cat { flex: none; white-space: nowrap; padding: .5rem .85rem; font-size: .8rem; }

  /* ---------- menu ---------- */
  .scan-section { padding: .95rem 1.15rem .2rem; }
  .scan-section-head { display: flex; align-items: baseline; gap: .5rem; margin-bottom: .7rem; }
  .scan-section-head h2 { font-size: 1.12rem; font-weight: 750; letter-spacing: -.02em; }
  .scan-section-head span { margin-left: auto; font-size: .72rem; color: var(--muted); }
  .scan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.1rem, 1fr)); gap: .7rem; align-items: start; }
  .scan-card {
    display: flex;
    flex-direction: column;
    padding: 0;
    text-align: left;
    -webkit-appearance: none;
    appearance: none;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: transform .12s ease, box-shadow .18s ease, border-color .18s ease;
    -webkit-tap-highlight-color: transparent;
  }
  .scan-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-strong); }
  .scan-card:active { transform: scale(.985); }
  .scan-card.is-sold { opacity: .6; }
  .scan-card.is-sold .scan-art { background: var(--bg); }
  .scan-art {
    position: relative;
    display: grid;
    place-items: center;
    height: 5.3rem;
    font-size: 2rem;
    line-height: 1;
  }
  .scan-emoji { filter: saturate(1.05); }
  /* A3 海报：完整显示，不裁切 */
  .scan-card.has-poster .scan-art {
    height: auto; padding-top: 138%; background: #f4f0e7; overflow: hidden;
  }
  .scan-poster {
    position: absolute; left: 0; right: 0; top: 0; bottom: 0;
    width: 100%; height: 100%; padding: 0;
    box-sizing: border-box; object-fit: cover; display: block;
    cursor: zoom-in;
  }
  .scan-zoom {
    position: absolute; right: .3rem; bottom: .3rem;
    padding: .12rem .4rem; border-radius: 99px;
    background: rgba(16, 24, 12, .62); color: var(--surface);
    font-size: .58rem; font-weight: 600; pointer-events: none;
  }
  .scan-tapn {
    position: absolute;
    top: .45rem;
    left: .45rem;
    padding: .12rem .38rem;
    border-radius: .45rem;
    background: var(--green-900);
    color: var(--lime);
    font-size: .6rem;
    font-weight: 800;
    letter-spacing: .03em;
  }
  .scan-sold {
    padding: .18rem .55rem;
    border-radius: 99px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .16em;
  }
  .scan-item-body { display: flex; flex-direction: column; gap: .12rem; flex: 1; padding: .55rem .65rem .65rem; }
  .scan-item-name { font-size: .84rem; font-weight: 650; line-height: 1.35; }
  .scan-item-meta {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: .69rem;
    line-height: 1.35;
    color: var(--muted);
  }
  .scan-item-row { display: flex; align-items: center; gap: .4rem; margin-top: auto; padding-top: .45rem; }
  .scan-price { font-size: .95rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
  .scan-price small { margin-left: .12rem; font-size: .64rem; font-weight: 600; color: var(--muted); letter-spacing: 0; }
  .scan-add {
    margin-left: auto;
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--lime);
    color: var(--green-900);
    box-shadow: var(--shadow-sm);
  }
  .scan-foot { padding: .9rem 0 1.1rem; font-size: .67rem; line-height: 1.6; color: var(--muted); text-align: center; }
  .scan-loading { display: grid; place-items: center; gap: .7rem; padding: 3.6rem 1.2rem; color: var(--muted); font-size: .78rem; }
  .scan-spinner {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    border: 2px solid var(--line);
    border-top-color: var(--green-700);
    animation: scanSpin .8s linear infinite;
  }
  .scan-error { display: grid; place-items: center; gap: .55rem; padding: 3.2rem 1.4rem; text-align: center; color: var(--muted); }
  .scan-error b { font-size: .92rem; color: var(--ink); }
  .scan-error span { font-size: .75rem; max-width: 15rem; line-height: 1.6; }

  /* ---------- bottom bar ---------- */
  .scan-bar {
    flex: none;
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .6rem 1rem calc(env(safe-area-inset-bottom) + .6rem);
    background: var(--surface);
    border-top: 1px solid var(--line);
  }
  .scan-cartbtn {
    position: relative;
    flex: none;
    padding: 0;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--lime-tint);
    color: var(--green-800);
    transition: background .16s, color .16s;
  }
  .scan-cartbtn.has { background: var(--green-900); color: var(--lime); }
  .scan-cartcount {
    position: absolute;
    top: -.15rem;
    right: -.15rem;
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 .24rem;
    border-radius: 99px;
    border: 2px solid var(--surface);
    background: var(--lime-dark);
    color: var(--green-900);
    font-size: .63rem;
    font-weight: 800;
    display: grid;
    place-items: center;
    font-variant-numeric: tabular-nums;
  }
  .scan-bar-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .05rem; }
  .scan-bar-info b {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
  }
  .scan-bar-info span { font-size: .69rem; color: var(--muted); }
  .btn.scan-cta {
    flex: none;
    height: 2.85rem;
    padding: 0 1.1rem;
    border-radius: 99px;
    font-size: .86rem;
    font-weight: 700;
    min-width: 6rem;
  }

  /* ---------- bottom sheet ---------- */
  .scan-mask { position: absolute; inset: 0; z-index: 40; background: var(--ink); opacity: .46; }
  .scan-sheet {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 41;
    display: flex;
    flex-direction: column;
    max-height: 82%;
    background: var(--surface);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
  }
  .scan-sheet-head { display: flex; align-items: center; gap: .55rem; padding: .9rem 1.1rem .55rem; }
  .scan-sheet-head h3 { font-size: .98rem; font-weight: 750; }
  .scan-sheet-head > span { font-size: .7rem; color: var(--muted); }
  .scan-sheet-tools { margin-left: auto; display: flex; align-items: center; gap: .45rem; }
  .scan-clear { padding: .25rem .5rem; border-radius: 99px; background: var(--bg); color: var(--ink-2); font-size: .7rem; font-weight: 600; }
  .scan-clear:hover { color: var(--danger); }
  .scan-sheet-close {
    width: 2rem;
    height: 2rem;
    padding: 0;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--bg);
    color: var(--ink-2);
  }
  .scan-sheet-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 1.1rem .3rem; }
  .scan-sheet-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: .4rem .7rem;
    padding: .7rem 0;
    border-bottom: 1px dashed var(--line);
  }
  .scan-sheet-item:last-child { border-bottom: 0; }
  .scan-sheet-item.is-sold { opacity: .55; }
  .scan-sheet-item.is-sold .scan-sheet-name { text-decoration: line-through; }
  .scan-sheet-sold { color: var(--danger); font-weight: 800; }
  .scan-sheet-warn {
    margin: .4rem 1.1rem 0;
    padding: .5rem .7rem;
    border-radius: .6rem;
    background: var(--bg);
    color: var(--danger);
    font-size: .72rem;
    line-height: 1.5;
  }
  .scan-sheet-name { font-size: .87rem; font-weight: 650; line-height: 1.35; }
  .scan-sheet-sub { font-size: .69rem; color: var(--muted); margin-top: .1rem; }
  .scan-sheet-price { font-size: .88rem; font-weight: 750; text-align: right; font-variant-numeric: tabular-nums; }
  .scan-qty { justify-self: start; display: inline-flex; align-items: center; gap: .45rem; padding: .15rem; border-radius: 99px; background: var(--bg); }
  .scan-qty button {
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--surface);
    color: var(--ink-2);
    box-shadow: var(--shadow-sm);
  }
  .scan-qty button:hover { color: var(--green-800); }
  .scan-qty span { min-width: .9rem; text-align: center; font-size: .78rem; font-weight: 750; font-variant-numeric: tabular-nums; }
  .scan-remove { justify-self: end; font-size: .7rem; color: var(--muted); padding: .15rem .2rem; }
  .scan-remove:hover { color: var(--danger); }
  .scan-sheet-foot {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .65rem 1.1rem calc(env(safe-area-inset-bottom) + .7rem);
    border-top: 1px solid var(--line);
    background: var(--surface);
  }
  .scan-sheet-empty { display: grid; place-items: center; gap: .4rem; padding: 1.8rem 1.2rem calc(env(safe-area-inset-bottom) + 1.4rem); text-align: center; color: var(--muted); }
  .scan-sheet-empty b { font-size: .9rem; color: var(--ink); }
  .scan-sheet-empty span { font-size: .72rem; }
  .scan-sheet-empty .btn { margin-top: .6rem; }

  /* ---------- checkout ---------- */
  .scan-topbar {
    flex: none;
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: calc(env(safe-area-inset-top) + .8rem) 1.1rem .9rem;
    background: linear-gradient(160deg, var(--green-900), var(--green-800));
    color: var(--surface);
  }
  .scan-back {
    flex: none;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--green-700);
    color: var(--surface);
  }
  .scan-topbar h1 { font-size: 1.02rem; font-weight: 750; letter-spacing: -.01em; }
  .scan-topbar p { font-size: .7rem; opacity: .7; margin-top: .1rem; }
  .scan-panels { padding: .9rem 1.15rem 1rem; display: grid; gap: .75rem; }
  .scan-panel {
    padding: .9rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
  }
  .scan-panel-head { display: flex; align-items: baseline; gap: .5rem; margin-bottom: .65rem; }
  .scan-panel-head h2 { font-size: .92rem; font-weight: 700; letter-spacing: -.01em; }
  .scan-panel-head span { margin-left: auto; font-size: .69rem; color: var(--muted); }
  .scan-phone { display: flex; flex-direction: column; gap: .5rem; }
  .scan-phone .scan-input { width: 100%; flex: 0 0 auto; }
  .scan-phone .btn.scan-mini { width: 100%; }
  .scan-input {
    flex: 1;
    min-width: 0;
    height: 2.8rem;
    padding: 0 .85rem;
    border-radius: var(--radius);
    border: 1px solid var(--line-strong);
    background: var(--bg);
    -webkit-appearance: none;
    appearance: none;
    font-size: 1.15rem;
    letter-spacing: .06em;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
  }
  .scan-input::placeholder { color: var(--muted); letter-spacing: 0; }
  .scan-input:focus { border-color: var(--green-700); box-shadow: 0 0 0 3px var(--lime-tint); }
  .scan-input:disabled { opacity: .6; }
  .btn.scan-mini { flex: none; height: 2.8rem; padding: 0 1rem; border-radius: var(--radius); font-size: .82rem; }
  .scan-hint { margin-top: .55rem; font-size: .71rem; line-height: 1.6; color: var(--muted); }
  .scan-member {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .7rem;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: linear-gradient(150deg, var(--lime-tint), var(--surface));
  }
  .scan-avatar {
    flex: none;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--green-900);
    color: var(--lime);
    font-size: .92rem;
    font-weight: 800;
  }
  .scan-member-info { flex: 1; min-width: 0; }
  .scan-member-info b { display: block; font-size: .9rem; font-weight: 700; }
  .scan-member-info span { display: block; font-size: .69rem; color: var(--ink-2); margin-top: .1rem; }
  .scan-member-stats { display: grid; gap: .18rem; text-align: right; font-size: .68rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
  .scan-member-actions { display: flex; justify-content: flex-end; margin-top: .5rem; }
  .scan-link { font-size: .72rem; font-weight: 600; color: var(--green-700); padding: .2rem .1rem; }
  .scan-link:hover { color: var(--green-900); text-decoration: underline; text-underline-offset: 2px; }
  .scan-note {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    padding: .7rem .75rem;
    border-radius: var(--radius);
    border: 1px dashed var(--line-strong);
    background: var(--bg);
  }
  .scan-note > div { flex: 1; min-width: 0; }
  .scan-note b { display: block; font-size: .82rem; font-weight: 700; color: var(--ink); }
  .scan-note span { display: block; margin-top: .18rem; font-size: .7rem; line-height: 1.55; color: var(--muted); }
  .scan-coupons { display: grid; gap: .45rem; }
  .scan-coupon {
    display: flex;
    align-items: center;
    gap: .6rem;
    width: 100%;
    padding: .6rem .65rem;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--bg);
    text-align: left;
    transition: border-color .15s, background .15s;
  }
  .scan-coupon:hover { border-color: var(--line-strong); }
  .scan-coupon.active { border-color: var(--green-700); background: var(--lime-tint); }
  .scan-coupon-radio {
    flex: none;
    width: 1.05rem;
    height: 1.05rem;
    border-radius: 50%;
    border: 1.5px solid var(--line-strong);
    background: var(--surface);
    color: transparent;
    display: grid;
    place-items: center;
  }
  .scan-coupon.active .scan-coupon-radio { border-color: var(--green-800); background: var(--green-800); color: var(--lime); }
  .scan-coupon-main { flex: 1; min-width: 0; }
  .scan-coupon-name { display: block; font-size: .81rem; font-weight: 650; line-height: 1.35; }
  .scan-coupon-rule { display: block; margin-top: .12rem; font-size: .67rem; color: var(--muted); }
  .scan-coupon-value { flex: none; font-size: .81rem; font-weight: 750; color: var(--green-900); white-space: nowrap; }
  .scan-sum { display: grid; gap: .42rem; }
  .scan-sum-row { display: flex; align-items: baseline; font-size: .8rem; color: var(--ink-2); }
  .scan-sum-row > span { color: var(--muted); }
  .scan-sum-row b { margin-left: auto; font-weight: 650; font-variant-numeric: tabular-nums; }
  .scan-sum-row.total { margin-top: .1rem; padding-top: .55rem; border-top: 1px dashed var(--line); color: var(--ink); }
  .scan-sum-row.total b { font-size: 1.15rem; font-weight: 800; letter-spacing: -.02em; color: var(--green-900); }
  .scan-pays { display: flex; flex-wrap: wrap; gap: .4rem; }
  .scan-pay {
    padding: .52rem .85rem;
    border-radius: 99px;
    border: 1px solid var(--line);
    background: var(--bg);
    color: var(--ink-2);
    font-size: .78rem;
    font-weight: 600;
    transition: background .15s, color .15s, border-color .15s;
  }
  .scan-pay.active { background: var(--green-900); border-color: var(--green-900); color: var(--lime); }

  /* ---------- success ---------- */
  .scan-done {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    padding: calc(env(safe-area-inset-top) + 1.6rem) 1.4rem calc(env(safe-area-inset-bottom) + 1.4rem);
    text-align: center;
  }
  .scan-done-inner { margin: auto 0; display: flex; flex-direction: column; align-items: center; width: 100%; }
  .scan-check {
    width: 3.9rem;
    height: 3.9rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--lime);
    color: var(--green-900);
    animation: scanPop .42s cubic-bezier(.2, .9, .3, 1.25);
  }
  .scan-done h1 { margin-top: 1rem; font-size: 1.45rem; font-weight: 800; letter-spacing: -.03em; }
  .scan-done-sub { margin-top: .3rem; font-size: .82rem; color: var(--muted); }
  .scan-done-badge {
    margin-top: .8rem;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .32rem .7rem;
    border-radius: 99px;
    background: var(--lime-tint);
    color: var(--green-900);
    font-size: .72rem;
    font-weight: 700;
  }
  .scan-receipt {
    width: 100%;
    margin-top: 1.3rem;
    padding: .95rem 1rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    text-align: left;
  }
  .scan-receipt-no { display: flex; align-items: baseline; gap: .6rem; padding-bottom: .7rem; border-bottom: 1px dashed var(--line); }
  .scan-receipt-no span { font-size: .7rem; color: var(--muted); }
  .scan-receipt-no b { margin-left: auto; font-family: var(--mono); font-size: .92rem; letter-spacing: .06em; }
  .scan-receipt-row { display: flex; align-items: baseline; gap: .6rem; padding-top: .55rem; font-size: .78rem; color: var(--muted); }
  .scan-receipt-row b { margin-left: auto; color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }
  .scan-receipt-note {
    margin-top: .75rem;
    padding-top: .75rem;
    border-top: 1px dashed var(--line);
    font-size: .72rem;
    line-height: 1.65;
    color: var(--ink-2);
  }
  .btn.scan-again { width: 100%; margin-top: 1.15rem; border-radius: 99px; font-weight: 700; }
  .scan-done .scan-foot { padding: .7rem 0 0; }

  /* ---------- desktop-only exit ---------- */
  .scan-exit { display: none; }

  @keyframes scanSpin { to { transform: rotate(360deg); } }
  @keyframes scanPop { 0% { transform: scale(.6); } 100% { transform: scale(1); } }

  @media (min-width: 900px) {
    .scan-page {
      max-width: 27rem;
      height: calc(100vh - 2.5rem);
      height: calc(100dvh - 2.5rem);
      margin: 1.25rem auto;
      border: 1px solid var(--line);
      border-radius: 2rem;
      box-shadow: var(--shadow-lg);
    }
    .scan-exit {
      position: fixed;
      top: 1.5rem;
      left: 1.5rem;
      z-index: 70;
      display: inline-flex;
      align-items: center;
      gap: .35rem;
      padding: .5rem .85rem;
      border-radius: 99px;
      border: 1px solid var(--line-strong);
      background: var(--surface);
      color: var(--ink-2);
      font-size: .78rem;
      font-weight: 600;
      box-shadow: var(--shadow-sm);
    }
    .scan-exit:hover { color: var(--ink); border-color: var(--ink-2); }
  }

  @media (max-width: 360px) {
    .scan-table-no { font-size: 2rem; }
    .scan-table-side { font-size: .65rem; }
    .scan-grid { grid-template-columns: repeat(auto-fill, minmax(8.4rem, 1fr)); }
  }

  @media (prefers-reduced-motion: reduce) {
    .scan-page *, .scan-page *::before, .scan-page *::after { animation: none !important; transition: none !important; }
  }

/* 小屏兜底：确保菜单两列，整页不横向溢出（不要覆盖桌面端的手机框宽度） */
@media (max-width: 620px) {
  .scan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
html, body { overflow-x: hidden; }

/* ---------- 顾客端：评价表单 / 底部入口 ---------- */
.scan-review-sheet { padding: 0 1.1rem calc(env(safe-area-inset-bottom) + 1rem); overflow-y: auto; }
.scan-review-stack { display: grid; gap: .85rem; }
.scan-review-row { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.scan-review-label { font-size: .9rem; font-weight: 700; }
.scan-review-stars { display: flex; align-items: center; margin-top: .3rem; }
.scan-star {
  padding: .05rem .12rem; border: 0; background: none;
  color: var(--warn); font-size: 1.95rem; line-height: 1; cursor: pointer;
}
.scan-review-tags { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .45rem; }
.scan-review-textarea {
  display: block; width: 100%; height: auto; min-height: 4rem;
  margin-top: .45rem; padding: .7rem .85rem;
  font-size: .9rem; letter-spacing: 0; line-height: 1.55; resize: none;
}
.scan-review-actions { display: flex; align-items: center; gap: .55rem; }
.scan-review-submit { flex: 1; }
.scan-links { display: flex; gap: 10px; margin-top: 12px; }
.scan-links .scan-link {
  flex: 1; text-align: center; padding: 10px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  text-decoration: none; font-size: var(--text-md); font-weight: 600;
}
.scan-poster-dialog { display: block; width: 100%; height: auto; border-radius: 10px; }

/* 海报查看：直接铺满整个窗口，不留白边 */
.scan-poster-view {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: #000;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.scan-poster-view img {
  width: 100%;
  height: 100%;
  max-width: 100vw;
  max-height: 100vh;
  max-height: 100dvh;
  display: block;
  object-fit: contain;
}
.scan-poster-view .scan-poster-close {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .35);
  background: rgba(0, 0, 0, .45);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 1;
}

.scan-again {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; height: 46px; margin-top: 1.15rem;
  border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
  font-weight: 600; text-decoration: none;
}

/* 已识别会员：扫码首屏直接显示等级、姓名和余额 */
.scan-member-bar {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin-top: .7rem;
  padding: .52rem .62rem;
  border-radius: .7rem;
  background: color-mix(in srgb, var(--surface) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--lime) 22%, transparent);
  color: var(--surface);
  text-decoration: none;
}
.scan-member-avatar {
  flex: none;
  width: 1.75rem;
  height: 1.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--lime);
  color: var(--green-900);
  font-size: .72rem;
  font-weight: 800;
}
.scan-member-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: .38rem;
  flex-wrap: wrap;
}
.scan-member-main b {
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .82rem;
}
.scan-member-level {
  padding: .1rem .4rem;
  border-radius: 99px;
  background: color-mix(in srgb, var(--lime) 18%, transparent);
  color: var(--lime);
  font-size: .62rem;
  font-weight: 700;
}
.scan-member-balance {
  margin-left: auto;
  font-size: .7rem;
  font-weight: 700;
  color: var(--lime);
  white-space: nowrap;
}
.scan-member-arrow {
  flex: none;
  display: inline-flex;
  color: color-mix(in srgb, var(--surface) 70%, transparent);
}

/* 再次扫通用码：保留上一单入口 */
.scan-active-order {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin: .55rem .85rem 0;
  padding: .55rem .68rem;
  border-radius: .7rem;
  border: 1px solid color-mix(in srgb, var(--lime) 28%, var(--line));
  background: var(--lime-tint);
  color: var(--green-900);
  text-decoration: none;
}
.scan-active-order-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .12rem;
}
.scan-active-order-main b { font-size: .75rem; }
.scan-active-order-main span { font-size: .64rem; color: var(--green-800); }
.scan-active-order-go {
  margin-left: auto;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: .18rem;
  font-size: .68rem;
  font-weight: 700;
}

/* 加菜模式提示 */
.scan-append-banner {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  margin: .55rem .85rem 0;
  padding: .52rem .68rem;
  border-radius: .7rem;
  border: 1px solid color-mix(in srgb, var(--lime) 30%, transparent);
  background: color-mix(in srgb, var(--lime) 12%, transparent);
  color: var(--surface);
}
.scan-append-banner b { font-size: .76rem; }
.scan-append-banner span { font-size: .66rem; color: var(--lime); }

/* 会员价：原价划线 + 会员价标签 */
.scan-price .scan-price-was {
  margin-right: .28rem;
  color: var(--muted);
  text-decoration: line-through;
  font-size: .68em;
  font-weight: 500;
}
.scan-price b { color: var(--green-900); }
.scan-member-tag {
  margin-left: .28rem;
  padding: .08rem .28rem;
  border-radius: 99px;
  background: var(--lime-tint);
  color: var(--green-800);
  font-size: .58rem;
  font-style: normal;
  font-weight: 700;
  vertical-align: .08em;
}

.scan-member-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
  object-fit: cover;
}

/* 备注输入框：铺满整行，给足输入高度 */
.scan-panel textarea.scan-note-input {
  display: block;
  width: 100%;
  height: auto;
  min-height: 7rem;
  padding: .85rem;
  font-size: .92rem;
  letter-spacing: 0;
  line-height: 1.6;
  resize: vertical;
}

/* 未登录会员：原价优先，同时提示会员价 */
.scan-member-hint {
  margin-left: .32rem;
  color: var(--muted);
  font-size: .62rem;
  font-style: normal;
  font-weight: 500;
  white-space: nowrap;
}

/* ===== app/styles/utilities.css ===== */
/* =========================================================
   工具类：只放“结构/排版”原子类，不放业务组件
   使用顺序：tokens → components/mpos/scan → utilities
   新增样式优先写组件类，不要继续堆 inline style。
   ========================================================= */

/* 布局 */
.u-flex { display: flex; }
.u-between { display: flex; align-items: center; justify-content: space-between; }
.u-center { display: flex; align-items: center; justify-content: center; }
.u-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.u-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); }
.u-grid-span-all { grid-column: 1 / -1; }
.u-min-0 { min-width: 0; }
.u-flex-1 { flex: 1; min-width: 0; }
.u-ml-auto { margin-left: auto; }
.u-mt-2 { margin-top: var(--space-2); }
.u-mt-3 { margin-top: var(--space-3); }
.u-mt-4 { margin-top: var(--space-4); }
.u-mb-3 { margin-bottom: var(--space-3); }
.u-mb-4 { margin-bottom: var(--space-4); }
.u-p-3 { padding: var(--space-3); }
.u-p-4 { padding: var(--space-4); }
.u-w-full { width: 100%; }

/* 文本 */
.u-muted { color: var(--muted); }
.u-xs { font-size: var(--text-xs); }
.u-sm { font-size: var(--text-sm); }
.u-md { font-size: var(--text-md); }
.u-strong { font-weight: 600; }
.u-bolder { font-weight: 700; }
.u-num { font-variant-numeric: tabular-nums; }
.u-nowrap { white-space: nowrap; }
.u-right { text-align: right; }

/* 组合型工具类：把高频的 4–6 行 inline layout 收敛掉 */
.u-wrap { flex-wrap: wrap; }
.u-gap-2 { gap: var(--space-2); }
.u-gap-3 { gap: var(--space-3); }
.u-gap-4 { gap: var(--space-4); }
.u-mt-1 { margin-top: var(--space-1); }
.u-toolbar {
  display: flex; align-items: center; gap: var(--space-3);
  flex-wrap: wrap; padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
}
.u-actions-inline {
  display: inline-flex; flex-wrap: wrap; gap: var(--space-2);
  justify-content: flex-end;
}
.u-grid-auto {
  display: grid; gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
}
.u-grid-auto-sm {
  display: grid; gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr));
}
.u-stack-4 { display: grid; gap: var(--space-4); }
.u-baseline { display: flex; align-items: baseline; gap: var(--space-2); }

/* 表单辅助文字：两行以内的说明统一用这三档 */
.u-hint {
  font-size: var(--text-xs);
  line-height: 1.6;
  color: var(--muted);
}
.u-hint-sm {
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--muted);
}
.u-hint-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: -4px;
  font-size: var(--text-xs);
  line-height: 1.6;
  color: var(--muted);
}
.u-hint-tight {
  margin: -6px 0 0;
  font-size: var(--text-xs);
  line-height: 1.6;
  color: var(--muted);
}
.u-grid-2-tight {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 18px;
}
@media (max-width: 640px) {
  .u-grid-2, .u-grid-3, .u-grid-2-tight { grid-template-columns: minmax(0, 1fr); }
}

.u-base { font-size: var(--text-base); }
.u-ellipsis { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-actions-6 { margin-left: auto; display: flex; gap: 6px; }
.u-textarea { height: auto; min-height: 92px; padding: 11px 14px; line-height: 1.6; resize: vertical; }
.u-section-foot {
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; font-size: var(--text-sm); color: var(--muted);
}

.u-check { width: 15px; height: 15px; cursor: pointer; }
.u-hint-block { margin: 2px 0 0; font-size: var(--text-sm); color: var(--muted); line-height: 1.5; }

.u-center-text { text-align: center; }
.u-mb-2 { margin-bottom: var(--space-2); }

.u-mt-0 { margin-top: 0; }
