﻿:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #1b2130;
  --muted: #1b2130;
  --line: #e6e8ee;
  --primary: #2563eb;
  --primary-soft: #eaf1ff;
  --sidebar: #121a2b;
  --sidebar-ink: #aab3c6;
  --green: #12a150;
  --red: #d92d20;
  --amber: #b45309;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

.app { display: flex; min-height: 100vh; }

/* ---------- rail + menu panel ---------- */
.rail {
  width: 76px; flex: 0 0 76px; background: var(--sidebar); color: var(--sidebar-ink);
  display: flex; flex-direction: column; height: 100vh; position: sticky; top: 0;
  padding: 10px 0; align-items: stretch;
}
.rail-brand {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 4px 0 12px; color: #fff; font-size: 11px; letter-spacing: .5px;
}
.rail-brand .mark {
  width: 34px; height: 34px; border-radius: 9px; font-size: 16px; font-weight: 700;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(37, 99, 235, .35);
}
img.mark { object-fit: cover; display: block; }
.rail-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 9px 0; font-size: 11.5px; color: var(--sidebar-ink); cursor: pointer;
  border-left: 3px solid transparent; transition: .15s;
}
.rail-item svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.rail-item:hover { color: #fff; background: rgba(255,255,255,.05); }
.rail-item.active { color: #fff; background: rgba(37,99,235,.2); border-left-color: #3b82f6; }
.rail-foot { margin-top: auto; text-align: center; font-size: 10px; color: #5f6b82; padding: 8px 0; }

.menu-panel {
  width: 208px; flex: 0 0 208px; background: var(--panel);
  border-right: 1px solid var(--line); height: 100vh; position: sticky; top: 0;
  display: flex; flex-direction: column;
}
.panel-title { padding: 18px 16px 8px; font-size: 15px; font-weight: 600; }
.panel-scroll { flex: 1; overflow-y: auto; padding: 0 8px 14px; }
.panel-group { font-size: 11px; color: #1b2130; padding: 12px 8px 5px; letter-spacing: .5px; }
.panel-item {
  display: block; padding: 8px 10px; border-radius: 7px; font-size: 13px;
  color: #1b2130; cursor: pointer; line-height: 1.35;
}
.panel-item:hover { background: #f4f6fa; }
.panel-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.panel-foot { padding: 10px 14px; font-size: 11px; color: #1b2130; border-top: 1px solid var(--line); }

.crumb { font-size: 11.5px; color: var(--muted); margin-bottom: 5px; }

/* 多标签工作区 */
.tabbar { display: flex; align-items: flex-end; gap: 4px; padding: 0 26px; background: var(--bg); border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { display: flex; align-items: center; gap: 8px; padding: 7px 12px; font-size: 12.5px; color: #1b2130; background: #eef0f4; border: 1px solid var(--line); border-bottom: none; border-radius: 7px 7px 0 0; cursor: pointer; white-space: nowrap; }
.tab:hover { background: #e6e9ef; }
.tab.active { background: #fff; color: var(--primary); font-weight: 600; }
.tab-x { border: none; background: transparent; color: #1b2130; font-size: 15px; line-height: 1; cursor: pointer; padding: 0 2px; }
.tab-x:hover { color: #d92d20; }

.note-bar {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  background: #fff8e6; border: 1px solid #fde3a7; border-radius: 8px;
  color: #92400e; font-size: 12.5px; margin-bottom: 14px;
}
.note-bar .dot { width: 6px; height: 6px; border-radius: 50%; background: #d97706; }

/* ---------- main ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 26px 14px; background: var(--bg);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: .3px; }
.topbar p { margin: 3px 0 0; font-size: 12px; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.today { font-size: 12px; color: var(--muted); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}

.view { padding: 0 26px 40px; }

/* ---------- cards ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.card-head h2 { margin: 0; font-size: 14.5px; font-weight: 600; }
.card-head .muted { font-size: 12px; color: var(--muted); }
.card-body { padding: 16px 18px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stat {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
}
.stat .label { font-size: 12.5px; color: var(--muted); }
.stat .value { font-size: 24px; font-weight: 600; margin-top: 8px; letter-spacing: .2px; }
.stat .sub { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.stat.accent .value { color: var(--primary); }
.stat.warn .value { color: var(--red); }
.stat.ok .value { color: var(--green); }

/* ---------- toolbar ---------- */
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.toolbar .spacer { flex: 1; }
.field { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.field input, .field select {
  height: 32px; border: 1px solid var(--line); border-radius: 7px;
  padding: 0 10px; font-size: 13px; color: var(--ink); background: #fff;
  outline: none;
}
.field input:focus, .field select:focus { border-color: #9bbcf8; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
input[type="date"] { font-family: inherit; }

.btn {
  height: 32px; padding: 0 14px; border-radius: 7px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  font-size: 13px; cursor: pointer; transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: #c9cedb; background: #fafbfc; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: #1d4ed8; }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: #fef3f2; border-color: #fda29b; }
.btn.sm { height: 26px; padding: 0 10px; font-size: 12px; border-radius: 6px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; border: 1px solid #dfe3ea; }
table.grid th {
  text-align: left; font-weight: 500; color: var(--muted);
  background: #fafbfc; padding: 6px 10px; border-bottom: 1px solid var(--line);
  border-right: 1px solid #e6e9ef;
  white-space: nowrap; font-size: 12.5px;
}
table.grid td {
  padding: 6px 10px; border-bottom: 1px solid #f0f1f5; vertical-align: middle;
  border-right: 1px solid #eef0f4;
}
table.grid th:last-child, table.grid td:last-child { border-right: none; }
table.grid.cf-fixed th, table.grid.cf-fixed td { overflow: hidden; text-overflow: ellipsis; }
table.grid td:first-child { white-space: nowrap; }
table.grid input[type="checkbox"] {
  width: 19px; height: 19px; margin: 0; cursor: pointer;
  accent-color: var(--primary); vertical-align: middle;
}
table.grid th input[type="checkbox"] { width: 19px; height: 19px; }
table.grid th, table.grid td { white-space: nowrap; }
table.grid td.wrap { white-space: normal; min-width: 120px; }
table.grid tbody tr:hover { background: #fafcff; }
table.grid tbody tr:last-child td { border-bottom: none; }
table.grid .num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid .strong { font-weight: 600; }
.empty { padding: 46px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.link { color: var(--primary); cursor: pointer; }
.link:hover { text-decoration: underline; }

.tag {
  display: inline-block; padding: 1px 8px; border-radius: 20px;
  font-size: 11.5px; line-height: 18px;
}
.tag.green { background: #e7f7ee; color: #12734a; }
.tag.red { background: #fef0ef; color: #b42318; }
.tag.amber { background: #fff6e5; color: #92400e; }
.tag.blue { background: #eaf1ff; color: #1d4ed8; }
.tag.gray { background: #f2f4f7; color: #1b2130; }

/* ---------- modal ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 16px; z-index: 100; overflow-y: auto;
}
.modal {
  width: 100%; max-width: 880px; background: #fff;
  border-radius: 12px; box-shadow: 0 20px 48px rgba(16,24,40,.24);
  animation: pop .16s ease-out;
  position: relative; overflow: hidden;
}
.modal.narrow { max-width: 460px; }
.modal.wide { max-width: 1040px; }
.modal.mid { max-width: 760px; }
@keyframes pop { from { transform: translateY(8px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 15.5px; font-weight: 600; }
.modal-close {
  border: none; background: transparent; font-size: 20px; line-height: 1;
  color: var(--muted); cursor: pointer; padding: 2px 6px; border-radius: 6px;
}
.modal-close:hover { background: #f2f4f7; }
.modal-body { padding: 18px 20px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 20px; border-top: 1px solid var(--line);
  background: #fcfcfd; border-radius: 0 0 12px 12px;
}

.form-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
.form-row.three { grid-template-columns: repeat(3, 1fr); }
.form-row.two { grid-template-columns: repeat(2, 1fr); }
.form-item { display: flex; flex-direction: column; gap: 6px; }
.form-item label { font-size: 12.5px; color: var(--muted); }
.form-item input, .form-item select, .form-item textarea {
  height: 34px; border: 1px solid var(--line); border-radius: 7px;
  padding: 0 10px; font-size: 13px; color: var(--ink); outline: none;
  width: 100%; background: #fff;
}
.form-item textarea { height: auto; padding: 8px 10px; resize: vertical; min-height: 34px; }
.form-item input:focus, .form-item select:focus, .form-item textarea:focus {
  border-color: #9bbcf8; box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.form-item .hint { font-size: 11px; color: var(--muted); }

table.lines { width: 100%; border-collapse: collapse; font-size: 13px; }
table.lines th {
  text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 500;
  padding: 8px; border-bottom: 1px solid var(--line); background: #fafbfc;
}
table.lines td { padding: 6px 8px; border-bottom: 1px solid #f2f3f7; }
table.lines input, table.lines select {
  height: 32px; border: 1px solid var(--line); border-radius: 6px;
  padding: 0 8px; font-size: 13px; width: 100%; outline: none; background: #fff;
}
table.lines input:focus, table.lines select:focus { border-color: #9bbcf8; }
table.lines .amount { text-align: right; font-variant-numeric: tabular-nums; padding-right: 10px; }
table.lines .del {
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 16px; line-height: 1; padding: 2px 6px; border-radius: 5px;
}
table.lines .del:hover { color: var(--red); background: #fef3f2; }
.doc-total {
  display: flex; justify-content: flex-end; gap: 26px;
  padding: 12px 8px 2px; font-size: 13px;
}
.doc-total b { font-size: 16px; color: var(--primary); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs button {
  border: none; background: none; padding: 9px 14px; font-size: 13.5px;
  color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ---------- split layout (商品信息) ---------- */
.split { display: grid; grid-template-columns: 196px minmax(0, 1fr); gap: 14px; align-items: start; }
.split-main { min-width: 0; }
.cat-panel { position: sticky; top: 88px; min-width: 0; overflow: hidden; }
.cat-head { padding: 10px 8px 10px 10px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 5px; min-width: 0; }
.cat-search { flex: 1 1 auto; width: 0; min-width: 0; height: 30px; border: 1px solid var(--line); border-radius: 16px; padding: 0 10px; font-size: 12.5px; outline: none; background: #fafbfc; }
.cat-search:focus { border-color: #9bbcf8; background: #fff; }
.cat-plus { flex: 0 0 26px; width: 26px; height: 26px; margin-right: 2px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--primary); font-size: 15px; line-height: 1; cursor: pointer; }
.cat-plus:hover { background: var(--primary-soft); border-color: #bfd3fb; }
.cat-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--line); }
.cat-foot select { height: 26px; border: 1px solid var(--line); border-radius: 6px; font-size: 11.5px; color: var(--muted); background: #fff; padding: 0 4px; }
.cat-body { padding: 8px; max-height: calc(100vh - 240px); overflow: auto; }
.cat-row { display: flex; align-items: center; gap: 2px; padding: 6px 8px; border-radius: 6px; font-size: 13px; color: #1b2130; cursor: pointer; }
.cat-row:hover { background: #f5f7fa; }
.cat-row.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.cat-toggle { width: 14px; text-align: center; color: #1b2130; font-size: 11px; flex: 0 0 14px; }
.cat-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb { width: 32px; height: 32px; border-radius: 5px; object-fit: cover; border: 1px solid var(--line); display: block; }
.thumb-empty { display: block; width: 32px; height: 32px; border-radius: 5px; background: #f2f4f7; border: 1px dashed #d0d5dd; }
.row-actions { display: flex; gap: 4px; white-space: nowrap; }
.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; padding: 8px 12px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.pager select { height: 28px; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; font-size: 12.5px; background: #fff; }
.form-section { font-size: 12.5px; font-weight: 600; color: #1b2130; margin: 6px 0 12px; padding-left: 8px; border-left: 3px solid var(--primary); }

/* ---------- 管家婆风格商品表单 ---------- */
.gp-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 26px; }
.gp-field { display: grid; grid-template-columns: 92px minmax(0, 1fr); align-items: center; gap: 8px; min-width: 0; }
.gp-field > label { font-size: 12.5px; color: #1b2130; text-align: right; white-space: nowrap; }
.gp-field input, .gp-field select, .gp-field textarea { height: 34px; border: 1px solid var(--line); border-radius: 7px; padding: 0 10px; font-size: 13px; background: #fff; outline: none; width: 100%; min-width: 0; }
.gp-field textarea { height: auto; padding: 8px 10px; resize: vertical; }
.gp-field input:focus, .gp-field select:focus, .gp-field textarea:focus { border-color: #9bbcf8; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.gp-inline { display: flex; align-items: center; gap: 6px; min-width: 0; }
.gp-inline input { min-width: 0; }
.gp-x { color: var(--muted); font-size: 12px; }
.gp-full { grid-column: 1 / -1; }
.gp-check { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.gp-check input { width: auto; height: auto; }
.req { color: var(--red); }
.more-fields { float: right; border: none; background: none; color: var(--primary); font-size: 12px; cursor: pointer; font-weight: 400; }
.img-box { width: 96px; height: 96px; border: 1px dashed #d0d5dd; border-radius: 8px; background: #fafbfc; display: flex; align-items: center; justify-content: center; cursor: pointer; color: #1b2130; font-size: 24px; overflow: hidden; flex: 0 0 96px; }
.img-box img { width: 100%; height: 100%; object-fit: cover; }

/* 更多配置抽屉 */
.gp-drawer { position: absolute; top: 0; right: 0; bottom: 0; width: 240px; background: #fff; border-left: 1px solid var(--line); box-shadow: -8px 0 24px rgba(16,24,40,.08); transform: translateX(101%); transition: transform .2s; display: flex; flex-direction: column; z-index: 6; }
.gp-drawer.open { transform: none; }
.gp-drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 13.5px; font-weight: 600; }
.gp-drawer-tip { padding: 10px 16px 2px; font-size: 11.5px; color: var(--muted); }
.gp-drawer-body { padding: 6px 10px 16px; overflow: auto; flex: 1; }
.gp-drawer-row { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; font-size: 12.5px; color: #1b2130; cursor: pointer; }
.gp-drawer-row:hover { background: #f5f7fa; }
.gp-drawer-row input { width: auto; height: auto; }
.img-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.img-thumb { position: relative; width: 96px; height: 96px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.img-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-del { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%; border: none; background: rgba(16,24,40,.6); color: #fff; font-size: 12px; line-height: 1; cursor: pointer; }
.perm-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px 12px; }
input.picked { background: #eaf1ff; color: #1d4ed8; font-weight: 600; border-color: #bfd3fb; }
.cell-edit { cursor: pointer; border-bottom: 1px dashed #c9cedb; }
.cell-edit:hover { background: #f5f8ff; color: var(--primary); }
.cell-pop { position: fixed; z-index: 400; width: 320px; background: #fff; border: 1px solid #bfd3fb; border-top: 3px solid var(--primary); border-radius: 10px; box-shadow: 0 14px 36px rgba(16,24,40,.22); padding: 14px; }
.cell-pop-title { font-size: 14px; font-weight: 600; color: var(--primary); margin-bottom: 10px; }
.cell-pop input { width: 100%; height: 38px; border: 1px solid var(--line); border-radius: 7px; padding: 0 10px; font-size: 14px; outline: none; }
.cell-pop input:focus { border-color: #9bbcf8; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.cell-pop-note { font-size: 12px; color: var(--muted); margin: 9px 0 12px; line-height: 1.45; }
.cell-pop-btns { display: flex; justify-content: flex-end; gap: 8px; }
.cell-pop-btns .btn { height: 30px; }
td.cell-active { background: #eaf1ff !important; box-shadow: inset 0 0 0 2px #2563eb; }

/* 列宽拖动 */
.col-resizer { position: absolute; top: 0; right: -3px; width: 7px; height: 100%; cursor: col-resize; z-index: 2; }
.col-resizer:hover { background: rgba(37,99,235,.25); }
th { position: relative; }
.col-filter th { padding: 4px 6px; background: #fafbfc; }
.col-filter input { width: 100%; height: 24px; border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; font-size: 12px; outline: none; background: #fff; }
.col-filter input:focus { border-color: #9bbcf8; }
/* 收款单/付款单：表头内排搜索框 */
.grid th .pb-fw { margin-top: 5px; }
.grid th .pb-f { width: 100%; box-sizing: border-box; height: 22px; padding: 0 4px; font-size: 11.5px; border: 1px solid #cfd8e3; border-radius: 4px; background: #fff; color: #333; }
.grid th .pb-f:focus { border-color: #6f9df5; outline: none; }
.col-gear { position: absolute; top: 8px; right: 8px; z-index: 6; width: 26px; height: 26px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: #1b2130; font-size: 14px; line-height: 1; cursor: pointer; }
.col-gear:hover { color: var(--primary); border-color: #bfd3fb; background: var(--primary-soft); }
.col-gear.inline { position: static; display: block; margin: 0 auto; width: 22px; height: 22px; font-size: 13px; }

/* 单元格修改对话框 */
.cell-dialog { position: fixed; left: 50%; top: 20%; transform: translateX(-50%); width: 400px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 20px 50px rgba(16,24,40,.28); z-index: 500; overflow: hidden; }
.cd-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: var(--primary); color: #fff; font-size: 13.5px; font-weight: 600; cursor: move; user-select: none; }
.cd-x { border: none; background: transparent; color: #fff; font-size: 18px; line-height: 1; cursor: pointer; padding: 0 4px; }
.cd-x:hover { opacity: .8; }
.cd-body { padding: 16px; }
.cd-body input { width: 100%; height: 38px; border: 1px solid var(--line); border-radius: 7px; padding: 0 10px; font-size: 14px; outline: none; }
.cd-body input:focus { border-color: #9bbcf8; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.cd-note { font-size: 12px; color: var(--muted); margin-top: 10px; line-height: 1.45; }
.cd-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); background: #fcfcfd; }
@media (max-width: 720px) { .gp-form { grid-template-columns: 1fr; } }
.gp-form.cols3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1280px) { .gp-form.cols3 { grid-template-columns: 1fr 1fr; } }
.modal-foot.left { justify-content: flex-start; }
.gp-topbar { display: flex; justify-content: flex-end; margin: 0 0 8px; }

.cat-selects { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.cat-selects select { height: 34px; border: 1px solid var(--line); border-radius: 7px; padding: 0 5px; font-size: 12.5px; background: #fff; width: 100%; outline: none; }
.cat-selects select:focus { border-color: #9bbcf8; }

@media (max-width: 1100px) {
  .split { grid-template-columns: 1fr; }
  .cat-panel { position: static; }
  .cat-body { max-height: 180px; }
}

/* toast */
#toast-root { position: fixed; top: 18px; right: 18px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #101828; color: #fff; padding: 10px 16px; border-radius: 8px;
  font-size: 13px; box-shadow: 0 10px 24px rgba(16,24,40,.2);
  animation: slide .18s ease-out;
}
.toast.err { background: #b42318; }
.toast.ok { background: #12734a; }
@keyframes slide { from { transform: translateX(12px); opacity: 0; } to { transform: none; opacity: 1; } }

.dash-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 16px; align-items: start; }

@media (max-width: 1240px) {
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1100px) {
  .rail { width: 64px; flex-basis: 64px; }
  .menu-panel { width: 176px; flex-basis: 176px; }
  .rail-item { font-size: 10.5px; }
}
@media (max-width: 860px) {
  .menu-panel { display: none; }
  .view, .topbar { padding-left: 14px; padding-right: 14px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .stats { grid-template-columns: 1fr; }
  .form-row, .form-row.two, .form-row.three { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { width: 64px; flex-basis: 64px; }
  .brand-text, .nav-group, .sidebar-foot { display: none; }
  #nav a { justify-content: center; padding: 11px; }
  #nav a svg { width: 18px; height: 18px; }
  #nav a { font-size: 0; }
  .view, .topbar { padding-left: 14px; padding-right: 14px; }
}

/* 可输入下拉（请选择…） */
.pk-wrap { position: relative; display: inline-block; }
.pk-wrap > input.pk-input {
  height: 30px; border: 1px solid var(--line); border-radius: 6px; padding: 0 8px;
  background: #fff; font-size: 13px; color: var(--text); outline: none;
}
.pk-wrap > input.pk-input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(43,110,246,.12); }
.pk-list {
  position: absolute; z-index: 80; top: 33px; left: 0; min-width: 100%; max-height: 240px; overflow: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 10px 26px rgba(16,24,40,.14); display: none; text-align: left;
}
.pk-item { padding: 6px 10px; font-size: 12.5px; cursor: pointer; white-space: nowrap; color: var(--text); }
.pk-item:hover, .pk-item.active { background: var(--primary-soft); color: var(--primary); }
.pk-empty { padding: 8px 10px; font-size: 12px; color: var(--muted); }

/* 全局字号整体加大一档（约 +7%） */
body { zoom: 1.28; }


table.grid.qb-grid th, table.grid.qb-grid td { padding: var(--qb-py, 6px) var(--qb-px, 4px); }
table.grid.qb-grid th { white-space: nowrap; font-size: 11px; letter-spacing: -0.2px; }
table.grid.qb-grid td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 销售明细查询 表头搜索行 */
thead tr.si-hf th{padding:3px 4px;background:#fbfcfd}
.si-f{width:100%;min-width:0;height:24px;border:1px solid var(--line);border-radius:4px;padding:0 4px;font-size:11.5px;background:#fff;color:var(--text)}
.si-f:focus{outline:none;border-color:var(--primary)}
/* 列保存按钮条 */
.colw-bar{display:flex;justify-content:flex-end;align-items:center;gap:6px;padding:6px 10px 0}
.colw-save{height:24px;padding:0 10px;font-size:11.5px;color:var(--muted);background:#fff}
.colw-save:hover{color:var(--primary);border-color:var(--primary)}
/* 悬浮横向滚动条 */
.hscroll-float{position:fixed;bottom:0;height:15px;overflow-x:auto;overflow-y:hidden;background:#fff;border-top:1px solid var(--line);box-shadow:0 -2px 8px rgba(15,23,42,.08);z-index:60;display:none}
.hscroll-float::-webkit-scrollbar{height:13px}
.hscroll-float::-webkit-scrollbar-thumb{background:#c7ced8;border-radius:7px}
.hscroll-float::-webkit-scrollbar-thumb:hover{background:#aeb7c4}
.hscroll-float::-webkit-scrollbar-track{background:#f4f6f9}
.hscroll-inner{height:1px}
.table-wrap.hscroll-native-hide::-webkit-scrollbar{height:0}

/* ================= 全局体验优化 ================= */
/* 顶部请求进度条 */
#busy-bar{
  position: fixed; left: 0; top: 0; height: 2.5px; width: 0; opacity: 0;
  background: linear-gradient(90deg,#2563eb,#60a5fa,#2563eb);
  box-shadow: 0 0 6px rgba(37,99,235,.55); z-index: 999;
  pointer-events: none; transition: opacity .18s; border-radius: 0 2px 2px 0;
}
#busy-bar.on{ opacity: 1; animation: busyRun 1.15s ease-in-out infinite; }
@keyframes busyRun{
  0%{ width: 8%; }
  55%{ width: 64%; }
  100%{ width: 92%; }
}
body.modal-open{ overflow: hidden; }

/* 勾选行高亮 */
table.grid tbody tr:has(input[type="checkbox"]:checked){ background: #eef5ff; }
table.grid tbody tr:has(input[type="checkbox"]:checked):hover{ background: #e4efff; }

/* 表头分隔更清晰 */
table.grid thead th{ border-bottom: 1px solid #dbe0ea; }

/* 空状态 */
.empty{ display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty::before{
  content: ''; width: 34px; height: 34px; border-radius: 10px; background: #eef2f8 no-repeat center/20px 20px;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2393a0b5' stroke-width='1.7' stroke-linecap='round'%3E%3Cpath d='M4 7h16M4 12h16M4 17h10'/%3E%3C/svg%3E");
}

/* 打印：只输出表格内容 */
@media print{
  @page{ margin: 10mm; }
  html, body{ zoom: 1 !important; background: #fff !important; }
  .rail,.menu-panel,.topbar,.tabbar,.toolbar,.colw-bar,.pager,.hscroll-float,
  #busy-bar,#toast-root,.col-gear,.col-resizer,.modal-close,#modal-root{ display: none !important; }
  .view{ padding: 0 !important; }
  .card{ border: none !important; box-shadow: none !important; }
  .table-wrap{ overflow: visible !important; max-height: none !important; }
  table.grid{ width: 100% !important; font-size: 10.5px !important; }
  table.grid th, table.grid td{ padding: 3px 4px !important; }
  table.grid thead{ display: table-header-group; }
  table.grid tr{ page-break-inside: avoid; }
  thead tr.si-hf, .col-filter, th .si-f, th .pb-f{ display: none !important; }
}

/* ================= 表头吸顶 ================= */
.table-wrap.vsc{ overflow: auto; overscroll-behavior: contain; }
.table-wrap.vsc thead th{
  position: sticky; z-index: 6; background-clip: padding-box;
  background-color: #fafbfc; box-shadow: inset 0 -1px 0 #dbe0ea;
}
.table-wrap.vsc thead tr.si-hf th{ background-color: #fbfcfd; }
.table-wrap.vsc::-webkit-scrollbar{ width: 11px; height: 11px; }
.table-wrap.vsc::-webkit-scrollbar-thumb{ background: #c7ced8; border-radius: 6px; }
.table-wrap.vsc::-webkit-scrollbar-thumb:hover{ background: #aeb7c4; }
.table-wrap.vsc::-webkit-scrollbar-track{ background: #f6f7fa; }

/* ================= 窄屏紧凑 ================= */
@media (max-width: 700px){
  .stats{ grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px; }
  .stat{ padding: 12px 14px; }
  .stat .value{ font-size: 19px; margin-top: 4px; }
  .stat .sub{ font-size: 11px; margin-top: 4px; }
}
@media (max-width: 430px){
  .stats{ grid-template-columns: 1fr !important; }
}
/* 拆分过的单据：单号标红 */
td.split-no{ color: var(--red) !important; font-weight: 600; }

/* 表头筛选：同类项小箭头 */
th.si-hf-cell{ position: relative; }
th.si-hf-cell .si-f{ padding-right: 18px; }
.hf-arrow{ position:absolute; right:2px; top:50%; transform:translateY(-50%); width:16px; height:18px; line-height:1; border:0; background:transparent; color:#8a93a5; font-size:11px; cursor:pointer; padding:0; }
.hf-arrow:hover{ color: var(--primary); }
.hf-item{ padding:5px 10px; cursor:pointer; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:320px; }
.hf-item:hover{ background:#eef5ff; }
.hf-item.hf-loading{ color:#98a2b3; cursor:default; }
.hf-item.hf-loading:hover{ background:transparent; }

th.hf-th{ position: relative; }
th.hf-th input{ padding-right: 16px; }

/* 去掉数字输入框（数量/单价/金额）的上下调整箭头 */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button{
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}
input[type="number"]{ -moz-appearance: textfield; appearance: textfield; }

/* 编辑收付款单：与录入表单一致的四列栅格，禁止子项撑破轨道 */
.pbe-grid > .form-item { min-width: 0; }
.pbe-grid input, .pbe-grid select { width: 100%; min-width: 0; }
