/* =========================================================================
   源齿收银系统 —— 全站样式
   -------------------------------------------------------------------------
   统一变量在 :root。主色为橄榄绿，深绿侧栏 + 米白页底 + 白卡片。
   想换主色只改 --primary / --primary-dark / --primary-soft / --sidebar。
   ========================================================================= */

:root {
  /* 颜色 */
  --primary: #6f8b3e;
  --primary-dark: #5c7532;
  --primary-deep: #3c472a;
  --primary-soft: #eef2e3;
  --primary-line: #dde5cc;
  --sidebar: #4e5c39;
  --sidebar-hover: #44502f;
  --sidebar-active: #3c472a;

  --bg: #f3f4ef;
  --card: #ffffff;
  --text: #303133;
  --text-2: #606266;
  --muted: #909399;
  --line: #e6e9dd;
  --line-soft: #eef0e8;
  --table-head: #e8efd8;

  --ok: #4e7a2f;
  --ok-bg: #eaf3e1;
  --ok-line: #cfe3b8;
  --warn: #a9791f;
  --warn-bg: #fdf3e2;
  --warn-line: #f5ddb5;
  --danger: #d9534f;
  --danger-bg: #fdecec;
  --danger-line: #f8d3d3;
  --blue: #3b6fd4;
  --blue-bg: #eaf0fe;
  --blue-line: #d3e2fb;

  /* 圆角 / 阴影 / 间距 / 字号 */
  --radius-sm: 5px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 2px rgba(60, 71, 42, .04), 0 4px 14px rgba(60, 71, 42, .05);
  --shadow-lg: 0 18px 48px rgba(38, 45, 28, .2);

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 28px;

  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-md: 13px;
  --fs-lg: 15px;
  --fs-xl: 19px;
  --fs-num: 26px;
}

* { box-sizing: border-box; }

/* hidden 属性优先：避免 display:flex 的组件把隐藏元素又显示出来 */
[hidden] { display: none !important; }

html, body { height: 100%; margin: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-md);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; }
input, select, textarea { color: var(--text); }
kbd {
  font-family: inherit;
  font-size: 10px;
  color: #7f8570;
  background: #f4f5ef;
  border: 1px solid #e0e4d5;
  border-radius: 4px;
  padding: 1px 5px;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d5dacb; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #c2c8b4; }
::-webkit-scrollbar-track { background: transparent; }

/* =========================================================================
   整体框架：左侧导航 + 右侧顶部信息条
   ========================================================================= */
.app { display: flex; height: 100%; }

.sidebar {
  width: 208px;
  flex: 0 0 208px;
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  color: #dfe6cf;
  overflow: hidden;
}

.side-brand {
  height: 64px;
  flex: 0 0 64px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.brand-mark {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  font-size: 17px;
  font-weight: 700;
  flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text strong { font-size: 14px; font-weight: 600; letter-spacing: 1px; color: #fff; }
.brand-text span { font-size: 10.5px; color: #b9c3a5; margin-top: 2px; letter-spacing: .5px; }

.side-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.side-nav::-webkit-scrollbar { width: 0; }

.nav-btn {
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #d5ddc4;
  font-size: var(--fs-md);
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  transition: background .14s, color .14s;
}
.nav-btn svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .9; }
.nav-btn:hover { background: var(--sidebar-hover); color: #fff; }
.nav-btn.active {
  background: var(--sidebar-active);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--primary);
}
.nav-btn.active svg { opacity: 1; color: #c3d49b; }

.side-foot {
  padding: 10px;
  border-top: 1px solid rgba(255, 255, 255, .07);
}
.side-version {
  padding: 8px 12px 2px;
  font-size: 10.5px;
  color: #93a07d;
  letter-spacing: .3px;
}

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 56px;
  flex: 0 0 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 5;
}
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--muted); }
.crumb-sep { color: #c4c9ba; }
.breadcrumb b { font-size: var(--fs-md); font-weight: 600; color: var(--text); }

.topbar-right { display: flex; align-items: center; gap: 16px; min-width: 0; }
.today-stat {
  font-size: var(--fs-sm);
  color: var(--primary-dark);
  background: var(--primary-soft);
  border: 1px solid var(--primary-line);
  border-radius: 999px;
  padding: 5px 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.topbar-shop {
  font-size: var(--fs-sm);
  color: var(--text-2);
  font-weight: 600;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shop-switch-btn {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  max-width: 240px;
}
.shop-switch-btn:hover { border-color: var(--primary); color: var(--primary-dark); }
.shop-switch-list { display: flex; flex-direction: column; gap: 8px; }
.shop-switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--card); cursor: pointer; text-align: left;
}
.shop-switch-row span:first-child { display: flex; flex-direction: column; gap: 2px; }
.shop-switch-row small { color: var(--muted); font-size: 12px; }
.shop-switch-row:hover { border-color: var(--primary); }
.shop-switch-row.active { border-color: var(--primary); background: var(--primary-soft); }
.clock { font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.cashier-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 12px 0 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: .14s;
}
.cashier-btn:hover { border-color: var(--primary); background: #fbfcf7; }
.avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}

.loading-bar {
  position: absolute;
  top: 56px;
  left: 208px;
  right: 0;
  height: 2px;
  z-index: 20;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  transition: opacity .15s;
}
.loading-bar.on { opacity: 1; }
.loading-bar i {
  display: block;
  width: 40%;
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  animation: loadingSlide 1s ease-in-out infinite;
}
@keyframes loadingSlide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

#main { flex: 1; min-height: 0; position: relative; }
.view { display: none; height: 100%; }
.view.active { display: block; }
#view-cashier.active { display: flex; }

/* =========================================================================
   收银台三栏
   ========================================================================= */
.cashier-layout {
  display: flex;
  gap: 12px;
  height: 100%;
  padding: 12px;
  background: var(--bg);
}

.pos-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.pos-products { flex: 1 1 36%; min-width: 320px; }
.pos-cart { flex: 1 1 42%; min-width: 360px; max-width: 620px; }
.pos-checkout { flex: 0 0 300px; width: 300px; }

.panel-head {
  height: 46px;
  flex: 0 0 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line-soft);
}
.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--text);
}
.panel-title::before {
  content: "";
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--primary);
}
.panel-hint { font-size: var(--fs-xs); color: var(--muted); }
.panel-tools { display: flex; align-items: center; gap: 8px; }

.pos-search { padding: 12px 12px 0; }
.searchbar {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 42px;
  padding: 0 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: .15s;
}
.searchbar:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(111, 139, 62, .12);
}
.searchbar svg { width: 17px; height: 17px; color: #a9ae9d; flex-shrink: 0; }
.searchbar input {
  flex: 1; min-width: 0;
  border: 0; outline: 0; background: transparent;
  font-size: var(--fs-md);
  color: var(--text);
}
.searchbar input::placeholder { color: #aeb3a4; }
.searchbar kbd { flex-shrink: 0; }
.searchbar.small { height: 34px; width: 220px; padding: 0 10px; }
.searchbar.small svg { width: 15px; height: 15px; }
.searchbar.small input { font-size: var(--fs-sm); }

.cat-row {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.cat-row::-webkit-scrollbar { display: none; }
.cat-chip {
  flex-shrink: 0;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: .14s;
}
.cat-chip:hover { border-color: var(--primary-line); background: #fafbf6; color: var(--primary-dark); }
.cat-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}
.cat-chip .num { margin-left: 5px; font-size: 10px; opacity: .65; }

.hot-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.hot-row::-webkit-scrollbar { display: none; }
.hot-chip {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 92px;
  padding: 6px 9px;
  border: 1px solid var(--primary-line);
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  text-align: left;
  transition: .14s;
}
.hot-chip:hover { border-color: var(--primary); background: #e6ecd6; }
.hot-chip b { font-size: 11.5px; font-weight: 600; color: var(--primary-deep); max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hot-chip span { font-size: 10px; color: var(--primary-dark); font-variant-numeric: tabular-nums; }

.grid-scroll { flex: 1; overflow-y: auto; padding: 12px; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 8px;
}

.product-card {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 9px;
  row-gap: 4px;
  align-items: center;
  padding: 9px;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color .14s, box-shadow .14s, background .14s;
}
.product-card:hover {
  border-color: var(--primary);
  background: #fbfcf7;
  box-shadow: 0 2px 8px rgba(111, 139, 62, .14);
}
.product-card:active { background: var(--primary-soft); }

.pc-img {
  grid-row: 1 / span 2;
  width: 44px;
  height: 44px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700;
  color: #fff;
  overflow: hidden;
  background: #cfd9b8;
}
.pc-img img { width: 100%; height: 100%; object-fit: cover; }
.pc-img.c1 { background: #9dbb78; }
.pc-img.c2 { background: #84a5c9; }
.pc-img.c3 { background: #a79ac9; }
.pc-img.c4 { background: #cf94a6; }
.pc-img.c5 { background: #86b9b4; }

.pc-name {
  grid-column: 2;
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pc-foot { grid-column: 2; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.pc-price { font-size: var(--fs-md); font-weight: 700; color: var(--danger); font-variant-numeric: tabular-nums; }
.pc-price small { font-size: 10px; font-weight: 600; margin-left: 1px; }
.pc-stock { font-size: 10.5px; color: var(--muted); }
.pc-stock.low { color: var(--danger); font-weight: 600; }

.pc-add {
  position: absolute;
  top: 7px; right: 7px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; line-height: 1;
  opacity: 0; transform: scale(.7);
  transition: .14s;
  pointer-events: none;
}
.product-card:hover .pc-add { opacity: 1; transform: scale(1); }

.pc-tag {
  display: inline-block;
  margin-right: 4px;
  padding: 0 4px;
  border-radius: 3px;
  background: var(--blue-bg);
  color: var(--blue);
  font-size: 9.5px;
  font-weight: 600;
  vertical-align: 1px;
}
.pc-tag.special { background: var(--warn-bg); color: var(--warn); }

.empty-state {
  height: 100%;
  min-height: 240px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
  color: var(--muted);
}
.empty-mark {
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #f7f8f3;
  border: 1px dashed #d2d8c6;
  color: #aab29a;
}
.empty-mark svg { width: 24px; height: 24px; }
.empty-state p { margin: 4px 0 0; font-size: var(--fs-md); font-weight: 500; color: var(--text-2); }
.empty-state .btn { margin-top: 4px; }

/* 购物车 */
.cart-list { flex: 1; overflow-y: auto; }
.cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft);
  transition: background .12s;
}
.cart-item:hover { background: #fafbf6; }
.cart-item.active {
  background: var(--primary-soft);
  box-shadow: inset 3px 0 0 var(--primary);
}
.ci-info { flex: 1; min-width: 0; }
.ci-name {
  font-size: var(--fs-md);
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ci-controls { display: flex; align-items: center; gap: 8px; }

.price-box {
  display: inline-flex; align-items: center; gap: 1px;
  height: 26px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fbfcf8;
  font-size: var(--fs-xs);
  color: var(--muted);
  transition: .14s;
}
.price-box:focus-within { border-color: var(--primary); background: #fff; }
.price-input {
  width: 46px;
  border: 0; outline: 0; background: transparent;
  text-align: right;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  padding: 0;
}

.stepper {
  display: inline-flex; align-items: center;
  height: 26px;
  padding: 0 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}
.stepper button {
  width: 24px; height: 24px;
  border: 0; background: transparent;
  color: var(--text-2);
  font-size: 14px; line-height: 1;
  border-radius: 4px;
}
.stepper button:hover { background: var(--primary-soft); color: var(--primary-dark); }
.stepper button:disabled { color: #c8ccbe; cursor: default; background: transparent; }
.stepper span {
  width: 28px;
  text-align: center;
  font-size: var(--fs-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.stepper .qty-input {
  width: 34px;
  border: 0;
  outline: 0;
  background: transparent;
  text-align: center;
  font-size: var(--fs-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 0;
}

.ci-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.ci-sub { font-size: var(--fs-md); font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ci-del {
  width: 22px; height: 22px;
  border: 0; border-radius: 4px;
  background: transparent;
  color: #b8bcae;
  font-size: 12px; line-height: 1;
}
.ci-del:hover { background: var(--danger-bg); color: var(--danger); }
.ci-gift {
  border: 1px solid var(--line); border-radius: 5px; background: #fff;
  color: var(--muted); font-size: 10px; padding: 2px 6px; line-height: 1.4;
}
.ci-gift:hover { border-color: #d9a441; color: #8a5a00; background: #fff8ea; }
.ci-warn { font-size: 10.5px; color: var(--danger); margin-top: 4px; }
.discount-mini { display: block; margin-top: 4px; font-size: 10.5px; color: var(--ok); }
.ci-flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.ci-flag {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid #e3e6da;
  background: #f4f5f0;
  color: #7a8069;
}
.ci-flag.special { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.ci-flag.excluded { background: #f4f5f0; border-color: #e3e6da; color: var(--muted); }
.ci-flag.repriced { background: var(--blue-bg); border-color: var(--blue-line); color: var(--blue); }

.cart-empty {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  color: var(--muted);
  padding: 20px;
}
.cart-empty-mark {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 1px dashed #d2d8c6;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: #b3bba4;
  margin-bottom: 6px;
}
.cart-empty p { margin: 0; font-size: var(--fs-md); font-weight: 600; color: var(--text-2); }
.cart-empty span { font-size: var(--fs-xs); }

.cart-shortcuts {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 9px 14px;
  border-top: 1px solid var(--line-soft);
  background: #fbfcf8;
  font-size: 10.5px;
  color: var(--muted);
}
.cart-shortcuts kbd { margin-right: 2px; }

/* 结算栏 */
.pos-checkout { overflow: hidden; }
.checkout-body { flex: 1; overflow-y: auto; padding: 12px 14px; }

.member-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px dashed #d4dac6;
  border-radius: var(--radius);
  background: #fbfcf8;
  text-align: left;
  transition: .14s;
}
.member-card:hover { border-color: var(--primary); background: var(--primary-soft); }
.member-avatar {
  width: 32px; height: 32px; flex-shrink: 0;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #eceee6;
  color: #7d8274;
  font-size: var(--fs-sm); font-weight: 700;
}
.member-avatar.has { background: var(--primary); color: #fff; }
.member-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.member-name { font-size: var(--fs-sm); font-weight: 600; }
.member-sub { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-action { margin-left: auto; font-size: 10.5px; color: var(--primary-dark); flex-shrink: 0; }

.settle-lines { margin-top: 14px; }
.settle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.settle-row b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.settle-row b.minus { color: var(--danger); }

.settle-total {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.settle-total-label { font-size: var(--fs-sm); color: var(--muted); }
.cart-sum-money {
  margin-top: 4px;
  font-size: var(--fs-num);
  font-weight: 700;
  color: var(--primary-deep);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.5px;
  line-height: 1.15;
}
.settle-tip { margin-top: 10px; font-size: 10.5px; color: var(--muted); line-height: 1.5; }
.settle-warn {
  margin-top: 8px; padding: 7px 9px; border-radius: 8px;
  background: #fff6e6; border: 1px solid #f3d19b; color: #8a5a00;
  font-size: 11px; line-height: 1.5;
}
.cashbook-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 12px; }
.cashbook-row:last-child { border-bottom: 0; }
.cashbook-row .cb-main { display: flex; flex-direction: column; gap: 2px; }
.cashbook-row .cb-sub { font-size: 10.5px; color: var(--muted); }
.cashbook-row .cb-amt.in { color: var(--green, #1f7a4d); font-weight: 700; }
.cashbook-row .cb-amt.out { color: #cf2f34; font-weight: 700; }
.hold-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.hold-row:last-child { border-bottom: 0; }
.hold-row .hold-main { display: flex; flex-direction: column; gap: 2px; }
.hold-row .hold-sub { font-size: 10.5px; color: var(--muted); }

.checkout-foot { padding: 12px 14px; border-top: 1px solid var(--line-soft); background: #fbfcf8; }
.checkout-btn {
  width: 100%;
  height: 44px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  font-size: var(--fs-lg);
  font-weight: 600;
  transition: .14s;
}
.checkout-btn kbd { background: rgba(255, 255, 255, .18); border-color: rgba(255, 255, 255, .3); color: #fff; }
.checkout-btn:hover:not(:disabled) { background: var(--primary-dark); border-color: var(--primary-dark); }
.checkout-btn:disabled { background: #eceee6; border-color: #eceee6; color: #aab0a0; cursor: not-allowed; }
.checkout-btn:disabled kbd { color: #aab0a0; background: #f7f8f3; border-color: #e2e6d8; }

.link-btn {
  border: 0; background: transparent;
  color: var(--primary-dark);
  font-size: var(--fs-xs);
  padding: 2px;
}
.link-btn:hover { color: var(--danger); text-decoration: underline; }

.count-pill {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 10.5px;
  font-weight: 600;
}

.so-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 10px 14px 0;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  font-size: var(--fs-xs);
  color: var(--warn);
}
.so-banner b { font-variant-numeric: tabular-nums; }

/* =========================================================================
   通用按钮 / 输入框
   ========================================================================= */
.btn {
  height: 34px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0 14px;
  border: 1px solid #d9decd;
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--primary-dark);
  font-size: var(--fs-sm);
  font-weight: 500;
  white-space: nowrap;
  transition: .14s;
}
.btn:hover { border-color: var(--primary); color: var(--primary-dark); background: #f8faf3; }
.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 500;
}
.btn.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn.ghost { background: #fff; border-color: #d9decd; color: var(--text-2); }
.btn.ghost:hover { border-color: var(--primary); color: var(--primary-dark); background: #fafbf6; }
.btn.danger { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
.btn.danger:hover { background: #fbdede; border-color: #f2c3c3; }
.btn.lg { height: 40px; padding: 0 22px; font-size: var(--fs-md); }
.btn.sm { height: 28px; padding: 0 10px; font-size: var(--fs-xs); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.icon-btn {
  width: 30px; height: 30px;
  border: 0; border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--primary-soft); color: var(--primary-dark); }

.input {
  height: 34px;
  padding: 0 10px;
  border: 1px solid #d9decd;
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: var(--fs-sm);
  outline: none;
  transition: .14s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(111, 139, 62, .12); }
.select { padding-right: 26px; cursor: pointer; }
.date-input { width: 138px; }

/* =========================================================================
   通用页面
   ========================================================================= */
.page { height: 100%; overflow-y: auto; padding: 16px 20px 36px; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.page-title h1 { margin: 0; font-size: var(--fs-xl); font-weight: 600; color: var(--text); }
.page-title p { margin: 4px 0 0; font-size: var(--fs-sm); color: var(--muted); }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.manage-grid {
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.cat-side { padding: 12px 10px; }
.side-title {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .8px;
  padding: 2px 8px 8px;
}
.side-list { display: flex; flex-direction: column; gap: 2px; }
.side-item {
  display: flex; align-items: center; gap: 6px;
  width: 100%;
  padding: 8px 9px;
  border: 0; border-radius: var(--radius-sm);
  background: transparent;
  font-size: var(--fs-sm); color: var(--text-2);
  text-align: left;
  cursor: pointer;
  transition: .12s;
}
.side-item:hover { background: #f5f7ee; color: var(--primary-dark); }
.side-item.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.side-item .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-item .num {
  font-size: 10px; color: var(--muted);
  background: #f4f5ef;
  padding: 1px 6px; border-radius: 999px;
}
.side-item.active .num { background: #fff; color: var(--primary-dark); }
.side-item .cat-edit {
  display: none;
  width: 20px; height: 20px;
  border: 0; border-radius: 4px;
  background: rgba(0, 0, 0, .05);
  font-size: 10px; color: inherit;
}
.side-item:hover .cat-edit { display: inline-flex; align-items: center; justify-content: center; }
.side-add {
  margin-top: 6px;
  width: 100%;
  padding: 8px 9px;
  border: 1px dashed #d2d8c6;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-xs);
}
.side-add:hover { border-color: var(--primary); color: var(--primary-dark); background: #fafbf6; }

.table-card { overflow: hidden; }
.table-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-sm); color: var(--text-2);
  background: #f7f8f3;
}
.table-tip { font-size: var(--fs-xs); color: var(--muted); }
.table-tools { display: flex; align-items: center; gap: 8px; }
.table-scroll { overflow: auto; max-height: calc(100vh - 250px); }
.table-scroll.tall { max-height: calc(100vh - 220px); }

.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  position: sticky; top: 0; z-index: 2;
  padding: 9px 12px;
  text-align: left;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--primary-deep);
  background: var(--table-head);
  border-bottom: 1px solid #dfe6d1;
  white-space: nowrap;
}
.tbl td {
  padding: 9px 12px;
  border-bottom: 1px solid #f1f3ea;
  font-size: var(--fs-sm);
  color: #4a4a4a;
  vertical-align: middle;
}
.tbl tbody tr:hover { background: #fafbf6; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .ops { text-align: right; white-space: nowrap; }
.tbl .num { padding-right: 18px; }
.tbl .ops { padding-right: 14px; }

.pcell { display: flex; align-items: center; gap: 9px; }
.pthumb {
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff;
  background: #cfd9b8;
  overflow: hidden;
}
.pthumb.c1 { background: #9dbb78; }
.pthumb.c2 { background: #84a5c9; }
.pthumb.c3 { background: #a79ac9; }
.pthumb.c4 { background: #cf94a6; }
.pthumb.c5 { background: #86b9b4; }
.pthumb img { width: 100%; height: 100%; object-fit: cover; }
.pmeta { min-width: 0; }
.pmeta b { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--text); margin-bottom: 2px; }
.pmeta small, td small { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.price-cell { font-weight: 600; color: var(--text); }
.stock-cell.low { color: var(--danger); font-weight: 600; }
.cell-main { font-weight: 600; color: var(--text); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid #e3e6da;
  font-size: var(--fs-xs);
  font-weight: 500;
  background: #f4f5f0;
  color: #7a8069;
  white-space: nowrap;
}
.badge.ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.badge.off { background: #f4f5f0; border-color: #e3e6da; color: var(--muted); }
.badge.void { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
.badge.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.badge.online { background: var(--blue-bg); border-color: var(--blue-line); color: var(--blue); }

.mini-btn {
  border: 0; background: transparent;
  color: var(--primary-dark);
  font-size: var(--fs-xs); font-weight: 500;
  padding: 3px 6px; border-radius: 4px;
}
.mini-btn:hover { background: var(--primary-soft); color: var(--primary-deep); }
.mini-btn.danger { color: var(--danger); }
.mini-btn.danger:hover { background: var(--danger-bg); }

.row-empty {
  padding: 40px 18px;
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-sm);
}
.row-empty::before {
  content: "";
  display: block;
  width: 34px; height: 34px;
  margin: 0 auto 10px;
  border-radius: 50%;
  border: 1px dashed #cfd5c2;
  background: #f7f8f3;
}
.row-empty span { display: block; font-size: var(--fs-xs); color: #b0b6a7; margin-top: 5px; }

/* =========================================================================
   统计卡片
   ========================================================================= */
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.stat-card {
  padding: 13px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.stat-label { font-size: var(--fs-xs); color: var(--muted); }
.stat-value {
  margin-top: 5px;
  font-size: 24px; font-weight: 700;
  color: var(--primary-deep);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.3px;
}
.stat-value small { font-size: var(--fs-sm); font-weight: 500; color: var(--muted); margin-left: 2px; }
.stat-hint { margin-top: 3px; font-size: 10.5px; color: #b0b6a7; }

/* =========================================================================
   抽屉
   ========================================================================= */
.drawer-mask {
  position: fixed; inset: 0;
  background: rgba(38, 45, 28, .38);
  display: none;
  z-index: 50;
}
.drawer-mask.open { display: block; animation: fadeIn .16s ease; }
.drawer {
  position: absolute; top: 0; right: 0;
  height: 100%;
  width: min(460px, 100%);
  display: flex; flex-direction: column;
  background: #fff;
  box-shadow: -18px 0 48px rgba(30, 36, 22, .18);
  animation: slideIn .2s ease-out;
}
.drawer-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding: 16px 20px 13px;
  border-bottom: 1px solid var(--line);
}
.drawer-head h3 { margin: 0; font-size: var(--fs-lg); font-weight: 600; color: var(--primary-deep); }
.drawer-head p { margin: 4px 0 0; font-size: var(--fs-xs); color: var(--muted); }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px 8px; }
.drawer-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: #fbfcf8;
}
.drawer-foot .foot-total { flex: 1; min-width: 0; }
.drawer-foot .foot-label { font-size: var(--fs-xs); color: var(--muted); }
.drawer-foot .foot-money {
  font-size: 24px; font-weight: 700; color: var(--primary-deep);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.drawer-foot .btn.primary { flex-shrink: 0; min-width: 120px; }

.block { margin-bottom: 18px; }
.block-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--primary-deep);
  border-left: 3px solid var(--primary);
  padding-left: 7px;
  margin-bottom: 10px;
}
.pay-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pay-tile {
  position: relative;
  height: 74px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid #e0e5d6;
  border-radius: var(--radius);
  background: #fff;
  color: var(--text-2);
  font-size: var(--fs-sm); font-weight: 500;
  transition: .14s;
}
.pay-tile:hover { border-color: var(--primary); background: #fafbf6; }
.pay-tile.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-deep);
  font-weight: 600;
}
.pay-tile.active::after {
  content: "✓";
  position: absolute; top: 6px; right: 7px;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 9px;
  display: flex; align-items: center; justify-content: center;
}
.pay-ico {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #f4f5ef;
  color: #6d7362;
}
.pay-ico svg { width: 16px; height: 16px; }
.pay-tile[data-method="cash"] .pay-ico { background: #fbf1dc; color: #a9791f; }
.pay-tile[data-method="wechat"] .pay-ico { background: #e8f3e3; color: #4e7a2f; }
.pay-tile[data-method="alipay"] .pay-ico { background: var(--blue-bg); color: var(--blue); }

.cash-box { background: #f7f8f3; border-radius: var(--radius); padding: 10px 14px; display: flex; align-items: baseline; gap: 6px; }
.cash-box span { font-size: 16px; font-weight: 600; color: var(--muted); }
.cash-box input {
  flex: 1; min-width: 0;
  border: 0; outline: 0; background: transparent;
  font-size: 26px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  text-align: right;
}
.cash-box input::placeholder { color: #c3c8b8; }

.quick-row { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.quick-chip {
  height: 28px;
  padding: 0 11px;
  border: 1px solid #d9decd;
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text-2);
  font-size: var(--fs-xs); font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.quick-chip:hover { border-color: var(--primary); color: var(--primary-dark); background: #fafbf6; }

.change-box {
  margin-top: 10px;
  border-radius: var(--radius);
  padding: 10px 14px;
  background: var(--ok-bg);
  border: 1px solid var(--ok-line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.change-box .change-label { font-size: var(--fs-xs); color: var(--ok); font-weight: 600; }
.change-box .change-amount { font-size: 22px; font-weight: 700; color: var(--primary-deep); font-variant-numeric: tabular-nums; }
.change-box.short { background: var(--danger-bg); border-color: var(--danger-line); }
.change-box.short .change-label { color: var(--danger); }
.change-hint { margin-top: 6px; font-size: 10.5px; color: var(--danger); min-height: 14px; }
.change-hint.ok { color: var(--muted); }

.scan-tip {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: #f5f8ff;
  border: 1px solid var(--blue-line);
  font-size: var(--fs-sm);
  color: #4a5f8a;
  line-height: 1.6;
}

.field-label { font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.text-input, .textarea {
  width: 100%;
  border: 1px solid #d9decd;
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 8px 10px;
  font-size: var(--fs-sm);
  outline: none;
  resize: vertical;
  transition: .14s;
}
.text-input:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(111, 139, 62, .12); }
.textarea { min-height: 70px; }

.meta-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line-soft);
  font-size: var(--fs-sm);
}
.meta-row span { color: var(--muted); }
.meta-row b { font-weight: 600; color: var(--text-2); text-align: right; }

/* 订单明细 */
.detail-items { margin-top: 4px; }
.detail-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
}
.detail-item .di-name { flex: 1; min-width: 0; }
.detail-item .di-name b { display: block; font-size: var(--fs-sm); font-weight: 600; line-height: 1.4; }
.detail-item .di-name small { font-size: 10.5px; color: var(--muted); }
.detail-item .di-money { text-align: right; font-variant-numeric: tabular-nums; }
.detail-item .di-money b { display: block; font-size: var(--fs-sm); font-weight: 600; }
.detail-item .di-money small { font-size: 10.5px; color: var(--muted); }
.amount-list { margin-top: 12px; }
.amount-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: var(--fs-sm); color: var(--text-2); }
.amount-row b { font-variant-numeric: tabular-nums; }
.amount-row.total { border-top: 1px dashed var(--line); margin-top: 4px; padding-top: 9px; font-size: var(--fs-md); }
.amount-row.total b { font-size: 17px; font-weight: 700; color: var(--text); }
.void-note {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-bg);
  color: #b02a2f;
  font-size: var(--fs-sm);
  line-height: 1.6;
}

/* =========================================================================
   居中弹窗
   ========================================================================= */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(38, 45, 28, .42);
  display: none;
  align-items: center; justify-content: center;
  padding: 24px;
  z-index: 60;
}
.modal-mask.open { display: flex; }
.modal {
  width: min(560px, 94vw);
  max-height: 90vh;
  display: flex; flex-direction: column;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  animation: popIn .16s ease-out;
  overflow: hidden;
}
.modal.sm { width: min(420px, 94vw); }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--line);
  background: #fbfcf8;
}
.modal-head h3 {
  margin: 0;
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--primary-deep);
  border-left: 3px solid var(--primary);
  padding-left: 8px;
}
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: #fbfcf8;
}
.modal-foot .left { margin-right: auto; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.span2 { grid-column: span 2; }
.field label { font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); }
.field label em { font-style: normal; color: #b0b6a7; font-weight: 400; margin-left: 4px; }
.field input, .field select, .field textarea {
  height: 34px;
  border: 1px solid #d9decd;
  border-radius: var(--radius-sm);
  padding: 0 10px;
  font-size: var(--fs-sm);
  outline: none;
  background: #fff;
  transition: .14s;
  width: 100%;
}
.field textarea { height: auto; min-height: 70px; padding: 8px 10px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(111, 139, 62, .12);
}
.field input:disabled { background: #f6f7f2; color: var(--muted); }
.switch-row {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fbfcf8;
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.switch-row input { width: 15px; height: 15px; accent-color: var(--primary); margin: 0; }
.form-hint { font-size: 10.5px; color: var(--muted); line-height: 1.5; }

.member-search-row { display: flex; gap: 8px; margin-bottom: 10px; }
.member-search-row .searchbar { flex: 1; height: 38px; }
.member-results { display: flex; flex-direction: column; gap: 5px; max-height: 220px; overflow-y: auto; }
.member-row {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  text-align: left;
  transition: .12s;
}
.member-row:hover { border-color: var(--primary); background: #fafbf6; }
.member-row .mr-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #eceee6; color: #7d8274;
  font-size: var(--fs-xs); font-weight: 700; flex-shrink: 0;
}
.member-row .mr-name { flex: 1; min-width: 0; font-size: var(--fs-sm); font-weight: 600; }
.member-row small { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.member-empty { padding: 16px; text-align: center; color: var(--muted); font-size: var(--fs-sm); }

.scope-box { margin-top: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fbfcf8; }
.scope-tools {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line-soft);
  font-size: var(--fs-xs); color: var(--muted);
}
.scope-tools span { flex: 1; }
.scope-tools b { color: var(--primary-dark); }
.scope-list { max-height: 180px; overflow-y: auto; padding: 6px; }
.scope-item {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: var(--fs-sm);
  cursor: pointer;
}
.scope-item:hover { background: var(--primary-soft); }
.scope-item input { width: 14px; height: 14px; accent-color: var(--primary); margin: 0; flex-shrink: 0; }
.scope-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scope-item small { color: var(--muted); font-size: 10.5px; font-variant-numeric: tabular-nums; }

.divider { display: flex; align-items: center; gap: 10px; margin: 14px 0 10px; color: var(--muted); font-size: var(--fs-xs); }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* =========================================================================
   提示气泡（成功 / 失败统一）
   ========================================================================= */
.toast-wrap {
  position: fixed;
  top: 16px; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px;
  z-index: 90;
  pointer-events: none;
  align-items: center;
}
.toast {
  display: flex; align-items: center; gap: 8px;
  max-width: 440px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(38, 45, 28, .14);
  animation: toastIn .18s ease;
}
.toast .dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-dark);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  font-weight: 700;
}
.toast .dot::before { content: "i"; }
.toast.ok { border-left-color: var(--ok); }
.toast.ok .dot { background: var(--ok-bg); color: var(--ok); }
.toast.ok .dot::before { content: "✓"; }
.toast.err { border-left-color: var(--danger); }
.toast.err .dot { background: var(--danger-bg); color: var(--danger); }
.toast.err .dot::before { content: "!"; }
.toast.out { animation: toastOut .16s ease forwards; }

/* =========================================================================
   小票（58mm 热敏纸排版）
   ========================================================================= */
#printRoot { display: none; }

.receipt {
  width: 56mm;
  padding: 3mm 2mm;
  background: #fff;
  color: #000;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  font-size: 11.5px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
.receipt .r-shop { text-align: center; font-size: 15px; font-weight: 800; letter-spacing: .5px; margin-bottom: 2px; }
.receipt .r-shop-sub { text-align: center; font-size: 10px; margin-bottom: 5px; }
.receipt .r-line { border-top: 1px dashed #000; margin: 6px 0; }
.receipt .r-meta div { display: flex; justify-content: space-between; gap: 8px; font-size: 10.5px; }
.receipt .r-meta div span:last-child { text-align: right; }
.receipt .r-item { margin: 5px 0; }
.receipt .r-iname { font-size: 11.5px; line-height: 1.35; word-break: break-all; }
.receipt .r-icalc { display: flex; justify-content: space-between; font-size: 10.5px; color: #222; }
.receipt .r-row { display: flex; justify-content: space-between; font-size: 11px; padding: 1px 0; }
.receipt .r-row.strong { font-size: 13px; font-weight: 800; padding: 3px 0; }
.receipt .r-foot { text-align: center; font-size: 10.5px; margin-top: 8px; line-height: 1.5; }
.receipt .r-void {
  margin-top: 8px;
  border: 1px solid #000;
  padding: 4px;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 4px;
}
.receipt-preview {
  background: #f3f4ef;
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  justify-content: center;
  max-height: 56vh;
  overflow-y: auto;
}
.receipt-preview .receipt { box-shadow: 0 8px 26px rgba(38, 45, 28, .12); }

/* =========================================================================
   库存 / 服务单 / 会员卡
   ========================================================================= */
.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.input.compact { height: 30px; padding: 0 8px; font-size: var(--fs-xs); min-width: 120px; }
.select.compact { min-width: 108px; }

.muted { color: var(--muted); }

.lowstock-card { margin-bottom: 12px; padding: 12px 14px; }
.lowstock-list { display: flex; flex-wrap: wrap; gap: 7px; }
.lowstock-chip {
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  font-size: var(--fs-xs);
  cursor: pointer;
}
.lowstock-chip b { color: var(--warn); font-weight: 600; }
.lowstock-chip span { color: #a98a52; font-size: 10.5px; }

.row-void td { color: var(--muted); }
.row-void .cell-main { color: var(--muted); }

.ledger-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: var(--fs-sm); }
.ledger-row:last-child { border-bottom: 0; }
.ledger-row .plus { color: var(--ok); font-weight: 600; }
.ledger-row .minus { color: var(--danger); font-weight: 600; }
.ledger-sub { color: var(--muted); font-size: 10.5px; margin-top: 2px; }

.doc-lines { display: flex; flex-direction: column; gap: 7px; }
.doc-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 74px 86px 64px;
  gap: 7px;
  align-items: center;
  padding: 8px 9px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
}
.doc-line b { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-line .stock-now { color: var(--muted); font-size: 10.5px; text-align: right; }
.doc-line input {
  width: 68px; height: 30px;
  border: 1px solid #d9decd; border-radius: var(--radius-sm);
  padding: 0 8px; font-size: var(--fs-sm); text-align: right;
}
.doc-scroll { max-height: 46vh; overflow-y: auto; padding-right: 2px; }

.doc-item {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 7px;
}
.doc-item-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.doc-item-head b { font-weight: 600; color: var(--text); }
.doc-item-head small { color: var(--muted); font-size: 10.5px; white-space: nowrap; }
.doc-item-purchase,
.doc-item-take,
.doc-item-batch {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-top: 7px; font-size: 10.5px; color: var(--muted);
}
.doc-item-purchase input,
.doc-item-take input,
.doc-item-batch input,
.doc-item-take select {
  height: 30px;
  border: 1px solid #d9decd;
  border-radius: var(--radius-sm);
  padding: 0 8px;
  font-size: var(--fs-sm);
  background: #fff;
}
.doc-item-batch .nd-batch { width: 110px; }
.doc-item-batch .nd-expiry { width: 130px; }
.doc-item-purchase .nd-cost { width: 74px; text-align: right; }
.doc-item-purchase .nd-qty { width: 60px; text-align: right; }
.doc-item-take .nd-actual { width: 60px; text-align: right; }
.doc-item-take .nd-reason { width: 90px; }
.doc-item-take .nd-reason-note { width: 100%; }
.nd-amount { color: var(--text); font-weight: 600; }
.nd-diff { color: var(--muted); }
.nd-diff.plus { color: var(--ok); font-weight: 600; }
.nd-diff.minus { color: var(--danger); font-weight: 600; }

.so-qty {
  width: 64px; height: 30px;
  border: 1px solid #d9decd; border-radius: var(--radius-sm);
  padding: 0 8px; font-size: var(--fs-sm); text-align: right;
}
.card-type-row {
  display: flex; flex-direction: column; align-items: stretch; justify-content: space-between; gap: 4px;
  padding: 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-soft);
  margin-bottom: 6px;
}
.card-type-row b { display: block; font-size: var(--fs-sm); }
.card-type-row small { display: block; margin-top: 2px; font-size: 10.5px; color: var(--muted); line-height: 1.45; }
.card-type-row .ops { display: flex; gap: 2px; flex-shrink: 0; justify-content: flex-end; }

/* =========================================================================
   打印
   ========================================================================= */
@media print {
  @page { size: 58mm auto; margin: 2mm; }
  html, body { background: #fff !important; height: auto !important; overflow: visible !important; }
  body > *:not(#printRoot) { display: none !important; }
  #printRoot { display: block !important; }
  #printRoot .receipt { width: 100%; padding: 0; box-shadow: none; font-size: 10.5px; }
  #printRoot .receipt .r-shop { font-size: 14px; }
  #printRoot .receipt .r-row.strong { font-size: 12px; }
}

/* =========================================================================
   自适应
   ========================================================================= */
@media (max-width: 1360px) {
  .pos-checkout { flex-basis: 276px; width: 276px; }
  .pos-cart { min-width: 330px; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(164px, 1fr)); }
}

@media (max-width: 1200px) {
  .sidebar { width: 184px; flex-basis: 184px; }
  .loading-bar { left: 184px; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-grid { grid-template-columns: 1fr; }
  .pos-checkout { flex-basis: 258px; width: 258px; }
  .pos-cart { min-width: 300px; }
  .today-stat { display: none; }
}

@media (max-width: 1024px) {
  .cashier-layout { flex-wrap: wrap; overflow-y: auto; }
  .pos-products { flex: 1 1 100%; min-height: 320px; }
  .pos-cart { flex: 1 1 60%; min-height: 320px; }
  .pos-checkout { flex: 1 1 260px; }
  .topbar-shop, .clock { display: none; }
  /* 门店切换是店长的关键入口，窄屏也要留着 */
  .shop-switch-btn { display: inline-flex; align-items: center; }
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateX(28px); opacity: .7; } to { transform: translateX(0); opacity: 1; } }
@keyframes popIn { from { transform: translateY(8px) scale(.99); opacity: .7; } to { transform: translateY(0) scale(1); opacity: 1; } }
@keyframes toastIn { from { transform: translateY(-8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes toastOut { to { transform: translateY(-6px); opacity: 0; } }

/* =========================================================================
   登录层 / 账号 / 员工 / 日志 / 交班
   ========================================================================= */
body.auth-locked .app { display: none; }

.auth-mask {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(760px 420px at 18% 12%, rgba(111, 139, 62, .24), transparent 62%),
    radial-gradient(700px 420px at 82% 88%, rgba(60, 71, 42, .38), transparent 60%),
    linear-gradient(140deg, #3c472a 0%, #4e5c39 52%, #5c7532 100%);
}
.auth-card {
  width: 400px;
  max-width: 100%;
  background: #fff;
  border-radius: 16px;
  padding: 28px 28px 22px;
  box-shadow: 0 26px 70px rgba(20, 26, 14, .38);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.auth-brand .brand-mark {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: var(--primary);
  color: #fff;
  font-size: 20px;
  font-weight: 800;
}
.auth-brand strong { display: block; font-size: 17px; color: var(--text); }
.auth-brand span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.auth-head h2 { margin: 0 0 6px; font-size: 19px; color: var(--text); }
.auth-head p { margin: 0 0 18px; font-size: 12.5px; line-height: 1.7; color: var(--muted); }
.auth-card .field { margin-bottom: 12px; }
.auth-card .btn.block { width: 100%; justify-content: center; margin-top: 8px; }
.auth-alert {
  margin-bottom: 14px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  color: var(--warn);
  font-size: 12.5px;
}
.auth-foot {
  margin-top: 16px;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--muted);
}
.auth-hint {
  margin: -2px 0 12px;
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
}

.account-card { display: flex; align-items: center; gap: 12px; }
.account-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 18px; font-weight: 800;
}
.account-card b { display: block; font-size: 15px; color: var(--text); }
.account-card span { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }

.check-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.check-row input { width: 16px; height: 16px; accent-color: var(--primary); }

.shift-card { padding: 18px 20px; }
.shift-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line-soft);
}
.shift-head h3 { margin: 0 0 5px; font-size: 16px; color: var(--text); }
.shift-head p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.shift-expected { text-align: right; }
.shift-expected span { display: block; font-size: 11.5px; color: var(--muted); }
.shift-expected b { font-size: 26px; color: var(--primary-dark); font-variant-numeric: tabular-nums; }
.shift-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}
.shift-stat {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: #f8f9f3;
  border: 1px solid var(--line-soft);
}
.shift-stat span { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.shift-stat b { font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; }
.shift-stat b.minus, .shift-diff.minus { color: var(--danger); }
.shift-warn {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  color: var(--warn);
  font-size: 12.5px;
  line-height: 1.6;
}
.shift-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 14px;
  align-items: end;
}
.shift-form .span2 { grid-column: span 2; }
.shift-form-btn { justify-content: flex-end; }
.shift-form-btn .btn { width: 100%; justify-content: center; }
.shift-diff {
  height: 34px; display: flex; align-items: center;
  font-size: 16px; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.shift-diff.plus { color: var(--ok); }

@media (max-width: 1100px) {
  .shift-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .shift-form { grid-template-columns: 1fr 1fr; }
}

.print-status-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: #f8f9f3;
  border: 1px solid var(--line-soft);
}
.print-status { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.print-status.on { color: var(--ok); }
.print-status.off { color: var(--danger); }

/* 收银台：储值余额勾选行 */
.check-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.check-line input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}
.check-line input[type="checkbox"]:disabled { cursor: not-allowed; opacity: .5; }

/* 报表页 */
.report-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.report-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.report-card > span { font-size: 12.5px; color: var(--muted); }
.report-card > b { font-size: 24px; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.report-card > small { font-size: 12px; color: var(--muted); }
.report-card > em { font-style: normal; font-size: 12px; color: #9a9ca4; }
.delta.up { color: #1f8b4c; font-style: normal; }
.delta.down { color: #cf2f34; font-style: normal; }
.report-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 16px;
}
@media (max-width: 1180px) {
  .report-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-grid { grid-template-columns: minmax(0, 1fr); }
}

/* 练习模式：全站顶部橙色提示条 */
.demo-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  flex: 0 0 38px;
  padding: 0 16px;
  background: #f59e0b;
  border-bottom: 1px solid #d97706;
  color: #3b2500;
  font-size: 13px;
  font-weight: 600;
}
.demo-banner[hidden] { display: none; }
.demo-badge {
  background: #7c2d12;
  color: #fff;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
}
.demo-text { font-weight: 500; }
.demo-mode { margin-left: auto; font-weight: 500; }
body.demo-mode .app { height: calc(100% - 38px); }

/* 设置页：练习模式一行 */
.mode-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.mode-row span { flex: 1 1 180px; font-size: 13px; }
