/* ============================================================
   云仓 WMS · 全局样式（纯原生 CSS，无外链）
   ============================================================ */
:root {
  --bg: #f3f5fa;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --ink: #1e293b;
  --ink-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e5e9f2;
  --line-2: #eef2f8;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: #eff6ff;
  --teal: #0d9488;
  --teal-soft: #ecfdf5;
  --green: #059669;
  --green-soft: #ecfdf5;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --violet: #7c3aed;
  --sidebar: #0e1729;
  --sidebar-2: #14213a;
  --sidebar-text: #b9c5d8;
  --sidebar-muted: #71809a;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 12px 32px -20px rgba(15, 23, 42, .25);
  --shadow-lg: 0 24px 70px -20px rgba(15, 23, 42, .35);
  --sidebar-w: 238px;
  --topbar-h: 66px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
body.modal-open { overflow: hidden; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }
button { font-family: inherit; }
svg { flex: none; }
code { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; background: #f1f5f9; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.text-sm { font-size: 12px; }
.text-red { color: var(--red); }
.text-green { color: var(--green); }
.nowrap { white-space: nowrap; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.spacer { flex: 1; }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; background: #fff; color: var(--red); font-size: 16px; z-index: 9999; padding: 24px; text-align: center; }

/* ============================== 按钮 ============================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 9px;
  background: #fff; color: var(--ink-2);
  font-size: 13px; font-weight: 500; line-height: 1;
  cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 6px 16px -8px rgba(37, 99, 235, .7); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-danger { background: #fff; border-color: #fecaca; color: var(--red); }
.btn-danger:hover { background: var(--red-soft); border-color: #fca5a5; }
.btn-danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger-solid:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover { background: #047857; border-color: #047857; color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: #f1f5f9; border-color: transparent; color: var(--ink); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 7px; }
.btn-lg { height: 44px; font-size: 15px; border-radius: 11px; }
.btn-block { width: 100%; }
.btn-link { background: none; border: none; color: var(--brand); padding: 0 2px; font-size: 12px; cursor: pointer; }
.btn-link:hover { color: var(--brand-dark); text-decoration: underline; }
.btn-link.danger { color: var(--red); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border: 1px solid transparent; border-radius: 9px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: #f1f5f9; color: var(--ink); }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.row-actions { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-actions .sep { width: 1px; height: 12px; background: var(--line); }

/* ============================== 表单 ============================== */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field-label .req { color: var(--red); margin-left: 2px; }
.field-hint { font-size: 11.5px; color: var(--muted-2); }
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: 9px;
  background: #fff; color: var(--ink); font-size: 13.5px; font-family: inherit;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 76px; padding: 9px 11px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.input:focus, .select:focus, .textarea:focus { border-color: #93b4f8; box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }
.input:disabled, .select:disabled, .textarea:disabled { background: #f8fafc; color: var(--muted); cursor: not-allowed; }
.input.is-invalid, .select.is-invalid { border-color: var(--red); box-shadow: 0 0 0 3px rgba(220, 38, 38, .08); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 30px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .span-2 { grid-column: span 2; }
.form-error {
  display: flex; align-items: flex-start; gap: 7px;
  padding: 9px 12px; border-radius: 9px;
  background: var(--red-soft); border: 1px solid #fecaca; color: #b91c1c;
  font-size: 12.5px; line-height: 1.45;
}
.form-error::before { content: "!"; flex: none; display: inline-grid; place-items: center; width: 16px; height: 16px; margin-top: 1px; border-radius: 50%; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.checkbox { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); cursor: pointer; user-select: none; }
.checkbox input { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; }
.filter-bar .field { min-width: 140px; }
.filter-bar .field.grow { flex: 1 1 180px; }
.filter-bar .field.w-sm { width: 140px; }
.filter-bar .field.w-md { width: 180px; }
.filter-bar .filter-actions { display: flex; gap: 8px; margin-left: auto; }

/* ============================== 登录页 ============================== */
.login-view { min-height: 100vh; display: grid; grid-template-columns: 1.08fr .92fr; background: #fff; }
.login-brand { position: relative; overflow: hidden; display: flex; align-items: center; padding: 56px 8vw; color: #e2e8f0; background: radial-gradient(900px 500px at 15% 10%, #1d3b6e 0%, transparent 60%), linear-gradient(150deg, #0b1222 0%, #101d35 55%, #0b2a3b 100%); }
.login-brand::before, .login-brand::after { content: ""; position: absolute; border-radius: 50%; filter: blur(2px); opacity: .16; pointer-events: none; }
.login-brand::before { width: 420px; height: 420px; right: -140px; top: -120px; background: radial-gradient(circle, #60a5fa, transparent 68%); }
.login-brand::after { width: 520px; height: 520px; left: -220px; bottom: -260px; background: radial-gradient(circle, #2dd4bf, transparent 65%); opacity: .12; }
.login-brand-inner { position: relative; z-index: 1; max-width: 470px; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; color: #fff; background: linear-gradient(135deg, #3b82f6, #0ea5e9); box-shadow: 0 10px 24px -10px rgba(59, 130, 246, .8); flex: none; }
.brand-mark svg { width: 22px; height: 22px; }
.brand-mark-lg { width: 54px; height: 54px; border-radius: 15px; margin-bottom: 26px; }
.brand-mark-lg svg { width: 30px; height: 30px; }
.login-kicker { margin: 0 0 10px; font-size: 11px; letter-spacing: .3em; color: #7dd3fc; font-weight: 700; }
.login-brand h1 { margin: 0; font-size: clamp(40px, 5vw, 62px); line-height: 1.08; letter-spacing: -.02em; color: #fff; font-weight: 800; }
.login-brand h1 span { color: #7dd3fc; }
.login-slogan { margin: 20px 0 0; font-size: 15.5px; line-height: 1.85; color: #a8b8cf; }
.login-points { list-style: none; margin: 34px 0 0; padding: 0; display: grid; gap: 13px; }
.login-points li { display: flex; align-items: center; gap: 11px; font-size: 13.5px; color: #cdd9ea; }
.login-points i { width: 18px; height: 18px; border-radius: 50%; background: rgba(45, 212, 191, .14); border: 1px solid rgba(45, 212, 191, .45); position: relative; flex: none; }
.login-points i::after { content: ""; position: absolute; left: 5px; top: 3px; width: 5px; height: 8px; border-right: 2px solid #2dd4bf; border-bottom: 2px solid #2dd4bf; transform: rotate(40deg); }
.login-foot { margin-top: 58px; font-size: 11.5px; color: #64748b; letter-spacing: .04em; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 40px 28px; background: radial-gradient(700px 420px at 85% 0%, #eff6ff 0%, transparent 60%), #fff; }
.login-card { width: 100%; max-width: 372px; }
.login-card-head h2 { margin: 0 0 7px; font-size: 26px; letter-spacing: -.01em; }
.login-card-head p { margin: 0 0 26px; color: var(--muted); font-size: 13.5px; }
.login-card .field { margin-bottom: 15px; }
.login-card .field .input { height: 44px; font-size: 14px; }
.login-card .btn { margin-top: 8px; }
.login-hint { margin: 16px 0 0; font-size: 12px; color: var(--muted); text-align: center; }
.login-copy { margin: 30px 0 0; font-size: 11px; color: var(--muted-2); text-align: center; }

/* ============================== 应用框架 ============================== */
.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 60;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--sidebar) 0%, #0b1424 100%);
  color: var(--sidebar-text); overflow-y: auto;
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; height: var(--topbar-h); padding: 0 20px; border-bottom: 1px solid rgba(148, 163, 184, .1); flex: none; }
.sidebar-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.sidebar-brand-text strong { color: #fff; font-size: 15px; letter-spacing: .02em; }
.sidebar-brand-text span { color: var(--sidebar-muted); font-size: 10.5px; margin-top: 3px; letter-spacing: .08em; }
.side-nav { padding: 14px 12px 20px; flex: 1; }
.nav-section { margin: 14px 0 6px; padding: 0 10px; font-size: 10.5px; letter-spacing: .14em; color: #5b6a84; font-weight: 600; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 10px;
  height: 39px; padding: 0 11px; margin: 1px 0;
  border-radius: 9px; color: var(--sidebar-text); font-size: 13.2px;
  transition: background .15s, color .15s;
}
.nav-item svg { width: 18px; height: 18px; color: #7d8ca6; transition: color .15s; }
.nav-item:hover { background: rgba(148, 163, 184, .08); color: #fff; }
.nav-item:hover svg { color: #cbd5e1; }
.nav-item.active { background: linear-gradient(90deg, rgba(37, 99, 235, .22), rgba(37, 99, 235, .06)); color: #fff; }
.nav-item.active::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: #3b82f6; }
.nav-item.active svg { color: #60a5fa; }
.sidebar-foot { flex: none; padding: 14px 20px; border-top: 1px solid rgba(148, 163, 184, .1); font-size: 11px; color: #5f708c; display: flex; align-items: center; gap: 7px; }
.dot-online { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .16); }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 55; backdrop-filter: blur(1px); }
.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: var(--topbar-h); padding: 0 26px;
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-title h1 { margin: 0; font-size: 18px; letter-spacing: -.01em; white-space: nowrap; }
.crumb { font-size: 11.5px; color: var(--muted-2); margin-top: 1px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-clock { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.user-chip { display: flex; align-items: center; gap: 9px; padding-left: 14px; border-left: 1px solid var(--line); }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, #2563eb, #0ea5e9); color: #fff; font-size: 13px; font-weight: 700; flex: none; }
.user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-meta strong { font-size: 12.8px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta span { font-size: 10.5px; color: var(--muted); }
.menu-toggle { display: none; }
.content { flex: 1; width: 100%; max-width: 1560px; padding: 24px 28px 48px; margin: 0 auto; }
.content > .page { animation: pageIn .18s ease-out; }
@keyframes pageIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ============================== 页面头部 / 卡片 ============================== */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 21px; letter-spacing: -.02em; }
.page-head .sub { margin: 5px 0 0; color: var(--muted); font-size: 12.5px; }
.page-head-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.card-head h3 { margin: 0; font-size: 14.5px; }
.card-head .sub { margin: 3px 0 0; color: var(--muted); font-size: 11.5px; }
.card-head-actions { display: flex; align-items: center; gap: 8px; }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }
.card-body.tight { padding: 12px; }
.page-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.page-grid.equal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* ============================== 统计卡片 ============================== */
.stat-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat-card { position: relative; overflow: hidden; display: flex; align-items: flex-start; gap: 12px; padding: 16px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
.stat-card:hover { border-color: #cbd8ee; }
.stat-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; flex: none; }
.stat-icon svg { width: 19px; height: 19px; }
.stat-icon.blue { background: var(--brand-soft); color: var(--brand); }
.stat-icon.teal { background: var(--teal-soft); color: var(--teal); }
.stat-icon.red { background: var(--red-soft); color: var(--red); }
.stat-icon.green { background: var(--green-soft); color: var(--green); }
.stat-icon.amber { background: var(--amber-soft); color: var(--amber); }
.stat-icon.violet { background: #f5f3ff; color: var(--violet); }
.stat-meta { min-width: 0; }
.stat-label { color: var(--muted); font-size: 11.8px; white-space: nowrap; }
.stat-value { margin: 3px 0 0; font-size: 25px; line-height: 1.15; font-weight: 750; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 11.5px; font-weight: 500; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.stat-foot { margin-top: 4px; font-size: 10.8px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-card.is-link { cursor: pointer; }
.stat-card.is-link:hover { box-shadow: 0 14px 30px -20px rgba(37, 99, 235, .55); }

/* ============================== 趋势图 ============================== */
.chart-legend { display: flex; align-items: center; gap: 16px; font-size: 11.5px; color: var(--muted); }
.legend-dot { display: inline-block; width: 8px; height: 8px; border-radius: 3px; margin-right: 5px; }
.trend { position: relative; padding: 10px 4px 0; }
.trend-plot { position: relative; height: 190px; margin-left: 38px; border-bottom: 1px solid var(--line); background: repeating-linear-gradient(to top, transparent 0, transparent 46px, var(--line-2) 46px, var(--line-2) 47px); }
.trend-cols { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: space-around; gap: 8px; }
.trend-day { flex: 1; max-width: 84px; height: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; position: relative; }
.trend-bar { width: 13px; border-radius: 4px 4px 2px 2px; min-height: 2px; transition: height .35s ease; }
.trend-bar.in { background: linear-gradient(180deg, #38bdf8, #0284c7); }
.trend-bar.out { background: linear-gradient(180deg, #fbbf24, #d97706); }
.trend-bar.empty { background: #e2e8f0; height: 2px !important; }
.trend-x { display: flex; margin: 8px 0 0 38px; justify-content: space-around; gap: 8px; }
.trend-x span { flex: 1; max-width: 84px; text-align: center; font-size: 10.5px; color: var(--muted); line-height: 1.35; }
.trend-x span b { display: block; font-weight: 500; color: var(--muted-2); }
.trend-y { position: absolute; left: 0; top: 10px; height: 190px; width: 34px; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; padding-right: 4px; font-size: 10px; color: var(--muted-2); font-variant-numeric: tabular-nums; }

/* ============================== 表格 ============================== */
.table-wrap { width: 100%; overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 12.8px; }
.table th { padding: 10px 14px; text-align: left; font-weight: 600; font-size: 11.5px; color: var(--muted); background: #f8fafc; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #fafcff; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .center { text-align: center; }
.table .strong { font-weight: 600; color: var(--ink); }
.table .sub { display: block; color: var(--muted-2); font-size: 11px; margin-top: 1px; }
.table .empty-cell { padding: 0; }
.table tr.low-row td { background: #fff7f7; }
.table tr.low-row:hover td { background: #fff1f2; }
.table .amount { font-variant-numeric: tabular-nums; }
.mono { font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; }
.cell-product { display: flex; flex-direction: column; min-width: 150px; }
.cell-product b { font-weight: 600; }
.cell-product span { color: var(--muted-2); font-size: 11px; margin-top: 1px; }
.table-actions { white-space: nowrap; }

/* ============================== 徽标 ============================== */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .75; }
.badge-draft { background: #f1f5f9; color: #64748b; }
.badge-confirmed { background: var(--green-soft); color: #047857; }
.badge-cancelled { background: #f8fafc; color: #94a3b8; }
.badge-in { background: #eff6ff; color: #1d4ed8; }
.badge-out { background: #fff7ed; color: #c2410c; }
.badge-transfer_in, .badge-transfer_out { background: #f5f3ff; color: #6d28d9; }
.badge-check { background: #ecfeff; color: #0e7490; }
.badge-supplier { background: #f0fdf4; color: #15803d; }
.badge-customer { background: #eff6ff; color: #1d4ed8; }
.badge-role { background: #f1f5f9; color: #475569; }
.badge-role.admin { background: #eff6ff; color: #1d4ed8; }
.badge-role.manager { background: #f5f3ff; color: #6d28d9; }
.badge-active { background: var(--green-soft); color: #047857; }
.badge-inactive { background: #f1f5f9; color: #94a3b8; }
.pill { display: inline-block; padding: 1px 7px; border-radius: 6px; background: #f1f5f9; color: var(--muted); font-size: 11px; }
.shortage { color: var(--red); font-weight: 600; }
.qty-pos { color: var(--green); font-weight: 600; }
.qty-neg { color: var(--red); font-weight: 600; }

/* ============================== 分页 / 空状态 / 加载 ============================== */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.pager-info { font-size: 11.8px; color: var(--muted); }
.pager-btns { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pager-btn { min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink-2); font-size: 12px; cursor: pointer; }
.pager-btn:hover:not(:disabled) { border-color: #cbd5e1; background: #f8fafc; }
.pager-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager-btn:disabled { opacity: .45; cursor: not-allowed; }
.pager-gap { padding: 0 4px; color: var(--muted-2); font-size: 12px; }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; padding: 48px 20px; text-align: center; color: var(--muted); }
.empty-icon { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 15px; background: #f1f5f9; color: #94a3b8; margin-bottom: 3px; }
.empty-icon svg { width: 24px; height: 24px; }
.empty p { margin: 0; font-size: 13.5px; font-weight: 500; color: var(--ink-2); }
.empty span { font-size: 11.8px; color: var(--muted-2); }
.page-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; min-height: 46vh; color: var(--muted); font-size: 13px; }
.spinner { width: 24px; height: 24px; border: 2.5px solid #dbeafe; border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; flex: none; }
.spinner-sm { width: 14px; height: 14px; border-width: 2px; display: inline-block; vertical-align: -2px; margin-right: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-page { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 46vh; text-align: center; gap: 10px; color: var(--muted); }
.error-page h3 { margin: 0; color: var(--ink); font-size: 18px; }
.error-page p { margin: 0; font-size: 13px; max-width: 480px; }
.skeleton { background: linear-gradient(90deg, #f1f5f9 25%, #e8eef7 37%, #f1f5f9 63%); background-size: 400% 100%; animation: shimmer 1.2s ease infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ============================== 弹窗 / 对话框 ============================== */
.modal-overlay { position: fixed; inset: 0; z-index: 120; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 18px 4vh; background: rgba(15, 23, 42, .5); backdrop-filter: blur(2px); overflow-y: auto; animation: fadeIn .15s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal { width: 100%; max-width: 560px; background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); animation: modalIn .18s ease-out; display: flex; flex-direction: column; max-height: 88vh; }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }
.modal-lg { max-width: 760px; }
.modal-xl { max-width: 920px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 17px 20px 13px; border-bottom: 1px solid var(--line-2); flex: none; }
.modal-head h3 { margin: 0; font-size: 16px; letter-spacing: -.01em; }
.modal-head p { margin: 3px 0 0; color: var(--muted); font-size: 11.8px; }
.modal-close { width: 30px; height: 30px; border: none; border-radius: 8px; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; }
.modal-close:hover { background: #f1f5f9; color: var(--ink); }
.modal-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 9px; padding: 13px 20px; border-top: 1px solid var(--line-2); flex: none; background: #fcfdff; border-radius: 0 0 16px 16px; }
.modal-form-error { margin-bottom: 13px; }
.dialog-overlay { z-index: 140; align-items: center; padding-top: 0; }
.dialog { width: 100%; max-width: 400px; background: #fff; border-radius: 15px; box-shadow: var(--shadow-lg); padding: 22px; animation: modalIn .16s ease-out; }
.dialog-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); margin-bottom: 13px; }
.dialog-icon.danger { background: var(--red-soft); color: var(--red); }
.dialog h3 { margin: 0 0 6px; font-size: 16px; }
.dialog p { margin: 0 0 18px; color: var(--muted); font-size: 13px; line-height: 1.6; word-break: break-word; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; }

/* ============================== Toast ============================== */
.toast-root { position: fixed; top: 18px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 9px; pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 9px; min-width: 230px; max-width: 380px; padding: 11px 14px; border-radius: 11px; background: #fff; border: 1px solid var(--line); box-shadow: 0 16px 40px -16px rgba(15, 23, 42, .35); font-size: 12.8px; color: var(--ink-2); animation: toastIn .2s ease-out; pointer-events: auto; }
.toast-dot { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; flex: none; background: var(--brand); }
.toast-success .toast-dot { background: var(--green); }
.toast-error { border-color: #fecaca; }
.toast-error .toast-dot { background: var(--red); }
.toast-info .toast-dot { background: var(--brand); }
.toast-msg { word-break: break-word; line-height: 1.5; }
.toast-out { opacity: 0; transform: translateX(10px); transition: opacity .25s, transform .25s; }
@keyframes toastIn { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }

/* ============================== 商品搜索下拉 ============================== */
.combo { position: relative; min-width: 190px; }
.combo-input { padding-right: 26px; }
.combo-caret { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font-size: 9px; color: var(--muted-2); pointer-events: none; }
.combo-open .combo-input { border-color: #93b4f8; box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }
.combo-list { position: fixed; z-index: 130; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 18px 44px -18px rgba(15, 23, 42, .35); max-height: 250px; overflow-y: auto; padding: 5px; }
.combo-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; padding: 7px 9px; border: none; border-radius: 7px; background: transparent; text-align: left; cursor: pointer; font-family: inherit; }
.combo-opt:hover, .combo-opt.hl { background: var(--brand-soft); }
.combo-main { font-size: 12.8px; color: var(--ink); font-weight: 500; }
.combo-sub { font-size: 11px; color: var(--muted-2); }
.combo-empty { padding: 14px 10px; text-align: center; color: var(--muted-2); font-size: 12px; }

/* ============================== 单据编辑 ============================== */
.doc-meta { display: flex; flex-wrap: wrap; gap: 10px 28px; font-size: 12px; color: var(--muted); }
.doc-meta b { color: var(--ink-2); font-weight: 600; }
.doc-form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; }
.doc-form-grid .span-1 { grid-column: span 1; }
.items-table { min-width: 720px; }
.items-table .combo { min-width: 220px; }
.items-table .input { height: 34px; }
.items-table .num-input { width: 96px; text-align: right; }
.items-table .price-input { width: 110px; text-align: right; }
.items-table .row-amount { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.items-table .unit-cell { color: var(--muted); white-space: nowrap; }
.doc-total { display: flex; align-items: center; justify-content: flex-end; gap: 30px; padding: 14px 18px; border-top: 1px dashed var(--line); font-size: 12.5px; color: var(--muted); }
.doc-total b { color: var(--ink); font-size: 15px; font-variant-numeric: tabular-nums; margin-left: 6px; }
.doc-total .grand b { color: var(--brand); font-size: 19px; }
.doc-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; padding: 14px 18px; border-top: 1px solid var(--line-2); background: #fcfdff; border-radius: 0 0 var(--radius) var(--radius); }
.doc-actions .spacer { flex: 1; }
.doc-banner { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 10px; background: var(--amber-soft); border: 1px solid #fde68a; color: #92400e; font-size: 12.2px; margin-bottom: 16px; line-height: 1.55; }
.doc-banner.info { background: var(--brand-soft); border-color: #bfdbfe; color: #1e40af; }
.doc-banner.success { background: var(--green-soft); border-color: #a7f3d0; color: #065f46; }
.readonly-value { display: flex; align-items: center; height: 38px; padding: 0 2px; font-size: 13.5px; color: var(--ink-2); }
.diff-badge { display: inline-block; min-width: 44px; padding: 2px 7px; border-radius: 6px; text-align: center; font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.diff-zero { color: var(--muted); background: #f1f5f9; }
.diff-pos { color: #047857; background: var(--green-soft); }
.diff-neg { color: var(--red); background: var(--red-soft); }
.stock-value { font-variant-numeric: tabular-nums; font-weight: 700; }
.stock-value.low { color: var(--red); }
.stock-value.ok { color: var(--green); }

/* ============================== 报表页 ============================== */
.report-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.report-card { display: flex; gap: 14px; align-items: flex-start; padding: 17px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.report-card:hover { border-color: #cbd8ee; }
.report-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; flex: none; }
.report-ic svg { width: 20px; height: 20px; }
.report-main { flex: 1; min-width: 0; }
.report-main h3 { margin: 0 0 3px; font-size: 14px; }
.report-main p { margin: 0 0 11px; color: var(--muted); font-size: 11.8px; line-height: 1.5; }
.report-btns { display: flex; gap: 7px; flex-wrap: wrap; }
.report-note { display: flex; gap: 8px; align-items: flex-start; margin-top: 14px; padding: 10px 13px; border-radius: 9px; background: #f8fafc; border: 1px dashed var(--line); color: var(--muted); font-size: 11.8px; line-height: 1.55; }
.required-tip { color: var(--muted-2); }

/* ============================== 详情信息 ============================== */
.detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 18px; }
.detail-item { min-width: 0; }
.detail-item .k { display: block; color: var(--muted-2); font-size: 11px; margin-bottom: 2px; }
.detail-item .v { font-size: 13px; color: var(--ink-2); word-break: break-word; }
.detail-item .v.mono { font-size: 12px; }
.info-strip { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; padding: 11px 18px; border-bottom: 1px solid var(--line-2); background: #fbfcff; font-size: 12px; color: var(--muted); }
.info-strip b { color: var(--ink-2); font-weight: 600; }
.back-link { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); margin-bottom: 9px; }
.back-link:hover { color: var(--brand); }

/* ============================== 响应式 ============================== */
@media (max-width: 1380px) {
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
  .page-grid { grid-template-columns: minmax(0, 1fr); }
  .detail-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .topbar-clock { display: none; }
}
@media (max-width: 1023px) {
  :root { --sidebar-w: 250px; }
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; box-shadow: 24px 0 60px -30px rgba(15, 23, 42, .6); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-overlay { display: block; }
  .main { margin-left: 0; }
  .menu-toggle { display: inline-flex; }
  .content { padding: 20px 18px 40px; }
  .topbar { padding: 0 16px; }
  .login-view { grid-template-columns: 1fr; }
  .login-brand { display: none; }
}
@media (max-width: 820px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid, .doc-form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: span 1; }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-grid.equal { grid-template-columns: minmax(0, 1fr); }
  .user-meta { display: none; }
  .logout-btn span { display: none; }
  .topbar-right { gap: 8px; }
  .filter-bar .filter-actions { margin-left: 0; width: 100%; }
  .filter-bar .filter-actions .btn { flex: 1; }
  .doc-total { gap: 16px; flex-wrap: wrap; }
  /* 手机端表格保持可读列宽，由 .table-wrap 横向滚动，而不是把列挤压成竖排 */
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .table-wrap table.table { min-width: 760px; }
  .table-wrap table.table th,
  .table-wrap table.table td { white-space: nowrap; }
  .table-wrap table.table td:first-child,
  .table-wrap table.table th:first-child { white-space: normal; min-width: 168px; }
}
@media (max-width: 520px) {
  .content { padding: 16px 12px 36px; }
  .stat-grid { grid-template-columns: minmax(0, 1fr); }
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .page-head h2 { font-size: 19px; }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { max-height: 94vh; border-radius: 16px 16px 0 0; }
  .modal-foot { border-radius: 0; }
  .topbar-title h1 { font-size: 16px; }
  .toast-root { left: 12px; right: 12px; }
  .toast { max-width: none; }
}

/* ============================== 打印 ============================== */
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .toast-root, .doc-actions, .page-head-actions, .btn { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; border-color: #cbd5e1; }
  .table th { background: #f1f5f9; }
}

/* 盘点差异行与汇总 */
.diff-row td { background: #fffdf5; }
.check-table tbody tr.diff-row:hover td { background: #fff9e6; }
.diff-summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px 28px; padding: 13px 18px; border-top: 1px dashed var(--line); color: var(--muted); font-size: 12.5px; }
.diff-summary b { color: var(--ink); font-size: 14px; font-variant-numeric: tabular-nums; margin-left: 5px; }
.diff-summary .grand b { color: var(--brand); font-size: 17px; }

/* 报表快捷日期 */
.range-quick { display: flex; align-items: center; gap: 6px; }

/* ============================== 手机优先：底部导航 / 安装提示 ============================== */
.tabbar { display: none; }
.install-banner { display: none; }

@media (max-width: 1023px) {
  .login-view { min-height: 100vh; min-height: 100dvh; }
  .login-panel { padding: 24px 18px; }
  .login-card { width: 100%; max-width: 430px; }

  /* 输入框 16px，避免 iOS Safari 聚焦时自动放大页面 */
  .input, select.input, textarea.input { font-size: 16px; }

  body.app-ready .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 62;
    display: flex; align-items: stretch;
    height: calc(58px + env(safe-area-inset-bottom));
    padding: 0 4px env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, .95);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    box-shadow: 0 -10px 30px -24px rgba(15, 23, 42, .5);
  }
  .tabbar .tab-item {
    flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; min-width: 0; padding: 6px 2px; border: none; border-radius: 10px;
    background: transparent; color: var(--muted); font-family: inherit; font-size: 10.5px;
    text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .tabbar .tab-item svg { width: 21px; height: 21px; }
  .tabbar .tab-item.active { color: var(--brand); background: var(--brand-soft); }
  .tabbar .tab-item.active svg { stroke-width: 2.1; }

  body.app-ready .main { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  body.app-ready .content { padding-bottom: calc(22px + env(safe-area-inset-bottom)); }

  .install-banner {
    position: fixed; left: 10px; right: 10px;
    bottom: calc(66px + env(safe-area-inset-bottom)); z-index: 63;
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 14px;
    background: #0b1524; color: #e2e8f0;
    box-shadow: 0 18px 44px -20px rgba(2, 6, 23, .75);
  }
  .install-banner.hidden { display: none; }
  .install-banner .ib-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .install-banner .ib-text strong { font-size: 12.5px; }
  .install-banner .ib-text span { font-size: 11px; color: #94a3b8; }
  .install-banner .btn { flex: none; height: 32px; padding: 0 14px; background: #2563eb; border: none; color: #fff; }
  .install-banner .icon-btn { flex: none; color: #94a3b8; font-size: 18px; width: 30px; height: 30px; }

  .install-guide p { margin: 0 0 12px; font-size: 13px; line-height: 1.75; color: var(--ink-2); }
  .install-guide p:last-child { margin-bottom: 0; }
  .install-guide .muted { color: var(--muted); font-size: 12px; }
}

/* 登录页（未进入应用）时安装提示贴近底部 */
@media (max-width: 1023px) {
  body:not(.app-ready) .install-banner { bottom: calc(16px + env(safe-area-inset-bottom)); }
}

/* 手机端趋势图：允许 7 列收缩，避免撑宽页面 */
@media (max-width: 1023px) {
  .trend-day, .trend-x span { min-width: 0; }
  .trend-x span { font-size: 10px; letter-spacing: -.2px; }
}

/* 报表提示条：图标固定尺寸，避免 flex 中被拉宽 */
.report-note > svg { flex: none; width: 16px; height: 16px; margin-top: 1px; }

/* 登录页：无需登录，先装到手机桌面 */
.login-install { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; padding: 10px 12px; border-radius: 12px; background: linear-gradient(135deg, #eff6ff, #e0f2fe); border: 1px solid #bfdbfe; }
.login-install.hidden { display: none; }
.login-install .li-icon { flex: none; width: 34px; height: 34px; border-radius: 10px; background: #fff; display: flex; align-items: center; justify-content: center; color: #2563eb; box-shadow: 0 4px 10px -6px rgba(37, 99, 235, .6); }
.login-install .li-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; line-height: 1.35; }
.login-install .li-text strong { font-size: 12.5px; color: #0f172a; }
.login-install .li-text span { font-size: 11px; color: #64748b; }
.login-install .btn { flex: none; height: 32px; padding: 0 12px; font-size: 12px; }

.login-apk { margin: 14px 0 0; text-align: center; font-size: 12.5px; }
.login-apk a { color: var(--text-2, #5b6b82); text-decoration: none; border-bottom: 1px dashed currentColor; padding-bottom: 1px; }
.login-apk a:hover { color: var(--primary, #2563eb); }

/* ============================================================
   拍照入库
   ============================================================ */
.scan-drop {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 28px 18px; margin: 4px; text-align: center; cursor: pointer;
  border: 1.5px dashed #c7d2e4; border-radius: 16px;
  background: linear-gradient(180deg, #f8fbff, #f2f7ff);
  transition: border-color .15s ease, background .15s ease;
}
.scan-drop:hover { border-color: var(--brand); background: #f5f9ff; }
.scan-drop-icon {
  width: 56px; height: 56px; border-radius: 16px;
  display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
}
.scan-drop-icon svg { width: 28px; height: 28px; }
.scan-drop strong { font-size: 15px; color: var(--ink); }
.scan-drop > span { max-width: 320px; font-size: 12px; line-height: 1.7; color: var(--muted); }
.scan-drop .btn { margin-top: 6px; min-width: 132px; }
.scan-hint { margin: 2px 0 0; font-size: 11px; color: var(--muted-2); }
.scan-preview { margin: 4px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.scan-preview img { display: block; width: 100%; max-height: 320px; object-fit: contain; background: #f8fafc; }
.scan-preview-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 12px; background: #f8fafc; font-size: 12px; color: var(--ink-2);
}
.scan-rows { display: flex; flex-direction: column; gap: 10px; padding: 0 16px 16px; }
.scan-row { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fbfcfe; }
.scan-row-line { margin-bottom: 8px; font-size: 11.5px; color: var(--muted); line-height: 1.5; word-break: break-all; }
.scan-row-main { display: grid; grid-template-columns: minmax(0, 1fr) 84px 54px; gap: 8px; align-items: center; }
.scan-row-main .select, .scan-row-main .input { height: 36px; font-size: 13px; }
.scan-row-main .btn { height: 36px; padding: 0 8px; font-size: 12px; }
.scan-empty { padding: 8px 16px 16px; font-size: 12.5px; color: var(--muted); }
.scan-unmatched { padding: 0 16px 16px; }
.scan-more { border-top: 1px dashed var(--line); padding-top: 10px; }
.scan-more summary { cursor: pointer; font-size: 12px; color: var(--muted); }
.scan-more-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.scan-chip {
  max-width: 100%; padding: 4px 8px; border-radius: 7px;
  background: #f1f5f9; color: var(--muted); font-size: 11px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.scan-submit-row { display: flex; justify-content: flex-end; margin-top: 4px; }
.scan-success {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 22px; border: 1px solid #bbf7d0; border-radius: 16px;
  background: linear-gradient(180deg, #f0fdf4, #ecfdf5);
}
.scan-success-icon {
  width: 50px; height: 50px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: #16a34a; color: #fff; font-size: 26px; font-weight: 700;
}
.scan-success h3 { margin: 0 0 4px; font-size: 17px; color: #14532d; }
.scan-success p { margin: 0; font-size: 12.5px; color: #166534; }
.scan-success-actions { display: flex; gap: 8px; margin-left: auto; }

@media (max-width: 520px) {
  .scan-row-main { grid-template-columns: minmax(0, 1fr) 70px 46px; gap: 6px; }
  .scan-success-actions { width: 100%; margin-left: 0; }
  .scan-success-actions .btn { flex: 1; }
}

/* 拍照入库：自动创建新商品 */
.scan-new { margin: 0 16px 14px; padding: 12px; border: 1px dashed #bfd4f7; border-radius: 12px; background: #f7faff; }
.scan-new.hidden { display: none; }
.scan-new-title { margin-bottom: 8px; font-size: 12.5px; font-weight: 600; color: #2456b8; line-height: 1.5; }
.scan-new-row { padding: 10px 0; border-top: 1px dashed #dbe6f8; }
.scan-new-row:first-of-type { padding-top: 0; border-top: 0; }
.scan-new-line { margin-bottom: 7px; font-size: 11.5px; color: var(--muted); line-height: 1.5; word-break: break-all; }
.scan-new-main { display: grid; grid-template-columns: minmax(0, 1fr) 64px 86px 58px; gap: 8px; align-items: center; }
.scan-new-main .input { height: 36px; font-size: 13px; }
.scan-new-main .btn { height: 36px; padding: 0 6px; font-size: 12px; }

@media (max-width: 520px) {
  .scan-new { margin: 0 12px 12px; padding: 10px; }
  .scan-new-main { grid-template-columns: minmax(0, 1fr) 52px 68px 48px; gap: 6px; }
}


/* 连接信息页 */
.conn-list { display: flex; flex-direction: column; gap: 14px; }
.conn-row { border-bottom: 1px dashed var(--line); padding-bottom: 12px; }
.conn-row:last-child { border-bottom: 0; padding-bottom: 0; }
.conn-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.conn-value { word-break: break-all; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.conn-value code { font-size: 13px; background: var(--bg-soft); padding: 5px 8px; border-radius: 6px; }
.conn-value.muted { color: var(--muted); font-size: 13px; }
.conn-actions { margin-top: 8px; display: flex; gap: 8px; }
.conn-hint { margin-top: 6px; font-size: 12px; color: var(--muted); }
.conn-steps { margin: 0; padding-left: 20px; line-height: 2; font-size: 14px; }
.conn-tip { margin-top: 12px; font-size: 13px; color: var(--muted); }
.conn-tip a { color: var(--primary); }
.conn-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.conn-meta > div { background: var(--bg-soft); border-radius: 8px; padding: 10px 12px; display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.conn-meta span { color: var(--muted); }
.conn-foot { margin-top: 14px; font-size: 12px; color: var(--muted); line-height: 1.8; }
@media (max-width: 520px) {
  .conn-actions { width: 100%; }
  .conn-meta { grid-template-columns: 1fr; }
}


/* ============================================================
   手机易用性强化（30–40 岁日常使用：大字号、大按钮、少滚动）
   ============================================================ */
@media (max-width: 1023px) {
  body { font-size: 15.5px; }
  .content { padding: 18px 14px calc(24px + env(safe-area-inset-bottom)); }
  .btn { height: 44px; padding: 0 18px; font-size: 15px; border-radius: 11px; }
  .btn-sm { height: 38px; padding: 0 14px; font-size: 13.5px; }
  .btn-xs { height: 32px; padding: 0 10px; font-size: 13px; }
  .btn-lg { height: 50px; font-size: 16px; }
  .input, .select { height: 46px; padding: 0 13px; font-size: 16px; border-radius: 11px; }
  .textarea { padding: 11px 13px; font-size: 16px; border-radius: 11px; }
  .field-label { font-size: 13.5px; }
  .page-head h2 { font-size: 23px; }
  .page-head .sub { font-size: 13px; }
  .card-head { padding: 15px 16px; }
  .card-head h3 { font-size: 16.5px; }
  .card-head .sub { font-size: 12.5px; }
  .card-body { padding: 16px; }
  .stat-card { padding: 14px; gap: 11px; }
  .stat-icon { width: 42px; height: 42px; border-radius: 12px; }
  .stat-icon svg { width: 21px; height: 21px; }
  .stat-label { font-size: 13px; }
  .stat-value { font-size: 27px; }
  .stat-value small { font-size: 12.5px; }
  .stat-foot { font-size: 12px; }
  table.table { font-size: 14px; }
  .table th { font-size: 12.5px; padding: 11px 14px; }
  .table td { padding: 13px 14px; }
  .cell-product { min-width: 170px; }
  .cell-product b { font-size: 14.5px; }
  .cell-product span { font-size: 12px; }
  .menu-item { height: 48px; font-size: 15px; }
  .tabbar .tab-item { font-size: 11.5px; }
  .tabbar .tab-item svg { width: 22px; height: 22px; }
  .install-banner .ib-text strong { font-size: 13.5px; }
  .install-banner .ib-text span { font-size: 12px; }
  .install-banner .btn { height: 36px; }
  .toast { font-size: 14px; }
  .filter-bar .field { flex: 1 1 170px; min-width: 0; }
  .filter-bar .field.w-sm, .filter-bar .field.w-md { width: auto; }
  .filter-bar .filter-actions { width: 100%; margin-left: 0; }
  .filter-bar .filter-actions .btn { flex: 1; height: 44px; }
  .page-head-actions .btn { height: 42px; }
}

/* 首页快捷操作：桌面隐藏，手机显示 */
.quick-grid { display: none; }
@media (max-width: 1023px) {
  .quick-grid {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px;
    margin: 0 0 16px;
  }
  .quick-item {
    display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
    min-height: 96px; padding: 12px; border-radius: 14px;
    background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
    color: var(--ink); text-decoration: none;
  }
  .quick-item:active { transform: translateY(1px); }
  .quick-item .qi-icon {
    width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
    background: var(--brand-soft); color: var(--brand);
  }
  .quick-item .qi-icon svg { width: 20px; height: 20px; }
  .quick-item .qi-green { background: var(--green-soft); color: var(--green); }
  .quick-item .qi-amber { background: var(--amber-soft); color: var(--amber); }
  .quick-item .qi-violet { background: #f5f3ff; color: var(--violet); }
  .quick-item b { font-size: 14.5px; line-height: 1.2; }
  .quick-item small { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
}

/* 手机表格：首列固定，横向滑动时商品名始终可见 */
@media (max-width: 820px) {
  .stat-grid { gap: 10px; }
  .table-wrap table.table { min-width: 780px; }
  .table-wrap table.table th:first-child,
  .table-wrap table.table td:first-child {
    position: sticky; left: 0; z-index: 2; background: #fff;
    box-shadow: 10px 0 14px -14px rgba(15, 23, 42, .45);
  }
  .table-wrap table.table thead th:first-child { background: #f8fafc; }
  .table-wrap table.table tr.low-row td:first-child { background: #fff7f7; }
  .filter-bar .field { flex: 1 1 calc(50% - 6px); }
}

@media (max-width: 520px) {
  .content { padding: 14px 12px calc(22px + env(safe-area-inset-bottom)); }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-card { flex-direction: column; gap: 8px; padding: 12px; }
  .stat-label { font-size: 12.5px; white-space: normal; }
  .stat-value { font-size: 24px; }
  .stat-foot { font-size: 11.5px; }
  .page-head-actions { width: 100%; }
  .page-head-actions .btn { flex: 1 1 auto; }
  .filter-bar .field { flex: 1 1 100%; }
  .table-wrap table.table { min-width: 740px; }
  .modal-foot .btn { flex: 1; }
  .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-item { min-height: 88px; }
  .login-card .login-title { font-size: 30px; }
  .tabbar .tab-item svg { width: 23px; height: 23px; }
}

/* 手机端勾选框放大，方便点按 */
@media (max-width: 1023px) {
  input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; accent-color: var(--brand); }
  label > input[type="checkbox"], label > input[type="radio"] { margin: 0 6px 0 0; vertical-align: -4px; }
  /* 页面头部只有一个按钮时保持紧凑右对齐，不要拉满整行 */
  .page-head-actions .btn:only-child { flex: 0 0 auto; margin-left: auto; height: 38px; padding: 0 16px; font-size: 14px; }
}


/* 手机端单据明细：表格改卡片，避免横向拖动才能填数量和单价 */
@media (max-width: 820px) {
  .items-table { min-width: 0 !important; display: block; }
  .items-table thead { display: none; }
  .items-table tbody { display: flex; flex-direction: column; gap: 10px; padding: 12px; }
  .items-table tbody tr {
    display: flex; flex-wrap: wrap; gap: 8px;
    padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfe;
  }
  .items-table tbody td { padding: 0 !important; border: 0 !important; background: none !important; }
  .items-table tbody td:nth-child(1) { flex: 1 1 100%; min-width: 0; }
  .items-table tbody td:nth-child(2) { flex: 1 1 100%; order: 2; font-size: 12.5px; color: var(--muted); }
  .items-table tbody td:nth-child(2)::before { content: "单位 "; color: var(--muted-2); }
  .items-table tbody td:nth-child(3) { flex: 1 1 38%; order: 3; min-width: 0; }
  .items-table tbody td:nth-child(4) { flex: 1 1 38%; order: 4; min-width: 0; }
  .items-table tbody td:nth-child(5) { flex: 1 1 100%; order: 5; }
  .items-table tbody td:nth-child(6) { flex: 0 0 auto; order: 6; margin-left: auto; }
  .items-table td[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: 3px;
    font-size: 11.5px; color: var(--muted); text-align: left;
  }
  .items-table .input { width: 100%; height: 44px; font-size: 16px; }
  .items-table .combo { min-width: 0; width: 100%; }
  .items-table .row-amount { font-size: 15px; }
  .items-table tbody tr:has(td.center) { display: block; text-align: center; }
}

/* 微信内置浏览器提示 */
.wx-hint {
  margin: 0 0 16px; padding: 10px 12px; border-radius: 10px;
  background: #ecfdf5; border: 1px solid #bbf7d0; color: #166534;
  font-size: 12.5px; line-height: 1.65;
}
.wx-hint b { font-weight: 700; }

/* ================= 手机端表格卡片化（中老年易读） ================= */
@media (max-width: 820px) {
  .table-wrap { overflow: visible; }
  .table-wrap table.table:not(.items-table) { min-width: 0; width: 100%; border-collapse: separate; border: 0; background: transparent; }
  .table-wrap table.table:not(.items-table) thead { display: none; }
  .table-wrap table.table:not(.items-table) tbody,
  .table-wrap table.table:not(.items-table) tr,
  .table-wrap table.table:not(.items-table) td { display: block; width: auto; }
  .table-wrap table.table:not(.items-table) tr.table-card-row {
    display: flex; flex-direction: column;
    background: #fff; border: 1px solid var(--line); border-radius: 14px;
    margin: 0 0 12px; padding: 4px 14px; box-shadow: 0 4px 14px rgba(15, 23, 42, .05);
  }
  .table-wrap table.table:not(.items-table) td.cell-title { order: -1; }
  .table-wrap table.table:not(.items-table) tr.table-card-row.low-row { border-color: #fecaca; background: #fff7f7; }
  .table-wrap table.table:not(.items-table) td {
    position: static; display: flex; align-items: flex-start; justify-content: space-between;
    gap: 12px; padding: 8px 0; border: 0; border-bottom: 1px dashed #eef2f7;
    white-space: normal; text-align: right; font-size: 15px; line-height: 1.5; min-width: 0;
  }
  .table-wrap table.table:not(.items-table) td:last-child { border-bottom: 0; }
  .table-wrap table.table:not(.items-table) td::before {
    content: attr(data-label); flex: 0 0 auto; max-width: 45%; text-align: left;
    color: var(--muted); font-size: 13.5px; font-weight: 500; line-height: 1.6;
  }
  .table-wrap table.table:not(.items-table) td:empty { display: none; }
  .table-wrap table.table:not(.items-table) td.cell-title {
    display: block; text-align: left; padding: 9px 0 8px; border-bottom: 1px solid var(--line);
    font-size: 17px; font-weight: 700; line-height: 1.35;
  }
  .table-wrap table.table:not(.items-table) td.cell-title::before { display: none; }
  .table-wrap table.table:not(.items-table) td.cell-title .cell-product b { font-size: 17px; }
  .table-wrap table.table:not(.items-table) td.cell-title .cell-product span {
    display: block; margin-top: 2px; font-size: 12.5px; color: var(--muted); font-weight: 400;
  }
  .table-wrap table.table:not(.items-table) td[data-label*="数量"],
  .table-wrap table.table:not(.items-table) td[data-label*="库存"],
  .table-wrap table.table:not(.items-table) td[data-label*="结存"],
  .table-wrap table.table:not(.items-table) td[data-label*="金额"] { font-size: 16px; font-weight: 700; }
  .table-wrap table.table:not(.items-table) td > .td-value {
    display: inline-flex; align-items: center; justify-content: flex-end; flex-wrap: wrap;
    gap: 6px; text-align: right;
  }
  .table-wrap table.table:not(.items-table) td .btn { margin-left: 6px; }
  .table-wrap table.table:not(.items-table) td:has(.btn) { justify-content: flex-end; flex-wrap: wrap; }
  .table-wrap table.table:not(.items-table) tr.empty-row td { display: block; text-align: center; padding: 22px 0; border: 0; }
  .table-wrap table.table:not(.items-table) tr.empty-row td::before { display: none; }
}

.text-danger { color: var(--danger); }
.text-brand { color: var(--brand); }
.ledger-title { margin: 18px 0 8px; font-size: 15px; }
.scan-camera { position: relative; background: #000; border-radius: 12px; overflow: hidden; aspect-ratio: 4 / 3; }
.scan-camera video { display: block; width: 100%; height: 100%; object-fit: cover; }


/* 点商品名快速调整库存 */
.cell-product.tap-edit { cursor: pointer; position: relative; }
.cell-product.tap-edit::after {
  content: "点击调库存"; display: inline-block; margin-left: 8px; padding: 1px 7px;
  border-radius: 999px; background: #eef4ff; color: #2563eb; font-size: 11px; font-weight: 500;
  vertical-align: 2px; white-space: nowrap; align-self: flex-start;
}
.cell-product.tap-edit:hover b { color: var(--brand); }
@media (max-width: 1023px) { .cell-product.tap-edit::after { content: "点这里改数量"; font-size: 11.5px; padding: 2px 8px; } }
.stock-adjust-product { margin-bottom: 4px; }
.stock-adjust-product b { display: block; font-size: 18px; line-height: 1.35; }
.stock-adjust-product span { color: var(--muted); font-size: 13px; }
.sa-tip { margin: 6px 0 14px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.stock-adjust-list { display: flex; flex-direction: column; gap: 10px; }
.stock-adjust-row {
  display: grid; grid-template-columns: minmax(110px, 1.2fr) minmax(110px, 1fr) 110px 64px;
  align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px;
}
.stock-adjust-row.is-current { border-color: #bfd4ff; background: #f7faff; }
.sa-wh b { display: block; font-size: 15px; }
.sa-wh span { color: var(--brand); font-size: 11.5px; }
.sa-cur { display: flex; align-items: baseline; gap: 4px; justify-content: flex-end; color: var(--muted); font-size: 12.5px; }
.sa-cur b { color: var(--text); font-size: 17px; }
.sa-input { height: 44px; font-size: 16px; text-align: right; }
.sa-save { height: 44px; }
@media (max-width: 520px) {
  .stock-adjust-row { grid-template-columns: 1fr 96px; grid-template-areas: "wh cur" "input save"; row-gap: 8px; }
  .sa-wh { grid-area: wh; } .sa-cur { grid-area: cur; } .sa-input { grid-area: input; } .sa-save { grid-area: save; }
}
