/* 老王工作台 - 移动端优先样式 */
:root {
  /* ============ 主色板：深蓝骨架 + 金色点缀 ============ */
  --navy:        #16325c;   /* 主品牌色：经典商务深蓝 */
  --navy-dark:   #102449;   /* 按压/标题深档 */
  --navy-deep:   #0a1931;   /* 最深档：渐变收尾 */
  --navy-soft:   #eef2f9;   /* 浅蓝底（替换 teal-soft） */
  --navy-line:   #c8d6ea;   /* 浅蓝描边（替换 #99f6e4） */

  /* 金色：仅作点缀（新批次高亮/上传按钮阴影/拖拽遮罩） */
  --gold:        #c9a557;   /* 经典黄铜金 */
  --gold-dark:   #a8843c;
  --gold-soft:   #faf4e3;   /* 浅金底 */

  /* 语义色（微调匹配商务调） */
  --red:    #c2410c;   /* 橘红一档，避免与金冲突 */
  --green:  #047857;   /* 暗绿去荧光 */
  --blue:   #1d4ed8;
  --orange: #d97706;

  /* 兼容映射：旧 teal 变量名保留指向新值，避免改 60+ 处使用点 */
  --teal:       var(--navy);
  --teal-dark:  var(--navy-dark);
  --teal-deep:  var(--navy-deep);
  --cyan:       #2563eb;
  --teal-soft:  var(--navy-soft);
  --brand-grad: linear-gradient(135deg, #16325c 0%, #0a1931 100%);

  /* 中性色（去青味） */
  --bg:     #f3f5f9;
  --card:   #ffffff;
  --line:   #dde3ec;
  --text:   #101c30;
  --muted:  #47556b;
  --muted2: #6b7a92;

  /* 警示黄（调淡调褐，避免与金混淆） */
  --yellow-bg:  #fdf6d8;
  --yellow-tag: #92680a;

  --tabbar-h: 58px;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: #eef2f7;
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; border: none; background: none; cursor: pointer; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--text); }
.num, .stat-num, .money, table { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* ---------- App 外壳（手机列，桌面居中） ---------- */
#app {
  position: relative;
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  box-shadow: 0 0 24px rgba(15, 23, 42, .08);
  display: flex;
  flex-direction: column;
}
#view { flex: 1; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 20px); }

/* ---------- 底部 Tab ---------- */
#tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 520px;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255,255,255,.96);
  backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--line);
  display: flex; z-index: 50;
}
.sidebar-brand, .sidebar-version { display: none; }
.tab-list { flex: 1; display: flex; }
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 11px; color: var(--muted2);
}
.tab .tab-ico { font-size: 20px; line-height: 1; }
.tab.active { color: var(--navy); font-weight: 600; }
.tab.active .tab-ico { color: var(--teal); }
.tab:active { transform: scale(.94); }

/* ---------- 通用 ---------- */
.page-pad { padding: 14px; }
.card {
  background: var(--card); border-radius: 14px; padding: 14px;
  box-shadow: 0 1px 2px rgba(15,23,42,.05);
  margin-bottom: 12px;
}
.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.gap6 { gap: 6px; } .gap8 { gap: 8px; } .gap10 { gap: 10px; }
.mt6 { margin-top: 6px; } .mt8 { margin-top: 8px; } .mt10 { margin-top: 10px; } .mt12 { margin-top: 12px; }
.mb8 { margin-bottom: 8px; }
.clickable:active { transform: scale(.98); }
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; line-height: 1.5; white-space: nowrap;
}
.tag-orange { background: #ffedd5; color: #c2410c; }
.tag-yellow { background: var(--yellow-bg); color: var(--yellow-tag); }
.tag-blue { background: #dbeafe; color: #1d4ed8; }
.tag-gray { background: #f1f5f9; color: var(--muted); }
.tag-green { background: #d1fae5; color: #047857; }
.tag-red { background: #fee2e2; color: #b91c1c; }

.money { font-weight: 600; white-space: nowrap; }
.m-cny { color: var(--red); }
.m-usd { color: var(--green); }
.m-usdt { color: var(--blue); }

/* ---------- 首页头部 + 统计 ---------- */
.home-head {
  background: var(--brand-grad); color: #fff;
  padding: calc(16px + env(safe-area-inset-top)) 18px 34px;
}
.home-head h1 { font-size: 20px; font-weight: 700; line-height: 1.3; }
.home-head p { font-size: 12.5px; color: rgba(255,255,255,.88); margin-top: 6px; line-height: 1.5; }
.home-head .logout-mini { flex: 0 0 auto; margin-top: 4px; }
.stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin-top: -20px; padding: 0 14px; position: relative; z-index: 1;
}
.home-upload-hint { text-align: center; margin: 10px 0 16px !important; }
.home-search { margin-top: 14px; }
.home-recent { margin-top: 18px !important; }
.stat-card {
  background: var(--card); border-radius: 14px; padding: 12px 8px; text-align: center;
  box-shadow: 0 2px 8px rgba(15,23,42,.08);
}
.stat-num { font-size: 19px; font-weight: 700; color: var(--navy); line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-label { font-size: 11px; color: var(--muted); margin-top: 4px; }
.stat-sub {
  font-size: 10.5px; margin-top: 4px; line-height: 1.5;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 1px 6px;
}

/* ---------- 上传 ---------- */
.upload-btn {
  width: 100%; background: var(--teal); color: #fff; border-radius: 14px;
  padding: 16px; font-size: 16px; font-weight: 700;
  box-shadow: 0 4px 14px rgba(201,165,87,.38);
}
.upload-btn:active { background: var(--teal-deep); transform: scale(.98); }
.upload-btn .plus { font-size: 20px; margin-right: 6px; }

/* ---------- 搜索 ---------- */
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border-radius: 12px; padding: 10px 12px;
  border: 1px solid var(--line);
}
.search-box input { border: none; outline: none; flex: 1; background: transparent; font-size: 14px; }

/* ---------- 月份分组 + 批次卡片 ---------- */
.month-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 4px; font-size: 13px; color: var(--navy); font-weight: 600;
}
.month-head .chev { transition: transform .2s; color: var(--muted2); }
.month-head.collapsed .chev { transform: rotate(-90deg); }
.month-sum { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 8px; }
.batch-card { display: block; width: 100%; text-align: left; margin-bottom: 10px; }
.batch-card:active { transform: scale(.985); }
/* 修改8.0：今天新上传的批次高亮 */
.batch-card.batch-new { border: 1.5px solid var(--gold); background: linear-gradient(180deg, var(--gold-soft) 0%, #fff 60%); }
.tag-new { background: var(--teal); color: #fff; margin-left: 6px; padding: 1px 7px; }
.upload-day-divider {
  display: flex; align-items: center; gap: 10px; margin: 14px 2px 8px;
  font-size: 11.5px; color: var(--teal-deep); font-weight: 700;
}
.upload-day-divider::before, .upload-day-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--navy-line);
}
.upload-day-divider span { white-space: nowrap; }
.batch-card .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.batch-card .sup { font-size: 15px; font-weight: 600; color: var(--navy); }
.count-badge {
  background: var(--brand-grad); color: #fff; font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}
.prices { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 9px; }
.prices .money { font-size: 14px; }

/* ---------- 台账 chips ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 6px 14px; border-radius: 999px; font-size: 13px;
  background: var(--card); border: 1px solid var(--line); color: var(--muted);
}
.chip.active { background: var(--brand-grad); border-color: transparent; color: #fff; font-weight: 600; }
.chip:active { transform: scale(.95); }
.chip-label { font-size: 12px; color: var(--muted); margin: 4px 2px 0; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; background: var(--card); }
th, td { padding: 9px 10px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
th { background: #f1f5f9; color: var(--muted); font-size: 11.5px; font-weight: 600; position: sticky; top: 0; }
tbody tr:active { background: #f8fafc; }
td.dash { color: var(--muted2); }

/* ---------- 我的 列表 ---------- */
.me-list .card { padding: 0; overflow: hidden; margin-bottom: 12px; }
.me-item {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; text-align: left; padding: 15px 16px; border-bottom: 1px solid var(--line);
}
.me-item:last-child { border-bottom: none; }
.me-item:active { background: #f8fafc; }
.me-item .arrow { color: var(--muted2); }
.me-item .mi-ico { font-size: 18px; width: 26px; text-align: center; }

/* ---------- 底部弹层 Sheet ---------- */
#sheet-mask, #detail-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 100;
}
#detail-mask { z-index: 59; display: none; }
#sheet {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%) translateY(100%);
  width: 100%; max-width: 520px; max-height: 88vh;
  background: var(--card); border-radius: 20px 20px 0 0; z-index: 101;
  display: flex; flex-direction: column;
  box-shadow: 0 -12px 48px rgba(15,23,42,.30);
  transition: transform .25s ease, width .2s ease, height .2s ease;
  padding-bottom: env(safe-area-inset-bottom);
  overflow: hidden;
}
#sheet.open { transform: translateX(-50%) translateY(0); }
/* 9.26：桌面端弹层加宽，详情表格列不再被挤截断 */
@media (min-width: 1000px) {
  #sheet { max-width: 780px; }
  #sheet.sheet-lg { max-width: 900px; }
}
/* 选完串号后自动变大：手机端几乎全屏 */
#sheet.sheet-lg { max-height: 96vh; height: 96vh; }
#sheet.sheet-lg .sheet-body { flex: 1; min-height: 0; }
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 12px 12px 60px; background: var(--card);
  border-radius: 20px 20px 0 0; border-bottom: 1px solid var(--line);
  position: relative;
}
.sheet-title { font-size: 16.5px; font-weight: 700; flex: 1; min-width: 0; color: var(--teal-dark); }
.sheet-x {
  color: #334155; font-size: 16px; font-weight: 700; flex: 0 0 auto;
  width: 38px; height: 38px; border-radius: 50%; background: #f1f5f9;
  display: inline-flex; align-items: center; justify-content: center;
}
.sheet-x:active { background: #e2e8f0; }
.sheet-back {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 50%;
  font-size: 30px; line-height: 36px; text-align: center;
  color: var(--teal-dark); background: var(--teal-soft);
  border: 1px solid var(--navy-line);
}
.sheet-back:active { background: #dde5f3; }
.sheet-body { padding: 14px 16px 20px; overflow-y: auto; -webkit-overflow-scrolling: touch; background: var(--card);
  border-radius: 0 0 20px 20px; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.input, select.input, textarea.input {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; background: var(--card); outline: none;
}
.input:focus { border-color: var(--teal); }
textarea.input { resize: vertical; min-height: 60px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 11px; padding: 11px 16px; font-size: 14px; font-weight: 600;
}
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:active { background: var(--teal-deep); }
.btn-navy { background: var(--brand-grad); color: #fff; }
.btn-ghost { background: var(--card); border: 1px solid var(--line); color: var(--teal-dark); }
.btn-danger { background: #fee2e2; color: #b91c1c; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; }
.seg { display: flex; background: #f1f5f9; border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { flex: 1; padding: 8px 4px; border-radius: 8px; font-size: 13px; color: var(--muted); }
.seg button.active { background: var(--card); color: var(--teal-dark); font-weight: 600;
  box-shadow: 0 1px 3px rgba(22,50,92,.20); }

/* ---------- 批次详情（全屏覆盖层） ---------- */
#detail-layer {
  position: fixed; inset: 0; z-index: 60;
  left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 520px;
  background: var(--bg); overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 100vh;
  animation: detail-in .22s ease;
}
@keyframes detail-in { from { opacity: .6; } to { opacity: 1; } }
.detail-head {
  position: sticky; top: 0; z-index: 20;
  background: var(--brand-grad); color: #fff; padding: 12px 14px 14px;
  box-shadow: 0 2px 10px rgba(22,50,92,.28);
}
.detail-back {
  display: inline-flex; align-items: center; gap: 2px;
  color: #fff; font-size: 13px; font-weight: 600;
  background: rgba(255,255,255,.20); border: 1px solid rgba(255,255,255,.30);
  border-radius: 999px; padding: 5px 14px 5px 8px;
}
.detail-back::before { content: "‹"; font-size: 24px; line-height: 1; margin-right: 2px; }
.detail-back:active { background: rgba(255,255,255,.32); }
.detail-top-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.detail-del-btn {
  display: inline-flex; align-items: center; gap: 4px;
  color: #fff; font-size: 13px; font-weight: 600;
  background: rgba(239,68,68,.30); border: 1px solid rgba(255,255,255,.38);
  border-radius: 999px; padding: 5px 14px;
}
.detail-del-btn:active { background: rgba(239,68,68,.55); transform: scale(.96); }
.detail-title { font-size: 17px; font-weight: 700; margin-top: 10px; }
.detail-sub { font-size: 12px; color: rgba(255,255,255,.88); margin-top: 3px; }
.pend-tag {
  display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px;
  background: rgba(254,249,195,.25); color: #fef9c3; font-size: 11px; font-weight: 600;
}

/* 详情顶部：产品总价 / 费用 / 汇率 */
.kv-card { padding: 12px 12px 10px; }
.kv-row { display: grid; grid-template-columns: 1.25fr 1fr 1fr auto; gap: 10px; align-items: end; }
.kv-item label { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.kv-save-btn {
  padding: 8px 16px; border-radius: 10px; font-size: 13px; font-weight: 700;
  background: var(--teal); color: #fff; white-space: nowrap;
}
.kv-save-btn:active { transform: scale(.95); }
.kv-save-btn:disabled { opacity: .6; }
.kv-in-wrap { position: relative; }
.kv-cur {
  position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  font-size: 12px; color: var(--teal-dark); font-weight: 700; pointer-events: none;
}
.kv-in {
  width: 100%; padding: 8px 9px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 14px; font-weight: 600; background: #fbfeff; outline: none;
  font-variant-numeric: tabular-nums;
}
.kv-in-wrap .kv-in { padding-left: 26px; }
.kv-in:focus { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(22,50,92,.18); }
.kv-in::placeholder { color: var(--muted2); font-weight: 400; font-size: 12px; }
.subtabs { display: flex; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 56px; z-index: 15; }
.subtabs button { flex: 1; padding: 12px 4px; font-size: 13.5px; color: var(--muted);
  border-bottom: 2px solid transparent; }
.subtabs button.active { color: var(--teal); font-weight: 700; border-bottom-color: var(--teal); }

/* 文件分类框（拖拽上传） */
.file-zones { display: flex; flex-direction: column; gap: 10px; }
.file-zone { border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden;
  background: var(--card); transition: border-color .15s, background .15s; }
.file-zone[data-fz="main"] { border-color: #fed7aa; }
.file-zone[data-fz="original"] { border-color: #fde68a; }
.file-zone[data-fz="attachment"] { border-color: #bfdbfe; }
.file-zone.drag { border-color: var(--teal); background: var(--teal-soft); }
.fz-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  background: #f8fafc; border-bottom: 1px solid var(--line); }
.file-zone.drag .fz-head { background: #dde5f3; }
.fz-desc { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fz-count { font-size: 12px; color: var(--muted); background: #fff; border: 1px solid var(--line);
  border-radius: 999px; padding: 1px 9px; min-width: 26px; text-align: center; }
.fz-list .fz-empty { display: block; padding: 9px 10px; }
.file-chip { display: flex; align-items: center; gap: 7px; padding: 8px 10px;
  border-bottom: 1px solid var(--line); font-size: 13px; cursor: pointer; }
.file-chip:last-child { border-bottom: none; }
.file-chip:active { background: #f8fafc; }
.fc-ico { flex: none; font-size: 15px; }
.fc-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-size { margin-left: 7px; color: var(--muted); font-size: 11px; font-style: normal; flex: none; }
.fc-act { flex: none; width: 30px; height: 30px; border-radius: 8px; display: inline-flex;
  align-items: center; justify-content: center; font-size: 14px; color: var(--muted);
  background: transparent; text-decoration: none; }
.fc-act:active { background: #eef2f7; }
.fc-act.fc-x { color: var(--red); }
.fz-drop { text-align: center; padding: 10px; font-size: 12.5px; color: var(--muted);
  border-top: 1px dashed var(--line); cursor: pointer; }
.fz-drop span { font-size: 11px; color: var(--muted2); }
.file-zone.drag .fz-drop { border-top-color: var(--teal); color: var(--teal); font-weight: 600; }

/* 文件在线预览层 */
#file-viewer { position: fixed; inset: 0; z-index: 120; background: #e6eef0;
  display: none; flex-direction: column; }
#file-viewer.open { display: flex; }
.fv-bar { flex: none; min-height: 54px; display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; background: var(--brand-grad); color: #fff;
  box-shadow: 0 2px 10px rgba(22,50,92,.3); }
.fv-title { flex: 1; min-width: 0; font-size: 14.5px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fv-dl { flex: none; color: #fff; text-decoration: none; font-size: 13px; font-weight: 600;
  border: 1.5px solid rgba(255,255,255,.75); border-radius: 999px; padding: 7px 15px; }
.fv-dl:active { background: rgba(255,255,255,.22); }
.fv-close { flex: none; width: 40px; height: 40px; border-radius: 50%; color: #fff;
  font-size: 17px; font-weight: 700; background: rgba(255,255,255,.20);
  border: 1px solid rgba(255,255,255,.3); display: inline-flex;
  align-items: center; justify-content: center; }
.fv-close:active { background: rgba(255,255,255,.34); }
.fv-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center;
  overflow: auto; background: #e6eef0; padding: 10px; }
.fv-body img { max-width: 100%; max-height: 100%; object-fit: contain;
  border-radius: 8px; box-shadow: 0 6px 24px rgba(15,23,42,.18); background: #fff; }
.fv-body iframe { width: 100%; height: 100%; border: 0; background: #fff;
  border-radius: 8px; box-shadow: 0 6px 24px rgba(15,23,42,.18); }
.fv-unsupported { color: var(--muted); font-size: 14px; padding: 30px; text-align: center; }
@media (min-width: 768px) {
  .file-zones { display: grid; grid-template-columns: repeat(3, 1fr); align-items: start; }
  #file-viewer { inset: 24px; border-radius: 14px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
}

/* 汇总视图 */
.sum-row { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 12px; border-bottom: 1px solid var(--line); }
.sum-row.used { background: var(--yellow-bg); }
.sum-model { flex: 1; font-size: 13.5px; }
.sum-calc { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.sum-calc b { color: var(--green); }
.sum-total { display: flex; justify-content: space-between; padding: 13px 12px;
  font-weight: 700; background: #f8fafc; border-radius: 0 0 12px 12px; }
.sum-edit-input { width: 84px; padding: 5px 7px; border: 1px solid var(--line);
  border-radius: 7px; text-align: right; }

/* 明细大表 */
.st-black { color: var(--red); font-weight: 600; }
.st-white { color: var(--green); font-weight: 600; }
.sep-row td { text-align: center; color: var(--yellow-tag); background: var(--yellow-bg);
  font-size: 12px; padding: 8px; }
.prod-row { cursor: pointer; }
.filter-sel { padding: 7px 9px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--card); font-size: 12.5px; }

/* ---------- 明细表格：可排序/筛选/调宽的表头 ---------- */
.grid-table { table-layout: fixed; }
.grid-table td { overflow: hidden; text-overflow: ellipsis; }
.grid-table td.cell-wrap { white-space: normal; word-break: break-word; }
.grid-table th.item-th { padding: 0; vertical-align: middle; user-select: none; }
.item-th .th-main {
  display: block; padding: 9px 22px 9px 10px; cursor: pointer; white-space: nowrap;
}
.item-th .th-main:active { background: #e2e8f0; }
.item-th .sort-ind { color: var(--teal); font-size: 10px; margin-left: 2px; }
.item-th .col-filter-btn {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  font-size: 10px; color: var(--muted2); cursor: pointer; line-height: 1;
  padding: 2px 1px; z-index: 2;
}
.item-th .col-filter-btn.on { color: var(--teal); font-weight: 700; }
.item-th .col-resizer {
  position: absolute; right: 0; top: 0; width: 9px; height: 100%;
  cursor: col-resize; z-index: 3;
}
body.col-resizing { cursor: col-resize !important; user-select: none; }
body.col-resizing * { cursor: col-resize !important; }

/* 回原表格小按钮（筛选/排序激活时出现） */
.grid-back-btn {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%;
  background: var(--teal-soft); color: var(--teal-dark); font-size: 16px; font-weight: 700;
  border: 1px solid var(--navy-line); line-height: 1;
}
.grid-back-btn:active { transform: scale(.92); }

/* 批内串号重复标红 */
.dup-cell { background: #fee2e2 !important; color: #b91c1c !important; font-weight: 700; }
.dup-warn { color: #b91c1c; font-weight: 700; }

/* 登记页查重块：黄=文件内重复，红=系统已有 */
.dup-box { margin-top: 8px; border-radius: 10px; padding: 8px 10px; font-size: 12px; }
.dup-y { background: var(--yellow-bg); border: 1px solid #fde047; }
.dup-y b { color: var(--yellow-tag); }
.dup-r { background: #fee2e2; border: 1px solid #fca5a5; }
.dup-r b { color: #b91c1c; }
.dup-imeis { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 4px; max-height: 90px; overflow-y: auto; }
.dup-imeis span {
  font-family: ui-monospace, monospace; font-size: 11px; padding: 1px 6px;
  background: rgba(255,255,255,.7); border-radius: 6px;
}

/* 单元格点击即改 */
td.cell-edit { cursor: text; }
td.cell-edit:hover { background: var(--navy-soft); }
td.cell-editing { padding: 0 !important; }
.cell-in {
  width: 100%; height: 100%; min-height: 34px; border: none; outline: 2px solid var(--teal);
  padding: 6px 8px; font-size: 12.5px; background: #fff; font-variant-numeric: tabular-nums;
}
td.cell-flash { animation: cellFlash .9s ease; }
@keyframes cellFlash { 0% { background: #bbf7d0; } 100% { background: transparent; } }
.op-th { width: 40px; min-width: 40px; text-align: center; color: var(--muted2); font-size: 11px; }
.op-cell { text-align: center; padding: 0 2px !important; }
.op-edit {
  width: 28px; height: 28px; border-radius: 8px; color: var(--muted);
  font-size: 13px; background: #f1f5f9;
}
.op-edit:active { transform: scale(.9); }

/* 批发开单（按串号出库） */
#ob-paste { width: 100%; resize: vertical; font-family: ui-monospace, monospace; font-size: 13px; }
.ob-pick-info { font-size: 12.5px; color: var(--text); background: var(--navy-soft); border-radius: 8px; padding: 7px 10px; }
.ob-sel-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 10px; background: var(--teal-soft); border-radius: 10px; margin-bottom: 8px;
}
.ob-sel-head b { color: var(--teal-dark); }
.ob-onekey { margin-left: auto; }
.ob-onekey input { width: 110px; padding: 5px 8px; font-size: 12px; }
.ob-group { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; overflow: hidden; }
.ob-group-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 8px; background: #f8fafc; border-bottom: 1px solid var(--line);
}
.ob-group-title { font-size: 12.5px; font-weight: 700; }
.ob-group-price { width: 86px; padding: 4px 7px; font-size: 12px; }
.ob-unit {
  display: grid; grid-template-columns: 1fr 92px 30px; align-items: center;
  gap: 6px; padding: 5px 8px; border-bottom: 1px dashed #eef2f7;
}
.ob-unit:last-child { border-bottom: none; }
.ob-unit-info { font-size: 11.5px; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ob-unit-info .num { font-size: 12.5px; font-weight: 600; }
.ob-sale { padding: 5px 7px; font-size: 12.5px; text-align: right; font-variant-numeric: tabular-nums; }
.ob-unit-del {
  width: 26px; height: 26px; border-radius: 50%; background: #f1f5f9;
  color: var(--muted); font-size: 12px;
}
.ob-unit-del:active { background: #fee2e2; color: #b91c1c; }

/* 出库选定横版报价表格（填完价截图发客户） */
.ob-quote {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; box-shadow: 0 1px 3px rgba(15,23,42,.06);
}
.ob-quote-head {
  padding: 8px 12px; background: var(--brand-grad); color: #fff;
  font-size: 12.5px; font-weight: 700;
}
.ob-quote-foot {
  padding: 7px 12px; border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--text); text-align: right; background: #f8fafc;
}
.ob-quote-foot .money { color: var(--teal-deep); }
.ob-table { font-size: 12px; min-width: 560px; width: 100%; }
.ob-quote .grid-wrap { border-radius: 0; border: none; box-shadow: none; margin: 0; }
.ob-table td { padding: 4px 6px !important; }
.ob-table th { padding: 5px 6px !important; }
.ob-table th.item-th { overflow: hidden; }
.ob-table .th-main { padding: 5px 24px 5px 6px !important; overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
.ob-table .col-filter-btn { right: 10px !important; z-index: 7; }
.ob-sale-cell { padding: 2px 4px !important; }
.ob-sale-cell .ob-sale {
  width: 100%; padding: 4px 5px; font-size: 12.5px; text-align: right;
  border: 1px solid var(--navy-line); border-radius: 6px; background: var(--navy-soft);
  font-variant-numeric: tabular-nums; font-weight: 700; color: var(--teal-deep);
}
.ob-sale-cell .ob-sale:focus { outline: 2px solid var(--teal); border-color: transparent; }
.ob-model-cell .ob-model-name { font-size: 11.5px; line-height: 1.35; word-break: break-word; }
.ob-color-tag { margin-top: 2px; font-size: 10px; padding: 0 6px; }

/* 出库记录全局页 */
.ob-sum-card { background: var(--navy-soft); border: 1px solid var(--navy-line); }
.ob-sum-cur { font-size: 13px; line-height: 1.9; display: flex; justify-content: space-between; gap: 10px; }
.ob-sum-cur .profit-pos, .ob-sum-cur .profit-neg { font-size: 13px; }
.ob-rec { transition: transform .1s; }
.ob-rec:active { transform: scale(.985); }
.obd-kvs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.obd-kv { display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.obd-kv > span { color: var(--muted); font-size: 11.5px; }
.obd-kv > b { font-size: 14px; font-variant-numeric: tabular-nums; }
.obd-prod-head { padding: 9px 12px; font-size: 12.5px; font-weight: 700; background: #f8fafc; border-bottom: 1px solid var(--line); }
/* 9.26 出库详情：表格上方基本信息（出库时间/客户/总金额） */
.obd-meta {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 26px;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
}
.obd-meta-item { display: flex; align-items: baseline; gap: 6px; }
.obd-meta-item > span { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.obd-meta-item > b { font-size: 13.5px; font-variant-numeric: tabular-nums; word-break: break-all; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
/* 9.26 出库详情表布局：行高舒适、金额右对齐（与表头一致）、列不挤 */
.ob-detail-table { min-width: 620px; }
.ob-detail-table td { padding: 10px 8px !important; }
.ob-detail-table td.money { text-align: right; white-space: nowrap; padding-right: 24px !important; }
.note-hl {
  background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: 8px;
  padding: 8px 10px; font-size: 13px; line-height: 1.6; word-break: break-word;
}

/* ===== 9.0 TableKit：列宽拖拽 / 冻结列 / 小返回 / 勾选条 ===== */
.tk-drag {
  position: absolute; right: 0; top: 0; width: 7px; height: 100%;
  cursor: col-resize; z-index: 6;
}
.tk-drag:hover { background: rgba(22,50,92,.30); }
.tk-scroll { max-height: 48vh; overflow: auto; -webkit-overflow-scrolling: touch; }
/* 冻结列：报价表/详情表的勾选列(34px) + IMEI 列 */
.ob-table .tk-c0, .ob-table .tk-c1 { position: sticky; z-index: 3; }
.ob-table .tk-c0 { left: 0; width: 34px; min-width: 34px; max-width: 34px; text-align: center; padding: 2px !important; }
.ob-table .tk-c1 { left: 34px; box-shadow: 7px 0 7px -7px rgba(15,23,42,.35); }
.ob-table tbody .tk-c0, .ob-table tbody .tk-c1 { background: #fff; }
.ob-table tbody tr:nth-child(even) .tk-c0,
.ob-table tbody tr:nth-child(even) .tk-c1 { background: #f8fafc; }
.ob-table thead .tk-c0, .ob-table thead .tk-c1 { background: #f1f5f9; z-index: 21; }
.ob-check-cell input { vertical-align: middle; }
/* 台账等普通表冻结首列 */
.tk-freeze-first tbody td:first-child { position: sticky; left: 0; background: #fff; z-index: 2;
  box-shadow: 7px 0 7px -7px rgba(15,23,42,.3); }
.tk-freeze-first thead th:first-child { position: sticky; left: 0; z-index: 21; background: #f1f5f9; }
/* 小返回键工具条 */
.tk-bar {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px;
  background: var(--teal-soft); border-bottom: 1px solid var(--navy-line); font-size: 12px;
}
.tk-bar.hidden { display: none; }
.tk-back, .tk-back-mini {
  background: var(--teal); color: #fff; border-radius: 999px;
  padding: 2px 10px; font-size: 12px; white-space: nowrap;
}
.tk-back-mini { padding: 1px 9px; font-size: 11px; }
.tk-selbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 10px; margin-bottom: 8px;
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; font-size: 12.5px;
}
.tk-selbar.hidden { display: none; }
.ob-bulk-bar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 7px 10px; margin: 2px 0 8px;
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px;
}
.ob-bulk-bar .input { padding: 5px 8px; font-size: 12.5px; width: 108px; }
/* 详情表表头可排序样式（非 item-th 的普通 th） */
.ob-detail-table th { padding: 0 !important; vertical-align: middle; user-select: none; }
.tk-th-main {
  display: block; padding: 6px 24px 6px 7px; cursor: pointer; white-space: nowrap;
}
.tk-th-main:active { background: #e2e8f0; }
.ob-detail-table .col-filter-btn {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-size: 10px; color: var(--muted2); cursor: pointer; padding: 2px 1px; z-index: 7;
}
.ob-detail-table .col-filter-btn.on { color: var(--teal); font-weight: 700; }
.tk-sort-asc .tk-th-main::after { content: " ▲"; color: var(--teal); font-size: 10px; }
.tk-sort-desc .tk-th-main::after { content: " ▼"; color: var(--teal); font-size: 10px; }
.tk-table .tk-sortable { user-select: none; }
.tk-freeze-first .tk-sort-asc::after { content: " ▲"; color: var(--teal); font-size: 10px; }
.tk-freeze-first .tk-sort-desc::after { content: " ▼"; color: var(--teal); font-size: 10px; }

/* 列筛选弹层 */
#grid-filter-pop {
  position: fixed; z-index: 200; width: 248px; max-height: 340px;
  background: var(--card); border-radius: 12px;
  box-shadow: 0 12px 40px rgba(15,23,42,.22); border: 1px solid var(--line);
  display: flex; flex-direction: column; overflow: hidden;
  opacity: 0; transform: scale(.97); transform-origin: top left;
  transition: opacity .12s ease, transform .12s ease;
}
#grid-filter-pop.open { opacity: 1; transform: scale(1); }
.gfp-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13px;
}
.gfp-x { color: var(--muted); cursor: pointer; padding: 0 4px; }
.gfp-search { padding: 8px 10px 4px; }
.gfp-search input {
  width: 100%; padding: 6px 9px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 12.5px;
}
.gfp-actions { display: flex; gap: 14px; padding: 2px 12px 6px; font-size: 12px; }
.gfp-actions a { color: var(--teal); cursor: pointer; }
.gfp-list { flex: 1; overflow-y: auto; padding: 0 10px 6px; max-height: 170px; }
.gfp-item {
  display: flex; align-items: center; gap: 7px; padding: 4px 2px;
  font-size: 12.5px; cursor: pointer; white-space: nowrap;
}
.gfp-item input { accent-color: var(--teal); }
.gfp-item span { overflow: hidden; text-overflow: ellipsis; }
.gfp-foot {
  display: flex; gap: 8px; padding: 9px 10px; border-top: 1px solid var(--line);
}
.gfp-foot .btn { flex: 1; padding: 7px 0; }

/* 列设置弹层 */
.col-toggle {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 4px; border-bottom: 1px solid var(--bg);
  font-size: 13.5px; cursor: pointer;
}
.col-toggle input { width: 17px; height: 17px; accent-color: var(--teal); }

/* ---------- 算账记录（多表格 + 电子表格） ---------- */
.calc-shell {
  display: flex;
  height: calc(100dvh - var(--tabbar-h) - env(safe-area-inset-bottom) - 8px);
  background: var(--card);
  border-radius: 12px;
  overflow: hidden;
}
/* 左侧表格列表 */
.calc-list {
  width: 100%;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.cs-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  border-bottom: 1px solid var(--line);
}
.cs-search { margin: 10px 12px 6px; }
.cs-groups { flex: 1; overflow-y: auto; padding: 4px 8px calc(14px + env(safe-area-inset-bottom)); }
.cs-group { margin-bottom: 4px; }
.cs-group-head {
  display: flex; align-items: center; gap: 6px;
  padding: 9px 8px; font-size: 13.5px; font-weight: 600; color: var(--navy);
  user-select: none; cursor: pointer; border-radius: 8px;
}
.cs-group-head:active { background: var(--bg); }
.cs-caret { width: 12px; color: var(--muted); font-size: 11px; }
.cs-folder-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-count {
  font-size: 11px; font-weight: 500; color: var(--muted);
  background: var(--bg); border-radius: 999px; padding: 1px 8px;
}
.cs-folder-ops { padding: 0 8px; color: var(--muted); font-size: 16px; line-height: 1; }
.cs-group-body { padding: 2px 0 6px; }
.cs-row {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 10px; border-radius: 10px; cursor: pointer;
}
.cs-row:active { background: var(--bg); }
.cs-row.active { background: var(--teal-soft); }
.cs-ico {
  flex: none; width: 30px; height: 30px; border-radius: 8px;
  background: #eef2f7; color: var(--navy);
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.cs-row.active .cs-ico { background: var(--teal); color: #fff; }
.cs-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cs-name {
  font-size: 14px; color: var(--navy); font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cs-meta { font-size: 11.5px; color: var(--muted); }
.cs-more { flex: none; padding: 4px 8px; color: var(--muted); font-size: 18px; line-height: 1; }
.cs-op { width: 100%; margin-bottom: 8px; text-align: left; justify-content: flex-start; }

/* 右侧编辑器：手机上整屏滑入 */
.calc-editor {
  position: fixed; inset: 0; z-index: 80;
  background: var(--bg);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .22s ease;
}
.calc-editor.open { transform: translateX(0); }
.calc-editor-empty { display: none; }
.ce-head {
  display: flex; align-items: center; gap: 10px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  background: var(--card); border-bottom: 1px solid var(--line);
}
.ce-title {
  flex: 1; min-width: 0; font-size: 16px; font-weight: 700; color: var(--navy);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer;
}
.ce-rename-ico { color: var(--muted); font-size: 12px; font-weight: 400; }
.ce-export { flex: none; }
.ce-toolbar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 8px 12px; background: var(--card); border-bottom: 1px solid var(--line);
}
.ce-tb {
  border: 1px solid var(--line); background: var(--card); border-radius: 8px;
  padding: 5px 9px; font-size: 13px; color: var(--navy);
  display: inline-flex; align-items: center; gap: 4px; cursor: pointer;
}
.ce-tb:active { background: var(--bg); }
.ce-tb.on { border-color: var(--teal); background: var(--teal-soft); color: var(--teal); }
.ce-tb .a-sample { color: #dc2626; font-weight: 700; }
.ce-sep { width: 1px; height: 20px; background: var(--line); margin: 0 3px; }
.ce-save { margin-left: auto; }
.ce-save.ok { color: var(--green); }
.ce-color-hidden {
  position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none;
}
.ce-grid-wrap { flex: 1; overflow: auto; position: relative; background: var(--card); }
.ce-foot {
  padding: 6px 12px calc(6px + env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--line);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.calc-table { border-collapse: separate; border-spacing: 0; width: auto; min-width: 100%; font-size: 13px; }
.calc-table th, .calc-table td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0;
}
.calc-table .calc-col-head,
.calc-table .calc-row-head,
.calc-table .calc-corner {
  background: #f1f5f9; color: var(--muted);
  font-size: 11px; font-weight: 600; text-align: center;
  user-select: none; white-space: nowrap;
}
.calc-table .calc-col-head {
  position: sticky; top: 0; z-index: 2;
  min-width: 104px; padding: 7px 8px;
}
.calc-table .calc-col-head.on { background: #dde5f3; color: var(--navy-deep); }
.calc-table .calc-row-head {
  position: sticky; left: 0; z-index: 2;
  min-width: 40px; width: 40px; padding: 7px 0;
}
.calc-table .calc-row-head.on { background: #dde5f3; color: var(--navy-deep); }
.calc-table .calc-corner {
  position: sticky; left: 0; top: 0; z-index: 4; min-width: 40px; width: 40px;
}
.calc-cell {
  min-width: 104px; max-width: 240px;
  padding: 7px 9px !important;
  white-space: pre-wrap; word-break: break-word;
  vertical-align: top; line-height: 1.45; background: var(--card);
  cursor: cell;
}
.calc-cell.num { text-align: right; font-variant-numeric: tabular-nums; }
.calc-cell.selected {
  outline: 2px solid var(--teal); outline-offset: -2px;
  position: relative; z-index: 1;
}
.calc-cell.editing {
  outline: 2px solid var(--teal); outline-offset: -2px;
  background: #fff; cursor: text; position: relative; z-index: 3;
}
.calc-err { color: var(--red); background: #fef2f2 !important; }

@media (min-width: 1024px) {
  .calc-shell {
    height: calc(100vh - 28px);
    border: 1px solid var(--line);
    margin: 0 14px;
    width: auto;
  }
  .calc-list { width: 296px; flex: none; border-right: 1px solid var(--line); }
  .cs-head { padding-top: 12px; }
  .cs-groups { padding-bottom: 14px; }
  .calc-editor {
    position: static; transform: none; z-index: auto;
    flex: 1; min-width: 0;
  }
  .calc-editor:not(.open) { display: none; }
  .calc-shell:has(.calc-editor:not(.open)) .calc-list { width: 100%; max-width: 720px; margin: 0 auto; border-right: none; }
  .calc-editor.open .calc-editor-empty { display: none; }
  .calc-editor-empty {
    display: flex; flex: 1; flex-direction: column;
    align-items: center; justify-content: center; gap: 10px;
    color: var(--muted); font-size: 14px;
  }
  .calc-editor-empty span { font-size: 46px; color: #cbd5e1; }
  .ce-head { padding: 10px 14px; }
  .ce-foot { padding-bottom: 8px; }
  .ce-back { display: none; }
}
@media (max-width: 1023px) {
  .calc-shell { border-radius: 0; height: calc(100dvh - var(--tabbar-h) - env(safe-area-inset-bottom)); }
  #calc-save-state { flex-basis: 100%; margin-left: 0; text-align: left; order: 10; }
  .ce-toolbar .btn, .ce-tb { padding: 6px 10px; }
}

/* 出库 */
.ob-stat { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.ob-stat .box { background: var(--navy-soft); border: 1px solid var(--navy-line); border-radius: 11px; padding: 11px 8px; text-align: center; }
.ob-stat .v { font-size: 15px; font-weight: 700; color: var(--teal-dark); }
.ob-stat .l { font-size: 11px; color: var(--muted); margin-top: 3px; }
.ob-card .ob-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ob-card .ob-top b { flex: 1; min-width: 0; }
.ob-del {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
  background: #f1f5f9; color: var(--muted); font-size: 12px; line-height: 1;
}
.ob-del:active { background: #fee2e2; color: var(--red); }
.ob-customer { margin-top: 9px; font-size: 14px; font-weight: 600; color: var(--teal-dark); }
.ob-units { display: flex; gap: 8px; margin-top: 8px; }
.ob-units span { flex: 1; text-align: center; font-size: 12px; color: var(--muted);
  background: #f8fafc; border: 1px solid var(--line); border-radius: 9px; padding: 7px 4px; }
.ob-units b { font-size: 15px; color: var(--text); }
.ob-units .ou-remain b { color: var(--teal); }
.ob-note { line-height: 1.7; background: var(--navy-soft); border: 1px solid var(--navy-line); color: var(--navy-dark) !important;
  border-radius: 8px; padding: 6px 9px; }
.req { color: var(--red); }
.profit-pos { color: var(--green); font-weight: 700; }
.profit-neg { color: var(--red); font-weight: 700; }
.check-list { max-height: 260px; overflow-y: auto; border: 1px solid var(--line);
  border-radius: 10px; background: var(--card); }
.check-item { display: flex; gap: 9px; align-items: flex-start; padding: 9px 11px;
  border-bottom: 1px solid var(--line); font-size: 12.5px; }
.check-item:last-child { border-bottom: none; }
.check-item input { margin-top: 2px; }
.check-item .ci-sub { color: var(--muted); font-size: 11px; margin-top: 2px; }
.check-item.disabled { opacity: .45; }

/* 供货商管理 */
.sup-card .aliases { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.alias-tag { background: #f1f5f9; border-radius: 8px; padding: 3px 8px; font-size: 12px;
  color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.alias-tag button { color: var(--muted2); font-size: 13px; line-height: 1; }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: rgba(15,23,42,.9); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13px; z-index: 200; max-width: 84%; text-align: center;
}

.empty { text-align: center; color: var(--muted2); padding: 44px 20px; font-size: 13px; line-height: 1.9; }
.empty .big { font-size: 40px; display: block; margin-bottom: 8px; }

@media (min-width: 521px) {
  body { background: #d8dee8; }
}

/* ---------- 登录态 / 改密页 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 30px 24px calc(var(--tabbar-h) + 30px);
}
.login-logo { font-size: 56px; line-height: 1; margin-bottom: 8px; }
.login-wrap h2 { font-size: 22px; font-weight: 700; color: var(--navy); margin-top: 4px; }
.login-card {
  width: 100%; max-width: 360px; margin-top: 16px;
  background: var(--card); border-radius: 16px; padding: 18px 16px;
  box-shadow: 0 6px 24px rgba(15,23,42,.08);
}
.remember-row {
  display: flex; align-items: center; gap: 6px;
  margin-top: 12px; color: var(--muted); cursor: pointer; user-select: none;
}
.remember-row input { width: 16px; height: 16px; accent-color: var(--teal); }
.mt14 { margin-top: 14px; }
.me-section-title {
  font-size: 12px; color: var(--muted2); font-weight: 600;
  margin: 14px 4px 6px; text-transform: uppercase; letter-spacing: .04em;
}
.logout-mini {
  background: rgba(255,255,255,.12); color: #fff;
  padding: 5px 12px; border-radius: 999px; font-size: 12px;
}
.logout-mini:active { background: rgba(255,255,255,.2); }
.btn-danger-solid { background: var(--red); color: #fff; }
.btn-danger-solid:active { background: #dc2626; }

/* ---------- 拖拽 Excel 上传遮罩 ---------- */
#drop-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(15,23,42,.7);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 10px;
  color: #fff; font-size: 18px; font-weight: 600;
  border: 4px dashed rgba(201,165,87,.85);
  pointer-events: none; /* 让 drop 事件落到 body 上 */
}
#drop-overlay .drop-big { font-size: 60px; }
#drop-overlay .drop-sub { font-size: 13px; font-weight: 400; color: #cbd5e1; }

/* ---------- 平板 / 桌面响应式 ---------- */
@media (min-width: 768px) {
  #app { max-width: 100%; }
  /* 弹层改为居中 modal */
  #sheet {
    bottom: auto; top: 50%; left: 50%;
    transform: translate(-50%,-50%) scale(.96);
    max-width: 560px; border-radius: 18px;
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: transform .25s ease, opacity .25s ease, visibility .25s;
  }
  #sheet.open {
    transform: translate(-50%,-50%) scale(1);
    opacity: 1; visibility: visible; pointer-events: auto;
  }
  /* 桌面/平板：弹层可手动拉伸（右下角拖角），选完串号后自动展开成大窗 */
  #sheet {
    resize: both; min-width: 420px; min-height: 320px;
    max-width: 96vw; max-height: 94vh;
  }
  #sheet.sheet-lg {
    width: min(1060px, 94vw); height: 88vh;
    max-width: 98vw; max-height: 96vh;
  }
  /* 大窗时报价表格内部滚动，价格栏/确认按钮始终可见 */
  #sheet.sheet-lg .ob-quote .grid-wrap { max-height: 44vh; }
  /* 右下角拉伸手柄（强化提示，不拦截原生拖拽区） */
  #sheet.sheet-lg::after {
    content: ""; position: absolute; right: 2px; bottom: 2px; z-index: 5;
    width: 16px; height: 16px; pointer-events: none;
    background:
      linear-gradient(135deg, transparent 50%, var(--muted2) 50%, var(--muted2) 60%, transparent 60%, transparent 72%, var(--muted2) 72%, var(--muted2) 82%, transparent 82%);
    opacity: .55;
  }
  #detail-mask { display: block; }
  #detail-layer {
    max-width: 920px; border-radius: 18px;
    left: 50%; transform: translateX(-50%);
    box-shadow: 0 24px 80px rgba(15,23,42,.35);
  }
  /* 首页卡片用两列 */
  .page-pad { padding: 18px; }
  .month-body { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  /* 平板/电脑：返回键放大更明显 */
  .detail-back { font-size: 15px; padding: 9px 20px 9px 12px; }
  .detail-back::before { font-size: 30px; }
  .sheet-back { width: 46px; height: 46px; font-size: 36px; line-height: 42px; left: 12px; }
  .sheet-x { width: 44px; height: 44px; font-size: 19px; }
}
@media (min-width: 1024px) {
  /* 桌面：左侧 240px 清新浅青绿侧边栏 + 右侧铺满主内容 */
  body { background: #e7f0f1; }
  #app {
    display: grid;
    grid-template-columns: 240px 1fr;
    max-width: 100%;
    min-height: 100vh;
    box-shadow: none;
  }
  #view { padding-bottom: 24px; min-width: 0; grid-column: 2; grid-row: 1; }
  #tabbar {
    position: sticky; bottom: auto; left: auto; top: 0;
    transform: none;
    grid-column: 1; grid-row: 1; align-self: start;
    width: 240px; height: 100vh;
    max-width: none;
    flex-direction: column;
    padding: 0; gap: 0;
    background: linear-gradient(180deg, #fafbfd 0%, #f0f4fa 100%);
    border-top: none;
    border-right: 1px solid var(--navy-line);
  }
  .sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: calc(18px + env(safe-area-inset-top)) 20px 20px;
  }
  .sidebar-brand .brand-logo { font-size: 26px; line-height: 1; }
  .sidebar-brand .brand-name { font-size: 17px; font-weight: 700; color: var(--navy-deep); white-space: nowrap; }
  .tab-list { flex: 1; flex-direction: column; gap: 4px; padding: 8px 12px; }
  #tabbar .tab {
    flex: none; flex-direction: row; justify-content: flex-start;
    gap: 12px; padding: 12px 14px;
    font-size: 14.5px; color: rgba(22,50,92,.65); border-radius: 10px;
  }
  #tabbar .tab .tab-ico { font-size: 18px; }
  #tabbar .tab.active { background: #dde5f3; color: var(--navy-deep); font-weight: 600; }
  #tabbar .tab.active .tab-ico { color: var(--navy); }
  #tabbar .tab:active { transform: none; }
  .sidebar-version {
    display: block; padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
    font-size: 11px; color: rgba(22,50,92,.55); border-top: 1px solid var(--navy-line);
  }
  .month-body { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
  .home-head { border-radius: 0 0 14px 14px; padding: calc(16px + env(safe-area-inset-top)) 22px 30px; }
  .stats { max-width: none; margin-left: 0; margin-right: 0; padding: 0 22px; gap: 14px; }
  .page-pad { max-width: none; padding: 18px 22px; }
  /* 详情覆盖层相对主内容区（侧栏右侧）居中 */
  #detail-layer {
    left: 240px; transform: none;
    max-width: calc(100vw - 240px);
  }
}

/* ---------- 登录/改密全屏态：隐藏导航 ---------- */
body.auth-mode #tabbar { display: none; }
body.auth-mode #view { padding-bottom: 0; }
@media (min-width: 1024px) {
  body.auth-mode #app { grid-template-columns: 1fr; max-width: 560px; margin: 0 auto; box-shadow: none; }
  body.auth-mode #view { grid-column: 1; grid-row: 1; min-height: 100vh; display: flex; }
  body.auth-mode .login-wrap { min-height: 100vh; flex: 1; justify-content: center; }
}

/* =========================================================
 * 误删防护：24h 锁定条 / 只读单元格 / 回收站 / 日志 / 备份
 * ======================================================= */

/* 锁定条 */
.lock-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--navy-soft); border: 1px solid var(--navy-line); color: var(--navy-dark);
  border-radius: 10px; padding: 9px 12px; margin: 10px 0 2px; font-size: 12.5px; line-height: 1.5;
}
.lock-bar button {
  flex: 0 0 auto; border: none; border-radius: 8px; cursor: pointer;
  background: var(--navy); color: #fff; font-size: 12.5px; font-weight: 600; padding: 7px 14px;
}
.lock-bar button:active { background: var(--navy-dark); }
.lock-bar.lock-on {
  background: var(--gold-soft); border-color: var(--gold); color: var(--gold-dark);
}
.lock-bar.lock-on button { background: #fff; color: var(--gold-dark); border: 1px solid var(--gold); }

/* 锁定时头部字段只读 */
input.kv-locked {
  background: #f6f7fa !important; color: var(--muted);
  -webkit-text-fill-color: var(--muted);
}

/* 只读单元格：不响应点击、无 hover */
td.cell-readonly { cursor: default; background: transparent; }
td.cell-readonly:hover { background: transparent; }

/* 手机端「第一次点只选中」待编辑高亮 */
td.cell-arm {
  background: var(--navy-soft) !important;
  box-shadow: inset 0 0 0 2px var(--navy);
}

/* 单台明细回收站 */
.recycle-card {
  margin-top: 14px; border: 1px dashed var(--navy-line); border-radius: 12px;
  background: #fbfcfe; overflow: hidden;
}
.rc-head {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  border: none; background: transparent; cursor: pointer;
  padding: 11px 14px; font-size: 13px; color: var(--navy-dark); font-weight: 600;
}
.rc-chev { color: var(--muted); transition: transform .2s ease; font-size: 12px; }
.recycle-card.open .rc-chev { transform: rotate(180deg); }
.rc-body { border-top: 1px solid var(--navy-line); padding: 6px 8px; }
.rc-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 6px; border-bottom: 1px solid #eef1f6;
}
.rc-item:last-child { border-bottom: none; }
.rc-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rc-info b { font-size: 13px; color: var(--navy-dark); }
.rc-foot { padding: 9px 8px 6px; line-height: 1.7; }

/* 危险描边按钮（关于页危险区） */
.btn-danger-ghost {
  background: #fff; color: var(--red); border: 1px solid var(--red); border-radius: 10px;
}
.btn-danger-ghost:active { background: #fef2f2; }
.about-danger {
  margin: 8px 16px 22px; padding: 14px; border-top: 1px dashed var(--navy-line);
}

/* 我的页：数据安全卡 */
.backup-card { padding: 0; overflow: hidden; }
.backup-item { background: linear-gradient(90deg, var(--gold-soft) 0%, #fff 70%); }

/* 每日备份列表 */
.bak-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 14px; border-bottom: 1px solid #eef1f6;
}
.bak-item:last-child { border-bottom: none; }
.bak-info { display: flex; flex-direction: column; gap: 3px; }
.bak-info b { color: var(--navy-dark); font-size: 14px; }

/* 操作日志 */
.log-filters { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.log-filters select { flex: 1 1 30%; min-width: 90px; }
.log-filters input { flex: 1 1 100%; }
.log-item {
  border: 1px solid var(--navy-line); border-radius: 10px; padding: 9px 11px;
  margin-bottom: 8px; background: #fff;
}
.log-top { display: flex; align-items: center; gap: 8px; }
.log-top b { font-size: 13.5px; color: var(--navy-dark); min-width: 0; }
.log-detail { margin-top: 5px; line-height: 1.65; color: var(--muted); }
.log-meta { margin-top: 5px; color: var(--muted2); }


