  :root {
    --bg: #f5f7f5; --card: #fff; --border: #e3e8e3; --text: #1f2937; --muted: #6b7280;
    --primary: #15803d; --primary-light: #dcfce7; --primary-dark: #166534;
    --green: #16a34a; --green-light: #dcfce7; --red: #dc2626; --red-light: #fee2e2;
    --amber: #d97706; --amber-light: #fef3c7; --teal: #0d9488; --teal-light: #ccfbf1;
    --blue: #2563eb; --blue-light: #dbeafe; --purple: #7c3aed; --purple-light: #ede9fe;
  }
  * { margin: 0; padding: 0; box-sizing: border-box; }
  body { font-family: "Microsoft YaHei", "PingFang SC", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
  .container { max-width: 1320px; margin: 0 auto; padding: 20px 24px 60px; }
  header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
  h1 { font-size: 21px; font-weight: 600; }
  h1 .sub { font-size: 12.5px; color: var(--muted); font-weight: 400; margin-left: 8px; }
  .header-actions { display: flex; gap: 7px; flex-wrap: wrap; }
  .btn { border: 1px solid var(--border); background: var(--card); color: var(--text); padding: 7px 13px; border-radius: 8px; cursor: pointer; font-size: 13px; transition: all .15s; }
  .btn:hover { border-color: var(--primary); color: var(--primary); }
  .btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
  .btn-primary:hover { background: var(--primary-dark); color: #fff; }
  .btn-sm { padding: 4px 10px; font-size: 12px; }
  .storage-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border-radius: 10px; padding: 9px 14px; margin-bottom: 12px; font-size: 13px; }
  .storage-bar.ok { background: var(--green-light); color: #166534; border: 1px solid #bbf7d0; }
  .storage-bar.warn { background: var(--amber-light); color: #92400e; border: 1px solid #fde68a; }
  .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
  .dot.g { background: var(--green); } .dot.a { background: var(--amber); }
  .nav { display: flex; gap: 4px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 5px; margin-bottom: 9px; flex-wrap: wrap; }
  .nav .tab { padding: 7px 13px; border-radius: 7px; cursor: pointer; font-size: 13.5px; color: var(--muted); border: none; background: transparent; white-space: nowrap; }
  .nav .tab.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
  .nav .tab.grp { color: var(--primary-dark); font-weight: 600; cursor: default; font-size: 12px; background: #f3f8f4; }
  .nav .tab.disabled { opacity: .45; cursor: not-allowed; }
  .nav .tab.top { font-weight: 600; }
  .nav .tab.top.active { background: var(--primary); color: #fff; }
  .subnav { display: flex; gap: 4px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 5px; margin-bottom: 9px; flex-wrap: wrap; }
  .subnav .tab { padding: 7px 13px; border-radius: 7px; cursor: pointer; font-size: 13.5px; color: var(--muted); border: none; background: transparent; white-space: nowrap; }
  .subnav .tab.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
  .dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; margin-bottom: 14px; }
  @media (max-width: 960px) { .dash-grid { grid-template-columns: 1fr; } }
  .dash-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
  .dash-card h3 { font-size: 13.5px; font-weight: 600; margin-bottom: 13px; }
  .bar-row { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; font-size: 12px; }
  .bar-row:last-child { margin-bottom: 0; }
  .bar-label { width: 82px; flex-shrink: 0; color: var(--muted); white-space: nowrap; }
  .bar-track { flex: 1; height: 16px; background: #f1f3f5; border-radius: 8px; overflow: hidden; }
  .bar-fill { display: block; height: 100%; border-radius: 8px; min-width: 2px; }
  .bar-val { width: 104px; text-align: right; flex-shrink: 0; font-weight: 600; }
  .stack-bar { display: flex; height: 20px; border-radius: 10px; overflow: hidden; background: #f1f3f5; }
  .stack-seg { height: 100%; }
  .dash-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 11px; font-size: 12px; color: var(--muted); }
  .dash-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }
  .ratio-row { display: flex; align-items: center; gap: 10px; margin-bottom: 11px; font-size: 12.5px; }
  .ratio-row:last-child { margin-bottom: 0; }
  .ratio-row .r-label { width: 72px; color: var(--muted); flex-shrink: 0; }
  .ratio-row .r-track { flex: 1; height: 9px; background: #f1f3f5; border-radius: 5px; overflow: hidden; }
  .ratio-row .r-fill { display: block; height: 100%; border-radius: 5px; }
  .ratio-row .r-val { width: 62px; text-align: right; flex-shrink: 0; font-weight: 600; }
  .tag-type { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11.5px; background: var(--blue-light); color: var(--blue); }
  .quick-links { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
  input, select, textarea { border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font-size: 13px; font-family: inherit; background: var(--card); color: var(--text); outline: none; }
  input:focus, select:focus, textarea:focus { border-color: var(--primary); }
  input[type=number] { text-align: right; }
  select:disabled { background: #f3f4f6; color: var(--muted); }
  .view { display: none; } .view.show { display: block; }
  .page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 10px; }
  .page-head h2 { font-size: 17px; font-weight: 600; }
  .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 11px; margin-bottom: 14px; }
  .stat-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 13px 15px; }
  .stat-card .label { color: var(--muted); font-size: 12px; margin-bottom: 5px; }
  .stat-card .value { font-size: 21px; font-weight: 600; }
  .c-green { color: var(--green); } .c-blue { color: var(--blue); } .c-primary { color: var(--primary); }
  .filter-bar { display: flex; gap: 9px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; }
  .filter-bar label { font-size: 12.5px; color: var(--muted); }
  .filter-bar input[type=date], .filter-bar input:not([type]), .filter-bar select { font-size: 12.5px; }
  .filter-count { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
  /* 统一分页控件 */
  .pager { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 12px; border-top: 1px solid var(--border); background: #fcfcfd; font-size: 12.5px; }
  .pager-info { color: var(--muted); }
  .pager-info b { color: var(--text, #111); font-weight: 600; }
  .pager-size { display: flex; align-items: center; gap: 5px; color: var(--muted); }
  .pager-size select { font-size: 12.5px; padding: 3px 6px; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
  .pager-pages { display: flex; gap: 4px; align-items: center; margin-left: auto; flex-wrap: wrap; }
  .pager-pages button { min-width: 30px; height: 28px; padding: 0 8px; border: 1px solid var(--border); background: #fff; border-radius: 6px; cursor: pointer; font-size: 12.5px; color: var(--text, #333); }
  .pager-pages button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
  .pager-pages button.cur { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
  .pager-pages button:disabled { opacity: .4; cursor: not-allowed; }
  .pager-pages .pager-ellipsis { color: var(--muted); padding: 0 2px; }
  .table-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
  .table-scroll { overflow-x: auto; }
  table { width: 100%; border-collapse: collapse; min-width: 640px; }
  th { text-align: left; padding: 9px 11px; background: #f9fafb; color: var(--muted); font-size: 12px; font-weight: 500; border-bottom: 1px solid var(--border); white-space: nowrap; }
  td { padding: 9px 11px; border-bottom: 1px solid #f1f3f5; font-size: 13px; white-space: nowrap; }
  tr:last-child td { border-bottom: none; }
  tbody tr:hover td { background: #f9fafb; }
  .tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; }
  .tag-info { background: var(--blue-light); color: var(--blue); }
  .tag-raw { background: var(--teal-light); color: var(--teal); }
  .tag-neg { background: var(--red-light); color: var(--red); }
  .warn-text { color: var(--red); font-weight: 600; }
  .stock-chip { font-weight: 500; color: var(--green); margin-left: 8px; font-size: 11.5px; }
  .stock-chip.neg { color: var(--red); }
  .batch-detail td { background: #f8faf8; padding: 0; }
  .batch-wrap { padding: 8px 12px 12px 30px; }
  .batch-wrap table { min-width: 0; font-size: 12px; }
  .batch-wrap th, .batch-wrap td { padding: 5px 10px; border-bottom: 1px solid #eef1ee; font-size: 12px; }
  .batch-wrap th { background: transparent; color: var(--muted); font-size: 11.5px; }
  .batch-tag { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11px; }
  .batch-tag.pur { background: var(--teal-light); color: var(--teal); }
  .batch-tag.proc { background: var(--blue-light); color: var(--blue); }
  .batch-tag.ship { background: var(--purple-light); color: var(--purple); }
  .ship-items { grid-column: 1 / -1; min-width: 0; }
  .ship-item-row { display: grid; grid-template-columns: 1.6fr 0.9fr 0.9fr 1fr 1fr 34px; gap: 8px; align-items: start; padding: 9px 0; border-bottom: 1px dashed var(--border); }
  .ship-item-row:last-of-type { border-bottom: none; }
  .ship-item-row > * { min-width: 0; }
  .ship-item-row .form-item label { font-size: 11px; }
  .ship-item-row .form-item input, .ship-item-row .form-item select { height: 34px; width: 100%; min-width: 0; }
  .ship-item-row .mini-add { border: 1px solid var(--border); background: var(--card); border-radius: 8px; height: 34px; margin-top: 19px; cursor: pointer; font-size: 18px; color: var(--primary); line-height: 1; }
  .ship-item-row .mini-add.del { color: var(--red); }
  .ship-item-row > :nth-child(1) { grid-column: 1; }
  .ship-item-row > :nth-child(2) { grid-column: 2; }
  .ship-item-row > :nth-child(3) { grid-column: 3; }
  .ship-item-row > :nth-child(4) { grid-column: 4; }
  .ship-item-row > :nth-child(5) { grid-column: 5; }
  .ship-item-row > :nth-child(6) { grid-column: 6; }
  /* 成品/非框商品无重量列：收为 5 列并让金额、删除按钮前移，避免空档 */
  .ship-item-row:has(> :nth-child(4).hidden) { grid-template-columns: 1.9fr 1fr 1fr 1fr 34px; }
  .ship-item-row:has(> :nth-child(4).hidden) > :nth-child(5) { grid-column: 4; }
  .ship-item-row:has(> :nth-child(4).hidden) > :nth-child(6) { grid-column: 5; }
  .ship-cost-ref { font-size: 11px; color: var(--muted); margin-top: 3px; line-height: 1.4; min-height: 15px; }
  .ship-head-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 6px; }
  .sale-items { grid-column: 1 / -1; min-width: 0; }
  .zone-title-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
  /* 财务报表：费用汇总模块两列自适应（≤4列占半行并排、≥5列占整行，密集填充空位） */
  .fin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: row dense; gap: 14px 16px; align-items: start; }
  .fin-grid > .fm { min-width: 0; }
  .fin-grid > .fm.wide { grid-column: 1 / -1; }
  .fin-grid > .fm > .zone-title:first-child { margin-top: 0 !important; }
  .fin-grid .table-scroll { max-width: 100%; }
  @media screen and (max-width: 1000px) { .fin-grid { grid-template-columns: 1fr; } .fin-grid > .fm.wide { grid-column: auto; } }
  /* 销售单头部：紧凑 4 列 + 单行新增标签栏 */
  .sale-head-grid { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 14px; }
  .sale-addbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; padding-bottom: 15px; border-bottom: 2px solid #86c99a; margin-bottom: 8px; }
  .sale-addbar .addbar-label { font-size: 12px; color: var(--muted); white-space: nowrap; }
  .sale-addbar input { flex: 1; min-width: 0; }
  .sale-addbar .btn { white-space: nowrap; }
  .sale-fee-grid { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
  .sale-item-row { display: grid; grid-template-columns: 1.6fr 0.9fr 1fr 1fr 34px; gap: 8px; align-items: start; padding: 9px 0; border-bottom: 1px dashed var(--border); }
  .sale-item-row:last-of-type { border-bottom: none; }
  .sale-item-row > * { min-width: 0; }
  .sale-item-row .form-item label { font-size: 11px; }
  .sale-item-row .form-item input, .sale-item-row .form-item select { height: 34px; width: 100%; min-width: 0; }
  .sale-item-row .mini-add { border: 1px solid var(--border); background: var(--card); border-radius: 8px; height: 34px; margin-top: 19px; cursor: pointer; font-size: 18px; color: var(--primary); line-height: 1; }
  .sale-item-row .mini-add.del { color: var(--red); }
  .sale-item-row > :nth-child(1) { grid-column: 1; }
  .sale-item-row > :nth-child(2) { grid-column: 2; }
  .sale-item-row > :nth-child(3) { grid-column: 3; }
  .sale-item-row > :nth-child(4) { grid-column: 4; }
  .sale-item-row > :nth-child(5) { grid-column: 5; }
  /* 供销鲜明细：8 个数据列 + 删除按钮 */
  .sale-item-row.sale-item-gxf { grid-template-columns: 1.5fr .8fr .7fr 1.15fr .95fr .85fr .95fr 1.1fr 30px; }
  .sale-item-row.sale-item-gxf > :nth-child(6) { grid-column: 6; }
  .sale-item-row.sale-item-gxf > :nth-child(7) { grid-column: 7; }
  .sale-item-row.sale-item-gxf > :nth-child(8) { grid-column: 8; }
  .sale-item-row.sale-item-gxf > :nth-child(9) { grid-column: 9; }
  .sale-cost-ref { font-size: 11px; color: var(--muted); margin-top: 3px; line-height: 1.4; min-height: 15px; }
  .tag-platform { background: var(--purple-light); color: var(--purple); }
  @media screen and (max-width: 1100px) {
    .sale-item-row.sale-item-gxf { grid-template-columns: 1.4fr .8fr .7fr 1.1fr 1fr 30px; }
    .sale-item-row.sale-item-gxf > * { grid-column: auto !important; }
  }
  @media screen and (max-width: 820px) {
    .ship-item-row, .sale-item-row { grid-template-columns: 1fr 1fr; }
    .ship-item-row > *, .sale-item-row > * { grid-column: auto !important; }
  }
  .link-btn { border: none; background: transparent; color: var(--primary); cursor: pointer; font-size: 12.5px; padding: 3px 5px; }
  .link-btn:hover { text-decoration: underline; }
  .row-actions { display: flex; gap: 2px; }
  .row-actions button { border: none; background: transparent; cursor: pointer; font-size: 12.5px; color: var(--muted); padding: 4px 6px; border-radius: 6px; white-space: nowrap; }
  .row-actions button:hover { background: var(--primary-light); color: var(--primary); }
  .row-actions button.del:hover { background: var(--red-light); color: var(--red); }
  .empty { text-align: center; color: var(--muted); padding: 34px 0; font-size: 13px; }
  .form-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 22px 24px; width: 100%; }
  .form-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 10px; }
  .form-head h3 { font-size: 16px; font-weight: 600; }
  .form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; }
  .sub-grid { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; }
  .form-item { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
  .form-item.full { grid-column: 1 / -1; }
  .form-item label { font-size: 12px; color: var(--muted); }
  .form-item label .req { color: var(--red); }
  .form-item input, .form-item select, .form-item textarea { width: 100%; min-width: 0; }
  .form-item .hint { font-size: 11.5px; color: var(--muted); line-height: 1.6; }
  .form-item.hidden { display: none; }
  .form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
  .hint { font-size: 12px; color: var(--muted); margin: -3px 0 11px; line-height: 1.7; }
  .calc-panel { background: #f8faf8; border: 1px dashed #cbd5cb; border-radius: 10px; padding: 13px 15px; margin-top: 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 13px; }
  .calc-item .k { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
  .calc-item .v { font-size: 16px; font-weight: 600; }
  .calc-item.big .v { font-size: 20px; color: var(--primary); }
  .calc-note { grid-column: 1 / -1; font-size: 12px; color: var(--muted); line-height: 1.8; }
  .seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
  .seg button { border: none; background: var(--card); padding: 6px 13px; font-size: 12.5px; cursor: pointer; color: var(--muted); }
  .seg button.active { background: var(--primary); color: #fff; }
  .zone-title { grid-column: 1 / -1; font-size: 12px; color: var(--primary-dark); background: var(--primary-light); border-radius: 6px; padding: 5px 10px; margin-top: 4px; }
  .warnbar { background: var(--amber-light); color: #92400e; border: 1px solid #fde68a; border-radius: 8px; padding: 10px 13px; font-size: 13px; }
  #toast { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); background: #1f2937; color: #fff; padding: 9px 20px; border-radius: 8px; font-size: 13px; display: none; z-index: 40; }
  @media screen and (max-width: 1040px) { .form-grid, .sub-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .sale-head-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  @media screen and (max-width: 720px) { .form-grid, .sub-grid { grid-template-columns: 1fr; } .sale-head-grid, .sale-fee-grid { grid-template-columns: 1fr; } .sale-addbar { flex-wrap: wrap; } .container { padding: 14px 10px 40px; } .form-card { padding: 16px 14px; } }

  /* ============ 视觉增强层：配色 / 底色 / 层次感（不影响任何布局与功能） ============ */
  :root {
    --shadow-sm: 0 1px 2px rgba(16,60,32,.05), 0 2px 8px rgba(16,60,32,.04);
    --shadow: 0 2px 6px rgba(16,60,32,.06), 0 8px 24px rgba(16,60,32,.05);
    --grad-green: linear-gradient(135deg,#22c55e,#15803d);
  }
  body {
    background:
      radial-gradient(circle at 8% -5%, rgba(34,197,94,.10) 0, transparent 28%),
      radial-gradient(circle at 95% 0%, rgba(59,130,246,.08) 0, transparent 26%),
      linear-gradient(180deg,#f7fbf8 0%,#f1f6f2 100%);
    background-attachment: fixed;
  }
  ::-webkit-scrollbar { width: 9px; height: 9px; }
  ::-webkit-scrollbar-track { background: #eef3ef; border-radius: 6px; }
  ::-webkit-scrollbar-thumb { background: #c2d6c8; border-radius: 6px; }
  ::-webkit-scrollbar-thumb:hover { background: #97bda4; }

  header {
    background: linear-gradient(120deg,#f0fdf4 0%,#ffffff 48%,#eff6ff 100%);
    border: 1px solid #d7e9da; border-radius: 14px; padding: 14px 18px;
    box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  }
  header::before { content:""; position:absolute; left:0; top:0; bottom:0; width:4px; background: var(--grad-green); }
  h1 { color: #14532d; font-weight: 700; letter-spacing: .2px; }
  h1 .sub { background: rgba(22,163,74,.10); color: #3f7a55; padding: 3px 10px; border-radius: 999px; }

  .btn { box-shadow: 0 1px 2px rgba(16,60,32,.06); }
  .btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16,60,32,.10); }
  .btn-primary { background: var(--grad-green); border-color: #15803d; color: #fff; box-shadow: 0 2px 8px rgba(21,128,61,.22); }
  .btn-primary:hover { background: linear-gradient(135deg,#16a34a,#166534); color: #fff; }
  .storage-bar { box-shadow: var(--shadow-sm); }

  .nav, .subnav {
    background: linear-gradient(180deg,#fff,#f8fbf9);
    border-color: #d7e9da; box-shadow: var(--shadow-sm); border-radius: 12px;
  }
  .nav .tab.active, .nav .tab.top.active { background: var(--grad-green); color: #fff; box-shadow: 0 2px 8px rgba(21,128,61,.22); }
  .subnav .tab.active { background: var(--primary-light); color: var(--primary-dark); box-shadow: inset 0 0 0 1px #bbf7d0; }
  .nav .tab.grp { background: linear-gradient(90deg,#eef8f0,#f4faf5); }

  .stat-card, .dash-card, .table-card, .form-card { box-shadow: var(--shadow); }
  .stat-card { position: relative; overflow: hidden; }
  .stat-card::before { content:""; position:absolute; left:0; top:0; bottom:0; width:3px; background: var(--green); }
  .stats .stat-card:nth-child(4n+2)::before { background: var(--blue); }
  .stats .stat-card:nth-child(4n+3)::before { background: var(--amber); }
  .stats .stat-card:nth-child(4n+4)::before { background: var(--purple); }
  .stat-card .value { font-weight: 700; letter-spacing: -.3px; }

  .dash-card { position: relative; overflow: hidden; }
  .dash-card::before { content:""; position:absolute; left:0; right:0; top:0; height:3px; background: linear-gradient(90deg,#22c55e,#0d9488,#3b82f6); opacity: .8; }
  .dash-card h3 { color: #1e3a2b; }

  .filter-bar, .pager { background: linear-gradient(180deg,#fff,#fafdfa); border-color: #e1ece2; box-shadow: var(--shadow-sm); }
  .pager { background: linear-gradient(180deg,#fbfdfb,#f5f9f6); }
  input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 3px rgba(22,163,74,.10); }

  .table-card { border-radius: 14px; }
  th { background: linear-gradient(180deg,#f5f9f5,#eef5ef); color: #3c5c46; font-weight: 600; }
  tbody tr:nth-child(even) td { background: #fbfdfb; }
  tbody tr:hover td { background: #eef8f0; }
  tbody tr.batch-detail td { background: #f8faf8; }

  .zone-title {
    background: linear-gradient(90deg,#dcfce7,#f0f9ff); border-left: 3px solid var(--primary);
    color: var(--primary-dark); font-weight: 600;
  }

  .form-card { position: relative; overflow: hidden; }
  .form-card::before { content:""; position:absolute; left:0; right:0; top:0; height:4px; background: var(--grad-green); }
  .form-head h3 { color: #14532d; }
  .calc-panel { background: linear-gradient(135deg,#f3fbf6,#eff7ff); border-color: #a9d6b8; }
  .calc-item.big .v { background: linear-gradient(90deg,#16a34a,#0d9488); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
  .seg button.active { background: var(--grad-green); }
  .tag-type, .tag-platform { box-shadow: inset 0 0 0 1px rgba(124,58,237,.12); }

  #toast {
    background: linear-gradient(135deg,#1f2937,#0f172a); color: #f8fafc;
    border: 1px solid rgba(255,255,255,.12); box-shadow: 0 10px 30px rgba(0,0,0,.22);
  }

  /* ============ 视觉增强 II：品牌深色页头 + 双仓主题色 ============ */
  :root { --accent: #15803d; --accent2: #0d9488; --accent-soft: #dcfce7; }
  body:has(#view-products.show) { --accent: #0d9488; --accent2: #2563eb; --accent-soft: #ccfbf1; }
  body:has(#view-dashboard.show), body:has(#view-purchase.show), body:has(#view-process.show),
  body:has(#view-shipment.show), body:has(#view-inventory.show), body:has(#view-purchasefinance.show) { --accent: #15803d; --accent2: #65a30d; --accent-soft: #dcfce7; }
  body:has(#view-saledash.show), body:has(#view-saleinventory.show),
  body:has(#view-sale.show), body:has(#view-finance.show) { --accent: #2563eb; --accent2: #7c3aed; --accent-soft: #dbeafe; }

  header {
    background: linear-gradient(120deg,#12472c 0%,#166534 48%,#0f766e 100%);
    border: none; padding: 16px 20px;
  }
  header::before { width: 5px; background: linear-gradient(180deg,#86efac,#22d3ee); }
  h1 { color: #fff; font-size: 22px; }
  h1 .sub { background: rgba(255,255,255,.15); color: #e7f8ee; border: 1px solid rgba(255,255,255,.18); }
  .header-actions .btn { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.28); color: #fff; box-shadow: none; }
  .header-actions .btn:hover { background: rgba(255,255,255,.24); border-color: rgba(255,255,255,.5); color: #fff; }

  .page-head h2 { position: relative; padding-left: 11px; color: #1e3a2b; }
  .page-head h2::before { content:""; position:absolute; left:0; top:3px; bottom:3px; width:4px; border-radius:2px; background: linear-gradient(180deg,var(--accent),var(--accent2)); }
  .nav .tab.top.active { background: linear-gradient(135deg,var(--accent),var(--accent2)); color: #fff; box-shadow: 0 3px 10px rgba(0,0,0,.12); }
  .nav .tab:hover:not(.active) { background: var(--accent-soft); color: var(--accent); }
  .subnav .tab.active { background: linear-gradient(135deg,var(--accent),var(--accent2)); color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
  .subnav .tab:hover:not(.active) { background: var(--accent-soft); color: var(--accent); }

  .stat-card { background: linear-gradient(135deg,#fff 40%,var(--accent-soft)); border-color: color-mix(in srgb, var(--accent) 20%, #fff); }
  .stat-card::before { width: 4px; background: linear-gradient(180deg,var(--accent),var(--accent2)); }
  .dash-card::before { background: linear-gradient(90deg,var(--accent),var(--accent2)); opacity: 1; }
  .dash-card h3 { padding-left: 9px; border-left: 3px solid var(--accent); }
  th { background: linear-gradient(180deg,var(--accent),var(--accent2)); color: #fff; font-weight: 600; }
  tbody tr:hover td { background: color-mix(in srgb, var(--accent) 7%, #fff); }
  .zone-title { background: linear-gradient(90deg,var(--accent-soft),#f0f9ff); border-left: 4px solid var(--accent); }
  .form-card::before { background: linear-gradient(90deg,var(--accent),var(--accent2)); }
  .form-head h3 { padding-left: 9px; border-left: 3px solid var(--accent); }
  .btn-primary, .pager-pages button.cur, .seg button.active { background: linear-gradient(135deg,var(--accent),var(--accent2)); border-color: var(--accent); }
  .storage-bar.ok { background: linear-gradient(90deg,#dcfce7,#f0fdf4); border-color: #86efac; }

  /* ============ 黑白灰主题层（覆盖以上全部彩色配色） ============ */
  :root {
    --bg: #f3f4f6; --card: #fff; --border: #e1e4e7; --text: #191c20; --muted: #727881;
    --primary: #343a40; --primary-light: #edeff1; --primary-dark: #17191c;
    --green: #4b5563; --green-light: #eceef0; --red: #1f2328; --red-light: #e3e5e8;
    --amber: #5b6169; --amber-light: #f0f1f3; --teal: #5b6169; --teal-light: #e9ebed;
    --blue: #4a5057; --blue-light: #e9ebed; --purple: #40464d; --purple-light: #e6e8eb;
    --accent: #343a40; --accent2: #6b7280; --accent-soft: #e9ebed;
    --grad-green: linear-gradient(135deg,#4b5563,#1f2328);
  }
  body {
    background:
      radial-gradient(circle at 8% -5%, rgba(90,100,110,.10) 0, transparent 28%),
      radial-gradient(circle at 95% 0%, rgba(120,128,136,.08) 0, transparent 26%),
      linear-gradient(180deg,#f7f8f9 0%,#eef0f2 100%);
    background-attachment: fixed;
  }
  ::-webkit-scrollbar-track { background: #eef0f2; }
  ::-webkit-scrollbar-thumb { background: #b8bec5; }
  ::-webkit-scrollbar-thumb:hover { background: #8d959e; }

  header { background: linear-gradient(120deg,#17191c 0%,#2d3238 48%,#4b5563 100%); border-color: #2d3238; }
  header::before { background: linear-gradient(180deg,#f3f4f6,#9ca3af); }
  h1 { color: #fff; }
  h1 .sub { background: rgba(255,255,255,.14); color: #f0f1f2; border-color: rgba(255,255,255,.20); }
  .header-actions .btn { background: rgba(255,255,255,.10); border-color: rgba(255,255,255,.26); color: #fff; }
  .header-actions .btn:hover { background: rgba(255,255,255,.20); border-color: rgba(255,255,255,.45); color: #fff; }
  .btn { box-shadow: 0 1px 2px rgba(20,24,28,.06); }
  .btn:hover { box-shadow: 0 4px 12px rgba(20,24,28,.10); }
  .btn-primary { box-shadow: 0 2px 8px rgba(20,24,28,.18); }
  input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 3px rgba(52,58,64,.10); }

  .page-head h2 { color: #1f2328; }
  .page-head h2::before { background: linear-gradient(180deg,#6b7280,#1f2328); }
  .nav .tab.top.active, .subnav .tab.active, .btn-primary, .pager-pages button.cur, .seg button.active {
    background: linear-gradient(135deg,#3b4148,#1f2328); border-color: #343a40; color: #fff;
  }
  .nav .tab:hover:not(.active), .subnav .tab:hover:not(.active) { background: #e9ebed; color: #343a40; }
  .nav .tab.grp { background: linear-gradient(90deg,#eceef0,#f5f6f7); color: #343a40; }

  .stat-card { background: linear-gradient(135deg,#fff 40%,#e9ebed); border-color: #d8dbde; }
  .stat-card::before { background: linear-gradient(180deg,#4b5563,#1f2328); }
  .stats .stat-card:nth-child(4n+1)::before { background: linear-gradient(180deg,#6b7280,#1f2328); }
  .stats .stat-card:nth-child(4n+2)::before { background: linear-gradient(180deg,#9ca3af,#4b5563); }
  .stats .stat-card:nth-child(4n+3)::before { background: linear-gradient(180deg,#d1d5db,#6b7280); }
  .stats .stat-card:nth-child(4n+4)::before { background: linear-gradient(180deg,#374151,#111827); }
  .dash-card::before { background: linear-gradient(90deg,#1f2328,#6b7280,#b6bcc3); }
  .dash-card h3, .form-head h3 { color: #1f2328; border-left-color: #4b5563; }
  th { background: linear-gradient(180deg,#4b5563,#2d3238); color: #fff; }
  tbody tr:nth-child(even) td { background: #f8f9fa; }
  tbody tr:hover td { background: #eceef0; }
  tbody tr.batch-detail td { background: #f5f6f7; }
  .batch-detail td { background: #f5f6f7; }
  .zone-title { background: linear-gradient(90deg,#e9ebed,#f5f6f7); border-left-color: #343a40; color: #1f2328; }
  .filter-bar, .pager { background: linear-gradient(180deg,#fff,#f8f9fa); border-color: #e1e4e7; }
  .pager { background: linear-gradient(180deg,#fafbfb,#f0f2f4); }
  .form-card::before { background: linear-gradient(90deg,#1f2328,#6b7280); }
  .calc-panel { background: linear-gradient(135deg,#f6f7f8,#eef0f2); border-color: #cbd0d5; }
  .calc-item.big .v { background: linear-gradient(90deg,#1f2328,#6b7280); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
  .tag-type, .tag-platform { box-shadow: inset 0 0 0 1px rgba(55,65,81,.15); }
  .sale-addbar { border-bottom-color: #9ca3af; }
  .storage-bar.ok { background: linear-gradient(90deg,#eceef0,#f6f7f8); color: #1f2328; border-color: #cdd2d7; }
  .storage-bar.warn { background: linear-gradient(90deg,#e4e6e8,#f2f3f4); color: #343a40; border-color: #c4c9ce; }
  .warnbar { background: #eceef0; color: #343a40; border-color: #cdd2d7; }
  #toast { background: linear-gradient(135deg,#1f2328,#111316); color: #f3f4f6; border-color: rgba(255,255,255,.18); }

  /* 图表色块与状态点统一去饱和，保留深浅层次 */
  .bar-fill, .stack-seg, .r-fill, .dash-legend i, .dot, .tag, .batch-tag { filter: grayscale(1); }
  .dot.g { background: #4b5563; }
  .dot.a { background: #9ca3af; }
  .header-actions .btn, .header-actions .btn:hover { filter: grayscale(1); }

  /* ============ 方案三：侧边栏工作台布局 · 柔和蓝灰 ============ */
  :root {
    --bg: #eef1f5; --card: #fff; --border: #e3e8ef; --text: #263241; --muted: #7b8899;
    --primary: #4f78a8; --primary-light: #eaf1fa; --primary-dark: #355c86;
    --green: #3f8f6a; --green-light: #e6f4ec; --red: #c85a5a; --red-light: #fdeaea;
    --amber: #b8863c; --amber-light: #fbf1dd; --teal: #3b8f8a; --teal-light: #e2f3f1;
    --blue: #4f78a8; --blue-light: #e8f0fa; --purple: #7b6bb0; --purple-light: #eeeafa;
    --accent: #4f78a8; --accent2: #6f97bd; --accent-soft: #eaf1fa;
    --shadow: 0 2px 10px rgba(30,50,75,.06), 0 10px 30px rgba(30,50,75,.04);
  }
  body:has(#view-products.show),
  body:has(#view-dashboard.show), body:has(#view-purchase.show), body:has(#view-process.show),
  body:has(#view-shipment.show), body:has(#view-inventory.show), body:has(#view-purchasefinance.show),
  body:has(#view-saledash.show), body:has(#view-saleinventory.show),
  body:has(#view-sale.show), body:has(#view-finance.show) {
    --accent: #4f78a8; --accent2: #6f97bd; --accent-soft: #eaf1fa;
  }
  body { background: var(--bg); color: var(--text); }
  ::-webkit-scrollbar-track { background: #e9edf3; }
  ::-webkit-scrollbar-thumb { background: #c0cad8; }
  ::-webkit-scrollbar-thumb:hover { background: #9fb0c6; }
  .container { max-width: none; margin: 0; padding: 0; min-height: 100vh; }

  /* 左侧栏 */
  .app-side {
    position: fixed; left: 0; top: 0; bottom: 0; width: 224px; z-index: 30;
    background: linear-gradient(165deg, #2b3b4f 0%, #1d2a3a 60%, #172332 100%);
    display: flex; flex-direction: column; padding: 0 0 14px;
    box-shadow: 2px 0 16px rgba(20,35,55,.12);
  }
  .side-brand { padding: 22px 20px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
  .side-brand .logo { display:flex; align-items:center; gap:10px; }
  .side-brand .mark {
    width: 34px; height: 34px; border-radius: 10px; flex: 0 0 34px;
    background: linear-gradient(135deg,#79a9d6,#4f78a8); color:#fff;
    display:flex; align-items:center; justify-content:center; font-size:17px; font-weight:700;
    box-shadow: 0 4px 12px rgba(79,120,168,.35);
  }
  .side-brand .title { color:#fff; font-size:15px; font-weight:600; letter-spacing:.5px; }
  .side-brand .subtitle { color:#93a7bd; font-size:10.5px; margin-top:3px; letter-spacing:.3px; }
  .side-nav-host { flex:1; overflow-y:auto; padding: 14px 12px 6px; }
  .side-nav-host::-webkit-scrollbar { width:5px; }
  .side-nav-host::-webkit-scrollbar-thumb { background: rgba(255,255,255,.16); }
  .side-cap { color:#7e93ab; font-size:10px; letter-spacing:1.6px; padding: 8px 10px 6px; }
  .side-foot { padding: 12px 18px 0; color:#70859c; font-size:10.5px; line-height:1.7; border-top:1px solid rgba(255,255,255,.07); margin-top:8px; }

  /* 左侧栏内的导航：纵向 */
  .app-side .nav, .app-side .subnav {
    background: transparent; border: none; box-shadow:none; border-radius:0;
    margin: 0 0 8px; padding: 0; display:flex; flex-direction:column; gap:3px;
  }
  .app-side .nav .tab.top {
    width:100%; text-align:left; padding: 11px 13px; border-radius:9px;
    color:#b6c6d8; font-size:13.5px; font-weight:500; display:flex; align-items:center; gap:9px;
    box-shadow:none;
  }
  .app-side .nav .tab.top::before { content:""; width:7px; height:7px; border-radius:2px; background:#6a829c; flex:0 0 7px; }
  .app-side .nav .tab.top:hover:not(.active) { background: rgba(255,255,255,.07); color:#fff; }
  .app-side .nav .tab.top.active {
    background: linear-gradient(90deg, rgba(121,169,214,.30), rgba(121,169,214,.08));
    color:#fff; font-weight:600; box-shadow:none;
  }
  .app-side .nav .tab.top.active::before { background:#9ec9ef; box-shadow:0 0 8px rgba(158,201,239,.6); }
  .app-side .subnav { padding: 2px 0 4px 16px; }
  .app-side .subnav .tab {
    width:100%; text-align:left; padding: 8px 12px; border-radius:8px;
    color:#9db0c6; font-size:12.5px; position:relative; box-shadow:none;
  }
  .app-side .subnav .tab::before { content:""; position:absolute; left:0; top:50%; transform:translateY(-50%); width:4px; height:4px; border-radius:50%; background:#5f7690; }
  .app-side .subnav .tab:hover:not(.active) { background:rgba(255,255,255,.06); color:#e5eef8; }
  .app-side .subnav .tab.active { background:rgba(255,255,255,.11); color:#fff; font-weight:600; box-shadow:none; }
  .app-side .subnav .tab.active::before { background:#9ec9ef; width:6px; height:6px; }

  /* 右侧主区 */
  .app-main { margin-left:224px; padding: 22px 30px 60px; min-height:100vh; }
  .app-main header {
    background: linear-gradient(120deg, #e8f0fa 0%, #f5f8fc 52%, #eaf1fa 100%);
    border: 1px solid #d6e2f0; border-radius:14px;
    padding: 15px 20px; box-shadow: var(--shadow); margin-bottom:12px;
  }
  .app-main h1 { color:var(--text); font-size:18px; }
  .app-main h1 .sub { background:#f1f4f8; color:#6d7d90; border-color:#e6ebf1; }
  .app-main .header-actions .btn { background:#f8fafc; border-color:#e2e8ef; color:#4a5a6d; filter:none; box-shadow:none; }
  .app-main .header-actions .btn:hover { background:var(--primary-light); border-color:var(--primary); color:var(--primary-dark); }
  .app-main .storage-bar { margin-bottom:14px; }
  .app-main .view { animation: viewIn .25s ease; }
  @keyframes viewIn { from { opacity:.5; transform:translateY(6px); } to { opacity:1; transform:none; } }

  .page-head h2 { color:#1f2c3d; }
  .page-head h2::before { background:linear-gradient(180deg,var(--primary),var(--primary-dark)); }
  .stat-card { background:#fff; border-color:var(--border); }
  .stat-card::before, .stats .stat-card:nth-child(4n+1)::before, .stats .stat-card:nth-child(4n+2)::before,
  .stats .stat-card:nth-child(4n+3)::before, .stats .stat-card:nth-child(4n+4)::before { background:linear-gradient(180deg,var(--primary),var(--primary-dark)); }
  .dash-card::before { background:linear-gradient(90deg,var(--primary),#8fb6d8); }
  .dash-card h3, .form-head h3 { color:#1f2c3d; border-left-color:var(--primary); }
  th { background:#f3f6fa; color:#5b6c80; border-bottom:1px solid var(--border); }
  tbody tr:nth-child(even) td { background:#fbfcfe; }
  tbody tr:hover td { background:#f1f6fc; }
  tbody tr.batch-detail td, .batch-detail td { background:#f6f8fb; }
  .zone-title { background:linear-gradient(90deg,var(--primary-light),#f7fafc); border-left-color:var(--primary); color:var(--primary-dark); }
  .filter-bar { background:#fff; border-color:var(--border); }
  .pager { background:#fafbfd; border-color:var(--border); }
  .btn-primary, .pager-pages button.cur, .seg button.active { background:linear-gradient(135deg,var(--primary),var(--primary-dark)); border-color:var(--primary); color:#fff; }
  .form-card::before { background:linear-gradient(90deg,var(--primary),var(--primary-dark)); }
  .calc-panel { background:linear-gradient(135deg,#f6f9fd,#eef4fa); border-color:#cbd9e8; }
  .calc-item.big .v { background:linear-gradient(90deg,var(--primary),var(--primary-dark)); -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; }
  .tag-type, .tag-platform { box-shadow:inset 0 0 0 1px rgba(79,120,168,.18); }
  .bar-fill, .stack-seg, .r-fill, .dash-legend i, .dot, .tag, .batch-tag { filter:none; }
  .dot.g { background:var(--green); } .dot.a { background:var(--amber); }
  .storage-bar.ok { background:linear-gradient(90deg,#e6f4ec,#f3fbf6); color:#2f6b4f; border-color:#bfe3cf; }
  .storage-bar.warn { background:linear-gradient(90deg,#fbf1dd,#fdf9f0); color:#8a6526; border-color:#f0dcaf; }
  .warnbar { background:#fbf1dd; color:#8a6526; border-color:#f0dcaf; }
  .sale-addbar { border-bottom-color:#b9cde2; }
  .header-actions .btn { filter:none; }
  #toast { background:linear-gradient(135deg,#2b3b4f,#172332); color:#f4f8fc; border-color:rgba(255,255,255,.14); }

  @media screen and (max-width: 900px) {
    .app-side { position:static; width:100%; height:auto; flex-direction:column; }
    .side-nav-host { padding:10px 12px; }
    .app-side .nav, .app-side .subnav { flex-direction:row; flex-wrap:wrap; }
    .app-side .nav .tab.top, .app-side .subnav .tab { width:auto; }
    .app-side .subnav { padding-left:0; }
    .app-main { margin-left:0; padding:16px 14px 40px; }
  }

  /* ============ 批量导入弹窗 ============ */
  .bi-mask { position:fixed; inset:0; background:rgba(20,32,48,.5); z-index:60; display:none; align-items:flex-start; justify-content:center; padding:36px 16px; overflow-y:auto; }
  .bi-mask.show { display:flex; }
  .bi-modal { background:var(--card); border:1px solid var(--border); border-radius:16px; width:100%; max-width:1000px; box-shadow:0 20px 60px rgba(15,25,40,.28); overflow:hidden; }
  .bi-head { display:flex; justify-content:space-between; align-items:center; padding:18px 24px; border-bottom:1px solid var(--border); background:linear-gradient(120deg,#eef4fc,#f8fafc); }
  .bi-head h3 { font-size:17px; font-weight:600; color:#1f2c3d; }
  .bi-head .bi-close { border:none; background:transparent; font-size:22px; color:#7b8899; cursor:pointer; line-height:1; padding:2px 8px; }
  .bi-body { padding:20px 24px; }
  .bi-step { font-size:12.5px; color:var(--muted); line-height:1.8; margin-bottom:14px; }
  .bi-step b { color:var(--primary-dark); }
  .bi-toolbar { display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin-bottom:12px; }
  .bi-tpl { font-size:12px; color:var(--muted); background:#f4f7fb; border:1px solid var(--border); border-radius:8px; padding:8px 12px; line-height:1.7; word-break:break-all; }
  .bi-tpl code { color:var(--primary-dark); background:#eaf1fa; padding:1px 5px; border-radius:4px; }
  .bi-textarea { width:100%; min-height:150px; border:1px solid var(--border); border-radius:10px; padding:12px 14px; font-family:"Consolas","Courier New",monospace; font-size:12.5px; line-height:1.6; resize:vertical; outline:none; background:#fbfcfe; color:var(--text); }
  .bi-textarea:focus { border-color:var(--primary); box-shadow:0 0 0 3px rgba(79,120,168,.10); }
  .bi-preview { margin-top:16px; border:1px solid var(--border); border-radius:10px; overflow:hidden; }
  .bi-preview .table-scroll { max-height:340px; overflow:auto; }
  .bi-preview table { min-width:700px; }
  .bi-preview th { position:sticky; top:0; z-index:1; font-size:11.5px; padding:8px 9px; }
  .bi-preview td { font-size:12px; padding:7px 9px; }
  .bi-preview tr.bi-err td { background:#fdeaea; }
  .bi-preview tr.bi-ok td:nth-child(2) { color:var(--green); font-weight:600; }
  .bi-err-msg { color:var(--red); font-size:11.5px; }
  .bi-summary { display:flex; gap:16px; flex-wrap:wrap; margin-top:12px; font-size:12.5px; color:var(--muted); }
  .bi-summary b { color:var(--text); }
  .bi-foot { display:flex; justify-content:flex-end; gap:8px; padding:14px 24px; border-top:1px solid var(--border); background:#fbfcfe; }
  .bi-hidden-file { display:none; }
