:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #101828;
  --ink-2: #475467;
  --ink-3: #98a2b3;
  --line: #e6eaef;
  --brand: #0f7b63;
  --brand-dark: #0b5f4c;
  --brand-soft: #e8f5f1;
  --sidebar: #101828;
  --sidebar-2: #1a2436;
  --warn: #b54708;
  --warn-soft: #fff4e5;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 24px rgba(16, 24, 40, 0.04);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }

.hidden { display: none !important; }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  background: #0c1322;
}
.login-hero {
  position: relative;
  padding: 64px 72px;
  color: #fff;
  background:
    radial-gradient(900px 480px at 12% 8%, rgba(16, 185, 129, 0.28), transparent 60%),
    radial-gradient(700px 420px at 88% 92%, rgba(59, 130, 246, 0.22), transparent 62%),
    #0c1322;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}
.login-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 30% 30%, #000 30%, transparent 78%);
  pointer-events: none;
}
.login-brand { display: flex; align-items: center; gap: 12px; font-weight: 600; letter-spacing: 0.4px; }
.logo-mark {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(140deg, #34d399, #0f7b63);
  display: grid; place-items: center;
  font-size: 18px; color: #06261f; font-weight: 800;
}
.login-title { font-size: 42px; line-height: 1.22; margin: 0 0 18px; font-weight: 700; letter-spacing: 0.5px; }
.login-sub { color: rgba(255, 255, 255, 0.62); font-size: 15px; line-height: 1.9; max-width: 520px; }
.login-points { display: grid; gap: 14px; margin-top: 40px; max-width: 520px; }
.login-point { display: flex; gap: 12px; align-items: flex-start; color: rgba(255, 255, 255, 0.8); }
.login-point i {
  flex: 0 0 22px; height: 22px; border-radius: 50%;
  background: rgba(52, 211, 153, 0.16); color: #6ee7b7;
  display: grid; place-items: center; font-style: normal; font-size: 12px;
}
.login-foot { color: rgba(255, 255, 255, 0.32); font-size: 12px; }
.login-panel { display: grid; place-items: center; padding: 40px; background: #fbfcfd; }
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { font-size: 24px; margin: 0 0 8px; }
.login-card p { color: var(--ink-3); margin: 0 0 28px; }
.login-card .btn { width: 100%; height: 46px; }
.login-error { color: var(--danger); font-size: 13px; min-height: 20px; margin-top: 10px; }
.login-hint {
  margin-top: 26px; padding: 14px 16px; border-radius: 10px;
  background: #f1f5f9; color: var(--ink-2); font-size: 12px; line-height: 1.8;
}
.login-hint b { color: var(--ink); }

/* ---------- app shell ---------- */
.app { min-height: 100vh; display: flex; }
.sidebar {
  width: 121px; flex: 0 0 121px; background: var(--sidebar); color: #cbd5e1;
  display: flex; flex-direction: column; padding: 14px 0 10px;
  transition: width 0.18s, flex-basis 0.18s;
}
/* 菜单收起：完全隐藏侧栏，主区占满 */
.app.nav-collapsed .sidebar { width: 0; flex-basis: 0; padding-left: 0; padding-right: 0; overflow: hidden; }
.brand { display: flex; align-items: center; gap: 8px; padding: 0 10px 18px; color: #fff; }
.brand-name { font-weight: 650; font-size: 13.5px; line-height: 1.3; white-space: nowrap; }
.brand-name small { display: block; font-size: 10px; color: #7d8ba3; font-weight: 400; letter-spacing: 0.5px; }
.nav { display: grid; gap: 4px; padding: 0; }
.nav-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 10px; border: 0; border-radius: 0; background: transparent;
  color: #9fb0c6; font-size: 12.8px; cursor: pointer; text-align: left;
  transition: background 0.15s, color 0.15s; white-space: nowrap;
}
.nav-btn:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-btn.active { background: var(--brand); color: #fff; font-weight: 600; }
.nav-btn .ico { width: 17px; text-align: center; opacity: 0.95; font-size: 13px; flex: 0 0 17px; }
.nav-btn .badge-mini {
  margin-left: auto; background: #f79009; color: #422006; font-size: 10.5px;
  padding: 1px 5px; border-radius: 999px; font-weight: 700;
}
.sidebar-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid rgba(255, 255, 255, 0.08); font-size: 11px; color: #7787a0; line-height: 1.7; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 62px; background: rgba(255, 255, 255, 0.86); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center;
  padding: 0 26px; gap: 16px; position: sticky; top: 0; z-index: 20;
}
/* 云服务器续费提醒（每年 11/1-11/14 顶栏显示，点击关闭） */
.renew-tip {
  margin: 0 auto; display: inline-flex; align-items: center; gap: 6px;
  background: linear-gradient(135deg, #ff7a45, #f5222d); color: #fff;
  border: 0; border-radius: 999px; padding: 7px 16px; font-size: 12.5px; font-weight: 650;
  cursor: pointer; box-shadow: 0 2px 10px rgba(245, 34, 45, 0.32); white-space: nowrap;
}
.renew-tip:active { opacity: .85; }
.topbar h1 { font-size: 17px; margin: 0; font-weight: 650; letter-spacing: 0.2px; }
.topbar .sub { color: var(--ink-3); font-size: 12.5px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
#navToggle { flex: 0 0 auto; font-size: 15px; font-weight: 700; }
.avatar {
  height: 32px; padding: 0 12px; border-radius: 16px; background: var(--brand-soft);
  color: var(--brand-dark); display: inline-flex; align-items: center; font-weight: 700; font-size: 13px;
  white-space: nowrap;
}
.content { padding: 24px 26px 60px; width: 100%; max-width: 1480px; }
.app-foot { margin-top: auto; padding: 26px 16px 22px; text-align: center; color: #98a2b3; font-size: 12px; line-height: 1.8; }

/* ---------- generic ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-title { font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.card-title .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }
.card-sub { color: var(--ink-3); font-size: 12.5px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink-3); cursor: pointer; padding: 0; transition: all 0.15s; }
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }
.icon-btn.on { color: var(--brand); border-color: var(--brand); background: rgba(15, 123, 99, 0.08); }
.card-body { padding: 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--line); background: #fbfcfd; color: var(--ink-2); font-size: 13px; }

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.strong { font-weight: 650; }
.num { font-variant-numeric: tabular-nums; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); cursor: pointer; font-size: 13.5px;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s; white-space: nowrap;
}
.btn:hover { border-color: #cfd6df; background: #f9fafb; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-danger { color: var(--danger); border-color: #fecdca; background: var(--danger-soft); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: #f2f4f7; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn-lg { height: 42px; padding: 0 20px; font-size: 14px; }

.input, .select, textarea.input {
  height: 36px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
  padding: 0 10px; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
textarea.input { height: auto; padding: 10px; line-height: 1.7; width: 100%; resize: vertical; }
.input:focus, .select:focus, textarea.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15, 123, 99, 0.1); }
.input-sm { height: 30px; font-size: 12.5px; }
/* 日期框：部分电脑（Windows 字体更宽/高分屏）下过窄会裁掉内容，
   用 min-width 覆盖内联 width，并收紧内边距给日期文本+日历图标留足空间 */
input[type="date"].input { min-width: 165px; padding: 0 6px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12.5px; color: var(--ink-2); font-weight: 550; }
.field .req { color: var(--danger); }

/* ---------- 订货日历 ---------- */
/* 双月并排：窄屏自动换行 */
.cal-months { display: flex; gap: 36px; flex-wrap: wrap; }
.cal-month-title { font-size: 15px; font-weight: 700; text-align: center; margin-bottom: 10px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 44px); gap: 5px; max-width: 360px; }
.cal-head { text-align: center; font-size: 12px; color: var(--ink-3); padding: 4px 0; font-weight: 600; }
.cal-day {
  height: 38px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
  font-size: 13px; cursor: pointer; text-align: center; padding: 0; transition: all 0.12s;
}
.cal-day:hover { border-color: var(--brand); }
/* 周日：默认不可出货状态（非仅红字），右上角"休"角标 */
.cal-day.sun {
  color: #b42318; background: #fef2f2; font-weight: 600; border-color: #fca5a5;
  cursor: not-allowed; position: relative;
}
.cal-day.sun::after {
  content: '休'; position: absolute; top: -6px; right: -6px;
  font-size: 9px; background: #dc2626; color: #fff; font-style: normal;
  border-radius: 999px; padding: 1px 4px; line-height: 1.3; font-weight: 700;
}
.cal-day.sun:hover { border-color: #dc2626; }
/* 周日被设为可出货：绿色可点击态 */
.cal-day.sun.open {
  color: #065f46; background: #ecfdf5; border-color: #6ee7b7; cursor: pointer;
}
.cal-day.sun.open::after { content: '营'; background: #059669; }
.cal-day.sun.open:hover { border-color: #10b981; }
.cal-day.sun.today { box-shadow: inset 0 0 0 2px rgba(180, 35, 24, 0.4); }
.cal-day.sun.open.today { box-shadow: inset 0 0 0 2px rgba(5, 150, 105, 0.45); }
.cal-day.today { box-shadow: inset 0 0 0 2px rgba(15, 123, 99, 0.35); }
.cal-day.sel { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 700; }
.cal-day.start { background: #f79009; border-color: #f79009; color: #422006; font-weight: 700; }

/* ---------- kpi ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-bottom: 11px; }
.kpi {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 6px 10px 6px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi-label { color: var(--ink-3); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: 15px; font-weight: 700; margin-top: 2px; letter-spacing: -0.3px; font-variant-numeric: tabular-nums; line-height: 1.25; }
.kpi-value small { font-size: 12px; font-weight: 500; color: var(--ink-3); margin-left: 3px; }
.kpi-note { margin-top: 1px; font-size: 11.5px; color: var(--ink-3); }
.kpi.warn .kpi-value { color: var(--warn); }
.kpi.brand .kpi-value { color: var(--brand-dark); }
.kpi .spark { position: absolute; right: -14px; bottom: -24px; width: 66px; height: 66px; border-radius: 50%; background: var(--brand-soft); opacity: 0.7; }
.kpi.warn .spark { background: var(--warn-soft); }
/* 可点击跳转的 KPI 卡片：悬停浮起提示可点 */
.kpi.kpi-click { cursor: pointer; transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease; }
.kpi.kpi-click:hover { transform: translateY(-2px); border-color: var(--brand); box-shadow: 0 6px 16px rgba(15, 123, 99, 0.16); }
.kpi.kpi-click:active { transform: translateY(0); }
/* KPI 点击后订货明细卡片定位高亮 */
.card.flash-target { animation: cardFlash 1.4s ease; }
@keyframes cardFlash {
  0%, 55% { box-shadow: 0 0 0 3px rgba(15, 123, 99, 0.4), var(--shadow); }
  100% { box-shadow: var(--shadow); }
}
/* 订单处理页页签：订货汇总/订货明细切换，同一时间只显示一个，表格占满整屏宽度 */
.dash-tabs { display: flex; gap: 2px; align-items: center; margin-bottom: 10px; border-bottom: 2px solid var(--line); }
.dash-tab {
  border: 0; background: none; cursor: pointer; padding: 9px 16px;
  font-size: 14px; font-weight: 600; color: var(--ink-3);
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  display: flex; align-items: center; gap: 7px;
  transition: color .15s, border-color .15s;
}
.dash-tab:hover { color: var(--ink); }
.dash-tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.dash-tab .tban { font-size: 11.5px; font-weight: 600; background: #f2f4f7; color: var(--ink-2); padding: 1px 8px; border-radius: 9px; }
.dash-tab.active .tban { background: var(--brand-soft); color: var(--brand); }
/* 页签面板限高内部滚动 + 表头吸顶：浏览 200+ 种商品不用整页翻，列名始终可见 */
.dash-pane .table-wrap { max-height: calc(100vh - 285px); min-height: 320px; overflow: auto; }
.dash-pane th { position: sticky; top: 0; z-index: 5; }

/* ---------- alert ---------- */
.alert {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px;
  border-radius: 10px; margin-bottom: 16px; font-size: 13.5px; border: 1px solid transparent;
}
.alert-warn { background: var(--warn-soft); color: #7a2e0e; border-color: #fed7aa; }
.alert-ok { background: var(--brand-soft); color: #054f3d; border-color: #b7e4d5; }
.alert .grow { font-weight: 500; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; color: var(--ink-3); font-weight: 550; font-size: 12px;
  padding: 10px 12px; background: #fafbfc; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data td { padding: 11px 12px; border-bottom: 1px solid #f1f3f6; vertical-align: middle; }
table.data tbody tr:hover { background: #fbfcfd; }
table.data tfoot td { background: #fbfcfd; font-weight: 650; border-top: 1px solid var(--line); }
table.data td.r, table.data th.r { text-align: right; }
table.data td.c, table.data th.c { text-align: center; }
table.data.compact td { padding: 8px 10px; }
/* 明细滚动时表头固定：表格容器限高内部滚动，表头吸附容器顶
   注：th sticky 相对最近滚动容器，.table-wrap 的 overflow-x:auto 会使它成为滚动容器，故用容器内吸附方案 */
#statsBody .table-wrap { max-height: calc(100vh - 300px); min-height: 320px; overflow: auto; }
#statsBody table.data th, .dash-pane .table-wrap table.data th { position: sticky; top: 0; z-index: 5; }
.code-tag { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; color: var(--ink-2); background: #f2f4f7; padding: 2px 6px; border-radius: 5px; }
.order-link { color: #1d4ed8; font-weight: 600; text-decoration: none; cursor: pointer; }
.order-link:hover { text-decoration: underline; background: #e8effc; }
.product-name { font-weight: 600; }
.unit { color: var(--ink-3); font-size: 11.5px; }

/* 订货汇总表：商品名称列加宽、档口列窄、档口标题自动折行 */
table.data.agg-table { table-layout: fixed; min-width: 100%; }
.agg-table .th-product { width: 150px; min-width: 150px; white-space: normal; word-break: break-all; }
.agg-table .td-product { width: 150px; min-width: 150px; white-space: normal; word-break: break-all; font-weight: 600; }
.agg-table .th-stall { width: 60px; min-width: 60px; white-space: normal; word-break: break-all; font-size: 11px; padding: 6px 3px; }
.agg-table .td-stall { width: 60px; min-width: 60px; text-align: center; padding: 6px 3px; font-size: 12px; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge-pending { background: var(--warn-soft); color: var(--warn); }
.badge-outbound { background: var(--brand-soft); color: var(--brand-dark); }
.badge-gray { background: #f2f4f7; color: var(--ink-2); }
.badge-blue { background: #eff8ff; color: #175cd3; }

/* ---------- price editor ---------- */
.price-input { width: 92px; height: 30px; text-align: right; padding-right: 8px; border: 1px solid var(--line); border-radius: 6px; color: #1d4ed8; font-weight: 700; }
.price-input.dirty { border-color: var(--brand); background: #f2fbf8; box-shadow: 0 0 0 2px rgba(15, 123, 99, 0.09); }
.price-input.price-up { color: #b91c1c; }
.price-input.price-down { color: #15803d; }

/* 商品档案：分类分组可折叠 */
.prod-cat-head { display: flex; align-items: center; gap: 8px; padding: 10px 18px; background: #f6f8f8; border-bottom: 1px solid var(--line); cursor: pointer; user-select: none; }
.prod-cat-head:hover { background: #eef3f2; }
.prod-cat-head b { font-size: 13.5px; }
.prod-cat-body { border-bottom: 1px solid var(--line); }
.prod-cat:last-child .prod-cat-body { border-bottom: none; }
.fold-arrow { display: inline-block; transition: transform .15s; color: var(--ink-3); font-size: 12px; }
.fold-arrow.folded { transform: rotate(-90deg); }
.price-arrow { font-size: 14px; font-weight: 800; line-height: 1; }
.price-arrow.up { color: #b91c1c; }
.price-arrow.down { color: #15803d; }
.badge-new { display: inline-block; background: #b91c1c; color: #fff; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px; margin-left: 6px; vertical-align: 1.5px; line-height: 1.5; }
.price-input::-webkit-outer-spin-button, .price-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.price-wrap { display: inline-flex; align-items: center; gap: 4px; }
.price-wrap .cny { color: var(--ink-3); font-size: 12px; }
.progress-line { height: 6px; border-radius: 99px; background: #eef1f5; overflow: hidden; min-width: 120px; flex: 1; }
.progress-line > i { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width 0.3s; }

/* ---------- tabs ---------- */
.tabs { display: inline-flex; background: #f2f4f7; padding: 3px; border-radius: 9px; gap: 3px; }
.tab { border: 0; background: transparent; padding: 7px 13px; border-radius: 7px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.tab.active { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08); }

/* ---------- empty ---------- */
.empty { padding: 46px 20px; text-align: center; color: var(--ink-3); }
.empty .big { font-size: 15px; color: var(--ink-2); margin-bottom: 6px; font-weight: 600; }

/* ---------- modal ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(16, 24, 40, 0.45);
  display: grid; place-items: center; z-index: 100; padding: 24px;
  animation: fadeIn 0.16s ease;
}
.modal {
  background: #fff; border-radius: 14px; max-width: 86vw; max-height: 88vh; width: 100%;
  display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(16, 24, 40, 0.25);
  animation: popIn 0.18s ease;
}
.modal.w400 { max-width: 400px; }
.modal.w520 { max-width: 520px; }
.modal.w620 { max-width: 620px; }
.modal.w720 { max-width: 720px; }
.modal.w800 { max-width: 800px; }
.modal.w980 { max-width: 980px; }
.modal-head { padding: 14px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.modal-head h3 { margin: 0; font-size: 15.5px; }
.modal-head .close, .modal-head .modal-x { margin-left: auto; }
/* 弹窗右上角关闭圆钮：大而明显 */
.modal-x {
  margin-left: auto; flex: none; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--line); background: #fff; color: #64748b;
  font-size: 19px; line-height: 1; cursor: pointer; display: grid; place-items: center;
  transition: all .15s ease;
}
.modal-x:hover { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; }
.modal-body { padding: 20px; overflow: auto; overscroll-behavior: contain; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; background: #fbfcfd; border-radius: 0 0 14px 14px; }

/* ---------- toast ---------- */
.toast-wrap { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; pointer-events: none; }
.toast {
  background: #101828; color: #fff; padding: 10px 16px; border-radius: 9px;
  font-size: 13px; box-shadow: 0 10px 28px rgba(16, 24, 40, 0.28); animation: popIn 0.18s ease;
  max-width: 560px;
}
.toast.ok { background: #0b5f4c; }
.toast.err { background: #912018; }

/* ---------- print document ---------- */
.print-doc { background: #fff; color: #111; padding: 12px 6px; font-size: 13px; }
.print-doc h2 { text-align: center; font-size: 22px; letter-spacing: 6px; margin: 4px 0 4px; }
.print-doc .doc-company { text-align: center; color: #555; font-size: 12.5px; margin-bottom: 16px; }
.print-meta { display: flex; justify-content: space-between; gap: 12px; margin: 10px 0 12px; font-size: 12.5px; color: #333; flex-wrap: wrap; }
.print-doc table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.print-doc th, .print-doc td { border: 1px solid #333; padding: 6px 8px; }
.print-doc th { background: #f3f3f3; font-weight: 600; }
.print-doc td.r, .print-doc th.r { text-align: right; }
.print-sign { display: flex; justify-content: space-between; gap: 24px; margin-top: 26px; color: #333; font-size: 12.5px; }
.print-sign div { flex: 1; border-top: 1px dashed #999; padding-top: 7px; }
.print-note { margin-top: 14px; color: #666; font-size: 11.5px; line-height: 1.8; }

/* ---------- misc ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.link { color: var(--brand); cursor: pointer; text-decoration: none; font-weight: 550; }
.link:hover { text-decoration: underline; }
.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filter-bar .label { color: var(--ink-3); font-size: 12.5px; }
.stat-strip { display: flex; gap: 22px; flex-wrap: wrap; padding: 12px 18px; border-top: 1px solid var(--line); background: #fbfcfd; font-size: 13px; color: var(--ink-2); border-radius: 0 0 var(--radius) var(--radius); }
.stat-strip b { color: var(--ink); font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--ink-3); font-size: 12px; }

/* 价格表按分类折叠 */
.cat-fold-row td { padding: 0 !important; background: #e8f5f1; border-top: 1px solid #d7e8e2; }
tr.cat-fold-row { cursor: pointer; }
.cat-fold-head { display: flex; align-items: center; gap: 10px; padding: 9px 14px; cursor: pointer; user-select: none; font-weight: 700; color: #0b5f4c; font-size: 13.5px; transition: background 0.12s; }
.cat-fold-head:hover { background: #d7e8e2; }
.cat-fold-ic { display: inline-block; width: 14px; font-size: 10px; color: #0f7b63; }
.cat-fold-name { flex: none; }
.cat-fold-meta { font-size: 12px; color: #5b8a7d; font-weight: 500; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(6px) scale(0.99); } to { opacity: 1; transform: none; } }

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 880px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .app { flex-direction: column; }
  .sidebar { width: 100%; flex: none; padding: 12px 14px; }
  .brand { padding: 0 4px 10px; }
  .nav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
  .nav-btn { padding: 9px 12px; white-space: nowrap; }
  .nav-btn .badge-mini { display: none; }
  .sidebar-foot { display: none; }
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
}

@media print {
  body { background: #fff; }
  html, body { height: auto !important; overflow: visible !important; }
  /* 彻底移出打印流，避免隐藏内容产生大量空白页 */
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block !important; position: static; width: 100%; }
  .print-doc { padding: 0; }
  .print-batch .print-doc { page-break-after: always; }
  .print-batch .print-doc:last-child { page-break-after: auto; }
  .no-print { display: none !important; }
  @page { margin: 14mm; }
}

/* 导入商品库存表按钮：紫色醒目区别于其他操作按钮 */
.btn-inv {
  background: #7c3aed !important;
  border-color: #7c3aed !important;
  color: #fff !important;
  font-weight: 650;
}
.btn-inv:hover { background: #6d28d9 !important; }

/* 库存对比：不一致行标红 */
tr.diff-row { background: #fef2f2; }
tr.diff-row td { color: #b91c1c; }
