:root {
  --bg: #f4f4f4; --surface: #ffffff; --ink: #111111; --muted: #6b6b6b;
  --accent: #1a4be0; --accent-ink: #ffffff; --line: #e5e5e5;
  --dark: #111111; --dark-surface: #1e1e1e; --dark-muted: #9a9a9a;
  --ok: #16794c; --warn: #b7791f; --bad: #c0392b; --info: #2b6cb0;
  --radius: 10px; --font: "Chivo", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 14px; }
.hidden { display: none !important; }
button { font-family: inherit; }

/* 登录 */
.login-wrap { min-height: 100vh; display: flex; background: linear-gradient(120deg, rgba(9,17,36,.55) 0%, rgba(9,17,36,.32) 60%, rgba(9,17,36,.45) 100%), #111 url(/img/hero.png) center/cover no-repeat; }
.login-hero { flex: 1.35; position: relative; overflow: hidden; background: transparent; }
.hero-img { display: none; }
.hero-overlay { position: absolute; inset: 0; background: linear-gradient(120deg, rgba(9,17,36,.55), rgba(9,17,36,.05)); display: flex; flex-direction: column; justify-content: center; padding: 48px; color: #fff; }
.login-hero .brand-mark { margin: 0; }
.hero-title { font-size: 30px; margin: 18px 0 8px; }
.hero-sub { color: rgba(255,255,255,.82); margin: 0; }
.login-side { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; background: transparent; }
.login-card { background: rgba(255,255,255,.08); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid rgba(255,255,255,.18); border-radius: 16px; padding: 32px; width: 380px; max-width: 100%; color: #fff; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.brand-mark { width: 44px; height: 44px; border-radius: 12px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; margin: 0 auto 12px; }
.brand-mark.small { margin: 0; width: 34px; height: 34px; font-size: 17px; border-radius: 9px; }
.login-card h1 { text-align: center; margin: 0 0 4px; font-size: 22px; color: #fff; }
.login-card .sub { text-align: center; color: rgba(255,255,255,.75); margin: 0 0 24px; }
.field { display: block; margin-bottom: 16px; }
.field span { display: block; margin-bottom: 6px; color: var(--muted); }
.login-card .field span { color: rgba(255,255,255,.85); }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff;
}
.login-card .field input { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.25); color: #fff; }
.login-card .field input::placeholder { color: rgba(255,255,255,.55); }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid rgba(26,75,224,.2); border-color: var(--accent); }
.check { display: flex; align-items: center; gap: 8px; margin: 4px 0 18px; color: var(--muted); }
.login-card .check { color: rgba(255,255,255,.85); }
.btn { border: 1px solid transparent; border-radius: 8px; padding: 9px 16px; cursor: pointer; font: inherit; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #153fb8; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-block { width: 100%; padding: 11px; }
.form-error { color: var(--bad); min-height: 18px; margin: 10px 0 0; }
.link-btn { background: none; border: none; color: var(--accent); cursor: pointer; padding: 0; font: inherit; }
.link-btn.danger { color: var(--bad); }
.link-btn:disabled { color: var(--muted); cursor: not-allowed; opacity: .55; }

/* 应用外壳 */
.app { display: flex; min-height: 100vh; align-items: flex-start; }
.sidebar {
  width: 248px; color: #fff; display: flex; flex-direction: column; position: sticky; top: 0;
  height: 100vh; flex: none;
  background: rgba(18,20,26,.78); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-right: 1px solid rgba(255,255,255,.08);
  transition: width .32s cubic-bezier(.22,.68,.36,1);
}
.sidebar.collapsed { width: 78px; }
.side-brand { display: flex; gap: 12px; align-items: center; padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-name { font-weight: 700; white-space: nowrap; }
.branch-name { color: var(--dark-muted); font-size: 12px; margin-top: 2px; white-space: nowrap; }
.side-nav { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 6px; }
.nav-item {
  display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px;
  color: #d8d8d8; cursor: pointer; border: none; background: none; font: inherit; text-align: left;
  transition: transform .28s cubic-bezier(.34,1.56,.64,1), background .2s ease, box-shadow .2s ease, color .2s ease;
}
.side-nav .nav-item:nth-child(1) { transition-delay: .00s; }
.side-nav .nav-item:nth-child(2) { transition-delay: .03s; }
.side-nav .nav-item:nth-child(3) { transition-delay: .06s; }
.side-nav .nav-item:nth-child(4) { transition-delay: .09s; }
.side-nav .nav-item:nth-child(5) { transition-delay: .12s; }
.side-nav .nav-item:nth-child(6) { transition-delay: .15s; }
.nav-item:hover {
  transform: translateY(-3px) scale(1.05); background: rgba(255,255,255,.1);
  box-shadow: 0 10px 22px rgba(0,0,0,.28); transition-delay: 0s;
}
.nav-item.active { background: var(--accent); color: #fff; }
.nav-item.active:hover { background: var(--accent); }
.nav-item .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; flex: none; }
.nav-label { white-space: nowrap; }
.side-foot { padding: 16px 18px; border-top: 1px solid rgba(255,255,255,.08); }
#side-user { color: #fff; margin-bottom: 8px; white-space: nowrap; }
#side-user .role { color: var(--dark-muted); font-size: 12px; }
.side-actions { display: flex; gap: 14px; }
.side-actions .link-btn { color: #d8d8d8; white-space: nowrap; }

/* 收起态：仅保留图标 */
.sidebar.collapsed .side-brand { justify-content: center; padding: 20px 12px; }
.sidebar.collapsed .side-brand-text, .sidebar.collapsed .nav-label,
.sidebar.collapsed #side-user, .sidebar.collapsed .side-actions { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px 0; }

.side-toggle {
  position: absolute; right: -13px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line);
  background: #fff; color: var(--ink); cursor: pointer; z-index: 2;
  display: flex; align-items: center; justify-content: center; font-size: 15px; line-height: 1;
  box-shadow: 0 4px 12px rgba(0,0,0,.18);
}
.sidebar.collapsed .side-toggle { right: -13px; }

/* 整页铺开视图 */
.page-overlay { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: flex; flex-direction: column; }
.po-head { height: 60px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; background: #fff; border-bottom: 1px solid var(--line); flex: none; }
.po-head h3 { margin: 0; font-size: 17px; }
.po-body { flex: 1; overflow-y: auto; padding: 28px 24px; }
.form-grid { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px 24px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .modal-actions { grid-column: 1 / -1; }
.row-4 { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px 24px; }
.row-4 .field { margin-bottom: 0; }
.po-body .field { margin-bottom: 0; }

/* 表单项卡片 + 鼠标跟随局部柔和高光 */
.po-body .field {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  overflow: hidden;
  transition: border-color .25s ease, box-shadow .25s ease;
}
.po-body .field::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%), rgba(26,75,224,.12), transparent 62%);
  opacity: 0;
  transition: opacity .35s ease;
  pointer-events: none;
}
.po-body .field:hover, .po-body .field:focus-within {
  border-color: rgba(26,75,224,.38);
  box-shadow: 0 8px 22px rgba(26,75,224,.10);
}
.po-body .field:hover::before, .po-body .field:focus-within::before { opacity: 1; }
.po-body .field input, .po-body .field select, .po-body .field textarea {
  background: transparent;
  border-color: transparent;
  padding: 4px 2px;
}
.po-body .field select { cursor: pointer; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 60px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; }
.view-title { font-size: 17px; font-weight: 700; }
.topbar-right { color: var(--muted); font-size: 13px; }
.content { padding: 24px; flex: 1; }

/* 卡片与统计 */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.stat-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 6px; }

/* 悬停百分比分段表盘 */
.stat-pct { transition: border-color .2s, box-shadow .2s; }
.stat-pct:hover { border-color: #b6e842; box-shadow: 0 6px 18px rgba(120, 150, 30, .18); }
.pct-face { position: relative; width: 96px; height: 96px; margin: 8px auto 2px; }
.pct-face svg { width: 100%; height: 100%; display: block; }
.pct-tick { stroke-linecap: butt; }
.pct-num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 700; color: #334155; }
.pct-num small { font-size: 12px; font-weight: 600; margin-left: 1px; }

/* 工具栏 */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; }
.toolbar .field { margin: 0; }
.toolbar select, .toolbar input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; }
.spacer { flex: 1; }

/* 扫码入口 */
.scan-bar { display: flex; justify-content: center; padding: 8px 0 4px; }
.scan-bar .btn { padding: 11px 26px; }
.scan-box video { width: 100%; max-width: 360px; aspect-ratio: 1/1; object-fit: cover; border-radius: 12px; margin: 0 auto; display: block; background: #000; }
.scan-manual { display: flex; gap: 10px; margin-top: 12px; }
.scan-manual input { flex: 1; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.scan-actions { display: flex; justify-content: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.scan-actions label.btn { cursor: pointer; }
.scan-status.error, #scan-status.error { color: var(--bad); }

/* 扫码加工详情（移动端工序录入） */
body.scan-full .sidebar, body.scan-full .topbar { display: none; }
body.scan-full .main { width: 100%; }
body.scan-full .content { padding: 16px; }
.scan-back-top {
  position: fixed; top: 16px; right: 16px; z-index: 30;
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 10px; padding: 8px 14px; font: inherit; font-size: 14px; cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,.1);
}
.scan-back-top:hover { border-color: var(--accent); color: var(--accent); }
.scan-detail { display: flex; flex-direction: column; gap: 14px; max-width: 560px; margin: 0 auto; }
.scan-status-card { display: flex; align-items: center; gap: 12px; background: #fbe7d2; border-radius: 14px; padding: 16px 18px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #8a6d3b; flex: none; }
.scan-status-text { font-size: 20px; font-weight: 700; }
.scan-status-card .muted { margin-top: 2px; }

.scan-info .info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; margin-top: 10px; }
.info-item .k { color: var(--muted); font-size: 13px; margin-bottom: 3px; }
.info-item > div:last-child { font-weight: 600; }

.scan-summary .sum-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.sum-cell { text-align: center; }
.sum-cell .v { font-size: 20px; font-weight: 700; }
.sum-cell .v.green { color: var(--ok); }
.sum-cell .v.orange { color: #e8833a; }
.sum-cell .k { color: var(--muted); font-size: 12px; margin-top: 2px; }
.sum-note { margin-top: 12px; padding: 10px 12px; background: #fdf1e3; border-radius: 10px; color: #a05a1c; font-size: 12px; line-height: 1.6; }
.sum-rows { margin-top: 10px; }
.sum-row { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.sum-row:last-child { border-bottom: none; }
.orange { color: #e8833a; }

.proc-list { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
.proc-row { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: #fff; }
.proc-top { display: flex; align-items: center; gap: 10px; }
.proc-name { font-weight: 700; font-size: 15px; }
.proc-row .btn-orange { margin-left: auto; }
.proc-meta { margin-top: 8px; color: var(--muted); font-size: 13px; }

.chip.proc-todo { color: #777; background: #eee; }
.chip.proc-running { color: #e8833a; background: rgba(232,131,58,.14); }
.chip.proc-done { color: var(--ok); background: rgba(22,121,76,.12); }

.finish-panel { margin-top: 12px; border-left: 3px solid #e8833a; background: #fdf6ee; border-radius: 0 12px 12px 0; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.finish-title { font-weight: 700; color: #a05a1c; }
.f-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.f-field > span { color: var(--muted); }
.f-field input, .static-box { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: inherit; }
.static-box { color: #333; line-height: 1.6; }
.btn-green { background: #2f7d5b; color: #fff; border: none; padding: 12px; border-radius: 12px; font-weight: 600; }
.btn-green:hover { background: #276b4d; }
.btn-orange { background: #e8833a; color: #fff; border: none; padding: 9px 20px; border-radius: 12px; font-weight: 600; }
.btn-orange:hover { background: #d4732f; }

.scan-warn { border: 1px solid #e8833a; border-radius: 14px; padding: 14px; }
.warn-title { font-weight: 700; color: #a05a1c; margin-bottom: 6px; }
.warn-text { color: #a05a1c; font-size: 13px; line-height: 1.6; }

.btn-outline { background: #fff; border: 1.5px solid #e8833a; color: #e8833a; padding: 13px; border-radius: 14px; font-weight: 600; }
.btn-outline:hover { background: #fdf1e3; }
.modal-actions.center { justify-content: center; gap: 14px; }
.confirm-body { text-align: center; color: var(--muted); padding: 10px 0 18px; line-height: 1.6; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; }
table.grid th, table.grid td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.grid th { color: var(--muted); font-weight: 600; font-size: 12px; }
/* 每一行一个浅色，循环轮换，便于区分 */
table.grid thead th { background: #f8f9fc; }
table.grid tbody tr:nth-child(4n+1) td { background: #eef3ff; }
table.grid tbody tr:nth-child(4n+2) td { background: #f2eefc; }
table.grid tbody tr:nth-child(4n+3) td { background: #eaf6f4; }
table.grid tbody tr:nth-child(4n)    td { background: #fff4ea; }
table.grid tbody tr:hover td { filter: brightness(.95); }
td.wrap, th.wrap { white-space: normal; }
.muted { color: var(--muted); }
.amount { font-variant-numeric: tabular-nums; }

/* 状态徽章 */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.unprocessed, .chip.pending, .chip.approved { color: var(--info); background: rgba(43,108,176,.1); }
.chip.processing { color: var(--warn); background: rgba(183,121,31,.12); }
.chip.processed, .chip.accepted, .chip.received { color: var(--ok); background: rgba(22,121,76,.1); }
.chip.partial { color: #6b46c1; background: rgba(107,70,193,.1); }
.chip.delivered { color: var(--ink); background: #eee; }
.chip.delete_pending, .chip.rejected { color: var(--bad); background: rgba(192,57,43,.1); }

/* 详情 */
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.kv-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 24px; }
.kv .k { color: var(--muted); font-size: 12px; margin-bottom: 3px; }
.section-title { font-weight: 700; margin: 22px 0 12px; }
.timeline { display: flex; flex-direction: column; gap: 10px; }
.tl-item { border-left: 2px solid var(--line); padding: 4px 0 4px 14px; }
.tl-item .tl-head { display: flex; justify-content: space-between; gap: 10px; }
.tl-item .tl-meta { color: var(--muted); font-size: 12px; }

/* 弹窗 */
.modal-root { position: fixed; inset: 0; z-index: 50; }
.modal-mask { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.modal { position: relative; margin: 8vh auto; width: 520px; max-width: calc(100vw - 32px); background: #fff; border-radius: 14px; padding: 22px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.modal-head h3 { margin: 0; }
.modal-body .field { margin-bottom: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; background: #fff; font: inherit; }
.tag.on { border-color: var(--accent); color: var(--accent); background: rgba(26,75,224,.06); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); background: var(--dark); color: #fff; padding: 12px 18px; border-radius: 10px; z-index: 80; }
.toast.error { background: var(--bad); }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* 开关 */
.switch-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.switch { position: relative; width: 44px; height: 24px; flex: none; }
.switch input { display: none; }
.switch-dot { position: absolute; inset: 0; background: #d8d8d8; border-radius: 999px; transition: background .2s ease; }
.switch-dot::before { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s cubic-bezier(.34,1.56,.64,1); }
.switch input:checked + .switch-dot { background: var(--accent); }
.switch input:checked + .switch-dot::before { transform: translateX(20px); }

/* 参考图上传 */
.upload-box { border: 1px dashed var(--line); border-radius: 10px; padding: 22px; text-align: center; color: var(--muted); cursor: pointer; position: relative; }
.upload-box input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.ref-preview { margin-top: 10px; max-width: 180px; border-radius: 8px; }
.ref-detail { max-width: 220px; border-radius: 8px; margin-top: 6px; display: block; }

/* 选项编辑 */
.opt-group { padding: 16px 0; border-top: 1px solid var(--line); }
.opt-group:first-of-type { border-top: none; padding-top: 0; }
.opt-group-title { font-weight: 600; margin-bottom: 10px; }
.opt-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.opt-list .tag.on { display: inline-flex; align-items: center; gap: 6px; }
.opt-del { border: none; background: none; color: var(--bad); cursor: pointer; font: inherit; padding: 0; line-height: 1; }
.opt-add { display: flex; gap: 8px; max-width: 420px; }
.opt-add input { flex: 1; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }

/* 统计分析 */
.stats-filter .filter-row { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; }
.stats-filter .filter-row.actions { justify-content: flex-end; margin-top: 16px; }
.date-field { display: flex; flex-direction: column; gap: 6px; }
.date-field span { color: var(--muted); font-size: 12px; }
.date-field input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; }

.seg-btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font: inherit; cursor: pointer; color: var(--ink); }
.seg-btn:hover { border-color: var(--accent); }
.seg-btn.on { border-color: var(--accent); background: rgba(26,75,224,.08); color: var(--accent); }
.ms-arrow { color: var(--muted); font-size: 11px; }
.ms-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; display: inline-flex; align-items: center; justify-content: center; }
.ms-empty { color: var(--muted); padding: 10px 8px; }

.flat-panel { margin-top: 16px; padding: 14px 16px; border: 1px dashed var(--line); border-radius: 10px; background: #fafbfd; }
.flat-title { color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-opt { padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font: inherit; cursor: pointer; }
.chip-opt:hover { border-color: var(--accent); }
.chip-opt.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- 加工单打印 ---------- */
.print-root { display: none; }
.print-sheet { font-size: 10.5pt; line-height: 1.2; color: #111; box-sizing: border-box; width: 100%; }
.print-sheet * { box-sizing: border-box; }
.print-sheet table { width: 100%; border-collapse: collapse; margin-bottom: 4px; table-layout: fixed; }
.print-sheet td, .print-sheet th { border: 1px solid #333; padding: 4px 6px; vertical-align: middle; word-break: break-word; line-height: 1.2; }
.ps-l { background: #f2f2f2; font-weight: 600; white-space: nowrap; }
.ps-num { text-align: right; }
.ps-section { text-align: center; font-weight: 700; font-size: 15pt; padding: 4px 0; }
.ps-empty { text-align: center; color: #777; padding: 10px; }
.ps-ref { max-width: 130px; max-height: 120px; object-fit: contain; }
.ps-tip { color: #777; font-size: 9pt; }
.ps-orderno { font-size: 11pt; }

.ps-head { border: none; margin-bottom: 8px; }
.ps-head td { border: none; line-height: 1.8; padding: 6px 6px; }
.ps-head .ps-logo-cell { width: 16%; }
.ps-head .ps-logo-cell img { height: 84px; object-fit: contain; }
.ps-head .ps-title-cell { text-align: center; font-size: 26pt; font-weight: 700; letter-spacing: 2px; line-height: 1.8; }
.ps-head .ps-qr-cell { width: 20%; text-align: center; }
.ps-qr { width: 110px; height: 110px; image-rendering: pixelated; }
.ps-img-label { text-align: center; font-weight: 600; width: 25%; font-size: 12pt; }
.ps-sign td { height: 30px; }

@media print {
  @page { size: A4 portrait; margin: 1.7cm 1.2cm; }
  html, body { height: auto !important; background: #fff; }
  body.printing #app-view, body.printing .page-overlay, body.printing .modal-root, body.printing #toast { display: none !important; }
  .print-root { display: block !important; width: 100%; height: auto !important; }
  .print-root.hidden { display: block !important; }
  .print-sheet { width: 100%; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-sheet table { margin-bottom: 4px; }
  .print-sheet td, .print-sheet th { padding: 3px 5px; }
  .ps-head td { border: none; padding: 6px 6px; line-height: 1.8; }
  .ps-head .ps-logo-cell img { height: 72px; }
  .ps-head .ps-title-cell { font-size: 26pt; line-height: 1.8; }
  .ps-qr { width: 96px; height: 96px; }
  .ps-ref { max-height: 100px; max-width: 110px; }
  .ps-section { font-size: 15pt; padding: 3px 0; }
  .ps-sign td { height: 26px; }
}

.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 14px; }

.chart-legend { display: flex; flex-wrap: wrap; gap: 18px; margin-bottom: 14px; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); }
.legend-item i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.chart-wrap { width: 100%; }
.line-chart { width: 100%; height: auto; display: block; }
.grid-line { stroke: var(--line); stroke-width: 1; }
.axis-text { fill: var(--muted); font-size: 11px; }

@media (max-width: 1024px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .kv-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .row-4, .row-note { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; gap: 10px; padding: 8px 12px; position: static; height: auto; }
  .side-brand { border-bottom: none; padding: 0; }
  .side-brand .brand-mark { width: 36px; height: 36px; font-size: 18px; margin: 0; }
  .side-brand-text { display: none; }
  .side-nav { flex-direction: row; overflow-x: auto; flex: 1; padding: 6px 0; gap: 8px; }
  .nav-item { white-space: nowrap; }
  .side-foot { border-top: none; padding: 0; }
  #side-user { display: none; }
  .side-toggle { display: none; }
  .topbar { padding: 0 14px; height: 52px; }
  .content { padding: 14px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 12px; }
  .kv-grid { grid-template-columns: 1fr; gap: 10px; }
  .form-grid { grid-template-columns: 1fr; }
  .row-4, .row-note { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar input, .toolbar select { width: 100%; }
  .toolbar .spacer { display: none; }
  .detail-head { flex-direction: column; }
  .scan-manual { flex-direction: column; }
  .login-wrap { flex-direction: column; }
  .login-hero { min-height: 220px; flex: none; }
}
