:root {
  --bg: #eef1f6;
  --card: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e8ebf0;
  --brand: #2563eb;
  --income: #e11d48;   /* 收入 / 进账 */
  --expense: #0d9488;  /* 支出 / 出账 */
  --profit: #4338ca;   /* 净利润 */
  --shadow: 0 2px 10px rgba(15, 23, 42, .06);
  --radius: 18px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
/* 手机端：输入框≥16px 防止 iOS 聚焦自动放大；可点元素禁止误选文字 */
input, textarea, select { font-size: 16px; font-family: inherit; }
.entry-item, .role-tab, .seg button, .icon-btn, .primary, .x,
.entry-card, .item-cell, button { -webkit-user-select: none; user-select: none; }
button { cursor: pointer; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}
.hidden { display: none !important; }

/* ---------- 登录 ---------- */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.login-card { width: 100%; max-width: 360px; text-align: center; padding: 28px 22px; }
.login-logo { font-size: 46px; }
.login-card h1 { margin: 8px 0 2px; font-size: 22px; }
.login-card .sub { margin: 0 0 18px; color: var(--muted); font-size: 13px; }
.role-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.role-tab {
  flex: 1; padding: 10px; border: 1px solid var(--line); background: #f8fafc;
  border-radius: 12px; font-size: 15px; color: var(--muted); cursor: pointer;
}
.role-tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.login-card input {
  width: 100%; padding: 13px; margin-bottom: 12px; border: 1px solid var(--line);
  border-radius: 12px; font-size: 16px; background: #f8fafc;
}
.login-card .hint { color: var(--muted); font-size: 12px; margin: 10px 0 0; }

/* ---------- 通用按钮 ---------- */
.primary {
  width: 100%; padding: 13px; border: none; border-radius: 12px;
  background: var(--brand); color: #fff; font-size: 16px; font-weight: 600; cursor: pointer;
}
.primary:active { opacity: .85; }

/* 毛玻璃按钮（快速出售 / 卡片主操作 / 次要按钮 同源）。
   浅色模式：必须用实色蓝，白字才够对比度（半透明蓝在白卡片上实测仅 1.75:1，白字看不清）。
   深色模式：在 @media (prefers-color-scheme: dark) 里改回半透明玻璃 + 白字（那边对比度 10.4:1）。 */
.quick-sell-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: 14px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  color: #fff;
  background: var(--brand);
  border: 1px solid var(--brand);
  box-shadow: 0 6px 18px rgba(37, 99, 235, .28), inset 0 1px 0 rgba(255, 255, 255, .26);
  -webkit-user-select: none; user-select: none;
  transition: background .15s, transform .08s;
}
.quick-sell-btn:hover { background: #1d4ed8; }
.quick-sell-btn:active { transform: translateY(1px); }

/* 卡片内主操作入口（入库 / 新增客户等）统一毛玻璃协调感，与快速出售同源 */
.primary.sm {
  width: auto; display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: 14px;
  font-size: 14px; font-weight: 600; color: #fff;
  background: var(--brand);
  border: 1px solid var(--brand);
  box-shadow: 0 6px 18px rgba(37, 99, 235, .28), inset 0 1px 0 rgba(255, 255, 255, .26);
  transition: background .15s, transform .08s;
}
.primary.sm:hover { background: #1d4ed8; }
.primary.sm:active { transform: translateY(1px); }

/* 小型次要按钮（如设置保存）：浅色下同改实色蓝，深色下回玻璃 */
.sm {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 12px;
  font-size: 13px; font-weight: 600; cursor: pointer; color: #fff;
  background: var(--brand);
  border: 1px solid var(--brand);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .26);
  transition: background .15s;
}
.sm:hover { background: rgba(37, 99, 235, .45); }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-row + .chip-row { margin-top: 8px; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 999px; padding: 7px 16px; font-size: 13px; line-height: 1; cursor: pointer;
  -webkit-user-select: none; user-select: none;
}
.chip:active { opacity: .8; }
.chip.active { background: var(--accent, var(--brand)); color: #fff; }
button.x {
  border: none; background: transparent; font-size: 24px; line-height: 1; color: var(--muted);
  cursor: pointer; width: 32px; height: 32px;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 14px 12px; background: rgba(238,241,246,.9); backdrop-filter: blur(8px);
}
.topbar .brand { font-weight: 700; font-size: 15px; white-space: nowrap; flex-shrink: 0; }
.top-right { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.user-chip { display: flex; align-items: center; gap: 4px; font-size: 12px; }
.role-badge {
  font-style: normal; font-size: 11px; padding: 1px 5px; border-radius: 999px;
  background: #ede9fe; color: #6d28d9;
}
.role-badge.clerk { background: #dcfce7; color: #15803d; }
.icon-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 5px 8px; font-size: 12px; cursor: pointer;
}

/* ---------- 内容区 ---------- */
.content { padding: 0 12px calc(84px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.block-title { font-size: 15px; margin: 0 0 10px; font-weight: 700; }
.block-sub { font-size: 11px; color: var(--muted); font-weight: 400; margin-left: 4px; }
/* 销售的产品卡片：自定义日期选择器（玻璃风，与板块标题同行右对齐） */
.dd-date {
  float: right; margin: -3px 0 0; height: 30px; padding: 3px 8px;
  font-size: 13px; font-weight: 500; color: var(--ink);
  background: rgba(255, 255, 255, .5);
  border: 1px solid rgba(203, 213, 225, .9); border-radius: 10px;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.dd-date:focus { outline: none; border-color: rgba(37, 99, 235, .6); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }

/* ── 屏幕电池库存管理（玻璃风，与页面统一） ── */
.screen-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.screen-search {
  flex: 1; min-width: 160px; height: 34px; padding: 0 12px;
  font-size: 14px; color: var(--ink);
  background: rgba(255, 255, 255, .5);
  border: 1px solid rgba(203, 213, 225, .9); border-radius: 10px;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.screen-search:focus { outline: none; border-color: rgba(37, 99, 235, .6); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.screen-type-seg { display: flex; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.screen-type-seg button { padding: 5px 12px; font-size: 13px; font-weight: 600; cursor: pointer; border: none; background: transparent; color: var(--muted); transition: all .15s; }
.screen-type-seg button.active { background: var(--brand, #2563eb); color: #fff; }
.screen-actions { display: flex; gap: 8px; margin-bottom: 10px; }
.screen-warn-banner {
  background: linear-gradient(135deg, #fef3c7, #fde68a); border: 1px solid #f59e0b;
  border-radius: 10px; padding: 8px 12px; font-size: 13px; color: #92400e; margin-bottom: 10px;
}
.screen-warn-banner b { color: #b45309; }
.ss-warn-inline {
  background: linear-gradient(135deg, #fef3c7, #fde68a); border: 1px solid #f59e0b;
  border-radius: 10px; padding: 8px 12px; font-size: 13px; color: #92400e; margin-bottom: 12px;
}
.ss-warn-inline b { color: #b45309; }
.screen-stock-list { max-height: 420px; overflow-y: auto; }
.ss-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; margin-bottom: 6px;
  background: rgba(255, 255, 255, .4); border: 1px solid rgba(203, 213, 225, .6);
  border-radius: 12px; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: transform .08s, box-shadow .15s;
}
.ss-item:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.06); }
.ss-zero { border-color: #fca5a5; background: rgba(254, 202, 202, .35); }
.ss-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ss-brand { font-size: 11px; color: var(--muted); font-weight: 600; }
.ss-model { font-size: 15px; font-weight: 700; color: var(--ink); }
.ss-tags { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
.ss-price { font-size: 11px; font-weight: 600; color: #2563eb; background: rgba(37,99,235,.10); border-radius: 6px; padding: 1px 6px; align-self: flex-start; }
.screen-cost-hint { font-size: 11px; color: var(--accent, #2563eb); margin-top: 4px; }
.ss-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.ss-qty { font-size: 15px; font-weight: 700; color: #16a34a; }
.ss-zero-num { color: #dc2626; }
.ss-out-btn { padding: 4px 10px; font-size: 12px; }

/* 库存：按品牌分组（屏幕/电池分开）—— 横向芯片布局 */
.ss-type-block { margin-bottom: 14px; }
.ss-type-block:last-child { margin-bottom: 0; }
.ss-type-title { font-size: 14px; font-weight: 800; color: var(--ink); display: flex; align-items: baseline; gap: 8px; margin: 4px 0 8px; }
.ss-type-meta { font-size: 11px; font-weight: 600; color: var(--muted); }
.ss-brand-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.ss-brand-chip {
  flex: 0 0 calc(50% - 4px); min-width: 100px; max-width: calc(50% - 4px);
  border: 1px solid rgba(203, 213, 225, .6); border-radius: 10px;
  overflow: hidden; background: rgba(255, 255, 255, .35);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.ss-chip-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 6px; padding: 7px 10px; cursor: pointer; user-select: none;
}
.ss-chip-head:hover { background: rgba(37, 99, 235, .06); }
.ss-brand-name { font-size: 13px; font-weight: 700; color: var(--ink); }
.ss-brand-count {
  font-size: 12px; font-weight: 800; color: #2563eb;
  background: rgba(37, 99, 235, .12); border-radius: 999px;
  padding: 1px 8px; min-width: 20px; text-align: center;
}
.ss-chip-body { display: none; padding: 4px 10px 8px; border-top: 1px solid rgba(203, 213, 225, .6); }
.ss-brand-chip.open .ss-chip-body { display: block; }
.ss-model-row { display: flex; align-items: center; gap: 6px; padding: 6px 0; border-bottom: 1px dashed rgba(203, 213, 225, .7); }
.ss-model-row:last-child { border-bottom: none; }
.ss-model-name { flex: 1 1 auto; font-size: 13px; font-weight: 600; color: var(--ink); min-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-model-qty { font-size: 13px; font-weight: 800; color: #16a34a; flex-shrink: 0; }
.ss-empty { color: var(--muted); font-size: 13px; padding: 12px; }

/* 类型区块可折叠（默认折叠） */
.ss-type-title { cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; }
.ss-type-title:hover { opacity: .85; }
.ss-type-title .ss-type-caret { display: inline-block; margin-right: 4px; transition: transform .15s; font-size: 12px; }
.ss-type-block.collapsed .ss-type-body { display: none; }
.ss-type-block.collapsed .ss-type-caret { transform: rotate(-90deg); }
.ss-edit-btn {
  padding: 2px 8px; font-size: 11px; border-radius: 6px;
  background: rgba(245, 158, 11, .15); color: #d97706; border: 1px solid rgba(245, 158, 11, .3);
  cursor: pointer; flex-shrink: 0;
}
.ss-edit-btn:hover { background: rgba(245, 158, 11, .25); }
.ss-del-btn {
  padding: 2px 8px; font-size: 11px; border-radius: 6px;
  background: rgba(239, 68, 68, .12); color: #dc2626; border: 1px solid rgba(239, 68, 68, .3);
  cursor: pointer; flex-shrink: 0;
}
.ss-del-btn:hover { background: rgba(239, 68, 68, .22); }

/* 库存管理弹窗 */
.screen-manage-toolbar { padding: 10px 12px 0; }
.stock-manage-list { padding: 8px 12px 12px; max-height: 60vh; overflow-y: auto; }
.sm-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 9px 0; border-bottom: 1px dashed rgba(203, 213, 225, .7); }
.sm-row:last-child { border-bottom: none; }
.sm-info { display: flex; align-items: center; gap: 6px; flex: 1 1 auto; min-width: 0; flex-wrap: wrap; }
.sm-type { font-size: 14px; }
.sm-brand { font-size: 12px; font-weight: 700; color: var(--ink); }
.sm-model { font-size: 12px; color: var(--ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sm-qty { font-size: 12px; font-weight: 700; color: #16a34a; flex-shrink: 0; }
.sm-cost { font-size: 11px; color: var(--muted); flex-shrink: 0; }
.sm-actions { display: flex; gap: 6px; flex-shrink: 0; }
.sm-edit-form { display: flex; gap: 6px; width: 100%; align-items: center; padding-top: 6px; }
.sm-edit-form.hidden { display: none; }
.sm-edit-form input { flex: 1; min-width: 60px; padding: 5px 8px; border: 1px solid rgba(203,213,225,.8); border-radius: 7px; font-size: 12px; }
.sm-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; padding: 10px 14px; margin-bottom: 10px; background: linear-gradient(135deg, rgba(37,99,235,.10), rgba(56,189,248,.06)); border: 1px solid rgba(37,99,235,.35); border-radius: 10px; }
.sm-sum-item { font-size: 13px; color: var(--ink); display: flex; align-items: center; justify-content: space-between; padding: 4px 8px; background: rgba(255,255,255,.5); border-radius: 8px; white-space: nowrap; }
.sm-sum-item b { font-size: 15px; color: #1d4ed8; }
.sm-sum-grand { grid-column: 1 / -1; justify-content: center; background: linear-gradient(135deg, rgba(180,83,9,.08), rgba(217,119,6,.06)); border-top: 1px dashed rgba(180,83,9,.3); padding-top: 8px; margin-top: 2px; }
.sm-sum-grand b { color: #b45309; font-size: 17px; }
.sm-edit-form .sm { flex: 0 0 auto; }

/* 搜索结果行 */
.ss-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border-bottom: 1px solid rgba(203,213,225,.4); gap: 8px; }
.ss-item.ss-zero { opacity: .55; }
.ss-main { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 3px 6px; }
.ss-brand { font-size: 11px; color: #6b7280; background: rgba(203,213,225,.35); padding: 1px 5px; border-radius: 4px; white-space: nowrap; }
.ss-model { font-size: 13px; font-weight: 600; color: var(--ink); }
.ss-model-line { display: flex; align-items: center; gap: 4px; flex-wrap: nowrap; }
.ss-tags { font-size: 11px; color: #9ca3af; white-space: normal; word-break: break-all; line-height: 1.3; }
.ss-alias { font-size: 10px; color: #f59e0b; background: rgba(245,158,11,.1); padding: 0 4px; border-radius: 3px; margin-left: 2px; }
.ss-note { font-size: 11px; color: #6b7280; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; display: block; margin-top: 1px; }
.ss-prices { display: flex; gap: 6px; width: 100%; margin-top: 2px; }
.ss-price, .ss-cost { font-size: 12px; padding: 1px 6px; border-radius: 4px; white-space: nowrap; }
.ss-price { color: #2563eb; background: rgba(37,99,235,.08); }
.ss-cost { color: #059669; background: rgba(5,150,105,.08); }
.ss-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.ss-qty { font-size: 13px; font-weight: 600; color: var(--ink); }
.ss-qty.ss-zero-num { color: #ef4444; font-size: 12px; }

/* 板块折叠：二手机库存及往下，点主标题展开/收起 */
.card.collapsible > h2.block-title { cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; }
.card.collapsible > h2.block-title:hover { color: var(--accent, #2563eb); }
.card.collapsed > *:not(.block-title) { display: none !important; }
.sec-caret { margin-left: 8px; font-size: 12px; color: var(--muted); display: inline-block; transform: translateY(-1px); }

/* ---------- 1. 总览 ---------- */
.overview { background: linear-gradient(135deg, #1e3a8a, #2563eb); color: #fff; }
.overview .ov-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.overview .ov-title { font-size: 16px; font-weight: 700; }
.overview.ov-collapsible .ov-head { cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; }
.overview.ov-collapsible .ov-head:hover { filter: brightness(1.1); }
.overview.ov-collapsed .ov-body { display: none; }
.seg { display: flex; background: rgba(255,255,255,.15); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button {
  border: none; background: transparent; color: #dbeafe; font-size: 12px;
  padding: 5px 9px; border-radius: 8px; cursor: pointer;
}
.seg button.active { background: #fff; color: var(--brand); font-weight: 600; }
.ov-scope-input { margin: 8px 0; }
.ov-scope-input input {
  padding: 9px; border-radius: 10px; font-size: 16px; color: var(--ink);
  border: 1px solid rgba(203, 213, 225, .9);
  background: rgba(255, 255, 255, .5);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.ov-scope-input input:focus { outline: none; border-color: rgba(37, 99, 235, .6); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.ov-big { display: flex; gap: 8px; }
.ov-big .b {
  flex: 1; background: rgba(255,255,255,.12); border-radius: 14px; padding: 12px 8px; text-align: center;
}
.ov-big .b .lab { font-size: 12px; opacity: .85; }
.ov-big .b .num { font-size: 20px; font-weight: 800; margin-top: 4px; }
.ov-big .b.inc .num { color: #fecaca; }
.ov-big .b.exp .num { color: #99f6e4; }
.ov-big .b.pro .num { color: #fff; }
.ov-mini { display: flex; gap: 8px; margin-top: 10px; }
.ov-mini .mi { flex: 1; font-size: 11px; opacity: .9; line-height: 1.5; }
.ov-mini .mi b { font-size: 13px; }

/* ---------- 二手机库存 ---------- */
.pos { color: var(--profit); }
.neg { color: var(--expense); }
.warn { color: #d97706; }
.stock-summary { display: flex; gap: 8px; margin-bottom: 12px; }
.stock-summary .ss-cell { flex: 1; background: #f1f5f9; border-radius: 12px; padding: 10px 6px; text-align: center; }
.stock-summary .ss-cell .lab { font-size: 11px; color: var(--muted); }
.stock-summary .ss-cell b { display: block; font-size: 17px; font-weight: 800; margin-top: 2px; color: var(--ink); }
.stock-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.stock-actions .sm { padding: 9px 14px; font-size: 14px; border-radius: 12px; }
.stock-actions.np-set-row { margin-top: -6px; }
.stock-list { display: flex; flex-direction: column; gap: 8px; }
.np-collapsed-hint {
  font-size: 12px; color: var(--muted); text-align: center;
  padding: 10px 0; margin: 4px 0;
  border: 1px dashed var(--line); border-radius: 10px; background: #fafafa;
}
.stk-item { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: #f8fafc; border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.stk-item.warn { border-color: #fcd34d; background: #fffbeb; }
.stk-item.sold { opacity: .82; }
.stk-main { flex: 1 1 100%; min-width: 0; }
.stk-name { font-size: 13px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; }
.stk-sub { font-size: 10.5px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.stk-sub b { font-weight: 700; }
.stk-sub b.age { font-weight: 800; color: #b45309; background: #fef3c7; border-radius: 6px; padding: 0 5px; margin: 0 1px; }
.stk-sub b.age.warn { color: #fff; background: #d97706; }
.stk-sub b.warn { color: #d97706; }
.stk-sub b.pos { color: var(--profit); }
.stk-sub b.neg { color: var(--expense); }

.stk-imei-inline { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; letter-spacing: .3px; }

/* ---------- 新机库存（独立模块，风格同二手机库存） ---------- */
.np-reminders { margin-bottom: 10px; }
.np-remind { border: 1px solid #fca5a5; background: #fef2f2; border-radius: 12px; padding: 8px 10px; font-size: 12px; color: #b91c1c; }
.np-remind b { color: #b91c1c; }
.np-remind-item { display: inline-block; margin: 4px 4px 0 0; padding: 2px 8px; border-radius: 999px; background: #fee2e2; color: #991b1b; font-size: 11px; font-weight: 600; }
/* 新机库龄预警：红色高亮（区别于二手机黄色 .stk-item.warn） */
.stk-item.np-warn { border-color: #fca5a5; background: #fef2f2; }
.stk-item.np-warn .stk-name { color: #b91c1c; }
/* 新机品牌快捷筛选 */
.np-brands { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.np-brand { padding: 5px 13px; border: 1px solid var(--line, #e5e7eb); background: #fff; color: #374151; border-radius: 999px; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: all .12s; }
.np-brand:active { transform: scale(.96); }
.np-brand.active { background: var(--brand, #ff5a1f); border-color: var(--brand, #ff5a1f); color: #fff; box-shadow: 0 2px 8px rgba(255,90,31,.28); }
/* 新机利润报表 - 各品牌销量数据条 */
.np-bars-title { font-size: 12px; color: var(--muted); margin: 12px 0 2px; }
.np-brand-bars .sb-bar-label { width: 56px; }
/* 采购渠道标签 */
.np-channel { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; line-height: 1.5; }
.np-ch-联通 { background: #e0f2fe; color: #0369a1; }
.np-ch-移动 { background: #dcfce7; color: #15803d; }
.np-ch-第三方 { background: #f1f5f9; color: #475569; }
/* 库龄预警默认设置行 */
.np-set { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); margin-left: 6px; }
.np-set input[type="number"] { width: 58px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 9px; font-size: 13px; text-align: center; }
.np-set .sm { padding: 6px 10px; font-size: 12px; border-radius: 9px; }
.np-seg button.active { background: var(--brand); color: #fff; }
/* IMEI 扫码行 */
.imei-scan-row { display: flex; gap: 8px; align-items: stretch; }
.imei-scan-row input { flex: 1 1 auto; }
.scan-btn { flex: 0 0 auto; padding: 0 14px; border: 1px solid var(--brand); background: var(--brand); color: #fff; border-radius: 11px; font-size: 13px; font-weight: 600; cursor: pointer; }
.scan-btn:active { transform: scale(.97); }
.imei-hint { font-size: 11px; color: var(--muted); margin-top: 4px; }
.imei-hint:empty { margin-top: 0; }
/* 新机批量录入：已加入的 IMEI 列表 */
.add-btn { flex: 0 0 auto; padding: 0 14px; border: 1px solid var(--line); background: #fff; color: var(--brand); border-radius: 11px; font-size: 13px; font-weight: 700; cursor: pointer; }
.add-btn:active { transform: scale(.97); }
.imei-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.imei-list:empty { margin-top: 0; }
.imei-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 6px 4px 10px; border-radius: 999px;
  background: rgba(37,99,235,.10); border: 1px solid rgba(37,99,235,.30);
  font-size: 12px; color: #1d4ed8; font-variant-numeric: tabular-nums;
}
.imei-x { border: none; background: transparent; color: #1d4ed8; font-size: 16px; line-height: 1; cursor: pointer; padding: 0 2px; }
.imei-x:active { opacity: .6; }

/* ---------- 扫码弹窗（摄像头实时识别，需 HTTPS） ---------- */
.scan-modal .modal-box { left: 50%; top: 50%; bottom: auto; transform: translate(-50%, -50%); max-width: 420px; border-radius: 18px; animation: up .18s ease; }
.scan-video { width: 100%; min-height: 220px; background: #0f172a; border-radius: 12px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.scan-video video { width: 100% !important; height: auto !important; border-radius: 12px; }
.scan-status { font-size: 12px; color: var(--muted); margin-top: 10px; min-height: 18px; }
.scan-tip { font-size: 11px; color: var(--muted); margin: 8px 0 0; line-height: 1.5; }
@media (max-width: 480px) {
  .scan-modal .modal-box { width: 92%; }
  .np-set { margin-left: 0; margin-top: 6px; }
  .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- 客户管理 ---------- */
.cust-reminders { margin-bottom: 10px; }
.rem-box { border: 1px solid #fcd34d; background: #fffbeb; border-radius: 12px; padding: 8px 10px; }
.rem-head { font-size: 13px; font-weight: 700; color: #b45309; margin-bottom: 6px; }
/* 首页顶部常驻：宽带合约到期横幅 */
.rem-banner { border: 1px solid #fdb924; background: linear-gradient(95deg,#fff7ed,#fffbeb); border-radius: 14px; padding: 10px 12px; margin-bottom: 12px; box-shadow: 0 2px 10px rgba(217,119,6,.12); }
.rem-banner-head { font-size: 14px; font-weight: 800; color: #b45309; margin-bottom: 8px; }
.rem-banner-items { display: flex; flex-wrap: wrap; gap: 8px; }
.rem-banner-item { font-size: 12.5px; padding: 6px 10px; border-radius: 999px; background: #fef3c7; color: #92400e; border: 1px solid #fde68a; cursor: pointer; }
.rem-banner-item.over { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.rem-banner-item:active { transform: scale(.97); }
.rem-item { padding: 6px 4px; border-top: 1px dashed #fde68a; cursor: pointer; }
.rem-item:first-of-type { border-top: none; }
.rem-cust { font-size: 13px; color: var(--ink); }
.rem-line { font-size: 11px; color: var(--muted); margin-top: 2px; }
.rem-warn { font-weight: 700; color: #d97706; }
.rem-warn.over { color: #dc2626; }
.cust-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.cust-toolbar input[type="search"] { flex: 1 1 auto; width: auto; }
.cust-list { display: flex; flex-direction: column; gap: 10px; }
.cust-card { background: #f8fafc; border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.cust-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.cust-main { min-width: 0; flex: 1 1 100%; cursor: pointer; }
.cust-name { font-size: 14px; font-weight: 700; color: var(--ink); }
.cust-name .cust-phone { font-size: 11px; font-weight: 500; color: var(--muted); margin-left: 6px; }
.cust-sub { font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.cust-note {
  margin-top: 8px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.55;
  color: var(--ink);
  white-space: normal;
  word-break: break-word;
}
/* 卡片头分组芯片：折叠状态下也能一眼看清该客户属于哪些业务分组 */
.grp-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.grp-chip { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px; color: #fff; white-space: nowrap; }
.grp-sim { background: #0d9488; } .grp-used { background: #ea580c; }
.grp-new { background: #2563eb; } .grp-other { background: #64748b; }
.grp-bb { background: #f59e0b; }
.cust-act { display: flex; gap: 6px; flex-shrink: 0; flex: 1 1 100%; justify-content: flex-end; }
.cust-act button, .cust-act .cadd { font-size: 11px; padding: 5px 9px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; }
.cust-act .cadd { background: var(--accent, #3388ee); color: #fff; border-color: transparent; }
.cust-biz { margin-top: 8px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.cust-biz summary { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: #2563eb; cursor: pointer; padding: 8px 10px; }
.cust-biz summary::-webkit-details-marker { display: none; }
.cust-biz summary:hover { background: #f1f5f9; }
.cust-biz .cbi-arrow { transition: transform .2s ease; font-size: 11px; }
.cust-biz[open] .cbi-arrow { transform: rotate(180deg); }
.cust-biz .biz-type-block, .cust-biz .stk-empty { padding: 0 10px 10px; }
.cust-biz .cust-biz-photos { padding: 8px 10px 4px; border-bottom: 1px dashed var(--line); margin-bottom: 8px; }
.cust-biz .cust-biz-photos .cbp-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.cust-list-wrap { margin-top: 8px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.cust-list-wrap summary { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: #2563eb; cursor: pointer; padding: 8px 12px; }
.cust-list-wrap summary::-webkit-details-marker { display: none; }
.cust-list-wrap summary:hover { background: #f1f5f9; }
.cust-list-wrap .clw-arrow { transition: transform .2s ease; font-size: 11px; }
.cust-list-wrap[open] .clw-arrow { transform: rotate(180deg); }
.cust-biz-filter { display: flex; gap: 6px; padding: 0 10px 8px; flex-wrap: wrap; }
.cbf-btn { font-size: 12px; padding: 3px 11px; border: 1px solid var(--line); background: #fff; border-radius: 999px; color: var(--muted); cursor: pointer; line-height: 1.6; }
.cbf-btn:hover { border-color: #2563eb; color: #2563eb; }
.cbf-btn.active { background: #2563eb; color: #fff; border-color: #2563eb; }
.biz-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.biz-row { display: flex; gap: 8px; align-items: flex-start; padding: 6px 8px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.biz-tag { flex-shrink: 0; font-size: 10.5px; font-weight: 700; padding: 3px 7px; border-radius: 7px; color: #fff; white-space: nowrap; }
.biz-sell { background: #3388ee; } .biz-buy { background: #0ea5e9; } .biz-new { background: #7c3aed; }
.biz-sim { background: #0d9488; } .biz-bb { background: #d97706; } .biz-other { background: #64748b; }
.biz-body { min-width: 0; flex: 1 1 auto; }
.biz-meta { font-size: 11px; color: var(--muted); }
.biz-detail { font-size: 12.5px; color: var(--ink); margin-top: 2px; word-break: break-word; }
.biz-bb { font-size: 11px; color: #fff; margin-top: 3px; background: #d97706; border-radius: 6px; padding: 4px 8px; }
.biz-bb b { color: #fff; font-weight: 700; }
.biz-group-h { font-size: 11px; font-weight: 700; color: var(--muted); margin: 10px 0 5px; padding: 3px 0 3px 8px; border-left: 3px solid var(--accent, #3388ee); background: rgba(51,136,238,.06); border-radius: 0 6px 6px 0; }
.biz-group-h.grp-sim { color: #0d9488; border-left-color: #0d9488; background: rgba(13,148,136,.08); }
.biz-group-h.grp-used { color: #ea580c; border-left-color: #ea580c; background: rgba(234,88,12,.08); }
.biz-group-h.grp-new { color: #2563eb; border-left-color: #2563eb; background: rgba(37,99,235,.08); }
.biz-group-h.grp-other { color: #64748b; border-left-color: #64748b; background: rgba(100,116,139,.08); }
.biz-group-h.grp-bb { color: #f59e0b; border-left-color: #f59e0b; background: rgba(245,158,11,.1); }
.cust-toolbar select.cust-group { font-size: 12px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); flex: 0 0 auto; max-width: 140px; }
.cust-toolbar #custAddBtn { flex: 0 0 auto; }
.stk-act { flex: 1 1 100%; display: flex; gap: 6px; justify-content: flex-end; flex-shrink: 0; }
.stk-act .sell { border: none; background: var(--profit); color: #fff; border-radius: 10px; padding: 9px 14px; font-size: 13px; font-weight: 700; }
.stk-act .del { border: 1px solid #fecaca; background: #fff; color: var(--income); border-radius: 10px; padding: 9px 10px; font-size: 12px; }
.stk-act .edit { border: 1px solid var(--line); background: #fff; color: var(--brand); border-radius: 10px; padding: 9px 12px; font-size: 12px; }
.stk-empty { font-size: 12px; color: var(--muted); text-align: center; padding: 8px 0; }

/* 二手机库存工具条：搜索 + 状态 + 排序 */
.stock-toolbar { margin-bottom: 10px; }
.stock-toolbar input[type="search"] {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px;
  font-size: 15px; background: #f8fafc; -webkit-appearance: none; margin-bottom: 8px;
}
.stock-toolbar input[type="search"]:focus { outline: none; border-color: var(--brand); }
.stock-toolbar-row { display: flex; gap: 8px; align-items: center; }
.stock-seg { flex: 1; display: flex; background: #eef2f7; border-radius: 10px; padding: 3px; gap: 3px; }
.stock-seg button {
  flex: 1; border: none; background: transparent; color: var(--muted); font-size: 13px;
  padding: 7px 0; border-radius: 8px; cursor: pointer;
}
.stock-seg button.active { background: #fff; color: var(--brand); font-weight: 700; box-shadow: 0 1px 3px rgba(15,23,42,.08); }
.stock-sort {
  border: 1px solid var(--line); background: #f8fafc; border-radius: 10px; padding: 8px 10px;
  font-size: 13px; color: var(--ink); cursor: pointer; -webkit-appearance: none;
}
.stk-imei {
  font-size: 10px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; letter-spacing: .3px;
}
.form-field select {
  width: 100%; padding: 13px; border: 1px solid var(--line); border-radius: 12px;
  font-size: 16px; background: #f8fafc; -webkit-appearance: none;
}

/* 编辑弹窗内照片管理（补拍/删除） */
.photo-edit { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.photo-edit .pp-edit { position: relative; width: 64px; height: 64px; }
.photo-edit .pp-edit img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.photo-edit .pp-x { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: none; background: var(--income); color: #fff; font-size: 14px; line-height: 1; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.photo-edit .pp-empty { font-size: 11px; color: var(--muted); }
.photo-edit .pp-edit.confirming img { opacity: .35; filter: grayscale(1); }
.photo-edit .pp-confirm { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; background: rgba(15,23,42,.72); border-radius: 8px; padding: 2px; }
.photo-edit .pp-confirm-txt { color: #fff; font-size: 10px; line-height: 1.1; text-align: center; }
.photo-edit .pp-confirm button { border: none; border-radius: 6px; font-size: 10px; padding: 3px 6px; line-height: 1; cursor: pointer; }
.photo-edit .pp-cancel { background: #e2e8f0; color: #334155; }
.photo-edit .pp-del { background: var(--income); color: #fff; }

/* 二手机实物照片：上传预览 + 列表缩略图 */
.photo-prev { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.photo-prev .pp-item { font-size: 11px; color: var(--muted); background: #eef2f7; border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-prev .pp-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: #fff; }
.cust-photos { margin-top: 8px; }
.stk-photos { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.stk-photo { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; background: #fff; }
.stk-photo:hover { border-color: var(--profit); box-shadow: 0 0 0 2px rgba(16,185,129,.25); }
.readonly-line .stk-photos { margin-top: 8px; }
.stock-sold { margin-top: 12px; }

/* 实物照片灯箱（点击缩略图放大预览） */
.photo-lightbox { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; }
.photo-lightbox .lb-mask { position: absolute; inset: 0; background: rgba(8,12,20,.92); }
.photo-lightbox .lb-img { position: relative; max-width: 92vw; max-height: 88vh; object-fit: contain; border-radius: 12px; box-shadow: 0 8px 40px rgba(0,0,0,.5); background: #fff; }
.photo-lightbox .lb-close { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 14px; z-index: 2; width: 40px; height: 40px; font-size: 30px; color: #fff; background: rgba(255,255,255,.12); border-radius: 50%; }
.photo-lightbox .lb-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 46px; height: 46px; border-radius: 50%; border: none; background: rgba(255,255,255,.14); color: #fff; font-size: 28px; line-height: 1; }
.photo-lightbox .lb-prev { left: 12px; }
.photo-lightbox .lb-next { right: 12px; }
.photo-lightbox .lb-count { position: absolute; bottom: calc(16px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 2; color: #fff; font-size: 13px; background: rgba(0,0,0,.4); padding: 4px 12px; border-radius: 999px; }
.stock-sold summary { font-size: 13px; color: var(--muted); cursor: pointer; padding: 6px 0; }

/* 二手机 KPI 条 + 利润报表 */
.kpi-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.kpi-strip .kpi-cell { min-width: 0; overflow: hidden; background: #f1f5f9; border-radius: 12px; padding: 9px 4px; text-align: center; }
.kpi-strip .kpi-cell .lab { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-strip .kpi-cell b { display: block; font-size: 14px; font-weight: 800; margin-top: 3px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-strip .kpi-cell b.pos { color: var(--profit); }
.kpi-strip .kpi-cell b.neg { color: var(--expense); }
.rep-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; background: #f8fafc; border: 1px solid var(--line); border-radius: 14px; padding: 10px 6px; text-align: center; }
.rep-summary > div { display: flex; flex-direction: column; gap: 3px; }
.rep-summary span { font-size: 11px; color: var(--muted); }
.rep-summary b { font-size: 14px; font-weight: 800; color: var(--ink); }
.rep-summary b.pos { color: var(--profit); }
.rep-summary b.neg { color: var(--expense); }
.rep-details { margin-top: 10px; }
.rep-date-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 10px; }
.rep-date-filter .rdf-lab { font-size: 12px; color: #0f172a; font-weight: 600; }
.rep-date-filter .rdf-sep { font-size: 12px; color: #0f172a; font-weight: 600; }
.rep-date-filter input[type="date"] { background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 6px 8px; font-size: 13px; color: #2563eb; font-weight: 600; min-width: 132px; }
.stock-range-sum { margin: 0 0 12px; }
.stock-range-sum .range-sum { background: #eef6ff; border-color: #bcd8ff; }
.stock-range-sum .range-sum span { font-size: 11px; color: #1e40af; font-weight: 600; }
.stock-range-sum .range-sum b { font-size: 15px; font-weight: 800; color: #0f172a; }
.stock-range-sum .range-title { grid-column: 1 / -1; font-size: 12px; font-weight: 700; color: #2563eb; text-align: left; margin-bottom: 2px; }
.rep-details > summary { font-size: 13px; color: var(--brand); cursor: pointer; padding: 6px 0; }
.rep-block { margin-top: 8px; }
.rep-h { font-size: 12px; font-weight: 700; color: var(--ink); margin: 6px 0 4px; }
.rep-tbl { width: 100%; border-collapse: collapse; font-size: 11.5px; display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.rep-tbl th, .rep-tbl td { padding: 6px 6px; text-align: left; border-bottom: 1px solid var(--line); line-height: 1.4; }
.rep-tbl th { color: var(--muted); font-weight: 600; background: var(--card); }
.rep-tbl td { color: var(--ink); white-space: nowrap; }
.rep-tbl td:first-child { white-space: normal; min-width: 96px; }
.rep-tbl td b.pos, .rep-tbl td.pos { color: var(--profit); font-weight: 700; }
.rep-tbl td b.neg, .rep-tbl td.neg { color: var(--expense); font-weight: 700; }
.rep-imei { font-size: 9px; color: var(--muted); font-family: ui-monospace, Menlo, monospace; }
.rep-tbl tbody tr:nth-child(even) { background: rgba(241,245,249,.5); }
.req { color: var(--income); }
.profit-preview { background: #eef2ff; border-radius: 10px; padding: 10px 12px; font-size: 13px; color: var(--muted); margin: 4px 0 12px; }
.profit-preview b { font-size: 16px; font-weight: 800; margin-left: 4px; }
.profit-preview b.pos { color: var(--profit); }
.profit-preview b.neg { color: var(--expense); }

/* ---------- 2. 录入横向滑动 ---------- */
.entry-scroll { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.entry-card {
  flex: 0 0 46%; min-width: 150px; border-radius: 16px; padding: 12px;
  background: #f8fafc; border: 1px solid var(--line);
}
.entry-card.exp { background: #f0fdfa; border-color: #99f6e4; }
.entry-card .ec-title { font-weight: 700; font-size: 14px; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.entry-card .ec-tag { font-size: 10px; padding: 1px 6px; border-radius: 999px; background: #fee2e2; color: var(--income); }
.entry-card.exp .ec-tag { background: #ccfbf1; color: var(--expense); }
.entry-item {
  display: flex; align-items: center; width: 100%; text-align: left;
  border: 1px solid var(--line); background: #fff;
  border-radius: 12px; padding: 12px 10px; margin-bottom: 8px;
  font-size: 15px; font-weight: 700; letter-spacing: .3px;
  min-height: 46px; color: #0f172a; cursor: pointer;
  /* 立体按键感：左色带（板块色）+ 顶部内高光（亮起）+ 双层外投影（悬浮）。 */
  box-shadow:
    inset 4px 0 0 var(--board-accent, rgba(15, 23, 42, .18)),
    inset 0 1px 0 rgba(255, 255, 255, .85),
    0 8px 16px rgba(15, 23, 42, .12),
    0 2px 4px rgba(15, 23, 42, .06);
  transition: transform .14s ease, box-shadow .18s ease;
}
.entry-item:hover {
  transform: translateY(-1px);
  box-shadow:
    inset 4px 0 0 var(--board-accent, rgba(15, 23, 42, .22)),
    inset 0 1px 0 rgba(255, 255, 255, .95),
    0 12px 22px rgba(15, 23, 42, .16),
    0 3px 6px rgba(15, 23, 42, .08);
}
.entry-item:active {
  transform: translateY(1px);
  box-shadow:
    inset 4px 0 0 var(--board-accent, rgba(15, 23, 42, .28)),
    0 1px 2px rgba(15, 23, 42, .10);
  background: #f8fafc;
}

/* 板块定位左侧色带颜色（与卡片渐变同源）。新增 card-type-* 时，只要再加一条 .entry-card.card-type-X { --board-accent: <色> } 即可。 */
.entry-card.card-type-accessory   { --board-accent: #22bb99; }
.entry-card.card-type-repair      { --board-accent: #ff8833; }
.entry-card.card-type-sim         { --board-accent: #3388ee; }
.entry-card.card-type-watch       { --board-accent: #9955dd; }
.entry-card.card-type-phone       { --board-accent: #33aa55; }
.entry-card.card-type-phone-ov    { --board-accent: #0ea5a4; }
.entry-card.card-type-recycle     { --board-accent: #ee4444; }
.entry-card.card-type-family      { --board-accent: #e05a8a; }
.entry-card.card-type-govsub      { --board-accent: #e0a800; }
.entry-card.card-type-commission  { --board-accent: #0891b2; }
.entry-collapse {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; text-align: left; border: 1px dashed var(--line); background: rgba(8,145,178,.06);
  border-radius: 10px; padding: 9px 10px; margin: 4px 0 6px; font-size: 13px; font-weight: 700;
  color: #0e7490; cursor: pointer;
}
.entry-collapse:active { background: rgba(8,145,178,.12); }
.entry-collapse .ec-arrow { font-size: 12px; transition: transform .15s; }
.entry-collapse-body { margin-bottom: 4px; }

/* ---------- 3. 二级网格 ---------- */
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.item-cell { background: #f8fafc; border: 1px solid var(--line); border-radius: 14px; padding: 9px 6px; text-align: center; }
.item-cell .ic-name { font-size: 12px; font-weight: 600; margin-bottom: 6px; min-height: 28px; display: flex; align-items: center; justify-content: center; }
.item-cell .ic-row { font-size: 10px; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap; margin: 2px 0; }
.item-cell .ic-row b { font-size: 13px; color: var(--income); font-weight: 700; }
.item-cell.exp .ic-row b { color: var(--expense); }
.item-cell .ic-pro { font-size: 10px; font-weight: 600; white-space: nowrap; }
.item-cell .ic-pro.pos { color: var(--profit); }
.item-cell .ic-pro.neg { color: var(--expense); }
.item-cell.second { background: #fef9f3; border-color: #fde2c4; }
.item-cell .ic-badge { font-size: 9px; color: #b45309; background: #fef3c7; border-radius: 6px; padding: 1px 4px; margin-left: 4px; font-weight: 600; }
.item-cell .ic-sale { font-size: 10px; font-weight: 600; color: var(--income); white-space: nowrap; }

/* ---------- 4. 板块汇总 ---------- */
.board-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.board-cell { background: #f8fafc; border: 1px solid var(--line); border-radius: 14px; padding: 10px 8px; }
.board-cell .bc-name { font-size: 13px; font-weight: 700; margin-bottom: 7px; text-align: center; }
.board-cell .bc-line { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin: 2px 0; }
.board-cell .bc-line b { color: var(--ink); font-size: 12px; }
.board-cell .bc-profit { margin-top: 5px; border-top: 1px dashed var(--line); padding-top: 5px; }
.board-cell .bc-profit b { color: var(--profit); }

/* ===== 配件/维修 销售看板 ===== */
.sales-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 12px; }
/* 销售看板品牌筛选条（仅配件板显示）：明确选中态（--accent 未定义，避免白字白底） */
.sales-brand-seg { margin: 0 0 10px; }
.sales-brand-seg .chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.sales-seg { margin: 0; }
.sb-summary { display: flex; flex-wrap: wrap; gap: 14px; align-items: baseline; background: #1e293b; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; color: #e2e8f0; }
.sb-summary b { font-size: 15px; color: #fff; }
.sb-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 12px; }
.sb-table th, .sb-table td { padding: 7px 8px; text-align: left; border-bottom: 1px solid var(--line); }
.sb-table th { color: var(--muted); font-weight: 600; font-size: 12px; }
.sb-table td:not(:first-child), .sb-table th:not(:first-child) { text-align: right; }
.sb-table .sb-total { font-weight: 700; background: #1e293b; color: #e2e8f0; }
.sb-table .sb-total td { border-top: 2px solid var(--line); color: #fff; }
.sb-table-sm { margin-bottom: 0; }
.sb-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 4px; }
.sb-type-block { background: var(--card2, #f8fafc); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.sb-type-head { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
/* 高亮行：仅类型名列红底白字突出，保留利润列原色 */
.sb-table .sb-top td:first-child { background: #dc2626; color: #fff; font-weight: 700; }
/* 组合类型（含叠加词：内存卡/充电宝/套装 等）同样红底白字突出 */
.sb-table .sb-combo td:first-child { background: #dc2626; color: #fff; font-weight: 700; }
/* 手风琴分栏行 */
.sb-cat-row.sb-clickable { cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; }
.sb-cat-row.sb-clickable:hover { background: var(--card2, #f8fafc); }
.sb-cat-row td:first-child { position: relative; }
.sb-arrow { font-size: 11px; margin-left: 6px; color: var(--muted); display: inline-block; }
/* 类型明细折叠 */
.sb-type-detail { display: none; }
.sb-type-detail.sb-open { display: table-row; }
.sb-type-detail > td { padding: 0 !important; border-bottom: 1px solid var(--line) !important; background: var(--card2, #f8fafc); border-radius: 0 0 10px 10px; }
.sb-type-detail .sb-table-sm { margin: 8px 10px; width: calc(100% - 20px); box-shadow: none; }
/* 各品类销量数据条（颜色随销量由绿→红渐变） */
.sb-bars { margin: 4px 0 14px; font-size: 12px; }
.sb-bar-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.sb-bar-label { width: 96px; flex: 0 0 auto; text-align: right; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-bar-track { flex: 1; min-width: 0; background: var(--line); border-radius: 6px; height: 16px; overflow: hidden; }
.sb-bar-fill { display: block; height: 100%; border-radius: 6px; transition: width .45s ease; }
.sb-bar-val { width: 40px; flex: 0 0 auto; text-align: left; color: var(--muted); font-variant-numeric: tabular-nums; }
/* 组合单品数据条：与表格组合类型同款红底高亮 */
.sb-bar-label { width: 120px; }                 /* 放宽以容纳单品名（如 普通TP 套装） */
.sb-bar-combo .sb-bar-label { color: #dc2626; font-weight: 700; }
.sb-bar-combo .sb-bar-track { box-shadow: inset 3px 0 0 #dc2626; }

/* 维修板：故障部件分组折叠 */
.sb-part-group { cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; }
.sb-part-group.sb-part-open .sb-part-arrow { transform: rotate(0); }
.sb-part-label { display: inline-flex; align-items: center; gap: 4px; width: 90px; font-weight: 600; color: var(--ink); }
.sb-part-arrow { transition: transform .2s ease; display: inline-block; font-size: 10px; color: var(--muted); }
.sb-part-detail { display: none; padding-left: 20px; }
.sb-part-detail.sb-part-open { display: block; }
.sb-part-item { margin: 4px 0; }
.sb-part-item-label { width: 140px; font-size: 11px; color: var(--muted); }

/* 客户业务统计板块（运营商分布） */
.cust-stats { margin: 0 0 12px; }
.cs-card { background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.cs-head { font-size: 13px; font-weight: 700; color: var(--ink); margin-bottom: 8px; }
.cs-section { margin: 10px 0; }
.cs-section-title { font-size: 12px; font-weight: 700; color: var(--muted); margin: 6px 0 2px; }
.cs-bb-title { color: #ea580c; }
.cs-sub { margin: 6px 0; }
.cs-sub-title { font-size: 12px; font-weight: 600; margin: 4px 0; padding-left: 8px; border-left: 3px solid var(--line); }
.cs-ch-own { color: #0d9488; border-left-color: #0d9488; }
.cs-ch-outer { color: #2563eb; border-left-color: #2563eb; }
.cs-ch-unk { color: #64748b; border-left-color: #64748b; }
.cs-detail-row { display: flex; flex-wrap: wrap; column-gap: 8px; row-gap: 2px; align-items: baseline; padding: 3px 0 3px 22px; font-size: 11px; border-bottom: 1px dashed var(--line); }
.cs-d-cust { flex: 0 0 auto; font-weight: 600; color: var(--ink); max-width: 72px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-d-phone { flex: 0 0 auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.cs-d-date { flex: 0 0 auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.cs-d-pkg { flex: 0 0 auto; color: #0d9488; background: #ecfdf5; border: 1px solid #99f6e4; border-radius: 6px; padding: 1px 6px; font-weight: 600; font-variant-numeric: tabular-nums; }
/* 渠道颜色：自有=青色，外部=蓝色 */
.cs-row-own { border-left: 2px solid #0d9488; padding-left: 8px; }
.cs-row-own .cs-d-cust { color: #0d9488; }
.cs-row-outer { border-left: 2px solid #2563eb; padding-left: 8px; }
.cs-row-outer .cs-d-cust { color: #2563eb; }
/* 业务统计板块：办卡佣金合计行 */
.cs-commission { margin-top: 6px; padding: 6px 8px; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; font-size: 12px; color: #1e40af; font-weight: 600; }
.cs-commission b { color: #0f172a; font-size: 14px; }
.cs-com-split { font-size: 11px; color: #64748b; font-weight: 500; margin-left: 6px; }
.cs-bb-com { background: #fff7ed; border-color: #fed7aa; color: #c2410c; }

/* ---------- 5. 总账 ---------- */
.total-card { background: linear-gradient(135deg, #0f172a, #1e293b); color: #fff; }
.total-card .tc-title { font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.total-card.tc-collapsed .tc-body { display: none; }
.total-card .tc-title.sec-toggle { cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; }
.total-card .tc-title.sec-toggle:hover { filter: brightness(1.2); }
.total-card .tc-row { display: flex; gap: 8px; margin-bottom: 10px; }
.total-card .tc-row .t {
  flex: 1; background: rgba(255,255,255,.08); border-radius: 12px; padding: 10px; text-align: center;
}
.total-card .tc-row .t .lab { font-size: 11px; opacity: .8; }
.total-card .tc-row .t .num { font-size: 17px; font-weight: 800; margin-top: 3px; }
.total-card .tc-row .t.inc .num { color: #fca5a5; }
.total-card .tc-row .t.exp .num { color: #5eead4; }
.total-card .tc-row .t.pro .num { color: #fff; }
.total-card .tc-row.tc-annual { margin-top: 12px; margin-bottom: 4px; border-top: 1px dashed rgba(8,145,178,.45); padding-top: 12px; }
.total-card .tc-row.tc-annual .t.annual {
  flex: 1; background: linear-gradient(90deg, rgba(8,145,178,.18), rgba(8,145,178,.04));
  border: 1px solid rgba(8,145,178,.4); border-radius: 12px; padding: 10px 12px;
}
.total-card .tc-row.tc-annual .t.annual .num { color: #22d3ee; font-size: 20px; }
.total-card .tc-row.tc-annual .t.annual .lab { color: #0e7490; font-weight: 700; }
.total-card .tc-row.tc-annual-exp { margin-top: 8px; display: flex; gap: 8px; align-items: center; }
.total-card .tc-row.tc-annual-exp .t.annual-exp {
  flex: 1; background: linear-gradient(90deg, rgba(220,38,38,.12), rgba(220,38,38,.03));
  border: 1px solid rgba(239,68,68,.35); border-radius: 12px; padding: 10px 12px;
}
.total-card .tc-row.tc-annual-exp .t.annual-exp .num { color: #f87171; font-size: 20px; font-weight: 800; }
.total-card .tc-row.tc-annual-exp .t.annual-exp .lab { color: #b91c1c; font-weight: 700; }
.total-card .tc-hist { margin-top: 6px; border-top: 1px solid rgba(255,255,255,.15); padding-top: 10px; }
.total-card .tc-hist label { font-size: 12px; opacity: .85; }
.total-card .tc-hist input { margin-left: 6px; padding: 6px; border-radius: 8px; border: none; }
.total-card .tc-hist .hist-out { margin-top: 8px; font-size: 12px; line-height: 1.7; }
.total-card .tc-hist .hist-out b { color: #fde68a; }
.total-card .tc-annual-reveal { margin-top: 12px; padding: 10px; text-align: center; font-size: 13px; font-weight: 700; color: #67e8f9; background: rgba(8,145,178,.18); border: 1px dashed rgba(34,211,238,.5); border-radius: 10px; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; }
.total-card .tc-annual-reveal:active { filter: brightness(1.25); }

/* ---------- 弹窗 ---------- */
.modal, .drawer { position: fixed; inset: 0; z-index: 50; }
.modal-mask, .drawer-mask { position: absolute; inset: 0; background: rgba(15,23,42,.45); }
.modal-box { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); width: 100%; max-width: 460px; max-height: 92vh; overflow-y: auto; border-radius: 20px 20px 0 0; padding: 18px; padding-bottom: calc(18px + env(safe-area-inset-bottom)); animation: up .2s ease; }
.drawer-box { position: absolute; right: 0; top: 0; height: 100%; width: 88%; max-width: 420px; border-radius: 0; overflow-y: auto; animation: slide .2s ease; }
@keyframes up { from { transform: translate(-50%, 20px); opacity: .6; } to { transform: translate(-50%, 0); opacity: 1; } }
@keyframes slide { from { transform: translateX(20px); opacity: .6; } to { transform: translateX(0); opacity: 1; } }
.modal-head, .drawer-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; margin-bottom: 12px; }
.modal-box.wide { max-width: 560px; }

/* ---- 类目设置 ---- */
.bc-tip { font-size: 12px; color: var(--muted); line-height: 1.6; margin: 0 0 12px; }
.bc-tip b { color: #1e293b; }
.bc-body { display: flex; flex-direction: column; gap: 10px; }
.bc-item { border: 1px solid #e2e8f0; border-radius: 12px; padding: 10px; background: #f8fafc; }
.bc-row { display: flex; gap: 8px; align-items: center; }
.bc-row .bc-name { flex: 1.4; min-width: 0; }
.bc-row .bc-type, .bc-row .bc-role { flex: 1; min-width: 0; }
.bc-row .bc-del { flex: 0 0 auto; padding: 6px 10px; border: none; border-radius: 8px; background: #fee2e2; color: #b91c1c; font-size: 13px; }
.bc-items { width: 100%; margin-top: 8px; }
.bc-add { margin-top: 4px; align-self: flex-start; padding: 8px 12px; border: 1px dashed #94a3b8; border-radius: 10px; background: transparent; color: #475569; font-size: 13px; }
.modal-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; }

.form-field { margin-bottom: 12px; }
.form-row { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; align-items: start; }
.form-row-3 { grid-template-columns: minmax(0,1fr) minmax(0,1fr) minmax(0,1fr); }
.form-row > * { min-width: 0; }
.form-row input, .form-row select, .form-row textarea { width: 100%; min-width: 0; }
/* iOS 日期选择器默认带较大内置最小宽度，压成 0 才能严格等宽 */
.form-row input[type="date"] { -webkit-appearance: none; appearance: none; }
.form-field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.form-field input, .form-field textarea {
  width: 100%; padding: 13px; border: 1px solid var(--line); border-radius: 12px; font-size: 16px; background: #f8fafc;
}
.form-field textarea { resize: none; height: 56px; }
.form-field textarea.one-line { height: 44px; line-height: 1.4; }
.form-field textarea.customer-note {
  height: 72px;
  padding: 14px 13px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--ink);
}
.net-custom { margin-top: 8px; height: 44px; line-height: 1.4; }
.readonly-line { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.readonly-line b { color: var(--ink); }

/* ---------- 录入弹窗顶部「关联客户」状态条 ---------- */
.entry-cust-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 12px;
  background: rgba(37, 99, 235, .06);
  border: 1px solid rgba(37, 99, 235, .20);
  border-radius: 12px;
}
.entry-cust-bar .ecb-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.entry-cust-bar .ecb-state { font-size: 14px; color: var(--ink); font-weight: 600; }
.entry-cust-bar .ecb-state.linked { color: var(--brand); }
.entry-cust-bar .primary.sm, .entry-cust-bar .sm { width: auto; }


/* ---------- 单据列表 ---------- */
.drawer-search { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.drawer-search input[type="search"] { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-size: 14px; -webkit-appearance: none; background: #fff; }
.drawer-search input[type="search"]:focus { outline: none; border-color: var(--accent, var(--brand)); }
.search-clear { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 12px; font-size: 13px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.search-tip { font-size: 12px; color: var(--muted); margin: 2px 2px 8px; }
mark { background: #fff3a3; color: inherit; border-radius: 3px; padding: 0 2px; font-weight: 600; }
.drawer-actions { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.exp-month { font-size: 13px; color: var(--muted); }
.exp-month input { padding: 7px; border-radius: 10px; border: 1px solid var(--line); }
.drawer-actions .primary { width: auto; padding: 9px 14px; font-size: 14px; }
.drawer-seg { display: inline-flex; gap: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 10px; align-self: flex-start; }
.drawer-seg .seg { border: 0; background: #fff; color: var(--muted); padding: 8px 18px; font-size: 13px; cursor: pointer; }
.drawer-seg .seg + .seg { border-left: 1px solid var(--line); }
.drawer-seg .seg.active { background: var(--accent, var(--brand)); color: #fff; font-weight: 600; }
.rec-summary { display: flex; flex-wrap: wrap; gap: 12px; align-items: baseline; background: var(--card2, #f8fafc); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 13px; margin-bottom: 10px; }
.rec-summary > span:first-child { font-weight: 600; color: var(--ink); }
.rec-summary b { font-size: 15px; }
.rec-summary .pos { color: #dc2626; }
.rec-summary .neg { color: #16a34a; }
.rec-summary .dd-profit { color: #7c3aed; font-weight: 800; }
.record-list { display: flex; flex-direction: column; gap: 8px; }
#dayDetailList { max-height: 380px; overflow-y: auto; }
/* 销售的产品：收入/支出 高亮按钮 + 明细折叠 */
.dd-btns { display: flex; gap: 10px; margin-bottom: 10px; }
.dd-btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 11px 8px; border-radius: 12px; font-size: 14px; font-weight: 700; cursor: pointer; border: 1.5px solid transparent; transition: transform .1s, box-shadow .12s; }
.dd-btn:active { transform: scale(.97); }
.dd-btn b { font-size: 15px; font-weight: 800; }
.dd-btn.dd-inc { background: #fef2f2; color: #b91c1c; border-color: #fca5a5; }
.dd-btn.dd-inc b { color: #b91c1c; }
.dd-btn.dd-inc.active { background: #b91c1c; color: #fff; box-shadow: 0 3px 12px rgba(185,28,28,.3); }
.dd-btn.dd-inc.active b { color: #fff; }
.dd-btn.dd-exp { background: #ecfdf5; color: #047857; border-color: #6ee7b7; }
.dd-btn.dd-exp b { color: #047857; }
.dd-btn.dd-exp.active { background: #047857; color: #fff; box-shadow: 0 3px 12px rgba(4,120,87,.3); }
.dd-btn.dd-exp.active b { color: #fff; }
.dd-detail { border: 1px solid var(--line); border-radius: 12px; padding: 0 10px; background: var(--card2, #f8fafc); }
.dd-detail > summary { cursor: pointer; padding: 10px 0; font-size: 13px; font-weight: 700; color: var(--brand); user-select: none; }
.dd-detail > summary::marker { color: var(--muted); }
.dd-detail[open] > summary { border-bottom: 1px dashed var(--line); margin-bottom: 8px; }
.dd-detail #dayDetailList { max-height: 340px; overflow-y: auto; margin-bottom: 10px; padding: 0 2px; }
.rec-item { border: 1px solid var(--line); border-radius: 12px; padding: 10px; font-size: 13px; transition: background .4s, box-shadow .4s; }
.rec-item.ri-flash { background: #ecfdf5; box-shadow: 0 0 0 2px #34d399 inset; }
.rec-item .ri-top { display: flex; justify-content: space-between; font-weight: 600; }
.rec-item .ri-mid { color: var(--muted); font-size: 12px; margin: 4px 0; }
/* 数量高亮醒目标注（如 ×10） */
.qty-badge { display: inline-block; background: #ea580c; color: #fff; font-weight: 700; font-size: 12px; line-height: 1; padding: 2px 7px; border-radius: 999px; vertical-align: middle; box-shadow: 0 1px 3px rgba(234,88,12,.45); }
.rec-item .ri-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
.rec-item .ri-actions button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 5px 12px; font-size: 12px; cursor: pointer; }
.rec-item .ri-actions .del { color: #dc2626; border-color: #fecaca; }
.rec-item .ri-type { display: flex; align-items: center; gap: 6px; }
.fix-badge {
  font-style: normal; font-size: 10px; font-weight: 600; color: #9a3412;
  background: #ffedd5; border: 1px solid #fed7aa; border-radius: 999px; padding: 1px 7px;
}
/* 更正记录（错误修改留痕） */
.fix-hist { background: #fff7ed; border: 1px solid #fed7aa; border-radius: 12px; padding: 10px; margin-bottom: 12px; }
.fix-hist .fh-title { font-size: 12px; font-weight: 700; color: #9a3412; margin-bottom: 6px; }
.fix-hist .fh-item { border-top: 1px dashed #fdba74; padding: 6px 0; }
.fix-hist .fh-item:first-of-type { border-top: none; }
.fix-hist .fh-head { font-size: 11px; color: #c2410c; margin-bottom: 2px; }
.fix-hist .fh-body { font-size: 11px; color: var(--muted); line-height: 1.5; }

/* ---------- 通用二次确认弹窗 ---------- */
.confirm-mask {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  background: rgba(8,12,20,.55); padding: 20px;
}
.confirm-box {
  width: 100%; max-width: 320px; background: #fff; border-radius: 16px;
  padding: 20px 18px 14px; box-shadow: 0 12px 40px rgba(0,0,0,.35);
}
.confirm-msg {
  font-size: 15px; line-height: 1.5; color: #1e293b; text-align: center;
  padding: 4px 4px 16px; font-weight: 500;
}
.confirm-actions { display: flex; gap: 10px; }
.confirm-actions button {
  flex: 1; border: none; border-radius: 12px; padding: 12px 0;
  font-size: 15px; font-weight: 600; cursor: pointer;
}
.confirm-cancel { background: #eef2f7; color: #475569; }
.confirm-ok { background: var(--income); color: #fff; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%);
  background: rgba(15,23,42,.9); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13px; z-index: 100;
}

@media (max-width: 360px) {
  .board-grid { grid-template-columns: repeat(2, 1fr); }
}

/* 底部悬浮快速记账按钮（毛玻璃胶囊） */
.fab {
  position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 30; display: flex; align-items: center; gap: 6px;
  background: rgba(37, 99, 235, .18); color: #fff;
  border: 1px solid rgba(255, 255, 255, .55); border-radius: 999px;
  padding: 13px 18px; font-size: 15px; font-weight: 700;
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  backdrop-filter: blur(12px) saturate(160%);
  box-shadow: 0 8px 22px rgba(37, 99, 235, .35), inset 0 1px 0 rgba(255, 255, 255, .5);
}
.fab:active { transform: scale(.96); }

/* 记住密码 */
.remember {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted);
  margin: 2px 2px 12px; cursor: pointer; user-select: none; -webkit-user-select: none;
}
.remember input { width: 17px; height: 17px; accent-color: var(--brand); margin: 0; }

/* ============================================================
   美化增强：圆角 · 毛玻璃 · 板块配色条
   （由「门店记账卡片美化」技能并入，原 page_style.css 等价迁到工作台）
   ============================================================ */
/* 手机端页面背景：柔和渐变，让毛玻璃卡片有景深 */
body {
  background: linear-gradient(160deg, #ffffff 0%, #fcfdff 50%, #ffffff 100%);
  background-attachment: fixed;
}

/* 所有 .card 升级为通透玻璃卡片（与按钮同款玻璃质感） */
.card {
  background: rgba(255, 255, 255, .46);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid rgba(203, 213, 225, .9);
  border-radius: 20px;
  /* 立体按键感同源：顶部内高光（亮起）+ 双层外投影（悬浮） */
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .85),
    0 10px 26px rgba(15, 23, 42, .14),
    0 4px 8px rgba(15, 23, 42, .08);
  transition: transform .14s ease, box-shadow .18s ease;
}
/* 默认折叠的板块导航卡（业务录入下方所有可折叠 section）：统一加键感——左侧色带 + 浮起悬浮 */
.card.collapsible {
  box-shadow:
    inset 4px 0 0 var(--card-accent, #3388ee),
    inset 0 1px 0 rgba(255, 255, 255, .85),
    0 10px 26px rgba(15, 23, 42, .14),
    0 4px 8px rgba(15, 23, 42, .08);
}
/* 两个主题卡自带渐变，不被毛玻璃覆盖 */
.overview { background: linear-gradient(135deg, #1e3a8a, #2563eb) !important; }
.total-card { background: linear-gradient(135deg, #0f172a, #1e293b) !important; }

/* 业务板块配色条：左侧 4px 色条 */
.card-type-accessory { border-left: 4px solid #22bb99; }
.card-type-repair    { border-left: 4px solid #ff8833; }
.card-type-sim       { border-left: 4px solid #3388ee; }
.card-type-watch     { border-left: 4px solid #9955dd; }
.card-type-phone     { border-left: 4px solid #33aa55; }
.card-type-phone-ov  { border-left: 4px solid #0ea5a4; }
.card-type-recycle   { border-left: 4px solid #ee4444; }
.card-type-family    { border-left: 4px solid #e05a8a; }
.card-type-govsub     { border-left: 4px solid #e0a800; }
.card-type-commission { border-left: 4px solid #0891b2; }

/* 录入卡 / 二级格 / 板块卡 跟随板块色做淡色填充，强化识别 */
.entry-card.card-type-accessory, .item-cell.card-type-accessory, .board-cell.card-type-accessory { background: linear-gradient(90deg, rgba(34,187,153,.10), rgba(255,255,255,0) 55%); }
.entry-card.card-type-repair,    .item-cell.card-type-repair,    .board-cell.card-type-repair    { background: linear-gradient(90deg, rgba(255,136,51,.10), rgba(255,255,255,0) 55%); }
.entry-card.card-type-sim,       .item-cell.card-type-sim,       .board-cell.card-type-sim       { background: linear-gradient(90deg, rgba(51,136,238,.10), rgba(255,255,255,0) 55%); }
.entry-card.card-type-watch,     .item-cell.card-type-watch,     .board-cell.card-type-watch     { background: linear-gradient(90deg, rgba(153,85,221,.10), rgba(255,255,255,0) 55%); }
.entry-card.card-type-phone,     .item-cell.card-type-phone,     .board-cell.card-type-phone     { background: linear-gradient(90deg, rgba(51,170,85,.10), rgba(255,255,255,0) 55%); }
.entry-card.card-type-phone-ov,  .item-cell.card-type-phone-ov,  .board-cell.card-type-phone-ov  { background: linear-gradient(90deg, rgba(14,165,164,.10), rgba(255,255,255,0) 55%); }
.entry-card.card-type-recycle,   .item-cell.card-type-recycle,   .board-cell.card-type-recycle   { background: linear-gradient(90deg, rgba(238,68,68,.10), rgba(255,255,255,0) 55%); }
.entry-card.card-type-family,    .item-cell.card-type-family,    .board-cell.card-type-family    { background: linear-gradient(90deg, rgba(224,90,138,.10), rgba(255,255,255,0) 55%); }
.entry-card.card-type-govsub,     .item-cell.card-type-govsub,     .board-cell.card-type-govsub     { background: linear-gradient(90deg, rgba(224,168,0,.10), rgba(255,255,255,0) 55%); }
.entry-card.card-type-commission, .item-cell.card-type-commission, .board-cell.card-type-commission { background: linear-gradient(90deg, rgba(8,145,178,.10), rgba(255,255,255,0) 55%); }

/* 金额高亮（技能原 .amount-text 语义） */
.amount-text { font-weight: 700; font-size: 18px; }

/* ---------- 深色模式（跟随系统） ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --card: #1e293b;
    --ink: #e6eaf2;
    --muted: #93a0b4;
    --line: #334155;
    --card2: #111827;
    --shadow: 0 6px 22px rgba(0,0,0,.45);
  }
  body { background: linear-gradient(160deg, #182a45 0%, #223456 50%, #182a45 100%); background-attachment: fixed; }
  .card {
    background: rgba(30, 41, 59, .44);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    backdrop-filter: blur(16px) saturate(140%);
    border: 1px solid rgba(148, 163, 184, .34);
    /* 立体按键感（深色版）：微弱内顶高光 + 双层深投影 */
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, .12),
      0 10px 28px rgba(0, 0, 0, .50),
      0 4px 10px rgba(0, 0, 0, .30);
  }
  /* 默认折叠的板块导航卡：键感色带（深色下亮蓝，区别于浅色板蓝） */
  .card.collapsible {
    box-shadow:
      inset 4px 0 0 var(--card-accent, #60a5fa),
      inset 0 1px 0 rgba(255, 255, 255, .15),
      0 10px 28px rgba(0, 0, 0, .50),
      0 4px 10px rgba(0, 0, 0, .30);
  }
  .topbar { background: rgba(11, 18, 32, .82); }
  .entry-card, .item-cell, .board-cell, .stk-item, .stock-summary .ss-cell,
  .kpi-strip .kpi-cell, .rep-summary, .cust-card, .biz-row {
    background: rgba(51, 65, 85, .42);
    border-color: rgba(148, 163, 184, .28);
  }
  .cust-act button { background: rgba(30, 41, 59, .75); color: var(--ink); border-color: rgba(148,163,184,.22); }
  .chip { background: rgba(30, 41, 59, .75); color: var(--ink); border-color: rgba(148,163,184,.22); }
  .cust-act .cadd { background: var(--accent, #3388ee); color: #fff; }
  .rep-tbl tbody tr:nth-child(even) { background: rgba(148, 163, 184, .1); }
  .entry-item {
    background: linear-gradient(180deg, rgba(51, 65, 85, .68), rgba(30, 41, 59, .55));
    color: var(--ink);
    border-color: rgba(148, 163, 184, .28);
    /* 立体按键感（深色版）：左色带 + 微弱顶部内高光 + 深色下双重投影 */
    box-shadow:
      inset 4px 0 0 var(--board-accent, rgba(148, 163, 184, .4)),
      inset 0 1px 0 rgba(255, 255, 255, .10),
      0 8px 18px rgba(0, 0, 0, .50),
      0 2px 4px rgba(0, 0, 0, .30);
  }
  .entry-item:hover {
    background: linear-gradient(180deg, rgba(71, 85, 105, .72), rgba(51, 65, 85, .6));
    transform: translateY(-1px);
    box-shadow:
      inset 4px 0 0 var(--board-accent, rgba(148, 163, 184, .45)),
      inset 0 1px 0 rgba(255, 255, 255, .16),
      0 12px 24px rgba(0, 0, 0, .55),
      0 3px 6px rgba(0, 0, 0, .35);
  }
  .entry-item:active {
    transform: translateY(1px);
    box-shadow:
      inset 4px 0 0 var(--board-accent, rgba(148, 163, 184, .5)),
      0 1px 2px rgba(0, 0, 0, .45);
  }
  .entry-collapse { background: rgba(8,145,178,.16); border-color: rgba(8,145,178,.3); color: #67e8f9; }
  .login-card input, .form-field input, .form-field textarea, .form-field select,
  /* 总览日期框：深色下改为蓝玻璃（与 .dd-date 同款），避免纯黑死板 */
  .ov-scope-input input { background: rgba(37, 99, 235, .22); border-color: rgba(255, 255, 255, .3); color: #e2e8f0; color-scheme: dark; }
  .drawer-search input[type="search"],
  .stock-toolbar input[type="search"], .stock-sort,
  .cust-toolbar select.cust-group {
    background: #111827; color: var(--ink); border-color: var(--line);
  }
  .role-tab { background: #111827; color: var(--muted); }
  /* 深色下板块色条淡背景适配 */
  .entry-card.card-type-accessory, .item-cell.card-type-accessory, .board-cell.card-type-accessory { background: linear-gradient(90deg, rgba(34,187,153,.18), rgba(51,65,85,0) 55%); }
  .entry-card.card-type-repair,    .item-cell.card-type-repair,    .board-cell.card-type-repair    { background: linear-gradient(90deg, rgba(255,136,51,.18), rgba(51,65,85,0) 55%); }
  .entry-card.card-type-sim,       .item-cell.card-type-sim,       .board-cell.card-type-sim       { background: linear-gradient(90deg, rgba(51,136,238,.18), rgba(51,65,85,0) 55%); }
  .entry-card.card-type-watch,     .item-cell.card-type-watch,     .board-cell.card-type-watch     { background: linear-gradient(90deg, rgba(153,85,221,.18), rgba(51,65,85,0) 55%); }
  .entry-card.card-type-phone,     .item-cell.card-type-phone,     .board-cell.card-type-phone     { background: linear-gradient(90deg, rgba(51,170,85,.18), rgba(51,65,85,0) 55%); }
  .entry-card.card-type-phone-ov,  .item-cell.card-type-phone-ov,  .board-cell.card-type-phone-ov  { background: linear-gradient(90deg, rgba(14,165,164,.18), rgba(51,65,85,0) 55%); }
  .entry-card.card-type-recycle,   .item-cell.card-type-recycle,   .board-cell.card-type-recycle   { background: linear-gradient(90deg, rgba(238,68,68,.18), rgba(51,65,85,0) 55%); }
  .entry-card.card-type-family,    .item-cell.card-type-family,    .board-cell.card-type-family    { background: linear-gradient(90deg, rgba(224,90,138,.18), rgba(51,65,85,0) 55%); }
  .entry-card.card-type-govsub,     .item-cell.card-type-govsub,     .board-cell.card-type-govsub     { background: linear-gradient(90deg, rgba(224,168,0,.18), rgba(51,65,85,0) 55%); }
  .total-card .tc-row.tc-annual .t.annual { background: rgba(8,145,178,.22); border-color: rgba(34,211,238,.5); }
  .total-card .tc-row.tc-annual-exp .t.annual-exp { background: rgba(220,38,38,.15); border-color: rgba(248,113,113,.45); }
  .total-card .tc-row.tc-annual .t.annual .num { color: #67e8f9; }
  .total-card .tc-row.tc-annual .t.annual .lab { color: #a5f3fc; }
  .rec-item.ri-flash { background: rgba(16,185,129,.22); box-shadow: 0 0 0 2px #34d399 inset; }
  .qty-badge { background: #fb923c; box-shadow: 0 0 8px rgba(251,146,60,.6); }
  .drawer-seg .seg { background: #111827; color: var(--muted); }
  .drawer-seg .seg + .seg { border-left-color: var(--line); }
  .drawer-seg .seg.active { background: var(--accent, var(--brand)); color: #fff; }
  .rec-summary { background: #111827; border-color: var(--line); color: var(--ink); }
  .rec-summary .pos { color: #f87171; }
  .rec-summary .neg { color: #4ade80; }
  .rec-summary .dd-profit { color: #a78bfa; }
  /* 销售的产品日期选择器：深色下玻璃蓝调，日历弹层跟随深色 */
  .dd-date { background: rgba(37, 99, 235, .22); border-color: rgba(255, 255, 255, .3); color: #e2e8f0; color-scheme: dark; }
  /* 销售看板：深色下子面板改深色，避免白底浅字看不清 */
  .sb-type-detail > td { background: rgba(15,23,42,.55); }
  .sb-type-detail .sb-table-sm td, .sb-type-detail .sb-table-sm th { color: var(--ink); }
  .sb-cat-row.sb-clickable:hover { background: rgba(51,65,85,.5); }

  /* 快速出售：深色下蓝玻璃（与全局总览同款蓝 #2563eb，浓度对齐总览） */
  .quick-sell-btn {
    color: #fff;
    background: rgba(37, 99, 235, .48);
    border-color: rgba(255, 255, 255, .45);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    backdrop-filter: blur(14px) saturate(180%);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .42);
  }
  .quick-sell-btn:hover { background: rgba(37, 99, 235, .60); }

  /* 卡片内主操作入口 / 次要按钮：深色下蓝玻璃协调版 */
  .primary.sm {
    color: #fff;
    background: rgba(37, 99, 235, .48);
    border-color: rgba(255, 255, 255, .45);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    backdrop-filter: blur(14px) saturate(180%);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .42);
  }
  .primary.sm:hover { background: rgba(37, 99, 235, .60); }
  .sm {
    color: #fff;
    background: rgba(37, 99, 235, .40);
    border-color: rgba(255, 255, 255, .38);
    -webkit-backdrop-filter: blur(12px) saturate(170%);
    backdrop-filter: blur(12px) saturate(170%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .36);
  }
  .sm:hover { background: rgba(37, 99, 235, .52); }
  .fab {
    color: #fff;
    background: linear-gradient(180deg, rgba(255, 255, 255, .24), rgba(56, 189, 248, .18));
    border-color: rgba(255, 255, 255, .45);
    box-shadow: 0 8px 22px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .25);
  }
  /* 屏幕电池库存：深色下玻璃蓝调 */
  .screen-search { background: rgba(37, 99, 235, .18); border-color: rgba(255, 255, 255, .28); color: #e2e8f0; }
  .screen-type-seg { border-color: rgba(148, 163, 184, .3); }
  .screen-type-seg button { color: var(--muted); }
  .screen-type-seg button.active { background: var(--accent, var(--brand)); color: #fff; }
  .ss-item { background: rgba(51, 65, 85, .4); border-color: rgba(148, 163, 184, .25); }
  .ss-price { color: #93c5fd; background: rgba(56, 189, 248, .14); }
  .screen-cost-hint { color: #93c5fd; }
  .ss-zero { border-color: #f87171; background: rgba(127, 29, 29, .3); }
  .screen-warn-banner { background: linear-gradient(135deg, rgba(180, 83, 9, .5), rgba(146, 64, 14, .4)); border-color: #b45309; color: #fef3c7; }
  .screen-warn-banner b { color: #fde68a; }
  .ss-warn-inline { background: linear-gradient(135deg, rgba(180, 83, 9, .5), rgba(146, 64, 14, .4)); border-color: #b45309; color: #fef3c7; }
  .ss-warn-inline b { color: #fde68a; }
  .ss-type-title { color: #e2e8f0; }
  .ss-type-meta { color: #94a3b8; }
  .ss-brand-grid { gap: 8px; }
  .ss-brand-chip { background: rgba(51, 65, 85, .4); border-color: rgba(148, 163, 184, .25); }
  .ss-chip-head:hover { background: rgba(56, 189, 248, .08); }
  .ss-brand-name { color: #e2e8f0; }
  .ss-brand-count { color: #93c5fd; background: rgba(56, 189, 248, .14); }
  .ss-chip-body { border-top-color: rgba(148, 163, 184, .25); }
  .ss-model-name { color: #f1f5f9; font-weight: 600; }
  .ss-model-qty { color: #4ade80; }
  .ss-empty { color: #94a3b8; }
  .ss-edit-btn { background: rgba(245, 158, 11, .15); color: #fbbf24; border-color: rgba(245, 158, 11, .3); }
  .ss-edit-btn:hover { background: rgba(245, 158, 11, .25); }
  .ss-del-btn { background: rgba(239, 68, 68, .15); color: #f87171; border-color: rgba(239, 68, 68, .3); }
  .ss-del-btn:hover { background: rgba(239, 68, 68, .25); }
  .sm-brand { color: #e2e8f0; }
  .sm-model { color: #e2e8f0; }
  .sm-qty { color: #4ade80; }
  .sm-cost { color: #94a3b8; }
  .sm-edit-form input { background: rgba(15, 23, 42, .5); border-color: rgba(148, 163, 184, .3); color: #e2e8f0; }
  .sm-summary { background: linear-gradient(135deg, rgba(56,189,248,.14), rgba(37,99,235,.08)); border-color: rgba(56,189,248,.4); }
  .sm-sum-item { background: rgba(15, 23, 42, .4); }
  .sm-sum-item b { color: #7dd3fc; }
  .sm-sum-grand { background: linear-gradient(135deg, rgba(180,83,9,.12), rgba(217,119,6,.08)); border-top-color: rgba(251,191,36,.3); }
  .sm-sum-grand b { color: #fde68a; }
  .ss-item { border-color: rgba(148,163,184,.2); }
  .ss-brand { color: #94a3b8; background: rgba(148,163,184,.2); }
  .ss-model { color: #e2e8f0; }
  .ss-tags { color: #64748b; }
  .ss-alias { color: #fbbf24; background: rgba(245,158,11,.15); }
  .ss-note { color: #94a3b8; }
  .ss-price { color: #60a5fa; background: rgba(37,99,235,.15); }
  /* 家庭支出（使用 CSS 变量，深浅自动适配） */
  .family-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
  .family-stat { font-size: 12px; color: var(--muted); }
  .family-stat b { color: var(--ink); }
  .govsub-group { display: flex; flex-direction: column; gap: 2px; }
  .govsub-top { font-size: 14px; font-weight: 600; color: var(--muted); }
  .govsub-top b { font-size: 16px; font-variant-numeric: tabular-nums; }
  .govsub-bottom { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
  .govsub-bottom b { font-variant-numeric: tabular-nums; }
  .gs-blue { color: #2563eb !important; }
  .gs-green { color: #16a34a !important; }
  .gs-red { color: #dc2626 !important; }
  .family-list { display: flex; flex-direction: column; gap: 8px; }
  .fam-month { font-size: 12px; color: var(--muted); padding: 6px 2px 2px; border-top: 1px dashed var(--line); margin-top: 4px; }
  .fam-item { background: var(--card2, #f1f5f9); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
  .fam-main { display: flex; align-items: center; gap: 10px; }
  .fam-date { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
  .fam-cat { font-weight: 600; color: var(--ink); flex: 1; }
  .fam-amt { font-weight: 700; color: #dc2626; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .fam-qty { font-weight: 700; color: #fff; background: #f97316; border-radius: 6px; padding: 1px 7px; font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .fam-price { font-weight: 600; color: #2563eb; background: rgba(37,99,235,.12); border-radius: 6px; padding: 1px 7px; font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .fam-total-prev { font-weight: 700; color: #dc2626; font-size: 15px; font-variant-numeric: tabular-nums; }
  .fam-note { font-size: 12px; color: var(--muted); margin-top: 4px; word-break: break-all; }
  .fam-note-tag { display: inline-block; font-weight: 700; font-size: 13px; color: #92400e; background: #fef3c7; border-radius: 6px; padding: 2px 9px; margin-right: 6px; white-space: nowrap; }
  .fam-suffix { color: #94a3b8; margin-left: 4px; white-space: nowrap; }
  .fam-price-big { display: inline-block; margin-left: 6px; color: #fff; background: #2563eb; border-radius: 6px; padding: 2px 9px; font-size: 14px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .fam-act { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
  .gov-badge { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 1px 9px; white-space: nowrap; }
  .gov-badge.paid { color: #166534; background: #dcfce7; }
  .gov-badge.unpaid { color: #b45309; background: #fef3c7; }
  .fam-note-inline { font-size: 12px; color: var(--muted); white-space: nowrap; }
  .fam-act .sm { padding: 4px 12px; font-size: 12px; }
  .fam-empty { font-size: 13px; color: var(--muted); text-align: center; padding: 18px 0; }

  .ss-cost { color: #34d399; background: rgba(5,150,105,.15); }

  .fam-amt { color: #f87171; }
  .fam-month b { color: var(--ink); font-weight: 700; }
}

/* ---- 未收账款卡片 ---- */
.recv-card { border-left: 4px solid #7c3aed; }
.recv-stat { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; font-size: 12px; color: var(--muted); }
.recv-stat b { color: #7c3aed; font-weight: 800; font-variant-numeric: tabular-nums; margin-left: 2px; }
.recv-stat .recv-total { margin-left: auto; padding-left: 12px; border-left: 1px solid var(--line); color: var(--ink); }
.recv-stat .recv-total b { color: #dc2626; font-size: 14px; }
.recv-flag { margin-left: auto; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.recv-flag-wait { color: #b45309; background: #fef3c7; }
.recv-flag-done { color: #15803d; background: #dcfce7; }
.fam-item.fam-done { opacity: .62; }
.fam-item.fam-done .fam-amt { color: #94a3b8; }
.fam-done .recv-flag { margin-left: 8px; }
.card-type-receivable { border-left: 4px solid #7c3aed; }
