/* ================= 鑫衣依 ERP 样式 ================= */
:root {
  --bg: #f1f5f9;
  --panel: #ffffff;
  --line: #e2e8f0;
  --line-2: #cbd5e1;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #94a3b8;
  --brand: #1d4ed8;
  --brand-2: #2563eb;
  --brand-soft: #eff6ff;
  --ok: #15803d;
  --ok-soft: #f0fdf4;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --sidebar: #0f172a;
  --sidebar-2: #1e293b;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .1);
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
a { color: var(--brand); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
input, select, textarea, button { font-family: inherit; font-size: 14px; }
input, select, textarea {
  padding: 7px 10px; border: 1px solid var(--line-2); border-radius: 7px;
  background: #fff; color: var(--text); outline: none; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
input[readonly] { background: #f8fafc; color: var(--text-2); }
label { display: block; font-size: 12.5px; color: var(--text-2); font-weight: 500; }
label > input, label > select { margin-top: 4px; }

/* ---------- 登录 ---------- */
.login-wrap {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 50% -10%, #1e3a8a 0%, #0f172a 60%);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 380px; background: #fff; border-radius: 16px; padding: 32px 28px;
  box-shadow: 0 24px 60px rgba(0,0,0,.35); text-align: center;
}
.login-logo { font-size: 40px; line-height: 1; }
.login-logo-img { width: 132px; height: 132px; object-fit: contain; margin: 0 auto 6px; display: block; }
.login-card h1 { font-size: 22px; margin: 10px 0 4px; }
.login-card .sub { color: var(--muted); font-size: 12.5px; margin: 0 0 22px; }
.login-card label { text-align: left; margin-bottom: 12px; }
.login-card .btn { margin-top: 8px; }
.login-card .hint { color: var(--muted); font-size: 12px; margin: 14px 0 0; }
.login-card .err { color: var(--danger); font-size: 12.5px; min-height: 18px; margin: 8px 0 0; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 216px; background: var(--sidebar); color: #e2e8f0; display: flex;
  flex-direction: column; position: sticky; top: 0; height: 100vh; flex: 0 0 216px;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 18px 14px; font-size: 15px; }
.brand span { font-size: 20px; }
.brand img { width: 34px; height: 34px; object-fit: contain; border-radius: 6px; background: #fff; }
#nav { flex: 1; overflow-y: auto; padding: 4px 10px 10px; }
#nav a {
  display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 8px;
  color: #cbd5e1; font-size: 13.5px; margin-bottom: 2px;
}
#nav a:hover { background: var(--sidebar-2); color: #fff; }
#nav a.active { background: var(--brand); color: #fff; font-weight: 600; }
#nav a .ico { width: 18px; text-align: center; }
#nav .group { color: #64748b; font-size: 11px; padding: 12px 12px 4px; letter-spacing: .08em; }
.sidebar-foot { padding: 12px; border-top: 1px solid #1e293b; }
.side-user { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: #94a3b8; }
.side-user a { color: #f87171; }
.side-alert {
  background: var(--danger); color: #fff; border-radius: 8px; padding: 8px 10px;
  font-size: 12.5px; margin-bottom: 10px;
}
.side-alert.ok { background: #166534; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 12px 20px; background: #fff;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.topbar h2 { font-size: 17px; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.date-input { width: 148px; }
.clock { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.view { padding: 18px 20px 60px; flex: 1; }
.only-mobile { display: none; }

/* ---------- 通用组件 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 7px;
  border: 1px solid var(--line-2); background: #fff; color: var(--text); cursor: pointer;
  font-size: 13.5px; white-space: nowrap; transition: .12s;
}
.btn:hover { background: #f8fafc; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.icon-btn {
  border: 0; background: transparent; font-size: 17px; cursor: pointer; padding: 4px 8px;
  border-radius: 6px; color: var(--text-2);
}
.icon-btn:hover { background: #f1f5f9; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden;
}
.card-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid var(--line); background: #fcfdff;
}
.card-head h3 { font-size: 14.5px; flex: 1; }
.card-head .sub { color: var(--muted); font-size: 12px; font-weight: 400; }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }
.grid { display: grid; gap: 16px; }
.grid.k2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.k6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 150px; }
.row.tight > * { flex: 0 0 auto; }
.row > .btn, .row > button, .row > a.btn { flex: 0 0 auto; }   /* 按钮不参与拉伸 */
/* 单据头固定排 4 块（现场要求：两块变 4 块） */
.row.k4x { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.row.k4x > * { flex: none; min-width: 0; }
/* 下拉 + 旁边的「＋」按钮 */
.with-add { display: flex; gap: 6px; align-items: stretch; }
.with-add select { flex: 1 1 auto; min-width: 0; }
.with-add .btn { flex: 0 0 auto; padding: 6px 10px; }
/* 客商选择按钮：占满宽度、文字左对齐，看着像输入框，点开是可搜索的列表 */
.with-add .partner-pick { flex: 1 1 auto; min-width: 0; justify-content: flex-start;
  text-align: left; overflow: hidden; white-space: nowrap; }
.with-add .partner-pick > span { overflow: hidden; text-overflow: ellipsis; }
/* 码数旁边的折算提示 */
.lines-table .conv { font-size: 11px; color: var(--text-2); text-align: right; margin-top: 2px; }

/* 导入数据：拖放区与识别结果行 */
.drop-zone { border: 2px dashed var(--line); border-radius: var(--radius); padding: 26px 18px;
             text-align: center; background: var(--bg); transition: .15s; }
.drop-zone.over { border-color: var(--brand); background: var(--brand-soft); }
.drop-zone .big { font-size: 34px; line-height: 1; margin-bottom: 8px; }
.imp-row { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.imp-row:last-child { border-bottom: 0; }
.imp-row.off { opacity: .5; }
.imp-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.imp-body { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.imp-kind { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.imp-kind select { min-width: 170px; }
.note.ok-line { color: var(--ok); }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }

/* KPI */
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .k { color: var(--text-2); font-size: 12.5px; display: flex; justify-content: space-between; }
.kpi .v { font-size: 24px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .u { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 3px; }
.kpi .d { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi.warn { border-color: #fcd34d; background: var(--warn-soft); }
.kpi.danger { border-color: #fca5a5; background: var(--danger-soft); }
.kpi.ok { border-color: #86efac; background: var(--ok-soft); }
.kpi .v.blue { color: var(--brand); }
.kpi .v.green { color: var(--ok); }
.kpi .v.red { color: var(--danger); }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: #f8fafc; color: var(--text-2); font-weight: 600; font-size: 12.5px; position: sticky; top: 0; z-index: 1; }
tbody tr:hover { background: #f8fbff; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.mono { font-family: var(--mono); font-size: 12.5px; }
.table-wrap { max-height: 62vh; overflow: auto; }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); font-size: 13px; }
.empty .big { font-size: 30px; display: block; margin-bottom: 8px; }

/* 标签/徽章 */
.tag { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 11.5px; line-height: 18px; font-weight: 500; }
.tag.in { background: var(--ok-soft); color: var(--ok); border: 1px solid #bbf7d0; }
.tag.out { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }
.tag.blue { background: var(--brand-soft); color: var(--brand); border: 1px solid #bfdbfe; }
.tag.gray { background: #f1f5f9; color: var(--text-2); border: 1px solid var(--line); }
.tag.red { background: var(--danger-soft); color: var(--danger); border: 1px solid #fecaca; }
.tag.amber { background: var(--warn-soft); color: var(--warn); border: 1px solid #fde68a; }
.tag.green { background: var(--ok-soft); color: var(--ok); border: 1px solid #bbf7d0; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs button {
  border: 0; background: transparent; padding: 9px 14px; cursor: pointer; font-size: 13.5px;
  color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

/* 表单行明细表 */
.lines-table input, .lines-table select { padding: 5px 8px; font-size: 13px; }
/* 数字框的上下箭头会把窄列里的数字挤没，去掉 */
.lines-table input[type=number]::-webkit-outer-spin-button,
.lines-table input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.lines-table input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.lines-table td { padding: 4px 6px; }
.lines-table .del { color: var(--danger); cursor: pointer; border: 0; background: none; font-size: 15px; }

/* 扫码 */
.scan-input {
  font-family: var(--mono); font-size: 16px; padding: 12px 14px; border: 2px dashed var(--brand-2);
  background: var(--brand-soft);
}
.scan-hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.scan-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.scan-opts .chk { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.scan-opts .chk input { width: auto; margin: 0; }
.scan-log { max-height: 240px; overflow: auto; margin-top: 12px; font-size: 12.5px; }
.scan-log div { padding: 6px 10px; border-radius: 6px; margin-bottom: 4px; font-family: var(--mono); }
.scan-log .ok { background: var(--ok-soft); color: #14532d; }
.scan-log .err { background: var(--danger-soft); color: #7f1d1d; }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: center;
  justify-content: center; z-index: 100; padding: 20px; }
.modal-box { background: #fff; border-radius: 12px; width: 100%; max-width: 520px; max-height: 90vh;
  display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(0,0,0,.3); }
.modal-box.wide { max-width: 780px; }
.modal-head { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { flex: 1; font-size: 15.5px; }
.modal-body { padding: 18px; overflow: auto; }

/* 旧版本提示条 */
#stale-bar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px; z-index: 250;
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; font-size: 13px;
  background: #fffbeb; border: 1px solid #fcd34d; border-left: 4px solid #f59e0b;
  border-radius: 8px; box-shadow: 0 8px 24px rgba(15,23,42,.16); color: #78350f;
}
#stale-bar.hidden { display: none; }

/* toast */
.toasts { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #0f172a; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: 380px; animation: slide .2s;
}
.toast.ok { background: #166534; }
.toast.err { background: #991b1b; }
.toast.warn { background: #92400e; }
@keyframes slide { from { opacity: 0; transform: translateX(20px); } }

/* ---------- 型号输入框（输入即提示） ---------- */
.cell-item { position: relative; min-width: 170px; }
.cell-item .ta-input { width: 100%; }
.ta-menu {
  position: absolute; z-index: 60; top: 100%; left: 0; min-width: 320px; max-height: 300px;
  overflow: auto; background: #fff; border: 1px solid var(--line-2); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15,23,42,.16); margin-top: 2px;
}
.ta-row {
  display: flex; align-items: center; gap: 8px; padding: 8px 11px; cursor: pointer;
  border-bottom: 1px solid var(--line); font-size: 13.5px;
}
.ta-row:last-child { border-bottom: 0; }
.ta-row:hover { background: var(--brand-soft); }
.ta-name { font-weight: 600; }
.ta-spec { color: var(--text-2); font-size: 12.5px; }
.ta-stock { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.ta-none { padding: 10px 12px; color: var(--muted); font-size: 13px; }
.ta-new { color: var(--brand); font-weight: 600; background: #f8fbff; }
.ta-form { padding: 10px 12px; display: flex; flex-direction: column; gap: 7px; }
.ta-form-t { font-weight: 600; font-size: 13px; color: var(--brand); }
.ta-form label { font-size: 12.5px; }
.ta-form input, .ta-form select { padding: 5px 8px; font-size: 13.5px; }
.add-cell { white-space: nowrap; }
.add-cell .del { padding: 0 4px; }

/* ---------- 类目/型号 选择器 ---------- */
.pickbtn {
  width: 100%; text-align: left; background: #fff; border: 1px solid var(--line-2);
  border-radius: 7px; padding: 6px 9px; cursor: pointer; font-size: 13px; line-height: 1.3;
}
.pickbtn:hover { border-color: var(--brand-2); background: var(--brand-soft); }
.pickbtn em { font-style: normal; color: var(--text-2); font-size: 12px; }
.picker { display: flex; flex-direction: column; gap: 10px; }
.picker-search input { font-size: 16px; padding: 11px 13px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line-2); background: #fff; border-radius: 20px; padding: 5px 13px;
  font-size: 13px; cursor: pointer; color: var(--text-2);
}
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.picker-list { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.pk-row {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 11px 13px; border: 0; border-bottom: 1px solid var(--line); background: #fff;
  cursor: pointer; font-size: 14px;
}
.pk-row:last-child { border-bottom: 0; }
.pk-row:hover, .pk-row:active { background: var(--brand-soft); }
.pk-main { flex: 1; min-width: 0; }
.pk-main b { font-weight: 600; }
.pk-main em { font-style: normal; color: var(--text-2); margin-left: 5px; font-size: 12.5px; }
.pk-side { text-align: right; flex: 0 0 auto; }
.pk-side code { display: block; color: var(--muted); font-size: 12px; }
.pk-stock { font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.pk-stock.low { color: var(--danger); font-weight: 600; }
.picker-foot { display: flex; align-items: center; justify-content: space-between; }

/* ---------- 盘仓（手机优先） ---------- */
.scan-hero {
  background: linear-gradient(135deg, #1d4ed8, #0f766e); color: #fff; border-radius: 12px;
  padding: 16px; margin-bottom: 14px;
}
.scan-hero h3 { font-size: 16px; margin-bottom: 4px; }
.scan-hero .sub { font-size: 12.5px; opacity: .85; }
.progress-line { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.progress-line .bar { flex: 1; background: rgba(255,255,255,.28); height: 9px; }
.progress-line .bar > div { background: #fff; }
.st-line {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.st-line:last-child { border-bottom: 0; }
.st-line .info { flex: 1; min-width: 0; }
.st-line .info b { font-size: 14px; }
.st-line .info .meta2 { font-size: 12px; color: var(--muted); }
.st-line .nums { text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; flex: 0 0 auto; }
.st-line .diff-up { color: var(--ok); font-weight: 700; }
.st-line .diff-down { color: var(--danger); font-weight: 700; }
.st-line .diff-zero { color: var(--muted); }
.st-qty {
  width: 96px; text-align: right; font-size: 16px; padding: 8px 10px;
}
.big-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 15px; font-size: 16px; font-weight: 600; border-radius: 10px;
  border: 0; background: var(--brand); color: #fff; cursor: pointer;
}
.big-btn.green { background: var(--ok); }
.big-btn.ghost { background: #fff; color: var(--brand); border: 1.5px solid var(--brand); }
.big-btn:disabled { opacity: .5; }
.st-scanrow { display: flex; gap: 8px; align-items: stretch; }
.st-scanrow input.qty-in { width: 96px; text-align: center; font-size: 17px; font-weight: 600; }
video.cam {
  width: 100%; border-radius: 10px; background: #000; max-height: 56vh; object-fit: cover;
}

/* 手机打印预览 */
.phone-print { text-align: center; }
.phone-print img {
  max-width: 100%; border: 1px dashed var(--line-2); border-radius: 8px; background: #fff;
}

/* 图表 */
.chart { width: 100%; height: 180px; }
.chart.sm { height: 120px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); flex-wrap: wrap; margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }

/* 进度条 */
.bar { background: #f1f5f9; border-radius: 20px; height: 7px; overflow: hidden; }
.bar > div { height: 100%; background: var(--brand); }
.bar.low > div { background: var(--danger); }
.bar.mid > div { background: #f59e0b; }

/* 条码预览 */
.bc-preview { background: #fff; border: 1px dashed var(--line-2); border-radius: 8px; padding: 12px;
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.bc-preview svg { max-width: 100%; height: auto; }
.bc-preview .qr svg { width: 120px; height: 120px; }

/* 时间线 */
.tl { font-size: 13px; }
.tl .item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.tl .item:last-child { border-bottom: 0; }
.tl .t { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; width: 74px; flex: 0 0 74px; }
.tl .c { flex: 1; }

code { background: #f1f5f9; padding: 1px 5px; border-radius: 4px; font-family: var(--mono); font-size: 12.5px; }
pre { background: #0f172a; color: #e2e8f0; padding: 12px 14px; border-radius: 8px; overflow: auto;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.55; }
.note { background: var(--brand-soft); border-left: 3px solid var(--brand); padding: 10px 14px;
  border-radius: 0 8px 8px 0; font-size: 13px; color: #1e3a8a; }
.note.warn { background: var(--warn-soft); border-color: #f59e0b; color: #78350f; }
.note.danger { background: var(--danger-soft); border-color: var(--danger); color: #7f1d1d; }

.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line-2);
  border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1100px) {
  .grid.k4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid.k6 { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .grid.k3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 820px) {
  .sidebar { position: fixed; left: -230px; z-index: 50; transition: .2s; height: 100vh; }
  .sidebar.open { left: 0; }
  .only-mobile { display: inline-flex; }
  .hide-sm { display: none !important; }
  .grid.k2, .grid.k3, .grid.k4, .grid.k6 { grid-template-columns: 1fr; }
  .row.k4x { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .view { padding: 12px 10px 60px; }
  /* 顶栏换成两行：第一行标题+菜单，第二行操作按钮 */
  .topbar { padding: 8px 10px; flex-wrap: wrap; row-gap: 8px; }
  .topbar h2 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
               min-width: 0; flex: 1 1 120px; }
  .topbar-right { flex: 1 1 100%; justify-content: stretch; }
  .topbar-right .btn { flex: 1 1 auto; justify-content: center; }
  .topbar-right .date-input { flex: 0 1 132px; width: auto; }
  .clock { display: none; }
  .card-head { flex-wrap: wrap; row-gap: 8px; padding: 10px 12px; }
  .card-head h3 { flex: 1 1 auto; }
  .card-head .sub { flex: 1 1 100%; order: 3; }
  .card-head input, .card-head select { flex: 1 1 130px; max-width: none !important; }
  .card-body { padding: 12px; }
  .kpi .v { font-size: 21px; }
  input, select { font-size: 16px; }   /* 避免 iOS 聚焦时自动放大 */
  /* 明细表在手机上隐藏成卷/成件/件数/批次/备注，减少横向滚动 */
  .lines-table .hide-m { display: none; }
  .lines-table input, .lines-table select { font-size: 16px; }
  .pk-row { padding: 13px 12px; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; }
  .tabs button { white-space: nowrap; }
  .modal { padding: 8px; }
  .modal-box { max-height: 94vh; }
}
@media print { .sidebar, .topbar, .toasts { display: none !important; } }
