/* 门店统计助手 - 样式（浅色主题 / 风格 A 克制现代）
   原则：所有既有 class 名保留，10 个老模板零改动；只统一间距、层级与骨架。 */
* { margin:0; padding:0; box-sizing:border-box; }
:root{
  --bg:#f6f7f9; --card:#fff; --line:#e6e8ec; --line2:#eef0f3;
  --text:#1a1d23; --muted:#6b7280; --muted2:#9aa1ab;
  --primary:#2f6bff; --primary-soft:#eef3ff;
  --green:#0f9d6e; --green-soft:#e8f7f1;
  --amber:#c47d00; --amber-soft:#fdf4e3;
  --red:#d94a4a;
  --shadow:0 1px 2px rgba(24,35,60,.04), 0 4px 14px rgba(24,35,60,.035);
  --side-w:216px; --side-mini:64px; --top-h:52px;
  --r-card:12px; --r-ctl:8px;
}
body{
  font-family:-apple-system,"Segoe UI","Microsoft YaHei","PingFang SC",sans-serif;
  background:var(--bg); color:var(--text); font-size:14px; line-height:1.55;
}
.app{ display:flex; min-height:100vh; }
.work{ flex:1; min-width:0; display:flex; flex-direction:column; }

/* 左侧骨架：分组导航 + 图标徽章，可收起 */
.side{ width:var(--side-w); flex:0 0 var(--side-w); background:var(--card);
  border-right:1px solid var(--line); padding:18px 12px 14px;
  position:sticky; top:0; height:100vh; display:flex; flex-direction:column; }
.brand{ display:flex; align-items:center; gap:10px; padding:2px 6px 16px; }
.brand .logo{ width:34px; height:34px; flex:0 0 34px; border-radius:10px;
  background:var(--primary); display:flex; align-items:center; justify-content:center;
  color:#fff; font-weight:700; font-size:14px; }
.brand-txt{ min-width:0; }
.brand h1{ font-size:14.5px; font-weight:600; white-space:nowrap; }
.brand p{ font-size:11px; color:var(--muted2); white-space:nowrap; }
.nav{ display:flex; flex-direction:column; gap:2px; flex:1;
  overflow-y:auto; overflow-x:hidden; padding-right:2px; }
.nav-group{ font-size:10.5px; color:var(--muted2); letter-spacing:1px;
  padding:14px 10px 5px; white-space:nowrap; }
.nav-group:first-child{ padding-top:2px; }
.nav-item{ display:flex; align-items:center; gap:10px; padding:7px 10px;
  border-radius:var(--r-ctl); color:#4b5563; font-size:13.5px; transition:.12s;
  min-height:34px; white-space:nowrap; }
.nav-ico{ width:18px; height:18px; flex:0 0 18px; border-radius:5px;
  background:#f0f2f5; color:#8b93a0; display:flex; align-items:center;
  justify-content:center; font-size:10.5px; line-height:1; }
.nav-item:hover{ background:#f7f8fa; }
.nav-item.active{ background:var(--primary-soft); color:var(--primary); font-weight:600; }
.nav-item.active .nav-ico{ background:var(--primary); color:#fff; }
.nav .dot{ margin-left:auto; font-size:11px; background:var(--amber-soft); color:var(--amber);
  padding:1px 6px; border-radius:9px; }
.side-foot{ margin-top:auto; padding:12px 8px 2px; border-top:1px solid var(--line2);
  font-size:11px; color:var(--muted2); }
.side-foot .row{ display:flex; justify-content:space-between; padding:2px 0; }
.side-foot .ok{ color:var(--green); }

/* 顶栏：面包屑 + 数据截止 */
.topbar{ position:sticky; top:0; z-index:20; height:var(--top-h); flex:0 0 var(--top-h);
  background:#fff; border-bottom:1px solid var(--line);
  display:flex; align-items:center; gap:14px; padding:0 28px; }
.icon-btn{ width:30px; height:30px; flex:0 0 30px; border:1px solid var(--line);
  border-radius:var(--r-ctl); background:#fff; cursor:pointer; padding:0;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px; }
.icon-btn:hover{ background:#f7f8fa; }
.icon-btn i{ display:block; width:13px; height:1.5px; background:#6b7280; border-radius:2px; }
.crumb{ font-size:12.5px; color:var(--muted2); display:flex; align-items:center; gap:7px; }
.crumb b{ color:var(--text); font-weight:600; }
.top-right{ margin-left:auto; display:flex; align-items:center; gap:7px; color:var(--muted); }
.status-dot{ width:7px; height:7px; border-radius:50%; background:var(--green); }

/* 收起态（按钮切换，localStorage 记住） */
.app.side-collapsed .side{ width:var(--side-mini); flex-basis:var(--side-mini); padding:16px 8px; }
.app.side-collapsed .brand{ justify-content:center; padding:2px 0 16px; }
.app.side-collapsed .brand-txt,
.app.side-collapsed .nav-txt,
.app.side-collapsed .side-foot{ display:none; }
.app.side-collapsed .nav-group{ font-size:0; padding:8px 0 0; height:8px; overflow:hidden; }
.app.side-collapsed .nav-item{ justify-content:center; padding:7px 0; }

.main{ flex:1; padding:22px 28px 60px; min-width:0; }
.page-head{ margin-bottom:18px; }
.page-head h2{ font-size:20px; font-weight:650; letter-spacing:.2px; }
.page-head p{ color:var(--muted); font-size:12.5px; margin-top:4px; }

/* 卡片与数字层级 */
.card{ background:var(--card); border:1px solid var(--line);
  border-radius:var(--r-card); box-shadow:var(--shadow); }
.card-head{ padding:13px 18px; border-bottom:1px solid var(--line2);
  display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; }
.card-head h3{ font-size:14px; font-weight:600; }
.card-head .sub{ font-size:11.5px; color:var(--muted2); font-weight:400; }
.card-body{ padding:16px 18px; }
.grid{ display:grid; gap:14px; }
.g4{ grid-template-columns:repeat(4,minmax(0,1fr)); }
.g3{ grid-template-columns:repeat(3,minmax(0,1fr)); }
.g2{ grid-template-columns:repeat(2,minmax(0,1fr)); }
.right-col{ display:flex; flex-direction:column; gap:12px; align-items:stretch; }
.stat{ padding:16px 18px; }
.stat .k{ font-size:12px; color:var(--muted); }
.stat .v{ font-size:23px; font-weight:650; margin-top:6px; font-variant-numeric:tabular-nums; }
.stat .v small{ font-size:12px; font-weight:500; color:var(--muted); margin-left:3px; }
.stat .d{ font-size:11.5px; margin-top:4px; color:var(--muted2); }

/* 控件（原来日期/下拉框重复定义了两遍，这里合并成一处） */
input[type=date], input[type=text], select{
  font-family:inherit; font-size:13px; padding:6px 10px; min-height:32px;
  border:1px solid var(--line); border-radius:var(--r-ctl);
  background:#fff; color:var(--text); outline:none; transition:border-color .12s; }
input[type=date]:focus, input[type=text]:focus, select:focus{ border-color:var(--primary); }
.btn{ border:1px solid var(--line); background:#fff; color:var(--text); padding:6px 13px;
  border-radius:var(--r-ctl); font-size:13px; cursor:pointer; transition:.12s;
  text-decoration:none; display:inline-block; }
.btn:hover{ background:#f8f9fb; }
.btn.primary{ background:var(--primary); border-color:var(--primary); color:#fff; font-weight:500; }
.btn.primary:hover{ background:#255be0; }
.btn.sm{ padding:4px 10px; font-size:12px; }
.btn.danger{ color:#c0392b; border-color:#edc7c2; }
.btn.danger:hover{ background:#fdf2f0; }
.btn:disabled{ opacity:.45; cursor:not-allowed; }
.badge{ display:inline-block; font-size:11.5px; padding:2px 8px; border-radius:20px;
  font-weight:500; white-space:nowrap; }
.badge.ok{ background:var(--green-soft); color:var(--green); }
.badge.warn{ background:var(--amber-soft); color:var(--amber); }
.badge.err{ background:#fdeeee; color:var(--red); }
.badge.info{ background:var(--primary-soft); color:var(--primary); }
.badge.gray{ background:#f2f3f5; color:#6b7280; }

/* 表格 */
table{ width:100%; border-collapse:collapse; font-size:13px; }
thead th{ text-align:left; font-weight:500; color:var(--muted); font-size:11.5px;
  padding:9px 12px; border-bottom:1px solid var(--line); background:#fbfcfd; white-space:nowrap; }
tbody td{ padding:8px 12px; border-bottom:1px solid var(--line2); }
tbody tr:hover{ background:#fafbfc; }
.num{ text-align:right; font-variant-numeric:tabular-nums; }
.mono{ font-family:ui-monospace,Consolas,monospace; font-size:12px; color:#4b5563; }
.group-row{ background:#f8fafc; font-weight:600; }
.group-row td{ border-bottom:1px solid var(--line); font-size:12.5px; }
.subtotal td{ background:#fbfcfd; font-weight:600; border-top:1px solid var(--line); }
.total-row td{ background:#eef3ff; font-weight:700; border-top:2px solid #b8ccff; }
.gift{ color:var(--muted2); }

/* 说明块 / 标签页 / 进度条 */
.note{ padding:11px 14px; border-radius:var(--r-ctl); font-size:12.5px; line-height:1.6; }
.note.amber{ background:var(--amber-soft); color:#8a5a00; }
.note.blue{ background:var(--primary-soft); color:#1e4bb8; }
.note b{ font-weight:600; }
.tabs{ display:flex; gap:2px; border-bottom:1px solid var(--line); }
.tab{ padding:8px 14px; font-size:13px; color:var(--muted); border-bottom:2px solid transparent;
  text-decoration:none; white-space:nowrap; }
.tab.on{ color:var(--primary); border-bottom-color:var(--primary); font-weight:600; }
.tab-n{ display:inline-block; font-size:11px; font-weight:500; background:var(--primary-soft);
  color:var(--primary); padding:0 6px; border-radius:9px; margin-left:4px; }
.pane-scroll{ max-height:720px; overflow-y:auto; }
.bar-wrap{ height:6px; background:var(--line2); border-radius:4px; overflow:hidden; margin-top:3px; }
.bar{ height:100%; background:var(--primary); border-radius:4px; }
.prog{ height:5px; background:#eef0f3; border-radius:3px; overflow:hidden; }
.prog i{ display:block; height:100%; background:var(--primary); transition:width .4s; }

/* 筛选区组件（胶囊 / 分段按钮 / 字段） */
.chips{ display:flex; flex-wrap:wrap; gap:7px; }
.chip{ padding:4px 11px; border:1px solid var(--line); border-radius:20px; font-size:12.5px;
  background:#fff; transition:.12s; text-decoration:none; color:var(--text); display:inline-block; }
.chip:hover{ border-color:#c9d1e0; }
.chip.on{ background:var(--primary-soft); border-color:#b8ccff; color:var(--primary); font-weight:500; }
.field{ display:flex; flex-direction:column; gap:4px; }
.field label{ font-size:11.5px; color:var(--muted); }
.filters{ display:flex; gap:16px; flex-wrap:wrap; align-items:flex-end; padding:12px 16px; }
.fgroup{ display:flex; flex-direction:column; gap:6px; }
.flabel{ font-size:11.5px; color:var(--muted); }
.flabel small{ color:var(--muted2); font-weight:400; }
.frow{ display:flex; gap:22px; flex-wrap:wrap; align-items:flex-start; }
.pills{ display:flex; flex-wrap:wrap; gap:6px; }
.pills.scroll{ max-height:86px; overflow-y:auto; padding-right:4px; }
.pills.days{ flex-wrap:nowrap; overflow-x:auto; padding-bottom:6px; }
.pills.days .pill{ flex:0 0 auto; padding:4px 10px; }
.day-label{ flex:0 0 auto; align-self:center; font-size:11.5px;
  color:var(--muted2); padding:0 4px; white-space:nowrap; }
.pill{ padding:4px 13px; border:1px solid var(--line); border-radius:18px; font-size:12.5px;
  background:#fff; cursor:pointer; user-select:none; transition:.12s; color:#4b5563;
  white-space:nowrap; line-height:1.5; }
.pill:hover{ border-color:#c9d1e0; background:#f8f9fb; }
.pill.on{ background:var(--primary-soft); border-color:#9ab5ff; color:var(--primary); font-weight:600; }
.seg{ display:inline-flex; border:1px solid var(--line); border-radius:var(--r-ctl);
  overflow:hidden; background:#fff; }
.seg button{ border:none; background:#fff; padding:6px 14px; font-size:12.5px; cursor:pointer;
  color:var(--muted); transition:.12s; white-space:nowrap; }
.seg button + button{ border-left:1px solid var(--line); }
.seg button:hover{ background:#f8f9fb; }
.seg button.on{ background:var(--primary-soft); color:var(--primary); font-weight:600; }

/* 杂项工具类（保留原名） */
.flex{ display:flex; align-items:center; gap:8px; }
.sp{ justify-content:space-between; }
.mt8{ margin-top:8px; } .mt12{ margin-top:12px; } .mt16{ margin-top:16px; }
.mb16{ margin-bottom:16px; }
.tabs.mb16{ margin-bottom:16px; }
.muted{ color:var(--muted); } .tiny{ font-size:11.5px; }
.right{ text-align:right; }

/* 单据卡片（逐笔流水 / 厂家详情） */
.recv{ display:flex; gap:12px; }
.recv .tm{ width:48px; flex:0 0 48px; font-size:13px; font-weight:600; padding-top:8px; color:#374151; }
.recv .box{ flex:1; border:1px solid var(--line); border-radius:9px; background:#fff;
  margin-bottom:10px; overflow:hidden; }
.recv .hd{ padding:7px 12px; background:#fbfcfd; border-bottom:1px solid var(--line2);
  display:flex; justify-content:space-between; align-items:center; gap:8px; flex-wrap:wrap;
  font-size:11.5px; color:var(--muted); }
.recv .hd-l{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; min-width:0; }
.recv .hd-r{ display:flex; align-items:center; gap:4px; flex-wrap:wrap; margin-left:auto; }
.recv .hd .amt{ font-size:13.5px; font-weight:650; color:var(--text); }
.paychip{ font-size:10.5px; border:1px solid var(--line); background:#fff; border-radius:10px;
  padding:1px 7px; color:#4b5563; white-space:nowrap; font-variant-numeric:tabular-nums; }
table.items th, table.items td{ padding:4px 8px; font-size:12px; }
table.items thead th{ background:#fbfcfd; font-size:10.5px; padding:5px 8px; }
table.items tr.gift td{ color:var(--muted2); }
table.items tr.neg td{ color:var(--red); }
table.items tr.foot td{ background:#fbfcfd; font-size:11.5px; color:var(--muted);
  border-top:1px solid var(--line); border-bottom:none; }
.recv.ret .box{ border-color:#f0c4c4; }
.recv.ret .tm{ color:var(--red); }
.recv.ret .hd{ background:#fdf6f6; }
.two-col{ display:grid; grid-template-columns:1fr 316px; gap:12px; align-items:start; }
.vpanel-row{ display:flex; justify-content:space-between; padding:7px 0; border-bottom:1px solid var(--line2); }
.assign-bar{ position:sticky; top:var(--top-h); z-index:5; background:var(--primary-soft);
  border-bottom:1px solid #b8ccff; padding:10px 16px; font-size:13px; }

/* 未分类就地展开 */
.unc-link{ color:var(--primary); text-decoration:none; font-weight:500; }
.unc-link:hover{ text-decoration:underline; }
.unc-box{ margin-top:8px; padding:8px 10px; background:#fafbfd;
  border:1px solid var(--line2); border-radius:7px; max-height:300px; overflow-y:auto; }
.unc-box table{ font-size:11.5px; }
.unc-box td,.unc-box th{ padding:3px 6px; }

/* 数据细看（新增模块专用） */
.detail-layout{ display:grid; grid-template-columns:minmax(0,1fr) 300px; gap:14px; align-items:start; }
.detail-side{ position:sticky; top:calc(var(--top-h) + 16px); }
.kpi-help{ font-size:11px; color:var(--primary); text-decoration:none; margin-left:6px; white-space:nowrap; }
.kpi-help:hover{ text-decoration:underline; }
.kpi-trend{ margin-top:7px; font-size:11.5px; font-variant-numeric:tabular-nums; }
.kpi-trend.up{ color:var(--green); }
.kpi-trend.down{ color:var(--red); }
.kpi-trend.flat{ color:var(--muted2); }
.crumbs{ display:flex; flex-wrap:wrap; align-items:center; gap:6px; margin:14px 0 0; font-size:12.5px; }
.crumbs a{ color:var(--primary); text-decoration:none; }
.crumbs a:hover{ text-decoration:underline; }
.crumbs .sep{ color:var(--muted2); }
.crumbs .cur{ color:var(--text); font-weight:600; max-width:420px;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.scope-bar a{ color:var(--primary); font-weight:500; }
.note-item{ padding:9px 8px; border-bottom:1px solid var(--line2); border-radius:7px; }
.note-item:last-child{ border-bottom:none; }
.note-item b{ display:block; font-size:12.5px; font-weight:600; margin-bottom:3px; }
.note-item p{ font-size:11.5px; color:var(--muted); line-height:1.65; }
.note-item.hi{ background:var(--primary-soft); }
.link-cell{ white-space:nowrap; }
.drill-link{ color:var(--primary); text-decoration:none; font-weight:500; font-size:12.5px; }
.drill-link:hover{ text-decoration:underline; }
#detailRows tr.neg td{ color:var(--red); }

/* 响应式：宽屏双栏 → 中等屏收起侧栏 → 手机单列 */
@media (max-width:1200px){
  .detail-layout{ grid-template-columns:1fr; }
  .detail-side{ position:static; }
}
@media (max-width:1100px){ .two-col{ grid-template-columns:1fr; } }
@media (max-width:900px){
  .side{ width:var(--side-mini); flex-basis:var(--side-mini); padding:16px 8px; }
  .brand{ justify-content:center; padding:2px 0 16px; }
  .brand-txt, .nav-txt, .side-foot{ display:none; }
  .nav-group{ font-size:0; padding:8px 0 0; height:8px; overflow:hidden; }
  .nav-item{ justify-content:center; padding:7px 0; }
  .topbar{ padding:0 16px; }
  .main{ padding:18px 16px 48px; }
  .g4{ grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:640px){
  .g4, .g3, .g2{ grid-template-columns:1fr; }
  .frow{ gap:12px; }
  .top-right{ display:none; }
}

/* ---- 供货商档案与往来账 ---- */
.form-grid{ display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px 16px; }
.form-grid .field{ min-width:0; }
.form-grid .full{ grid-column:1 / -1; }
.form-grid input[type=text], .form-grid input[type=date], .form-grid select,
.form-grid textarea, .form-grid input[type=file]{
  width:100%; padding:6px 9px; border:1px solid var(--line, #e6e8ec); border-radius:7px;
  background:#fff; color:var(--text, #1a1d23); font-size:13px; font-family:inherit;
}
.form-grid textarea{ resize:vertical; line-height:1.6; }
.form-grid .full .btn{ width:auto; }
input[type=file]{ padding:6px 9px; border:1px solid var(--line, #e6e8ec);
  border-radius:7px; background:#fff; font-size:13px; }
.btn.danger{ color:var(--red, #d94a4a); border-color:#f0c4c4; }
.btn.danger:hover{ background:#fdeeee; }
.neg{ color:var(--red, #d94a4a); }
@media (max-width:1100px){ .form-grid{ grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:640px){ .form-grid{ grid-template-columns:1fr; } }
