/* ============ 收银交接班系统 · 样式 ============ */
:root {
  --bg: #0a0e1a;
  --bg-2: #0f1626;
  --card: #141c30;
  --card-2: #1a2440;
  --border: #24314f;
  --border-2: #2f3e63;
  --text: #e8eeff;
  --text-2: #9aabcc;
  --text-3: #64748b;
  --primary: #22d3ee;
  --primary-2: #0ea5b7;
  --accent: #8b5cf6;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* 桌面版式：左侧边栏宽度（展开 / 收起） */
  --side-w: 236px;
  --side-w-min: 74px;
  --topbar-h: 56px;
  --primary-soft: rgba(34, 211, 238, .13);
  /* 正在录入的那一行（副食盘点）整行高亮 */
  --row-active: rgba(34, 211, 238, .17);
}

/* ---------- 浅色主题（html[data-theme="light"]） ---------- */
html[data-theme="light"] {
  --bg: #f3f5fa;
  --bg-2: #edf0f7;
  --card: #ffffff;
  --card-2: #f4f6fc;
  --border: #dfe5f1;
  --border-2: #c9d3e6;
  --text: #1c2438;
  --text-2: #5a6b8c;
  --text-3: #8a97b0;
  --primary: #0891b2;
  --primary-2: #0e7490;
  --accent: #7c3aed;
  --ok: #059669;
  --warn: #b45309;
  --danger: #dc2626;
  --shadow: 0 10px 30px rgba(15, 23, 42, .08);
  --primary-soft: rgba(8, 145, 178, .1);
  --row-active: rgba(8, 145, 178, .13);
}
html[data-theme="light"] body {
  background-image:
    radial-gradient(900px 420px at 12% -8%, rgba(8, 145, 178, .07), transparent 62%),
    radial-gradient(760px 380px at 92% 0%, rgba(124, 58, 237, .06), transparent 60%);
}
html[data-theme="light"] .topbar { background: rgba(255, 255, 255, .88); }
html[data-theme="light"] .sidebar { background: rgba(237, 240, 247, .78); }
html[data-theme="light"] .sticky-actions { background: rgba(255, 255, 255, .92); }
html[data-theme="light"] .modal-mask { background: rgba(15, 23, 42, .42); }
html[data-theme="light"] input[type="date"] { color-scheme: light; }
html[data-theme="light"] .data-table tbody td { border-bottom-color: rgba(15, 23, 42, .1); }
html[data-theme="light"] .data-table tbody tr:hover { background: rgba(8, 145, 178, .05); }
html[data-theme="light"] .pill-morning { color: #0369a1; border-color: rgba(3, 105, 161, .35); background: rgba(3, 105, 161, .08); }
html[data-theme="light"] .pill-evening { color: #6d28d9; border-color: rgba(109, 40, 217, .32); background: rgba(109, 40, 217, .07); }
html[data-theme="light"] .toast { box-shadow: 0 12px 34px rgba(15, 23, 42, .16); }
html[data-theme="light"] .modal-box { box-shadow: 0 26px 70px rgba(15, 23, 42, .25); }
html[data-theme="light"] .auth-card { box-shadow: 0 22px 60px rgba(15, 23, 42, .16); }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(900px 420px at 12% -8%, rgba(34, 211, 238, .13), transparent 62%),
    radial-gradient(760px 380px at 92% 0%, rgba(139, 92, 246, .13), transparent 60%);
  background-attachment: fixed;
  min-height: 100vh;
}

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: .3px; }
h1 { font-size: 20px; }
h2 { font-size: 19px; }
h3 { font-size: 15px; }
p { margin: 0; }
a { color: var(--primary); }
.muted { color: var(--text-2); font-size: 12.5px; }
.hidden { display: none !important; }
.center { text-align: center; }
.ta-right { text-align: right; }
.strong { color: var(--primary); font-weight: 700; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.neg { color: var(--warn); }

/* ---------- 按钮 ---------- */
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
  background: var(--card-2);
  cursor: pointer;
  transition: .16s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.14); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #04222a;
  box-shadow: 0 6px 18px rgba(34, 211, 238, .22);
}
.btn-ghost { background: transparent; border-color: var(--border-2); color: var(--text-2); }
.btn-ghost:hover { color: var(--text); border-color: var(--primary); }
.btn-danger { background: rgba(248, 113, 113, .16); color: var(--danger); border-color: rgba(248, 113, 113, .38); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.icon-btn {
  background: none; border: none; color: var(--text-2); font-size: 22px;
  line-height: 1; cursor: pointer; padding: 0 4px; border-radius: 6px;
}
.icon-btn:hover { color: var(--text); }
.link-btn { background: none; border: none; color: var(--primary); cursor: pointer; font-size: 12.5px; padding: 0; font-family: inherit; }
.link-btn:hover { text-decoration: underline; }

/* ---------- 输入 ---------- */
input, select, textarea {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 9px 11px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: .16s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(34, 211, 238, .13); }
input:disabled, select:disabled { opacity: .62; cursor: not-allowed; }
textarea { resize: vertical; }
select { cursor: pointer; }
input[type="date"] { color-scheme: dark; cursor: pointer; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 13px; }
.field > span { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
/* 店员视角的店铺名：纯文本完整展示，替代会截断的下拉框 */
.store-static {
  min-height: 38px;
  display: flex; align-items: center;
  font-size: 15px; font-weight: 700; letter-spacing: .5px;
  color: var(--text-1);
  background: var(--bg-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 11px;
  word-break: break-all;
}
.field.sub > span { font-size: 11.5px; color: var(--text-3); }
.field-row { display: flex; gap: 10px; align-items: flex-end; }
.flex-1 { flex: 1; }
.code-btn { height: 38px; padding: 0 12px; font-size: 12.5px; }
.hint { font-size: 12px; color: var(--text-3); margin-top: 8px; line-height: 1.6; }
.hint-warn { color: var(--warn); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-3.tight { gap: 9px; }
.grid-3.tight .field { margin-bottom: 0; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

.seg { display: inline-flex; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; gap: 3px; }
.seg-item {
  flex: 1; border: none; background: transparent; color: var(--text-2);
  padding: 7px 14px; border-radius: 7px; cursor: pointer; font-size: 13px;
  font-weight: 600; font-family: inherit; transition: .16s; white-space: nowrap;
}
.seg-item.active { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #04222a; }
.seg-item:disabled { opacity: .4; cursor: not-allowed; }
.field > .seg { width: 100%; }

/* ---------- 骨架：左侧边栏 + 右侧主区（桌面优先） ---------- */
.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  transition: grid-template-columns .2s ease;
}

.sidebar {
  position: sticky; top: 0; align-self: start;
  height: 100vh;
  display: flex; flex-direction: column;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  overflow: hidden;
}
.side-head {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  padding: 0 16px; min-height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  flex: none;
}
.side-title { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.side-title strong { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-title .muted { font-size: 11.5px; white-space: nowrap; }

.nav {
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px 10px;
  background: none; border-bottom: none;
}
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  width: 100%; text-align: left;
  background: none; border: none;
  color: var(--text-2); padding: 10px 12px; border-radius: 10px;
  cursor: pointer; font-size: 13.5px; font-weight: 600; font-family: inherit;
  white-space: nowrap; transition: .16s;
}
.nav-item i {
  font-style: normal; opacity: .85; flex: none;
  width: 20px; text-align: center; font-size: 15px;
}
.nav-item span { overflow: hidden; text-overflow: ellipsis; }
.nav-item:hover { color: var(--text); background: rgba(127, 150, 200, .1); }
.nav-item.active { color: var(--primary); background: var(--primary-soft); }
.nav-item.active i { opacity: 1; }
.nav-item.active::before {
  content: ''; position: absolute; left: -10px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 3px 3px 0;
  background: var(--primary);
}

.side-foot {
  flex: none;
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px; border-top: 1px solid var(--border);
}
.side-foot .user-chip { padding: 0 2px; min-width: 0; }
.side-foot .user-meta { min-width: 0; }
.side-foot .user-meta b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-logout { width: 100%; }
.side-logout i { display: none; font-style: normal; }

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

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  min-height: var(--topbar-h);
  padding: 8px 20px;
  background: rgba(10, 14, 26, .86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.top-left, .top-right { display: flex; align-items: center; gap: 12px; min-width: 0; }
.top-store {
  font-size: 13px; font-weight: 600; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.side-toggle {
  display: none;
  border: 1px solid var(--border-2); background: var(--card-2); color: var(--text-2);
  width: 34px; height: 34px; flex: none; border-radius: 9px; cursor: pointer;
  font-size: 16px; line-height: 1; padding: 0; place-items: center; transition: .15s;
}
.side-toggle:hover { color: var(--primary); border-color: var(--primary); }
/* 收起按钮贴在侧边栏头部右缘（紧挨侧边栏，符合“收谁谁上的钮”直觉） */
.side-collapse { flex: none; margin-left: auto; }

/* 收起态：只留图标（仅桌面宽度生效；窄屏为抽屉，始终展示完整菜单） */
html.side-collapsed { --side-w: var(--side-w-min); }
@media (min-width: 961px) {
  /* 收起态：侧边栏头改为纵向，品牌图标在上、展开按钮在下 */
  html.side-collapsed .side-head {
    flex-direction: column; justify-content: center;
    gap: 8px; padding: 12px 0;
  }
  html.side-collapsed .side-collapse { margin-left: 0; }
  html.side-collapsed .side-title,
  html.side-collapsed .user-meta,
  html.side-collapsed .nav-item span { display: none; }
  html.side-collapsed .nav-item { justify-content: center; padding: 11px 0; }
  html.side-collapsed .side-foot .user-chip { justify-content: center; }
  html.side-collapsed .side-logout { padding: 8px 0; }
  html.side-collapsed .side-logout i { display: inline; }
}

.side-backdrop { display: none; }

.brand-mark {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #06121f; font-weight: 800; font-size: 17px;
  box-shadow: 0 6px 18px rgba(34, 211, 238, .25);
}
.brand-mark.big { width: 58px; height: 58px; font-size: 25px; margin: 0 auto 14px; border-radius: 16px; }
.user-chip { display: flex; align-items: center; gap: 9px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
  background: var(--card-2); color: var(--primary); border: 1px solid var(--border-2);
}
.user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-meta b { font-size: 13px; }
.user-meta i { font-style: normal; font-size: 11px; color: var(--text-3); }

/* ---------- 显示设置（字号 / 主题，位于用户信息左侧） ---------- */
.top-tools { display: flex; align-items: center; gap: 8px; }
.fs-ctl {
  display: inline-flex; align-items: center; gap: 1px;
  background: var(--card-2); border: 1px solid var(--border-2);
  border-radius: 999px; padding: 2px;
}
.fs-btn {
  border: none; background: transparent; color: var(--text-2);
  min-width: 26px; height: 26px; padding: 0 5px; border-radius: 999px;
  cursor: pointer; font-family: inherit; font-weight: 700; font-size: 12px;
  line-height: 1; display: grid; place-items: center; transition: .15s;
}
.fs-btn:hover { color: var(--primary); background: rgba(34, 211, 238, .12); }
.fs-btn:disabled { opacity: .35; cursor: not-allowed; background: transparent; color: var(--text-2); }
.fs-val {
  min-width: 36px; text-align: center; font-size: 11px; font-weight: 700;
  color: var(--text-2); font-family: var(--mono); font-variant-numeric: tabular-nums;
}
.tool-btn {
  border: 1px solid var(--border-2); background: var(--card-2); color: var(--text-2);
  width: 32px; height: 32px; border-radius: 999px; cursor: pointer;
  font-size: 15px; line-height: 1; padding: 0;
  display: grid; place-items: center; transition: .15s;
}
.tool-btn:hover { color: var(--primary); border-color: var(--primary); }

/* 顶部门店选择器（店长） */
.top-store-pick { display: flex; align-items: center; }
.store-pick {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 5px 3px 9px;
  background: var(--card-2);
  border: 1px solid var(--border-2);
  border-radius: 999px;
  transition: .16s;
}
.store-pick:hover { border-color: var(--primary-2); }
.store-pick:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(34, 211, 238, .13); }
.store-pick-ico {
  flex: none; font-size: 11px; font-weight: 700; letter-spacing: .5px;
  color: var(--primary); background: rgba(34, 211, 238, .13);
  border-radius: 999px; padding: 2px 8px; white-space: nowrap;
}
.store-pick select {
  width: auto; min-width: 108px; max-width: 200px;
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background-color: transparent;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%2322d3ee' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M3 4.7 6 7.7 9 4.7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 3px center;
  background-size: 11px 11px;
  border: none; border-radius: 999px;
  padding: 4px 20px 4px 2px;
  font-size: 13px; font-weight: 700; color: var(--text);
  text-overflow: ellipsis;
}
.store-pick select:focus { border: none; box-shadow: none; }
.store-pick select option { background: var(--card); color: var(--text); font-weight: 500; }

#app-view { flex: 1; min-width: 0; }
.page { max-width: 1720px; margin: 0 auto; padding: 20px 24px 90px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h2 { margin-bottom: 3px; }
.head-actions { display: flex; gap: 8px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-head h3::before {
  content: ''; width: 3px; height: 15px; border-radius: 2px;
  background: linear-gradient(180deg, var(--primary), var(--accent));
}
.result-card { border-color: rgba(34, 211, 238, .3); }

.badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; background: var(--card-2);
  color: var(--text-2); border: 1px solid var(--border);
}
.badge-ok { color: var(--ok); border-color: rgba(52, 211, 153, .38); background: rgba(52, 211, 153, .1); }
.badge-warn { color: var(--warn); border-color: rgba(251, 191, 36, .38); background: rgba(251, 191, 36, .1); }

.pill {
  display: inline-block; padding: 2px 9px; border-radius: 6px;
  font-size: 12px; font-weight: 600;
  background: var(--card-2); color: var(--text-2); border: 1px solid var(--border);
}
.pill-morning { color: #7dd3fc; border-color: rgba(125, 211, 252, .35); background: rgba(125, 211, 252, .1); }
.pill-evening { color: #c4b5fd; border-color: rgba(196, 181, 253, .35); background: rgba(196, 181, 253, .1); }
.pill-manager { color: var(--primary); border-color: rgba(34, 211, 238, .35); background: rgba(34, 211, 238, .1); }
.pill-staff { color: var(--text-2); }

/* ---------- 双栏班次（早班左 / 晚班右） ---------- */
.page-wide { max-width: none; padding-bottom: 48px; }
/* 交班页竖向空间紧张（副食盘点 14 档要一屏看全），把页头与「当班信息」卡片压紧 */
.page-wide { padding-top: 14px; }
.page-wide .page-head { margin-bottom: 10px; align-items: center; }
.page-wide .page-head h2 { font-size: 19px; margin-bottom: 1px; }
.page-wide .page-head .muted { font-size: 11.5px; }
.page-wide > .card { padding: 10px 16px; margin-bottom: 12px; }
.page-wide > .card .card-head { margin-bottom: 6px; }
.page-wide > .card .grid-2 { gap: 10px 18px; }
/* 「当班信息」两栏：标签与控件同一行，省掉一行标签高度 */
.page-wide > .card .field { flex-direction: row; align-items: center; gap: 10px; margin-bottom: 0; }
.page-wide > .card .field > span { white-space: nowrap; }
.page-wide > .card .field select,
.page-wide > .card .field input { flex: 1; min-width: 0; height: 32px; }
.shift-cols {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start;
}
.shift-cols > * { min-width: 0; }
/* 副食盘点：单栏长表一次全部展开（不分栏、不做表内滚动），压缩行高让 1K 屏一屏看全 */
.shift-panel > * { min-width: 0; }
.shift-panel .table-wrap { overflow: auto; }
.shift-panel .table-wrap thead th { position: sticky; top: 0; z-index: 3; }
.shift-cols .card { margin-bottom: 0; }
.shift-panel { display: flex; flex-direction: column; }
.card-head.sub-head { margin: 10px 0 6px; }
.sub-title { font-size: 13.5px; color: var(--text-2); }
.sub-title::before { height: 12px; opacity: .7; }
.shift-panel .card-head .badge { white-space: nowrap; }
.shift-panel .data-table { min-width: 0; font-size: 13px; }
.shift-panel .data-table tbody td { padding: 3px 10px; }
.shift-panel .data-table thead th { padding: 6px 10px; font-size: 11.5px; }
.shift-panel .data-table tfoot td { padding: 7px 10px; }
/* 副食表：整表铺满卡片（与下方字段左右对齐对称），列宽按比例分配；
   三个录入列固定较窄、输入框居中并限宽，避免格子被拉得很宽 */
.shift-panel .snack-table { width: 100%; min-width: 520px; table-layout: fixed; }
.shift-panel .snack-table thead th:nth-child(1) { width: 12%; }
.shift-panel .snack-table thead th:nth-child(2),
.shift-panel .snack-table thead th:nth-child(3),
.shift-panel .snack-table thead th:nth-child(4) { width: 14%; }
.shift-panel .snack-table thead th:nth-child(5),
.shift-panel .snack-table thead th:nth-child(6) { width: 23%; }
.shift-panel .snack-table td:nth-child(2),
.shift-panel .snack-table td:nth-child(3),
.shift-panel .snack-table td:nth-child(4) { text-align: center; }
.shift-panel .cell-input { padding: 3px 8px; font-size: 13px; width: 100%; max-width: 92px; margin: 0 auto; }
/* 光标所在行整行高亮（含面额与卖出/金额），一行看全不易串行 */
.shift-panel .snack-table tbody tr.row-active > td {
  background: var(--row-active);
  border-bottom-color: var(--primary-2);
}
.shift-panel .snack-table tbody tr.row-active > td:first-child {
  box-shadow: inset 3px 0 0 0 var(--primary);
  color: var(--primary);
}
.shift-panel .snack-table tbody tr.row-active .cell-input { border-color: var(--primary); }
.shift-panel .snack-table tbody tr.row-active .col-sold,
.shift-panel .snack-table tbody tr.row-active .col-amount { color: var(--text); }
/* 交班人 / 接班人：点选本店名单的弹出层 */
.shift-panel .field-person { position: relative; }
.staff-suggest {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 40;
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px; border-radius: 10px;
  background: var(--card-2); border: 1px solid var(--border-2); box-shadow: var(--shadow);
}
.staff-suggest-label { flex-basis: 100%; font-size: 11px; color: var(--text-3); }
.staff-option {
  border: 1px solid var(--border-2); background: var(--card); color: var(--text);
  border-radius: 999px; padding: 3px 12px; font-size: 13px; cursor: pointer; font-family: inherit;
}
.staff-option:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.shift-panel .hint { margin-top: 5px; }
.shift-panel .result-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
.shift-panel .diff-box { flex-wrap: wrap; }
.shift-panel .diff-desc { margin-left: auto; }
.panel-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border);
}
.panel-actions .btn { min-width: 104px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 520px; }
.data-table thead th {
  background: var(--bg-2); color: var(--text-2);
  font-size: 12px; font-weight: 700; text-align: left;
  padding: 10px 12px; white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.data-table tbody td { padding: 8px 12px; border-bottom: 1px solid rgba(36, 49, 79, .55); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(34, 211, 238, .045); }
.data-table tfoot td { padding: 11px 12px; background: var(--bg-2); font-weight: 700; border-top: 1px solid var(--border); }
.data-table.compact { min-width: 380px; font-size: 12.5px; }
.data-table.compact td, .data-table.compact th { padding: 5px 10px; }
.row-click { cursor: pointer; }
.total-row td { background: var(--bg-2); font-weight: 700; }

.snack-table { min-width: 520px; }
.snack-table th:first-child, .snack-table td:first-child { width: 74px; }
.col-price { font-weight: 700; color: var(--text-2); font-family: var(--mono); }
.col-sold, .col-amount { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
/* 表头与数值列同向对齐（卖出/金额数值右对齐，表头也要右对齐才不错位） */
.snack-table thead th:nth-child(5),
.snack-table thead th:nth-child(6) { text-align: right; }
/* 面额与三个数量列表头居中，与内容一致 */
.snack-table thead th:nth-child(2),
.snack-table thead th:nth-child(3),
.snack-table thead th:nth-child(4) { text-align: center; }
.col-amount { color: var(--text); font-weight: 600; }
.cell-input { padding: 6px 8px; text-align: center; font-family: var(--mono); font-size: 14px; }
.snack-table td:nth-child(2), .snack-table td:nth-child(3), .snack-table td:nth-child(4) { width: 112px; }

.bar { display: inline-block; width: 96px; height: 7px; border-radius: 4px; background: var(--bg-2); overflow: hidden; vertical-align: middle; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); }
.bar-text { font-size: 11.5px; color: var(--text-3); margin-left: 7px; }

.empty { padding: 34px; text-align: center; color: var(--text-3); }

/* ---------- 结算 ---------- */
.result-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.result-item {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
  display: flex; flex-direction: column; gap: 5px;
}
.result-item span { font-size: 12px; color: var(--text-2); }
.result-item strong { font-size: 20px; font-family: var(--mono); font-variant-numeric: tabular-nums; }

.diff-box {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 16px 18px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-2);
}
.diff-label { font-size: 13px; color: var(--text-2); font-weight: 600; }
.diff-value { font-size: 32px; font-weight: 800; font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.diff-tag { padding: 4px 13px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.diff-desc { font-size: 12.5px; color: var(--text-3); margin-left: auto; }
.diff-balanced { border-color: rgba(52, 211, 153, .4); background: rgba(52, 211, 153, .07); }
.diff-balanced .diff-value, .diff-balanced .diff-tag { color: var(--ok); }
.diff-balanced .diff-tag { background: rgba(52, 211, 153, .14); }
.diff-short { border-color: rgba(248, 113, 113, .42); background: rgba(248, 113, 113, .07); }
.diff-short .diff-value, .diff-short .diff-tag { color: var(--danger); }
.diff-short .diff-tag { background: rgba(248, 113, 113, .14); }
.diff-over { border-color: rgba(251, 191, 36, .42); background: rgba(251, 191, 36, .07); }
.diff-over .diff-value, .diff-over .diff-tag { color: var(--warn); }
.diff-over .diff-tag { background: rgba(251, 191, 36, .14); }

.diff-bad { color: var(--danger); }
.diff-warn { color: var(--warn); }
.diff-ok { color: var(--ok); }

/* ---------- 统计 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 5px;
  box-shadow: var(--shadow);
}
.stat-label { font-size: 12px; color: var(--text-2); font-weight: 600; }
.stat-value { font-size: 22px; font-weight: 800; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 11.5px; color: var(--text-3); line-height: 1.5; }
.tone-bad .stat-value { color: var(--danger); }
.tone-warn .stat-value { color: var(--warn); }
.tone-ok .stat-value { color: var(--ok); }

/* ---------- 筛选 ---------- */
.filter-bar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.filter-bar .field { margin-bottom: 0; min-width: 132px; flex: 1 1 132px; }
.filter-bar .btn { height: 38px; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tabs-inline { margin-bottom: 14px; }
.tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-2); padding: 8px 14px; cursor: pointer;
  font-size: 13.5px; font-weight: 600; font-family: inherit; transition: .16s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.store-list { display: flex; gap: 10px; flex-wrap: wrap; }
.store-chip {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 15px;
  display: flex; flex-direction: column; gap: 3px; min-width: 140px;
}
.store-chip strong { font-size: 14px; }

/* ---------- 副食面额 ---------- */
.price-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.price-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 12px;
  font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--text);
}
.price-chip-editable { padding-right: 6px; }
.chip-del {
  border: 0; background: transparent; cursor: pointer; padding: 0 3px;
  color: var(--text-3); font-size: 15px; line-height: 1;
}
.chip-del:hover { color: var(--danger); }
.price-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.price-editor .price-chips { margin-bottom: 12px; }
.price-add { display: flex; gap: 8px; align-items: center; }
.price-add input { flex: 1; min-width: 0; }

/* 按门店分组的面额列表 */
.store-price-list { display: flex; flex-direction: column; gap: 12px; }
.store-price-row {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
}
.store-price-row .price-chips { margin-bottom: 0; }
.sp-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 10px;
}
.sp-title { display: flex; align-items: center; gap: 8px; }
.sp-title strong { font-size: 14px; }
.sp-actions { display: flex; gap: 8px; }

/* ---------- 密码行 ---------- */
.code-cell { display: flex; align-items: center; gap: 10px; }
.code-text {
  font-family: var(--mono); font-size: 14px; letter-spacing: 1.5px;
  color: var(--text-3);
}
.code-text.shown { color: var(--text); letter-spacing: 1px; }

/* ---------- 详情 ---------- */
.detail-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.detail-meta span {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 12px; font-size: 12.5px; color: var(--text);
}
.detail-meta b { color: var(--text-3); font-weight: 600; margin-right: 6px; }
.detail-settle { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 14px; }
.detail-settle > div {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 13px; font-size: 13px;
}
.detail-settle span { color: var(--text-2); }
.detail-settle b { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.detail-settle .hl { border-color: rgba(34, 211, 238, .35); }
.detail-settle .hl b { color: var(--primary); font-size: 15px; }
.detail-settle .diff-bad b { color: var(--danger); }
.detail-settle .diff-warn b { color: var(--warn); }
.detail-settle .diff-ok b { color: var(--ok); }
.detail-note { margin-top: 14px; font-size: 13px; color: var(--text-2); line-height: 1.9; }
.detail-note b { color: var(--text-3); font-weight: 600; }

/* ---------- 粘性操作条（避开左侧边栏；窄屏抽屉时占满） ---------- */
.sticky-actions {
  position: fixed; left: var(--side-w); right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 12px 18px;
  background: rgba(10, 14, 26, .9);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
}
.sticky-actions .btn { min-width: 116px; }

/* ---------- 登录页 ---------- */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 18px;
}
.auth-card {
  width: 100%; max-width: 430px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 18px; padding: 28px 26px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, .5);
}
.auth-card.center { text-align: center; max-width: 380px; }
.auth-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 22px; }
.auth-card.center .auth-brand { display: block; }
.auth-brand.block { display: block; text-align: center; }
.auth-brand.block .brand-mark { margin: 0 auto 13px; }
.auth-brand.block h1 { font-size: 19px; margin-bottom: 4px; }
.auth-brand h1 { font-size: 17px; }
.form { display: flex; flex-direction: column; }
.form-links { display: flex; justify-content: flex-end; margin-top: 10px; }

/* ---------- 密码输入 ---------- */
.pin-wrap { display: flex; gap: 8px; align-items: stretch; }
.pin-input {
  flex: 1; min-width: 0;
  font-family: var(--mono); font-size: 19px; letter-spacing: 3px;
  text-align: center; padding: 11px 12px;
}
.pin-eye {
  flex: none; width: 62px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 12.5px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: .16s;
}
.pin-eye:hover { color: var(--text); border-color: var(--primary); }
.divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0 16px; color: var(--text-3); font-size: 11.5px;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.confirm-text { font-size: 14px; line-height: 1.75; }

/* ---------- 弹窗 / 提示 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(4, 7, 14, .68); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 18px;
  opacity: 0; transition: opacity .18s;
}
.modal-mask.show { opacity: 1; }
.modal-box {
  width: 100%; max-width: 460px; max-height: 88vh;
  background: var(--card); border: 1px solid var(--border-2);
  border-radius: 16px; box-shadow: 0 26px 70px rgba(0, 0, 0, .6);
  display: flex; flex-direction: column;
  transform: translateY(10px) scale(.985); transition: transform .18s;
}
.modal-mask.show .modal-box { transform: none; }
.modal-wide { max-width: 780px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 18px; border-bottom: 1px solid var(--border);
}
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 9px;
  padding: 14px 18px; border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.loading-box {
  background: var(--card); border: 1px solid var(--border-2);
  border-radius: 13px; padding: 20px 26px;
  display: flex; align-items: center; gap: 12px; font-size: 14px;
}
.spinner {
  width: 17px; height: 17px; flex: none; border-radius: 50%;
  border: 2px solid rgba(34, 211, 238, .25);
  border-top-color: var(--primary);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.boot-loading {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
  color: var(--text-2); font-size: 14px;
}
.boot-error { gap: 18px; }
.boot-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

#toast-wrap { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; }
.toast {
  padding: 11px 20px; border-radius: 11px; font-size: 13.5px; font-weight: 600;
  background: var(--card-2); border: 1px solid var(--border-2);
  color: var(--text); box-shadow: 0 12px 34px rgba(0, 0, 0, .45);
  opacity: 0; transform: translateY(-12px); transition: .22s;
  max-width: 88vw; text-align: center;
}
.toast.show { opacity: 1; transform: none; }
.toast-success { border-color: rgba(52, 211, 153, .45); color: var(--ok); }
.toast-danger { border-color: rgba(248, 113, 113, .45); color: var(--danger); }
.toast-warn { border-color: rgba(251, 191, 36, .45); color: var(--warn); }
.toast-info { border-color: rgba(34, 211, 238, .45); color: var(--primary); }

/* ---------- 打印 ---------- */
#print-root { display: none; }

@media print {
  html { zoom: 1 !important; }
  html, body {
    background: #fff !important; color: #000 !important;
    background-image: none !important;
  }
  #app, .shell, .modal-mask, #toast-wrap { display: none !important; }
  #print-root { display: block !important; }
  .print-page { padding: 0; color: #000; font-size: 12px; }
  .print-page h1 { font-size: 17px; text-align: center; margin-bottom: 6px; color: #000; }
  .print-sub { text-align: center; font-size: 11px; color: #333; margin-bottom: 12px; }
  .print-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; font-size: 11px; }
  .print-table th, .print-table td { border: 1px solid #333; padding: 4px 6px; color: #000; }
  .print-table th { background: #eee; font-weight: 700; }
  .print-table .n { text-align: right; font-family: var(--mono); }
  .print-table .sum td { font-weight: 700; background: #f4f4f4; }
  .print-sign { margin-top: 22px; font-size: 12px; letter-spacing: .5px; }
}

/* ---------- 响应式（桌面优先，自大向小降级） ---------- */

/* 中屏：交班双栏改为上下堆叠（副食表不设内滚，整表随页面展开） */
@media (max-width: 1360px) {
  .shift-cols { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .shift-panel .snack-table { min-width: 560px; }
  .shift-panel .data-table { min-width: 560px; }
}

@media (max-width: 1180px) {
  .page { padding: 18px 18px 84px; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
}

/* 窄屏：侧边栏变抽屉，顶栏出现汉堡按钮（此时忽略「收起侧栏」偏好，抽屉内始终显示文字） */
@media (max-width: 960px) {
  .shell, html.side-collapsed .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; height: 100%;
    width: 272px; max-width: 86vw;
    z-index: 60; transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: 0 0 44px rgba(0, 0, 0, .5);
  }
  .sidebar.open { transform: none; }
  .side-backdrop.show {
    display: block; position: fixed; inset: 0; z-index: 55;
    background: rgba(4, 7, 14, .6); backdrop-filter: blur(2px);
  }
  .side-toggle { display: grid; }
  .side-collapse { display: none; }
  .sticky-actions { left: 0; }
  .page { padding: 16px 16px 84px; }
}

@media (max-width: 880px) {
  .result-grid, .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .detail-settle { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .page { padding: 14px 12px 96px; }
  .card { padding: 14px; border-radius: 12px; }
  .grid-2, .grid-3, .grid-3.tight, .grid-4 { grid-template-columns: 1fr; }
  .result-grid, .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 18px; }
  .diff-value { font-size: 25px; }
  .diff-desc { margin-left: 0; width: 100%; }
  .topbar { padding: 8px 12px; gap: 8px; }
  .top-left { gap: 8px; }
  .top-store { font-size: 12.5px; }
  .store-pick { padding: 2px 4px; }
  .store-pick-ico { display: none; }
  .store-pick select { min-width: 88px; max-width: 132px; font-size: 12.5px; padding-right: 18px; }
  .side-foot .user-meta { display: none; }
  .top-tools { gap: 6px; }
  .fs-val { display: none; }
  .modal-box { max-width: none; }
  .modal-wide { max-width: none; }
  .result-item strong { font-size: 17px; }
}
