:root {
  --bg: #f5f5f2;
  --card: #ffffff;
  --ink: #1c1c1a;
  --muted: #8a8a82;
  --line: #e3e3dc;
  --accent: #0f6b4f;
  --accent-ink: #ffffff;
  --warn: #b3541e;
  --danger: #a03030;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 16px; line-height: 1.5; }
.page { max-width: 480px; margin: 0 auto; padding: 16px 14px 48px; }
h1 { font-size: 20px; margin: 8px 0 4px; }
.sub { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; }
button { font: inherit; border: none; border-radius: 10px; padding: 10px 14px; cursor: pointer; }
.btn { background: var(--ink); color: #fff; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn-danger { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn-sm { padding: 6px 10px; font-size: 14px; border-radius: 8px; }
button:disabled { opacity: 0.4; }
select, input[type="number"], input[type="text"], input[type="date"], input[type="time"], textarea {
  font: inherit; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
textarea { width: 100%; resize: vertical; }
.big { font-size: 44px; font-weight: 700; line-height: 1.1; }
.center { text-align: center; }
.tag { display: inline-block; font-size: 12px; color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 1px 10px; vertical-align: middle; }
/* 取餐状态：已取餐绿、未取餐警示、已预定默认灰 */
.tag.pickup-taken { color: var(--accent); border-color: var(--accent); }
.tag.pickup-missed { color: var(--warn); border-color: var(--warn); }
.list { display: flex; flex-direction: column; gap: 8px; }
.item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 12px; background: #fff; }
.item .name { font-weight: 600; }
.item .meta { font-size: 12px; color: var(--muted); }
.qty { font-weight: 700; font-size: 20px; min-width: 44px; text-align: center; }
.banner { border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; font-size: 14px; }
/* 后台底部悬浮提示（tab 栏上方，脱离文档流） */
#flash { position: fixed; left: 50%; transform: translateX(-50%); z-index: 60;
  bottom: calc(72px + env(safe-area-inset-bottom)); width: calc(100% - 28px); max-width: 452px; margin: 0; }
.banner.warn { background: #fdf3e7; border: 1px solid #ecd3b5; color: var(--warn); }
.banner.ok { background: #eaf4ef; border: 1px solid #c8e0d5; color: var(--accent); }
.banner.err { background: #f9ecec; border: 1px solid #e7c8c8; color: var(--danger); }
.stepper { display: flex; align-items: center; gap: 14px; }
.stepper button { width: 52px; height: 52px; font-size: 26px; border-radius: 12px; background: var(--ink); color: #fff; }
.login-list button { width: 100%; text-align: left; margin-bottom: 8px; }
.muted { color: var(--muted); font-size: 13px; }
/* 窄声明（notice）：选项列表/表单上方的说明条，可复用组件 */
.notice { font-size: 13px; color: var(--muted); line-height: 1.6; padding: 0 2px; margin-bottom: 10px; }

/* 免扫码评审：明确隔离于正式企微会话与生产数据。 */
.demo-entry { display: flex; flex-direction: column; gap: 2px; margin-top: 16px; padding: 13px 14px;
  border-radius: 12px; background: var(--ink); color: #fff; text-decoration: none; }
.demo-entry small { color: rgba(255, 255, 255, 0.68); font-size: 12px; font-weight: 400; }
.demo-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: 0 0 auto;
  margin-bottom: 10px; padding: 9px 11px; border: 1px solid #d9c486; border-radius: 12px; background: #fff8dc; color: #604b10; }
.demo-banner span { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.demo-banner small { color: #8b7538; font-size: 11px; white-space: nowrap; }
.demo-banner a { color: inherit; font-size: 13px; font-weight: 700; text-decoration: none; white-space: nowrap; }

/* 设置页分组行（移动端 grouped list 风格）：卡片即容器，行间发丝线；值=纯文本/隐形时间输入 */
.cell-row { display: flex; align-items: center; gap: 10px; padding: 11px 14px; }
.cell-row + .cell-row { border-top: 1px solid var(--line); }
.cell-value { background: none; border: none; padding: 0; font: inherit; font-weight: 600; color: var(--accent); }
.cell-link { cursor: pointer; }
/* CRUD 详情页底部删除行（移动端惯例：居中红字） */
.cell-row.danger { color: var(--danger); justify-content: center; font-weight: 600; }
.chev { color: var(--muted); font-size: 20px; line-height: 1; margin-left: 2px; }

/* 时间编辑弹层（底部，带蒙层） */
.sheet-mask { position: fixed; inset: 0; z-index: 110; background: rgba(0, 0, 0, 0.35); }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 111; background: var(--card);
  border-radius: 16px 16px 0 0; padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
  max-width: 480px; margin: 0 auto; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }

/* 时/分滚轮：滚动吸附=原生手感，中心选中带，上下渐隐 */
.wheel-box { position: relative; display: flex; justify-content: center; gap: 56px; margin-top: 12px; }
.wheel-band { position: absolute; left: 10%; right: 10%; top: 50%; height: 40px; transform: translateY(-50%);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); border-radius: 10px; background: #f2f7f4; }
.wheel { position: relative; z-index: 1; height: 200px; width: 72px; overflow-y: scroll; scroll-snap-type: y mandatory;
  font-size: 20px; font-weight: 600; scrollbar-width: none; -ms-overflow-style: none;
  -webkit-mask-image: linear-gradient(transparent, #000 25%, #000 75%, transparent);
  mask-image: linear-gradient(transparent, #000 25%, #000 75%, transparent); }
.wheel::-webkit-scrollbar { display: none; }
.wheel-item { height: 40px; line-height: 40px; scroll-snap-align: center; }
.wheel-spacer { height: 80px; }

/* 全屏页（设置子页 / 全屏输入共用外壳）：整屏覆盖，置顶返回箭头；入场右滑进，出场 JS 跟手/滑出 */
.fs-page { position: fixed; inset: 0; z-index: 90; background: var(--bg); overflow-y: auto; }
.fs-page.sub-in { animation: sub-in .24s ease-out; }
@keyframes sub-in { from { transform: translateX(100%); } }
/* 全屏输入（声明式 openInput）：text=大输入实时计数；fk=置顶搜索+结果点选 */
#fs-text { min-height: 38vh; font-size: 17px; line-height: 1.6; }
.fs-search { position: sticky; top: 0; z-index: 1; background: var(--bg); padding-bottom: 10px; }
.fs-search input { width: 100%; height: 44px; font-size: 16px; }
.fs-added { color: var(--accent); font-weight: 600; white-space: nowrap; }
.kv { display: flex; justify-content: space-between; padding: 4px 0; }
code { background: #f0f0ec; padding: 2px 6px; border-radius: 6px; font-size: 13px; word-break: break-all; }

/* 实时取景扫码浮层（POS） */
#scanner { position: fixed; inset: 0; z-index: 100; background: #000;
  display: flex; flex-direction: column; }
.scan-head { display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; color: #fff; padding-top: calc(12px + env(safe-area-inset-top)); }
.scan-head .scan-close { background: rgba(255, 255, 255, 0.12); border: none; color: #fff; }
#scan-video { flex: 1; width: 100%; object-fit: cover; background: #000; }
.scan-foot { display: flex; justify-content: center; padding: 14px; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
.scan-foot .stepper button { background: rgba(255, 255, 255, 0.9); }
.scan-status { text-align: center; color: #fff; font-size: 15px; padding: 0 16px 16px; min-height: 22px; }
.scan-status.ok { color: #7ee2b8; font-weight: 600; }
.scan-status.err { color: #ff9d9d; font-weight: 600; }

/* 扫码结果全屏反馈 */
#bigflash { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 24px; font-size: 26px; font-weight: 700; color: #fff; pointer-events: none;
  animation: bigflash-in .18s ease-out; }
#bigflash.ok { background: rgba(15, 107, 79, 0.93); }
#bigflash.err { background: rgba(160, 48, 48, 0.93); font-size: 20px; font-weight: 600; pointer-events: auto; }
@keyframes bigflash-in { from { opacity: 0; } to { opacity: 1; } }

/* 记录/菜单浮层 + 现场报确认整屏页同栈 */
#records, #menu-edit, #book-now { position: fixed; inset: 0; z-index: 90; background: var(--bg); overflow-y: auto; }
.rec-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; background: var(--bg); border-bottom: 1px solid var(--line); }
.rec-body { max-width: 480px; margin: 0 auto; padding: 14px 14px 48px; }

/* 台号独占首行 */
.station-title { font-size: 32px; margin: 10px 0 2px; letter-spacing: 1px; }

/* App 壳（me/pos 通用）：头 + 可滚动 Tab 页 + 底部切换栏（dvh 不可用时退回 vh）*/
body.tally-app { height: 100vh; height: 100dvh; overflow: hidden; }
.tally-app .page { display: flex; flex-direction: column; height: 100vh; height: 100dvh; padding: 12px 14px 0; }
.tab-page { display: none; scrollbar-width: none; -ms-overflow-style: none; }
.tab-page::-webkit-scrollbar { display: none; }
.tab-page.on { display: block; flex: 1 1 auto; overflow-y: auto; padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: flex; justify-content: center;
  background: var(--card); border-top: 1px solid var(--line); padding: 6px 0 calc(6px + env(safe-area-inset-bottom)); }
.tabbar button { flex: 1; max-width: 160px; background: none; border: none; border-radius: 0;
  display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); font-size: 11px; padding: 4px 0; }
.tabbar button .tab-ico { font-size: 22px; line-height: 1.2; }
.tabbar button .tab-ico svg { width: 24px; height: 24px; display: block; }
.tabbar button.on { color: var(--accent); font-weight: 700; }

/* 报饭主页：7 天日期条（可滑动但不出滚动条）+ 餐段手风琴 */
.day-strip { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; align-items: center;
  scrollbar-width: none; -ms-overflow-style: none; }
.day-strip::-webkit-scrollbar { display: none; }
.day-chip { flex: 0 0 auto; min-width: 58px; padding: 8px 6px; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.day-chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.day-chip.off { opacity: 0.45; }
/* 「今天」卡片放大、主题色描边；默认滚到屏幕纵向中线（strip 垂直居中保证同线） */
.day-chip.today { min-width: 78px; padding: 10px 8px; border-color: var(--accent); color: var(--accent); }
.day-chip.today .day-label { font-size: 20px; font-weight: 700; }
.day-chip.today.on { background: var(--accent); color: var(--accent-ink); }
.day-chip .day-label { font-weight: 600; font-size: 14px; }
.day-chip .day-sub { font-size: 11px; opacity: 0.75; }
/* 餐段选择胶囊（后台补记用） */
.meal-chip { padding: 8px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; font-size: 15px; }
.meal-chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* 餐段行：整行点选/取消，菜单常驻（不收起，避免布局跳动） */
.meal-block { border-top: 1px solid var(--line); }
.meal-block:first-child { border-top: none; }
.meal-row { display: flex; align-items: center; gap: 10px; padding: 13px 14px; }
.meal-row.on { background: #eaf4ef; }
.meal-row.off { opacity: 0.55; }
.sel-dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; color: #fff; }
.sel-dot.on { background: var(--accent); border-color: var(--accent); }
.sel-dot svg { width: 12px; height: 12px; }
.off-ico { width: 22px; display: inline-flex; justify-content: center; color: var(--muted); flex: 0 0 auto; }
.off-ico svg { width: 16px; height: 16px; }
.meal-menu { padding: 2px 14px 14px 46px; font-size: 14px; line-height: 1.9;
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; }
.meal-menu div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 内联小图标（餐段胶囊/凭证标题里） */
.ico-inline { width: 14px; height: 14px; vertical-align: -2px; }

/* 后台菜单维护：菜品 tag 平时纯文字（长按进入删除编辑态才带 ×）+ 新增输入行 */
.dish-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.dish-tag { display: inline-flex; align-items: center; padding: 5px 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px; font-size: 14px;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.dish-tag.del { gap: 6px; padding-right: 6px; }
.dish-tag.del button { width: 22px; height: 22px; padding: 0; border: none; border-radius: 50%;
  background: transparent; color: var(--muted); font-size: 14px; line-height: 1; }
.dish-tag.del button:hover { color: var(--danger); }
.dish-tag.add { border-style: dashed; color: var(--muted); cursor: pointer; }
/* 加菜走全屏输入（openInput text），行内只留 ＋ 胶囊 */

/* 流水首行：flex 中心线对齐（文字/份数/标签胶囊严格垂直居中） */
.item .name { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 6px; }

/* 已撤销的流水笔：划线留痕（flex 匿名项不吃继承的 text-decoration，需显式穿透） */
.item.voided { opacity: 0.55; }
.item.voided .name, .item.voided .name * { text-decoration: line-through; }
