:root {
  --bg: #e7e3da;
  --card: #ffffff;
  --ink: #3d4239;
  --muted: #858b7e;
  --line: #d8d3c5;
  --primary: #6b7d63;
  --primary-dark: #58694f;
  --accent: #93a289;
  --danger: #c0392b;
  --ok: #2f7d4f;
  --warn: #d9822b;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(90,60,30,.08), 0 4px 14px rgba(90,60,30,.06);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: linear-gradient(135deg, #4d5c46, #6b7d63);
  color: #fff;
  box-shadow: 0 2px 10px rgba(60, 35, 15, .25);
}
.brand { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 700; letter-spacing: .5px; }
.brand-icon { font-size: 20px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab {
  border: none;
  background: transparent;
  color: rgba(255,255,255,.82);
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s;
}
.tab:hover { background: rgba(255,255,255,.12); color: #fff; }
.tab.active { background: rgba(255,255,255,.22); color: #fff; font-weight: 600; }

/* ---------- 布局 ---------- */
main { max-width: 1180px; margin: 0 auto; padding: 20px; }
.panel { display: none; }
.panel.active { display: block; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* ---------- 看板统计卡片 ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 24px; font-weight: 700; margin-top: 4px; }
.stat-today .stat-value { color: var(--primary); }
.stat-warn .stat-value { color: var(--warn); }

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 860px) {
  .dash-grid { grid-template-columns: 1fr; }
}

/* ---------- 横向条形图（今日品类） ---------- */
.bar-row { display: grid; grid-template-columns: 110px 1fr 90px; align-items: center; gap: 10px; margin-bottom: 10px; }
.bar-label { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 18px; background: #e2ded2; border-radius: 9px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--primary)); border-radius: 9px; min-width: 6px; transition: width .3s; }
.bar-val { text-align: right; font-weight: 600; font-size: 13px; }

/* ---------- 7 日趋势柱状图 ---------- */
.trend-chart { min-height: 170px; display: flex; flex-direction: column; }
.trend-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; flex: 1; }
.trend-col { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.trend-bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; min-height: 90px; }
.trend-bar {
  width: 60%;
  max-width: 34px;
  background: linear-gradient(180deg, var(--accent), var(--primary));
  border-radius: 6px 6px 2px 2px;
  min-height: 3px;
}
.trend-val { font-size: 11px; color: var(--muted); white-space: nowrap; }
.trend-day { font-size: 11px; color: var(--muted); }

/* ---------- 列表 ---------- */
.stack { display: flex; flex-direction: column; gap: 8px; }
.list-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #f8f6ee;
}
.row-right { display: flex; align-items: center; gap: 10px; }
.empty-hint { color: var(--muted); text-align: center; padding: 18px 0; }
/* 交班记录：仅显示最近 N 天 + 展开全部（V6.9） */
.shift-more {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin-top: 2px; padding: 8px 10px; border-top: 1px dashed var(--line);
}

/* ---------- 工具栏 / 表单 ---------- */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar.wrap { row-gap: 8px; }
.grow { flex: 1 1 140px; }

.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 13px; color: var(--muted); }
.record-form { display: flex; flex-direction: column; gap: 14px; }
.record-form-top {
  display: grid;
  grid-template-columns: minmax(240px, 2fr) minmax(200px, 1fr);
  gap: 12px;
  align-items: end;
}
@media (max-width: 560px) {
  .record-form-top { grid-template-columns: 1fr; }
}
.recharge-form {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.6fr auto;
  gap: 12px;
  align-items: end;
}
@media (max-width: 900px) {
  .recharge-form { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .recharge-form { grid-template-columns: 1fr; }
}
.check-label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; padding: 6px 0; }
.items-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.item-row {
  display: grid;
  grid-template-columns: 1fr 150px 38px;
  gap: 8px;
  align-items: center;
}
@media (max-width: 560px) {
  .item-row { grid-template-columns: 1fr 110px 38px; }
}
.item-del { height: 36px; line-height: 1; font-size: 15px; }

.form-stack { display: flex; flex-direction: column; gap: 10px; }
.form-stack label { font-size: 13px; color: var(--muted); }

.input, select.input {
  font-family: inherit;
  font-size: 16px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #d8c9b6;
  border-radius: 8px;
  padding: 8px 10px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(107,125,99,.18); }
.input.small { max-width: 150px; }

/* ---------- 按钮 ---------- */
.btn {
  font-family: inherit;
  font-size: 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  background: #eee5d8;
  color: var(--ink);
  transition: filter .15s, background .15s;
  white-space: nowrap;
  display: inline-block;
  text-align: center;
}
.btn:hover { filter: brightness(.96); }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { background: #fdecea; color: var(--danger); border-color: #f5c6c0; }
.btn.danger:hover { background: #fbdcd8; }
.danger-txt { color: var(--danger); }
.btn.ghost { background: #fff; border-color: var(--line); }
.btn.ghost:hover { background: #eef0e8; }
.btn.tiny { padding: 3px 8px; font-size: 12px; border-radius: 6px; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.big { padding: 10px 22px; font-size: 15px; }
.btn-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
/* R6.7.1：上传按钮改用 <label for=file> 原生触发（iOS Safari 对 JS click() 隐藏 file input 兼容差），label 套 .btn 需补 display */
label.btn { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.link-btn { border: none; background: none; color: var(--primary); cursor: pointer; font-size: 13px; }
.link-btn:hover { text-decoration: underline; }

/* ---------- 表格 ---------- */
.table-card { padding-bottom: 8px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 13px; background: #f2efe4; }
tbody tr:hover { background: #f8f7f0; }
.th-actions { text-align: right; }
.td-actions { display: flex; gap: 6px; justify-content: flex-end; }
.num { text-align: right; }
.strong { font-weight: 600; }
.text-warn { color: var(--warn); font-weight: 600; }
.empty-row { text-align: center; color: var(--muted); padding: 24px 0; }
.table-footer { color: var(--muted); font-size: 12px; padding: 8px 10px 2px; }
.cell-name { display: flex; align-items: center; gap: 6px; }

/* ---------- 状态标签 ---------- */
.st { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.st-new       { background: #ececec; color: #666; }
.st-active    { background: #e4f3e9; color: var(--ok); }
.st-attention { background: #e8f0f9; color: #3b6ea8; }
.st-warning   { background: #fdeeda; color: var(--warn); }
.st-risk      { background: #fdecea; color: var(--danger); }
.st-balwarn   { background: #fdecea; color: var(--danger); }
.tag-new { font-size: 10px; background: var(--accent); color: #fff; border-radius: 4px; padding: 1px 5px; }

/* ---------- 组合选择框（会员搜索） ---------- */
.combobox { position: relative; }
.combobox-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  z-index: 60;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(60,35,15,.16);
  max-height: 260px;
  overflow-y: auto;
}
.combobox-item { padding: 12px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; -webkit-tap-highlight-color: transparent; }
.combobox-item:hover { background: #eef0e8; }
.combobox-item .muted { font-size: 12px; }
.chip {
  display: flex; align-items: center; gap: 8px;
  background: #eae6da; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; font-weight: 600;
}
.chip-phone { color: var(--muted); font-weight: 400; }
.chip-x {
  margin-left: auto; border: none; background: transparent; color: var(--muted);
  font-size: 16px; cursor: pointer; line-height: 1; padding: 0 2px;
}
.chip-x:hover { color: var(--danger); }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(40, 25, 10, .45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: #fff; border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.3);
  width: 100%; max-width: 420px; padding: 20px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  animation: pop .18s ease;
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-title { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.modal-body { margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Toast ---------- */
#toastRoot { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.25);
  opacity: 0; transform: translateY(-8px); transition: opacity .25s, transform .25s;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-err { background: var(--danger); }
.toast-ok { background: var(--ok); }

/* ---------- 其他 ---------- */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }
code { background: #eae6da; padding: 2px 6px; border-radius: 6px; font-size: 13px; }
.help-list { padding-left: 20px; }
.help-list li { margin-bottom: 8px; }

/* ---------- 销售收银 POS ---------- */
.pos-layout { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .pos-layout { grid-template-columns: 1fr; } }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-top: 10px; max-height: 420px; overflow-y: auto; }
.product-item {
  display: grid; grid-template-columns: 1fr auto; align-content: center;
  row-gap: 2px; column-gap: 6px; text-align: left;
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 8px 10px; cursor: pointer; font-family: inherit;
  transition: border-color .15s, background .15s, transform .05s;
}
.product-item:hover { border-color: var(--primary); background: #eef0e8; }
.product-item:active { transform: scale(.97); }
.product-item .p-name { font-size: 13px; font-weight: 600; }
.product-item .p-price { font-size: 12px; color: var(--primary); font-weight: 600; }
/* R7.5-2：「选规格」独立热区——跨两行居中，不增加卡片高度；
   触控目标 ≥44×44（平板），不依赖 hover/长按 */
.product-item .spec-open {
  grid-column: 2; grid-row: 1 / -1; align-self: center;
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
  min-width: 44px; min-height: 44px; padding: 0 6px;
  font-family: inherit; font-size: 11px; line-height: 1.15; font-weight: 600;
  color: var(--primary); background: #eef0e8;
  border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
}
.product-item .spec-open:hover { border-color: var(--primary); background: #e6ebdd; }
.product-item .spec-open:active { transform: scale(.94); background: #dfe5d5; }
.product-item.empty { grid-column: 1 / -1; color: var(--muted); text-align: center; border-style: dashed; cursor: default; }

.cart-list { display: flex; flex-direction: column; gap: 6px; min-height: 120px; max-height: 380px; overflow-y: auto; }
.cart-row {
  display: grid; grid-template-columns: 1fr auto auto 44px; gap: 6px; align-items: center;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #f8f6ee;
}
.cart-row .c-name { font-weight: 600; }
.cart-row .c-price { color: var(--primary); font-weight: 600; }
/* R7.5-2：购物车「改规格」入口——定宽以保证有无规格的行右侧按钮对齐。
   平板触控：改规格与「−」均放大到 ≥44px 触控目标（仅作用于购物车行，不影响其他页面 .btn.tiny） */
.cart-row .cart-edit { min-width: 56px; min-height: 44px; white-space: nowrap; }
.cart-row .cart-edit-ph { min-width: 56px; visibility: hidden; }
.cart-row .btn.tiny.danger { min-width: 44px; min-height: 44px; font-size: 18px; line-height: 1; }

/* ---------- R7.5-P6.2：单品人工改价（Manual Item Price Override） ---------- */
/* 购物车行新增「改单价」热区 → 栅格由 4 列扩为 5 列（名称 / 金额 / 改单价 / 改规格 / −） */
/* R7.5-P6.4：末列改为 [−][+] 数量步进器（V4 方案，末列宽度由内容自适应）。
   数量 N 仍只在商品名处以 ×N 展示，步进器**不重复显示数字**（省 22px 且避免两处数字不一致）。 */
.cart-row { grid-template-columns: 1fr auto auto auto auto; }
.cart-row .cart-price { min-width: 56px; min-height: 44px; white-space: nowrap; }
/* 名称列下限：低于此宽度中文商品名不可读（实测短名场景曾被压到 17.7px）。
   给 1fr 一个 min-width，必要时整行轻微变宽，绝不把商品名压成竖条。 */
.cart-row .c-name { min-width: 96px; }
/* 步进器：两个独立热区，各自 ≥44×44px，间距 6px 不重叠 */
.cart-row .cart-qty { display: inline-flex; align-items: center; gap: 6px; }
.cart-row .cart-qty button { min-width: 44px; min-height: 44px; }
.cart-row .cart-qty .cart-inc { font-size: 18px; line-height: 1; }
/* D1：规格已变、人工成交价待重新确认 → 整行高亮警示（结账前必须确认） */
.cart-row.is-needconfirm { border-color: var(--warn); background: #fdf3e6; }
.c-ovline { display: block; font-size: 11px; font-weight: 400; color: var(--muted); margin-top: 2px; }
.c-ovtag { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 999px;
  font-size: 11px; font-weight: 600; }
.c-ovtag.is-cut { background: #fdecea; color: var(--warn); }          /* 降价 → 橙（与「优惠」同色系） */
.c-ovtag.is-add { background: #e4e9dc; color: var(--primary-dark); }  /* 人工加价 → 绿，绝不写成「优惠」 */
.c-ovtag.is-zero { background: #f0efe9; color: var(--muted); }
.c-need { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 999px;
  font-size: 11px; font-weight: 700; background: var(--warn); color: #fff; }
.text-add { color: var(--primary-dark); }
/* 结账页：商品原价合计 / 单品人工改价 / 改单后商品合计（与「整单优惠」分列） */
.checkout-summary { margin: 8px 0 0; padding: 6px 0; border-top: 1px dashed var(--line); }
.checkout-summary .checkout-row { border-bottom: none; font-size: 13px; color: var(--muted); }

/* 改单价弹窗（§六 / §13.2）：只读原价 + 大号成交价输入 + 实时改价 + 恢复/取消/保存 */
.price-edit { display: flex; flex-direction: column; gap: 8px; }
.price-edit .pe-item { font-weight: 700; font-size: 15px; }
.price-edit .pe-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.price-edit .pe-row > span { color: var(--muted); font-size: 13px; }
.price-edit .pe-list { font-size: 20px; font-weight: 800; color: var(--ink); }
.price-edit .pe-input-row { flex-direction: column; align-items: stretch; gap: 4px; }
.price-edit .pe-input-row label { color: var(--muted); font-size: 13px; }
.price-edit .pe-input { min-height: 56px !important; font-size: 28px !important;
  font-weight: 800; text-align: right; color: var(--primary); }
.price-edit .pe-calc { min-height: 26px; font-size: 16px; font-weight: 700; }
.pe-md.is-cut { color: var(--warn); }
.pe-md.is-add { color: var(--primary-dark); }
.pe-md.is-zero { color: var(--muted); font-weight: 500; font-size: 14px; }
.price-edit .pe-qty { font-size: 12px; color: var(--muted); }
.price-edit .pe-err { min-height: 18px; font-size: 13px; color: var(--danger); font-weight: 600; }
.cart-total { display: flex; justify-content: space-between; align-items: center; border-top: 2px dashed var(--line); margin-top: 12px; padding-top: 12px; }
.total-amount { font-size: 26px; font-weight: 800; color: var(--primary); }

/* ---------- 商品库 ---------- */
.product-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #f0ece2; color: #8a7d63; }
.tag-green { background: #e4e9dc; color: var(--primary); }
.cat-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; background: #fff; }
.cat-row .cat-name { font-weight: 600; min-width: 120px; }
.cat-row .cat-meta { flex: 1; font-size: 12px; }
.cat-row .cat-actions { display: flex; gap: 6px; }
/* 规格管理（V6.7） */
.og-card { flex-direction: column; align-items: stretch; }
.og-card .og-head { display: flex; align-items: center; gap: 10px; }
.og-values { display: flex; flex-direction: column; gap: 6px; padding: 6px 0 2px; }
.opt-row { display: flex; align-items: center; gap: 6px; padding: 4px 8px; background: #f7f6f2; border-radius: 6px; }
.opt-row .opt-name { font-weight: 500; min-width: 90px; }
.opt-row .opt-delta { width: 72px !important; }
.chk-inline { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; white-space: nowrap; }
.chk-grid { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 6px 0; }
.chk-grid .chk-inline { padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.modal-wide { max-width: 640px; }
/* 商品编辑内联规格（V6.7-R2）：一级勾选组 → 二级展开选项+加价 */
.spec-group { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; background: #fff; }
.spec-check { font-weight: 600; font-size: 14px; }
.spec-values { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.spec-values.hidden { display: none; }
.spec-values .opt-check input { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; }
.spec-values .opt-delta:disabled { background: #f0efe9; color: #aaa; cursor: not-allowed; }
.spec-btns { display: flex; gap: 8px; margin-top: 4px; }
.c-spec { display: block; font-size: 11px; color: var(--muted, #8a8a80); font-weight: 400; margin-top: 1px; }
.spec-val-chip { padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
/* R7.5-2：规格弹窗实时价格条（实时反映所选规格加价，并提示未选的必选组） */
.spec-live {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  margin: -6px 0 12px; padding: 8px 10px;
  background: #f8f6ee; border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; color: var(--muted);
}
.spec-live b { color: var(--primary); font-size: 20px; font-weight: 800; }
.spec-val-chip input { width: 14px; height: 14px; accent-color: var(--brand); cursor: pointer; }
.cat-inline { min-width: 110px; max-width: 150px; }

/* ==========================================================================
   R7.5 Phase 5 · 规格选择弹窗 UI 重构（大面积 Tile / Grid，iPad 优先）
   —— 取代原「小 radio + 细长整行」形态：整块可点、无 radio 圆圈主控件、
      触控高 ≥64px、2/3/4 等分列、>4 自动换行、长文本不溢出、底部 sticky。
   ========================================================================== */
.modal.spec-modal {
  display: flex; flex-direction: column;
  max-width: 680px; width: 100%;
  max-height: calc(100vh - 32px);
  padding: 0; overflow: hidden;
}
.spec-modal .modal-title { padding: 18px 20px 4px; margin: 0; }
.spec-modal .modal-body {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  margin: 0; padding: 4px 20px 8px;
}
.spec-modal .spec-origin {
  padding: 0 20px 6px; font-size: 12px; color: var(--muted);
}
.spec-modal .spec-origin b { color: var(--ink); }
.spec-modal .spec-live { margin: 8px 20px; flex: 0 0 auto; }
.spec-modal .modal-actions {
  flex: 0 0 auto; gap: 12px;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line); background: #fff;
  position: sticky; bottom: 0;
}
.spec-modal .modal-actions .btn { min-height: 56px; font-size: 16px; font-weight: 700; }
.spec-modal .modal-actions .btn.primary { flex: 1 1 auto; }

.spec-stack { display: block; }
/* 组与组之间靠「间距 + 标题层级」区分，不再每组套一层重边框（§22） */
.spec-group-block { margin: 0 0 18px; }
.spec-group-title { font-size: 14px; font-weight: 700; margin: 0 0 10px; color: var(--ink); }
.spec-group-title .req { color: var(--danger); font-weight: 800; margin-left: 4px; }
.spec-group-title.miss { color: var(--danger); }
.spec-group-title .spec-fixed-tag {
  display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; color: var(--muted);
  background: #f0efe9; border: 1px solid var(--line);
}

.spec-tile-grid { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); }
.spec-tile-grid.n1 { grid-template-columns: 1fr; }
.spec-tile-grid.n2 { grid-template-columns: repeat(2, 1fr); }
.spec-tile-grid.n3 { grid-template-columns: repeat(3, 1fr); }
.spec-tile-grid.n4 { grid-template-columns: repeat(4, 1fr); }
/* 窄屏兜底：3/4 列在窗口不足时退化为 2 列，长标签仍完整可读 */
@media (max-width: 560px) {
  .spec-tile-grid.n3, .spec-tile-grid.n4 { grid-template-columns: repeat(2, 1fr); }
}
/* 整块 Tile 即点击区域（label 包裹 → 原生 radio 语义保留，圆圈视觉隐藏） */
.spec-tile {
  position: relative; display: flex; align-items: center; justify-content: center;
  gap: 6px; flex-wrap: wrap;
  min-height: 66px; padding: 10px 12px;
  border: 1.5px solid var(--line); border-radius: 12px; background: #fff;
  font-size: 15px; font-weight: 600; line-height: 1.25; color: var(--ink);
  text-align: center; cursor: pointer; overflow-wrap: anywhere;
  transition: border-color .12s, background .12s, color .12s, transform .05s;
  -webkit-tap-highlight-color: transparent;
}
.spec-tile:hover { border-color: var(--accent); }
.spec-tile:active { transform: scale(.97); }
.spec-tile input {
  position: absolute; width: 1px; height: 1px; opacity: 0;
  margin: 0; pointer-events: none;
}
.spec-tile .t-check { display: none; font-weight: 800; font-size: 17px; }
.spec-tile .t-label { overflow-wrap: anywhere; }
.spec-tile .t-delta { font-size: 12px; font-weight: 700; opacity: .9; white-space: nowrap; }
/* 选中：品牌绿底 + 白字 + ✓（不只靠颜色表达状态） */
.spec-tile.is-on {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 2px 8px rgba(107,125,99,.35);
}
.spec-tile.is-on .t-check { display: inline; }

/* FIXED 规格：只读固定条（不伪装成可切换选项），但仍进入出品信息 */
.spec-fixed-row { display: flex; flex-wrap: wrap; gap: 8px; }
.spec-fixed-chip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 48px; padding: 0 16px; border-radius: 10px;
  background: #f0efe9; border: 1px dashed var(--line);
  font-size: 15px; font-weight: 600; color: var(--muted);
}
.spec-fixed-chip::before { content: "🔒"; font-size: 12px; opacity: .7; }

/* R7.5-P5.2 规格闸门（fail-closed）：缺规格组 / 固定值与绑定冲突时，禁用提交并说明待迁移批次。
   语义：既不允许假装规格不存在，也不允许换个值凑出来。暖色警示 + 品牌色体系保持一致。 */
.spec-gate-note {
  margin: 8px 20px 0; padding: 12px 14px; border-radius: 12px;
  background: #fdf6ec; border: 1px solid #e8c9a0; color: #7a5326;
  font-size: 14px; line-height: 1.55; flex: 0 0 auto;
}
.spec-gate-note .gate-title { font-weight: 800; color: #9a5b12; margin-bottom: 6px; font-size: 15px; }
.spec-gate-note .gate-line { margin-top: 4px; }
.spec-gate-note .gate-line b { color: #7a5326; }
.spec-gate-note .gate-line.muted { color: #a07845; font-size: 13px; }
.spec-modal .modal-actions .btn.primary:disabled {
  background: #d8d3c6; border-color: #d8d3c6; color: #8b8574;
  cursor: not-allowed; opacity: 1; font-weight: 600;
}

/* ---------- 结账弹窗 ---------- */
.checkout-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; max-height: 132px; overflow-y: auto; }
.checkout-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.checkout-total { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 0; border-top: 2px solid var(--line); margin-top: 4px; }
.checkout-total .num { font-size: 24px; font-weight: 800; color: var(--primary); }
.pay-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin: 10px 0; }
.pay-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 12px 8px;
  font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; text-align: center;
  transition: border-color .15s, background .15s;
}
.pay-btn:hover { border-color: var(--primary); background: #eef0e8; }
.pay-btn .pay-ico { display: block; font-size: 22px; margin-bottom: 4px; }
.pay-btn.active { border-color: var(--primary); background: #e4e9dc; }
.qr-show { text-align: center; padding: 8px 0; }
.qr-show img { width: 220px; height: 220px; object-fit: contain; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.balance-hint { background: #f2f3ea; border: 1px solid #ecd9c0; border-radius: 8px; padding: 10px; margin: 10px 0; font-size: 14px; }

/* ---------- 收款码设置 ---------- */
.qr-setting { display: flex; gap: 24px; flex-wrap: wrap; }
.qr-item { display: flex; flex-direction: column; gap: 8px; }
.qr-preview { width: 150px; height: 150px; object-fit: contain; border: 1px solid var(--line); border-radius: 10px; background: #fff; }

/* ---------- 结账小票 ---------- */
.receipt-overlay {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(40, 25, 10, .55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.receipt-sheet {
  background: #fff; width: 100%; max-width: 340px;
  border-radius: 4px; padding: 22px 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  font-size: 14px; color: #222;
}
.receipt-head { text-align: center; font-size: 17px; font-weight: 800; letter-spacing: 1px; margin-bottom: 12px; }
.receipt-meta { display: flex; flex-direction: column; gap: 3px; color: #444; font-size: 13px; margin-bottom: 10px; }
.receipt-items { border-top: 1px dashed #bbb; border-bottom: 1px dashed #bbb; padding: 8px 0; margin-bottom: 8px; }
.r-row { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.r-sub { color: #999; font-size: 12px; text-align: right; margin-top: -3px; margin-bottom: 3px; }
.receipt-total { display: flex; justify-content: space-between; font-size: 16px; font-weight: 800; padding: 6px 0; }
.receipt-pay { font-size: 13px; color: #444; }
.receipt-balance { font-size: 13px; color: var(--primary); margin-top: 4px; }
.receipt-foot { text-align: center; color: #888; font-size: 12px; margin-top: 14px; }
.receipt-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.receipt-actions .btn { flex: 1 1 30%; min-height: 44px; min-width: 96px; }

/* ---------- 电子小票导出（R7.5 Phase 7.1A） ---------- */
.export-sheet { max-width: 420px; }
.export-hint { color: #858b7e; font-size: 12px; line-height: 1.6; margin-bottom: 10px; }
.export-img {
  display: block; width: 100%; max-width: 375px; margin: 0 auto 4px;
  border: 1px solid #d8d3c5; border-radius: 6px; background: #fff;
}

/* 打印小票：只打印小票内容 */
@media print {
  body > *:not(#receiptOverlay) { display: none !important; }
  #receiptOverlay { position: static !important; background: #fff !important; padding: 0 !important; display: block !important; }
  .receipt-sheet { box-shadow: none !important; width: 100% !important; max-width: 100% !important; padding: 0 !important; }
  .receipt-actions { display: none !important; }
}

/* ---------- 删除确认 ---------- */
.cf-msg { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.cf-line { padding: 6px 10px; background: #f2efe4; border-radius: 8px; }
.cf-warn { color: var(--danger); font-weight: 600; }
.cf-check { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }
.cf-check input { width: 16px; height: 16px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- 优惠价 / 挂帐 ---------- */
.discount-box { display: flex; flex-direction: column; gap: 4px; margin: 8px 0 4px; }
.discount-box label { font-size: 13px; color: var(--muted); }
.btn.full { width: 100%; margin-top: 10px; }
.pending-row { flex-wrap: wrap; }

/* ---------- 消费/充值视图切换 ---------- */
.seg-group { display: inline-flex; gap: 4px; }
.seg {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  padding: 5px 14px; font-size: 13px; border-radius: 8px; cursor: pointer; font-family: inherit;
}
.seg.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- 库存预警横幅 ---------- */
.stock-warn {
  background: #fdecea; border: 1px solid #f5c6c0; color: var(--danger);
  border-radius: 8px; padding: 8px 12px; margin: 8px 0; font-size: 13px; cursor: pointer;
}
.stock-warn:hover { background: #fbdcd8; }
.material-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.material-form .input { min-width: 90px; }

/* ---------- 组合支付 ---------- */
.combo-row { grid-template-columns: 1fr 140px 60px; }
.combo-row .c-name { white-space: nowrap; }
#comboList { display: flex; flex-direction: column; gap: 6px; }

/* V6.6 画像分析 */
.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; }
.bar-label { width: 96px; flex-shrink: 0; color: #2b2b2b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; height: 14px; background: #ece6d8; border-radius: 7px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: #6b7d63; border-radius: 7px; }
.bar-val { width: 120px; flex-shrink: 0; text-align: right; color: #8a8a8a; }
.trend-bars { display: flex; align-items: flex-end; gap: 3px; height: 110px; padding-top: 10px; }
.trend-col { flex: 1; display: flex; align-items: flex-end; height: 100%; }
.trend-bar { width: 100%; background: #8a9b80; border-radius: 3px 3px 0 0; min-height: 2px; }
.trend-col:hover .trend-bar { background: #6b7d63; }
.col { min-width: 0; }
.row { display: flex; }
.stat-grid { display: grid; gap: 12px; }
.stat-card { background: #fff; border: 1px solid #e5e0d6; border-radius: 12px; padding: 14px 16px; }

/* V6.6 图片上传 */
.upload-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.upload-row .input { flex: 1; }
/* R6.7.2：上传错误常驻红字（flex-basis:100% 自动换到下一行，不挤占本行布局） */
.img-err { flex-basis: 100%; color: #c0392b; font-size: 12px; line-height: 1.4; }

/* R6.3 新订单提醒（防漏接） */
.co-alert {
  display: none;
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 200;
  align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 18px;
  background: #c0392b; color: #fff;
  font-size: 16px; font-weight: 600;
  cursor: pointer;
  box-shadow: 0 3px 14px rgba(0,0,0,.35);
  animation: coAlertPulse 1s ease-in-out infinite alternate;
}
.co-alert.show { display: flex; }
.co-alert.soft { background: #e67e22; animation: none; }
.co-alert .ca-main { white-space: nowrap; }
.co-alert .ca-detail { font-weight: 400; font-size: 13px; opacity: .95; }
.co-alert .ca-more { font-weight: 400; font-size: 12px; opacity: .85; }
.co-alert .ca-x { margin-left: auto; font-weight: 400; font-size: 15px; opacity: .8; padding: 2px 6px; }
.co-alert .ca-x:hover { opacity: 1; }
@keyframes coAlertPulse { from { box-shadow: 0 3px 14px rgba(0,0,0,.35); } to { box-shadow: 0 3px 26px rgba(192,57,43,.95); } }
.co-sound-btn {
  position: fixed; right: 14px; bottom: 14px;
  z-index: 199;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1px solid #d8d2c6;
  background: #fff;
  font-size: 20px; line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,.22);
}
.co-sound-btn.off { opacity: .55; filter: grayscale(1); }

/* ===== Phase 3A：门店营业状态徽章（topbar 右侧，三态） ===== */
.store-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}
.store-chip:hover { background: rgba(255, 255, 255, .22); }
.store-chip__dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.store-status-pick { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 2px; }

/* ===== Phase 3A+：营业时间设置面板（常规营业时间 + 今日临时调整） ===== */
.store-hours-panel { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.store-hours-panel .sh-line {
  padding: 7px 11px; background: #f2efe4; border-radius: 8px; line-height: 1.6;
}
.store-hours-panel .sh-line b { color: var(--primary-dark); }
.sh-muted { color: var(--muted); font-size: 12.5px; }
.sh-warn { color: var(--warn); font-weight: 600; }
.sh-ok { color: var(--ok); font-weight: 700; }
.sh-no { color: var(--danger); font-weight: 700; }
.sh-tag {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px;
  background: #e4ead9; color: var(--primary-dark); font-size: 12px; font-weight: 600;
}
.sh-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.sh-time-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sh-time-row label { font-size: 13px; color: var(--muted); }
.sh-time-row .input { width: auto; min-width: 128px; }

/* ---------- WB-PILOT-007：会员身份状态 / 卡片价格待更新 ---------- */
/* 散客状态条：与「已选会员」的 chip 明显区分（同一容器，靠 chip-guest 切换配色） */
.chip-guest {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
  background: #f3f0e6; color: var(--muted); font-weight: 500;
  border: 1px dashed var(--line);
}
.chip-guest .mx-guest { color: var(--ink); font-weight: 600; }
/* 卡片价待更新：不改变卡片主区（加购）语义，只做视觉提示 */
.product-item .p-stale {
  display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 999px;
  background: #fbe9dc; color: var(--warn); font-size: 10.5px; font-weight: 700;
  vertical-align: 1px;
}
/* 商品区顶部的同步提示条：复用 .empty 的整行占位，内部提供 44px 高按钮 */
.product-item.price-warn {
  grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center;
  justify-content: center; gap: 8px; color: var(--warn); font-size: 12.5px;
}
.product-item.price-warn .btn { min-height: 44px; min-width: 88px; }

/* ================= WB-PILOT-009：390px 级窄屏布局收尾 ================= */
/* 只改样式；不碰交易算法、不改 DOM、不改 JS。三件事：
   (1) 让 POS 栅格列宽恒等于可用宽度（根因修复，不靠 overflow-x:hidden 藏内容）；
   (2) 购物车行在窄屏折成两行，控件不再被右边界切掉；
   (3) 商品卡片把「会员价 · 原价」放到整卡宽度，并把本次相关按钮抬到 44px 设计目标。 */

/* (1) 根因：.pos-layout 里 1fr 的隐含 min-width:auto 会被子项最小内容宽顶开
       （实测 390px 视口下列宽 430.94px → documentElement.scrollWidth 451）。
       minmax(0, 1fr) 把下限归零，列宽 = 可用宽度；内容超出由下一层自己换行。 */
@media (max-width: 900px) {
  .pos-layout { grid-template-columns: minmax(0, 1fr); }
}
.pos-layout > .card { min-width: 0; }

/* (2) 购物车行：≤560px 折两行 —— 第一行商品名（可多行换行），
       第二行「金额 + 改单价 + 改规格 + −/+」。每个按钮都留在视口内且独立可点。 */
@media (max-width: 560px) {
  .cart-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
  .cart-row .c-name { flex: 1 1 100%; min-width: 0; }
  .cart-row .c-price { margin-right: auto; }
  .cart-row .cart-price,
  .cart-row .cart-edit,
  .cart-row .cart-edit-ph,
  .cart-row .cart-qty { flex: 0 0 auto; }
}

/* (3) 商品卡片：≤560px 改单列，价格区拿到整卡宽度
       （原来只剩 57–79px，10px 的「会员价 · 原价」被挤成 2–3 行）。 */
@media (max-width: 560px) {
  .product-item { grid-template-columns: 1fr; }
  .product-item .p-price { display: block; line-height: 1.35; }
  .product-item .spec-open {
    grid-column: 1; grid-row: auto; justify-self: end; align-self: center; margin-top: 4px;
  }
}

/* (4) 本产品 44px 触控目标（这是本产品的设计目标，不是微信/iPad 平台硬标准）：
       本次相关的「结账 / 清空 / 挂帐 / 清除会员」统一抬到 44px 高。 */
#posCheckoutBtn,
#posClearCart,
#posHangBtn,
#posMemberClear { min-height: 44px; }
