/* ============================================================
   五金配件入库及领取系统 · 全局样式 v20
   设计目标：清爽、层次分明、桌面侧栏 + 手机底部标签栏
   说明：保留了全部原有 class 钩子，页面 PHP 无需改动即可生效
   ============================================================ */

/* ---------------- 设计变量 ---------------- */
:root {
  --brand: #2563eb;
  --brand-600: #1d4ed8;
  --brand-050: #eff5ff;
  --brand-100: #dbe8ff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e5eaf2;
  --line-2: #eef2f7;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --ok: #15803d;
  --ok-bg: #e9f8ef;
  --warn: #b45309;
  --warn-bg: #fdf4e3;
  --danger: #dc2626;
  --danger-bg: #fdecec;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-1: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-2: 0 10px 30px -12px rgba(15, 23, 42, .25);
  --shadow-3: 0 18px 50px -18px rgba(15, 23, 42, .35);
  --sidebar-w: 246px;
  --font: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-600); }
img, svg { max-width: 100%; }
button, input, select, textarea { font-family: inherit; }
::selection { background: var(--brand-100); color: var(--ink); }

/* 无鼠标用户的焦点提示（键盘 Tab 时才出现） */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--brand); color: #fff; padding: 10px 16px; border-radius: 0 0 10px 0;
}
.skip:focus { left: 0; }

/* ============================================================
   一、外壳：侧栏 + 内容区
   ============================================================ */
.app { min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  transition: width .22s cubic-bezier(.3, .8, .3, 1);
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  z-index: 70;
}

/* 品牌区 */
.sb-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 18px 18px 16px;
}
.sb-logo {
  width: 38px; height: 38px; flex: none; border-radius: 11px;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #2563eb, #4f8cf7 55%, #38bdf8);
  box-shadow: 0 6px 16px -6px rgba(37, 99, 235, .55);
}
.sb-logo svg { width: 21px; height: 21px; }
.sb-brand-t { min-width: 0; }
.sb-name {
  font-size: 14.5px; font-weight: 700; color: var(--ink); letter-spacing: .2px;
  line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sb-sub { font-size: 11.5px; color: var(--faint); letter-spacing: .04em; }

/* 导航 */
.sb-scroll { flex: 1 1 auto; overflow-y: auto; padding: 4px 10px 10px; }
.sb-scroll::-webkit-scrollbar { width: 6px; }
.sb-scroll::-webkit-scrollbar-thumb { background: #dfe6f0; border-radius: 6px; }
.sb-group + .sb-group { margin-top: 14px; }
.sb-group-label {
  font-size: 11px; font-weight: 600; letter-spacing: .1em; color: var(--faint);
  padding: 6px 10px 6px; text-transform: uppercase;
}
.sb-link {
  display: flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 11px; margin-bottom: 2px;
  border-radius: 10px; color: var(--ink-2); font-size: 13.5px; font-weight: 500;
  position: relative; transition: background .16s, color .16s;
}
.sb-link svg { width: 18px; height: 18px; flex: none; opacity: .75; }
.sb-link:hover { background: #f4f7fc; color: var(--ink); }
.sb-link:hover svg { opacity: 1; }
.sb-link.on {
  background: var(--brand-050); color: var(--brand-600); font-weight: 600;
}
.sb-link.on svg { opacity: 1; color: var(--brand); }
.sb-link.on::before {
  content: ''; position: absolute; left: -10px; top: 11px; bottom: 11px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--brand);
}
.sb-badge {
  margin-left: auto; font-size: 11px; font-weight: 600; color: var(--brand-600);
  background: var(--brand-050); border-radius: 20px; padding: 1px 8px;
}

/* 侧栏底部用户卡 */
.sb-foot { padding: 10px; border-top: 1px solid var(--line-2); }
.user-menu { position: relative; }
.user-btn {
  width: 100%; display: flex; align-items: center; gap: 10px;
  background: #f8fafd; border: 1px solid var(--line); border-radius: 12px;
  padding: 8px 10px; cursor: pointer; text-align: left; transition: .16s;
}
.user-btn:hover { background: #f2f6fd; border-color: #d6e2f5; }
.avatar {
  width: 32px; height: 32px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff;
  background: linear-gradient(135deg, #64748b, #94a3b8); letter-spacing: .5px;
}
.avatar.lg { width: 40px; height: 40px; font-size: 15px; }
.user-btn .u-meta { min-width: 0; flex: 1; }
.user-btn .uname {
  display: block; font-size: 13.5px; font-weight: 600; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-btn .urole { display: block; font-size: 11.5px; color: var(--faint); }
.user-btn .caret { font-size: 10px; color: var(--faint); transition: transform .2s; }
.user-menu.open .user-btn .caret { transform: rotate(180deg); }
.user-drop {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 8px);
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 6px;
  box-shadow: var(--shadow-2); display: none; z-index: 300;
}
.user-menu.open .user-drop { display: block; animation: pop .16s ease-out; }
.user-drop-head { padding: 8px 10px 9px; border-bottom: 1px solid var(--line-2); margin-bottom: 5px; }
.user-drop-head .u1 { font-weight: 600; color: var(--ink); font-size: 13.5px; }
.user-drop-head .u2 { color: var(--faint); font-size: 11.5px; margin-top: 1px; }
.user-drop a {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: 8px; color: var(--ink-2); font-size: 13px;
}
.user-drop a svg { width: 16px; height: 16px; flex: none; opacity: .8; }
.user-drop a:hover svg { opacity: 1; }
.user-drop a:hover { background: var(--brand-050); color: var(--brand-600); }
.user-drop a.danger { color: var(--danger); }
.user-drop a.danger:hover { background: var(--danger-bg); }

/* 内容区 */
.shell {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex; flex-direction: column;
}
.wrap {
  width: 100%; max-width: 1320px; margin: 0 auto;
  padding: 26px 28px 40px; flex: 1 0 auto;
}

/* 手机顶栏（桌面隐藏） */
.mobilebar { display: none; }
.drawer-mask { display: none; }

/* ============================================================
   二、页头
   ============================================================ */
.page-head { margin-bottom: 18px; }
.page-head h1 {
  font-size: 21px; font-weight: 700; color: var(--ink); letter-spacing: -.2px;
  line-height: 1.35;
}
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 5px; max-width: 78ch; }
.page-head .sub strong { color: var(--ink-2); font-weight: 600; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ============================================================
   三、卡片
   ============================================================ */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px;
  box-shadow: var(--shadow-1);
}
.card > h2, .card h2 {
  font-size: 15px; font-weight: 650; color: var(--ink); margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.card h2 .cnt { font-size: 12.5px; font-weight: 500; color: var(--faint); }
.card-title {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px 14px; margin-bottom: 16px;
  padding-bottom: 13px; border-bottom: 1px solid var(--line-2);
}
.card-title h2 { margin: 0; }
.card-title .row { gap: 8px; }

/* ============================================================
   四、按钮
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 15px; border-radius: var(--radius-sm);
  border: 1px solid #d7dfec; background: #fff; color: var(--ink-2);
  font-size: 13.5px; font-weight: 550; line-height: 1; cursor: pointer;
  white-space: nowrap; text-align: center;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .12s, color .15s;
}
.btn:hover {
  background: #f7f9fd; border-color: #c4d2e6; color: var(--ink);
  box-shadow: 0 2px 8px -2px rgba(15, 23, 42, .12);
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[disabled] { opacity: .55; cursor: not-allowed; box-shadow: none; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--brand), #4b86f5);
  border-color: transparent; color: #fff;
  box-shadow: 0 6px 16px -8px rgba(37, 99, 235, .8);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--brand-600), #3d78ea); color: #fff; }
.btn-success { background: linear-gradient(135deg, #12864a, #22b05e); border-color: transparent; color: #fff;
  box-shadow: 0 6px 16px -8px rgba(18, 134, 74, .7); }
.btn-success:hover { background: linear-gradient(135deg, #0f7440, #1c9d52); color: #fff; }
.btn-danger { background: linear-gradient(135deg, #dc2626, #f0656a); border-color: transparent; color: #fff;
  box-shadow: 0 6px 16px -8px rgba(220, 38, 38, .65); }
.btn-danger:hover { background: linear-gradient(135deg, #c11f1f, #e05257); color: #fff; }
.btn-warn { background: linear-gradient(135deg, #d97706, #f5a623); border-color: transparent; color: #fff;
  box-shadow: 0 6px 16px -8px rgba(217, 119, 6, .6); }
.btn-warn:hover { background: linear-gradient(135deg, #b96606, #e79a1c); color: #fff; }
.btn-ghost {
  background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .3); color: #fff;
}
.btn-ghost:hover { background: rgba(255, 255, 255, .24); color: #fff; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; gap: 4px; }
.btn-block { width: 100%; }
.btn svg { width: 15px; height: 15px; }

/* 表格内的一行按钮 */
.actions { display: flex; align-items: center; gap: 5px; flex-wrap: nowrap; }
.inline-act { display: inline-flex; margin: 0; }
.form-inline { display: inline-flex; }

/* ============================================================
   五、表单
   ============================================================ */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 15px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field label {
  font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
}
.field .hint, .hint { font-size: 12px; color: var(--faint); line-height: 1.5; }
.field .req, .req { color: var(--danger); font-weight: 600; }

input[type=text], input[type=number], input[type=password], input[type=date],
input[type=datetime-local], input[type=month], input[type=email], input[type=search],
input[type=file], select, textarea {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1px solid #d7dfec; border-radius: var(--radius-sm);
  background: #fff; color: var(--ink); font-size: 14px; line-height: 1.4;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea { height: auto; min-height: 64px; padding: 9px 12px; resize: vertical; }
select {
  appearance: none; -webkit-appearance: none;
  padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
input[type=file] { padding: 6px 10px; height: auto; line-height: 1.8; }
input:hover, select:hover, textarea:hover { border-color: #c4d2e6; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .13);
}
input[readonly], input.ro, .ro, input:disabled, select:disabled, textarea:disabled {
  background: #f5f7fb; color: var(--muted); cursor: default;
}
input[readonly]:hover, input.ro:hover { border-color: #d7dfec; }

.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { min-width: 150px; }

/* 筛选区 */
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 13px 14px; align-items: end; }
.filter-grid .field { min-width: 0; }
.filter-actions {
  display: flex; gap: 8px; align-items: center;
  grid-column: 1 / -1; justify-content: flex-end; padding-top: 2px;
}
.filter-actions .btn { height: 38px; }

/* ============================================================
   六、表格
   ============================================================ */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 12px; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th, .table td { padding: 11px 13px; text-align: left; vertical-align: middle; }
.table thead th {
  background: #f7f9fc; color: var(--muted); font-weight: 600; font-size: 12.5px;
  letter-spacing: .02em; white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.table thead th:first-child { border-radius: 10px 0 0 0; }
.table thead th:last-child { border-radius: 0 10px 0 0; }
.table tbody td { border-bottom: 1px solid var(--line-2); color: var(--ink-2); }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover td { background: #f8fbff; }
.table .num, .table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .mono { color: var(--muted); }
.table .empty { padding: 34px 0; }

/* ============================================================
   七、徽标 / 标签 / 芯片
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600;
  line-height: 1.7; white-space: nowrap;
}
.badge-in, .badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-out { background: var(--danger-bg); color: var(--danger); }
.badge-admin { background: var(--brand-050); color: var(--brand-600); }
.badge-user { background: #f1f5f9; color: var(--ink-2); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-off { background: #f1f5f9; color: var(--faint); }

.unit-chip { gap: 2px; padding-right: 3px; }
.unit-del { display: inline-flex; margin: 0; }
.unit-del button {
  border: 0; background: transparent; color: #b9c4d4; cursor: pointer;
  font-size: 12px; line-height: 1; padding: 2px 4px; border-radius: 6px;
}
.unit-del button:hover { background: var(--danger-bg); color: var(--danger); }

.chip {
  display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px;
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px;
  background: #fff; color: var(--ink); font-weight: 600; font-size: 13.5px;
  transition: .16s; min-width: 96px;
}
.chip:hover {
  border-color: var(--brand); color: var(--brand-600); background: var(--brand-050);
  box-shadow: 0 6px 16px -10px rgba(37, 99, 235, .6); transform: translateY(-1px);
}
.chip .chip-sub { display: block; font-size: 11.5px; font-weight: 400; color: var(--faint); }

/* ============================================================
   八、统计卡 / 看板
   ============================================================ */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(196px, 1fr)); gap: 14px; margin-bottom: 18px; }
/* 六卡看板：宽屏固定 6 列，避免 5+1 的不均衡排布 */
@media (min-width: 1180px) {
  .stats.stats-6 { grid-template-columns: repeat(6, 1fr); }
}
.stat {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-1);
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.stat::after {
  content: ''; position: absolute; right: -28px; top: -28px; width: 92px; height: 92px;
  border-radius: 50%; background: var(--brand-050); opacity: .85;
}
.stat .s-ic {
  position: absolute; right: 14px; top: 14px; z-index: 1;
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: #fff; color: var(--brand); box-shadow: var(--shadow-1);
}
.stat .s-ic svg { width: 17px; height: 17px; }
.stat .s-label { color: var(--muted); font-size: 12.5px; font-weight: 500; position: relative; z-index: 1; }
.stat .s-num {
  font-size: 27px; font-weight: 750; color: var(--ink); margin: 4px 0 1px;
  font-variant-numeric: tabular-nums; letter-spacing: -.5px; position: relative; z-index: 1;
  line-height: 1.25;
}
.stat .s-sub { font-size: 12px; color: var(--faint); position: relative; z-index: 1; }
.stat.up .s-num { color: #12864a; }
.stat.down .s-num { color: #d13a3f; }
.stat.warn .s-num { color: #b45309; }
.stat.up::after { background: var(--ok-bg); }
.stat.down::after { background: var(--danger-bg); }
.stat.warn::after { background: var(--warn-bg); }
.stat.up .s-ic { color: #12864a; }
.stat.down .s-ic { color: #d13a3f; }
.stat.warn .s-ic { color: #b45309; }
.stat.clickable { cursor: pointer; }
.stat.clickable:hover {
  transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: #c9dbf8;
}

.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.charts .card { margin-bottom: 0; }
.charts + .charts { margin-top: 16px; }

/* 排行条 */
.bar-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 9px;
  font-size: 12.5px; padding: 3px 2px; border-radius: 8px;
}
.bar-row.clickable { cursor: pointer; }
.bar-row.clickable:hover { background: #f7faff; }
.bar-row .bl {
  width: 132px; text-align: right; color: var(--ink-2); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none;
}
.bar-row .bt { flex: 1; background: #eef2f8; border-radius: 6px; height: 9px; position: relative; overflow: hidden; }
.bar-row .bf {
  position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; min-width: 3px;
  background: linear-gradient(90deg, #2563eb, #6ba1ff);
  animation: grow .5s cubic-bezier(.2, .8, .3, 1);
  transform-origin: left;
}
.bar-row .bv {
  width: 62px; font-variant-numeric: tabular-nums; color: var(--ink);
  font-weight: 600; flex: none;
}

/* 趋势图（由 dashboard.js 绘制） */
.trend-wrap { position: relative; height: 216px; width: 100%; }
.trend-wrap svg { display: block; width: 100%; height: 100%; overflow: visible; }
.trend-tip {
  position: absolute; pointer-events: none; z-index: 3;
  background: rgba(15, 23, 42, .92); color: #fff; border-radius: 9px;
  padding: 7px 10px; font-size: 12px; line-height: 1.6; white-space: nowrap;
  transform: translate(-50%, -116%); opacity: 0; transition: opacity .12s;
  box-shadow: var(--shadow-2);
}
.trend-tip.on { opacity: 1; }
.trend-tip b { font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); margin-top: 10px; flex-wrap: wrap; }
.legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.legend .dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

/* ============================================================
   九、提示 / 空状态 / 分页
   ============================================================ */
.alert {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 12px 15px; border-radius: 12px; margin-bottom: 14px; font-size: 13.5px;
  border: 1px solid transparent; line-height: 1.55;
}
.alert::before { font-weight: 700; flex: none; }
.alert-ok { background: var(--ok-bg); color: #14663a; border-color: #bfe8ce; }
.alert-ok::before { content: '✓'; }
.alert-err { background: var(--danger-bg); color: #a01f22; border-color: #f7c9ca; }
.alert-err::before { content: '!'; }
.alert-info { background: var(--brand-050); color: #1e40af; border-color: #cadcfb; }
.alert-info::before { content: 'i'; }

.empty { text-align: center; color: var(--faint); padding: 34px 12px; font-size: 13px; }
.empty::before {
  content: ''; display: block; width: 44px; height: 44px; margin: 0 auto 10px;
  border-radius: 14px; background: #f1f5fa url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 24 24' fill='none' stroke='%23a8b5c8' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M3 7h18v13H3z'/%3E%3Cpath d='M3 7l3-3h12l3 3'/%3E%3Cpath d='M9 12h6'/%3E%3C/svg%3E") center/22px no-repeat;
}

.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.pager a, .pager .dis, .pager .cur {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 34px; padding: 0 13px; border: 1px solid var(--line);
  border-radius: 9px; background: #fff; color: var(--ink-2); font-size: 13px;
}
.pager a:hover { background: var(--brand-050); border-color: #c9dbf8; color: var(--brand-600); }
.pager .dis { color: #c3cddb; }
.pager .cur { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }

/* ============================================================
   十、出入库操作台
   ============================================================ */
.op-layout { display: grid; grid-template-columns: 360px 1fr; gap: 16px; align-items: start; }
.op-left .card, .op-right .card { padding: 18px; }
.op-left .card h2, .op-right .card h2 { font-size: 14.5px; }
.op-left .card h2 span { color: var(--faint); font-size: 12px; font-weight: 400; }

/* 分段控件 */
.seg {
  display: flex; gap: 4px; margin-bottom: 14px; padding: 4px;
  background: #f1f5fa; border-radius: 12px;
}
.seg button {
  flex: 1; padding: 8px 4px; border: 1px solid transparent; border-radius: 9px;
  background: transparent; cursor: pointer; font-size: 12.8px; font-weight: 550;
  color: var(--muted); transition: .15s; white-space: nowrap;
}
.seg button:hover { color: var(--ink); background: rgba(255, 255, 255, .7); }
.seg button.on {
  background: #fff; color: var(--brand-600); font-weight: 650;
  box-shadow: 0 2px 8px -3px rgba(15, 23, 42, .22);
}
.seg button:disabled { opacity: .5; cursor: not-allowed; }

.mode-seg { display: flex; gap: 6px; }
.mode-seg button {
  flex: 1; padding: 9px; border-radius: 10px; border: 1px solid #d7dfec;
  background: #fff; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink-2);
}
.mode-seg button.on-in { background: #12864a; color: #fff; border-color: #12864a; }
.mode-seg button.on-out { background: #dc2626; color: #fff; border-color: #dc2626; }

/* 匹配结果列表 */
.match-list {
  max-height: 342px; overflow: auto; border: 1px solid var(--line);
  border-radius: 12px; background: #fff; margin-top: 12px;
}
.match-list:empty { display: none; }
.match-item {
  position: relative; padding: 10px 13px 10px 14px;
  border-bottom: 1px solid var(--line-2); cursor: pointer; transition: background .12s;
}
.match-item:last-child { border-bottom: none; }
.match-item:hover { background: var(--brand-050); }
.match-item:hover::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand);
}
.match-item .m-n { font-weight: 650; color: var(--ink); font-size: 13.5px; }
.match-item .m-s { color: var(--faint); font-size: 12px; }
.match-item .m-stock {
  position: absolute; right: 13px; top: 10px;
  font-size: 11.5px; font-weight: 600; color: var(--ok);
  background: var(--ok-bg); border-radius: 20px; padding: 1px 9px;
}
.match-item .m-stock.low { color: var(--danger); background: var(--danger-bg); }

/* 已定位提示 */
.locate-note {
  display: flex; align-items: center; gap: 7px; margin-top: 12px;
  font-size: 12.5px; color: var(--muted); min-height: 18px;
}
.locate-note:empty { display: none; }
.locate-note.ok { color: var(--ok); }

/* 单号清单 */
.order-note { background: #f8fafd; border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.order-note label { font-weight: 600; color: var(--ink-2); }
.qty-input { width: 62px !important; text-align: center; font-variant-numeric: tabular-nums; }
.qty-select { width: 84px; }
.qty-wrap { display: inline-flex; align-items: center; gap: 6px; }
.qty-wrap .qty-input { width: 58px !important; }
.qty-wrap .qty-unit { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.op-right .op-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }

/* 提交条 */
.op-submit-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line-2);
}
.op-submit-bar .btn-primary { min-width: 132px; }
.op-total { margin-left: auto; font-size: 13px; color: var(--muted); }
.op-total b { color: var(--ink); font-variant-numeric: tabular-nums; font-size: 15px; }

.scan-banner {
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(100deg, #eef6ff, #f4f9ff);
  border: 1px solid #cfe0fb; color: #1e42a0;
  padding: 11px 15px; border-radius: 12px; margin-bottom: 14px; font-size: 13px;
}

/* ============================================================
   十一、二维码
   ============================================================ */
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(154px, 1fr)); gap: 14px; }
.qr-cell {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px;
  text-align: center; background: #fff; transition: box-shadow .16s, border-color .16s;
  break-inside: avoid;
}
.qr-cell:hover { border-color: #c9dbf8; box-shadow: var(--shadow-1); }
.qr-cell .qr-img { background: #fff; border-radius: 8px; overflow: hidden; }
.qr-cell img, .qr-cell svg { width: 100%; height: auto; display: block; }
.qr-cell .q-t { font-size: 13px; font-weight: 650; margin-top: 7px; word-break: break-all; color: var(--ink); }
.qr-cell .q-s { font-size: 11.5px; color: var(--faint); word-break: break-all; }

/* ============================================================
   十二、系统设置宫格
   ============================================================ */
.settings-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(252px, 1fr)); gap: 14px; margin: 4px 0 26px; }
.settings-tile {
  display: flex; flex-direction: column; gap: 7px; text-align: left; cursor: pointer;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; transition: .18s; position: relative; overflow: hidden;
  box-shadow: var(--shadow-1); font-family: inherit;
}
.settings-tile::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--brand), #38bdf8); opacity: 0; transition: opacity .18s;
}
.settings-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: #c9dbf8; }
.settings-tile:hover::before { opacity: 1; }
.settings-tile .st-ic {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  font-size: 19px; background: var(--brand-050); margin-bottom: 2px;
}
.settings-tile .st-title { font-size: 14.5px; font-weight: 650; color: var(--ink); }
.settings-tile .st-sub { font-size: 12.5px; color: var(--muted); line-height: 1.55; }

/* ============================================================
   十三、仓库视图
   ============================================================ */
.wv-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.wv-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.wv-tab {
  padding: 8px 16px; border-radius: 20px; background: #fff; color: var(--ink-2);
  border: 1px solid var(--line); font-size: 13px; font-weight: 600; transition: .15s;
}
.wv-tab:hover { border-color: #c9dbf8; color: var(--brand-600); background: var(--brand-050); }
.wv-tab.on { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 6px 16px -8px rgba(37, 99, 235, .9); }

.wv-grid { display: grid; gap: 13px; grid-template-columns: repeat(var(--wv-cols, 3), minmax(0, 1fr)); }
.wv-shelf {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  text-align: left; cursor: pointer; position: relative;
  background: linear-gradient(180deg, #fff 0%, #f6faff 100%);
  border: 1px solid #dfe8f5; border-radius: 14px; padding: 13px 15px;
  min-height: 100px; transition: .16s; font-family: inherit;
}
.wv-shelf:hover {
  transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: var(--brand);
}
.wv-shelf::after {
  content: '详情'; position: absolute; right: 12px; top: 12px;
  font-size: 11px; color: #9fb0c7; background: #f1f6fd; border-radius: 20px; padding: 1px 8px;
  opacity: 0; transition: opacity .16s;
}
.wv-shelf:hover::after { opacity: 1; }
.wv-shelf.low { border-color: #f3b7ba; }
.wv-shelf .wv-no { font-size: 16px; font-weight: 700; color: var(--ink); letter-spacing: .2px; }
.wv-shelf .wv-loc { font-size: 12px; color: var(--muted); }
.wv-shelf .wv-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 4px; }
.wv-shelf .wv-badge {
  background: rgba(37, 99, 235, .08); color: var(--brand-600);
  font-size: 11.5px; padding: 2px 9px; border-radius: 20px; font-weight: 600;
}
.wv-shelf .wv-badge.warn { background: var(--danger-bg); color: var(--danger); }
.wv-layout-edit { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow: auto; padding-right: 2px; }
.wv-le-row {
  display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center;
  background: #f8fafd; border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px;
}
.wv-le-row .wv-le-no { font-weight: 700; color: var(--ink); min-width: 76px; }
.wv-le-row label { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.wv-le-row input[type=number], .wv-le-row input[type=text] { width: 62px; height: 32px; }
.wv-le-row .wv-le-loc input { width: 104px; }
.wv-le-row select { height: 32px; font-size: 12px; width: 96px; }
.wv-layer { margin-bottom: 12px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.wv-layer-head {
  background: #f3f8ff; color: var(--brand-600); font-weight: 700; font-size: 12.5px;
  padding: 8px 14px; letter-spacing: .02em;
}
.wv-layer .wv-part {
  display: flex; align-items: center; gap: 10px; padding: 9px 14px;
  border-top: 1px dashed var(--line-2); flex-wrap: wrap;
}
.wv-part .pv { font-size: 13px; color: var(--ink); font-weight: 550; }
.wv-part .pv small { color: var(--faint); font-weight: 400; }
.wv-part .stock { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.wv-part .stock b { color: var(--ink); font-variant-numeric: tabular-nums; }
.wv-part .stock.low b { color: var(--danger); }
.wv-opbtn {
  font-size: 12px; padding: 5px 12px; border-radius: 8px;
  border: 1px solid #dfe8f5; background: #fff; color: var(--ink-2); cursor: pointer;
  transition: .14s; font-weight: 550;
}
.wv-opbtn:hover { border-color: var(--brand); color: var(--brand-600); background: var(--brand-050); }
.wv-empty { color: var(--faint); font-size: 13px; padding: 12px 14px; }

/* ============================================================
   十四、弹窗
   ============================================================ */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 1000;
  background: rgba(15, 23, 42, .48);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal-box {
  background: #fff; border-radius: var(--radius); width: 900px; max-width: 100%;
  max-height: 86vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-3); animation: pop .18s ease-out;
}
.modal-box.modal-lg { width: 680px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 15px 20px; border-bottom: 1px solid var(--line-2);
}
.modal-head h3 { font-size: 15.5px; font-weight: 650; color: var(--ink); }
.modal-close {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  width: 30px; height: 30px; border-radius: 9px; font-size: 14px; cursor: pointer;
  display: grid; place-items: center; transition: .14s; flex: none;
}
.modal-close:hover { background: var(--danger-bg); border-color: #f7c9ca; color: var(--danger); }
.modal-body { overflow: auto; padding: 18px 20px 20px; }
.modal-body .table thead th { position: sticky; top: 0; z-index: 1; }
.modal-body .empty { padding: 26px 0; }

/* ============================================================
   十五、行内编辑 / 开关 / 标签页
   ============================================================ */
.editable {
  cursor: text; border-bottom: 1px dashed #c2cfe2; padding: 1px 3px;
  border-radius: 5px; min-width: 18px; display: inline-block; transition: .14s;
}
.editable:hover { background: var(--brand-050); border-bottom-color: var(--brand); }
.ie-input { font-size: 13px; padding: 3px 6px; border: 1px solid var(--brand); border-radius: 6px; width: 92%; min-width: 64px; height: 30px; }

.switch-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.switch-label { font-weight: 600; color: var(--ink-2); font-size: 13px; }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex: none; }
.switch input { display: none; }
.switch .slider { position: absolute; inset: 0; background: #cfd8e3; border-radius: 24px; cursor: pointer; transition: .2s; }
.switch .slider::before {
  content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}
.switch input:checked + .slider { background: #16a34a; }
.switch input:checked + .slider::before { transform: translateX(20px); }
.switch input:focus-visible + .slider { box-shadow: 0 0 0 3px rgba(37, 99, 235, .25); }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button {
  padding: 8px 15px; border: 1px solid var(--line); background: #fff;
  border-radius: 10px; cursor: pointer; font-size: 13px; color: var(--ink-2);
}
.tabs button.on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ============================================================
   十六、页脚 / 手机底部标签栏
   ============================================================ */
.site-footer {
  flex-shrink: 0; border-top: 1px solid var(--line-2); background: #fbfcfe;
  padding: 16px 0 20px; font-size: 12.5px; color: var(--faint);
}
.site-footer-in {
  display: flex; flex-wrap: wrap; gap: 8px 18px;
  align-items: center; justify-content: center;
}
.site-footer .fc { color: var(--muted); }
.site-footer .fl { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.site-footer .fl a { color: var(--muted); }
.site-footer .fl a:hover { color: var(--brand); }

.tabbar {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
  background: rgba(255, 255, 255, .96);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 24px -14px rgba(15, 23, 42, .35);
}
.tabbar a, .tabbar button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 5px 2px; border: 0; background: transparent; cursor: pointer;
  color: var(--muted); font-size: 10.5px; font-weight: 550; border-radius: 10px;
  font-family: inherit;
}
.tabbar a svg, .tabbar button svg { width: 21px; height: 21px; }
.tabbar a.on { color: var(--brand); }
.tabbar a.on svg { color: var(--brand); }
.tabbar a:active, .tabbar button:active { background: #f2f6fd; }

/* ============================================================
   十七、登录 / 安装页
   ============================================================ */
.auth-body {
  /* 先写 vh 兜底（老内核不支持 dvh），再写 dvh 适配刘海屏 */
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 24px 18px;
  background:
    radial-gradient(1100px 620px at 12% -8%, #dbeafe 0%, rgba(219, 234, 254, 0) 62%),
    radial-gradient(900px 560px at 96% 6%, #e0f2fe 0%, rgba(224, 242, 254, 0) 60%),
    linear-gradient(180deg, #f6f9fe, #eef3fa);
}
.auth-card {
  width: 100%; max-width: 396px; background: #fff; border: 1px solid var(--line);
  border-radius: 20px; padding: 30px 28px 24px; box-shadow: var(--shadow-3);
  margin: auto; text-align: center;
}
/* 输入框内容保持左对齐（文字排版居中仅作用于标签与标题） */
.auth-card input { text-align: left; }
.auth-card .login-err { text-align: left; }
.auth-brand { justify-content: center; text-align: center; }
.auth-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 20px; }
.auth-brand .sb-logo { width: 42px; height: 42px; border-radius: 12px; }
.auth-brand .sb-logo svg { width: 23px; height: 23px; }
.auth-brand .t1 { font-size: 16px; font-weight: 700; color: var(--ink); line-height: 1.3; }
.auth-brand .t2 { font-size: 12px; color: var(--faint); }
.auth-card h1 { font-size: 19px; font-weight: 700; color: var(--ink); }
.auth-card .sub { color: var(--muted); font-size: 12.8px; margin: 4px 0 20px; }
.auth-card .field { margin-bottom: 13px; }
.auth-card .btn-block { height: 42px; font-size: 14.5px; margin-top: 4px; }
.auth-tip {
  margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line);
  font-size: 12px; color: var(--faint); text-align: center; line-height: 1.6;
}
/* 登录页底部备案信息（居中） */
.auth-foot {
  flex-shrink: 0; width: 100%;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  font-size: 12px; color: var(--faint); text-align: center;
}
.auth-foot .afc {
  display: flex; flex-wrap: wrap; gap: 4px 16px;
  align-items: center; justify-content: center;
}
.auth-foot a { color: var(--faint); }
.auth-foot a:hover { color: var(--brand); }
.login-err {
  background: var(--danger-bg); color: #a01f22; border: 1px solid #f7c9ca;
  border-radius: 10px; padding: 10px 12px; margin-bottom: 13px; font-size: 12.8px;
  line-height: 1.6;
}
/* 兼容旧 class（install.php 等仍在使用） */
.login-body { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 18px;
  background: linear-gradient(180deg, #f6f9fe, #eef3fa); }
.login-box { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 30px 26px;
  width: 400px; max-width: 100%; box-shadow: var(--shadow-3); }
.login-box h1 { font-size: 18px; text-align: center; margin-bottom: 4px; color: var(--ink); }
.login-box .sub { text-align: center; color: var(--muted); margin-bottom: 18px; font-size: 13px; }
.login-box .field { margin-bottom: 13px; }
.login-box .btn { width: 100%; height: 42px; }
.auth-card code, .login-box code { background: #f1f5fa; border-radius: 6px; padding: 1px 6px; font-size: 12.5px; }

/* ============================================================
   十八、工具类
   ============================================================ */
.muted { color: var(--muted); }
.mono { font-family: "SFMono-Regular", Consolas, Menlo, monospace; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.mt0 { margin-top: 0; } .mt10 { margin-top: 10px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.right { text-align: right; }
.flex-between { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.footer-note { text-align: center; color: var(--faint); font-size: 12px; margin-top: 26px; }
.clickable { cursor: pointer; }
hr { border: 0; border-top: 1px solid var(--line-2); margin: 14px 0; }
code, pre { font-family: "SFMono-Regular", Consolas, Menlo, monospace; }
code { background: #f1f5fa; border-radius: 6px; padding: 1px 6px; font-size: 12.5px; color: var(--ink-2); }
pre { white-space: pre-wrap; word-break: break-all; }

/* 动画 */
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes sheetUp { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001s !important; transition-duration: .001s !important; }
}

/* ============================================================
   十九、响应式
   ============================================================ */

/* --- 中屏：收起侧栏，改为顶部栏 + 抽屉 --- */
@media (max-width: 1080px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .26s cubic-bezier(.3, .8, .3, 1);
    box-shadow: 0 0 40px rgba(15, 23, 42, .18);
    width: 272px;
  }
  .sidebar.open { transform: none; }
  .shell { margin-left: 0; }
  .drawer-mask {
    display: block; position: fixed; inset: 0; z-index: 65;
    background: rgba(15, 23, 42, .42);
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none; transition: opacity .22s;
  }
  .drawer-mask.on { opacity: 1; pointer-events: auto; }
  body.drawer-lock { overflow: hidden; }

  .mobilebar {
    display: flex; align-items: center; gap: 10px;
    position: sticky; top: 0; z-index: 60;
    height: 56px; padding: 0 14px;
    background: rgba(255, 255, 255, .94);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
  }
  .hamburger {
    width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line);
    background: #fff; display: grid; place-content: center; gap: 4px; cursor: pointer;
    flex: none; padding: 0;
  }
  .hamburger span { display: block; width: 17px; height: 1.8px; border-radius: 2px; background: var(--ink-2); }
  .mb-brand {
    font-size: 14.5px; font-weight: 700; color: var(--ink); flex: 1;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .mb-role {
    font-size: 11px; font-weight: 600; color: var(--brand-600);
    background: var(--brand-050); border-radius: 20px; padding: 3px 9px; flex: none;
  }
  .wrap { padding: 18px 16px 34px; }
  .op-layout { grid-template-columns: 1fr; }
  .charts { grid-template-columns: 1fr; }
}

/* --- 手机：单列 + 底部标签栏 --- */
@media (max-width: 900px) {
  .tabbar { display: flex; }
  /* 给固定底栏留出空间，避免遮住最后的按钮/页脚 */
  .shell { padding-bottom: calc(62px + env(safe-area-inset-bottom)); }
}

@media (max-width: 720px) {
  body { font-size: 14px; }
  .wrap { padding: 14px 12px 30px; }
  .page-head { margin-bottom: 14px; }
  .page-head h1 { font-size: 18.5px; }
  .page-head .sub { font-size: 12.5px; }
  .card { padding: 15px 14px; border-radius: 14px; margin-bottom: 14px; }
  .card > h2, .card h2 { font-size: 14.5px; }
  .card-title { gap: 8px; padding-bottom: 11px; margin-bottom: 13px; }

  /* 统计卡：两列 */
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 13px 14px; border-radius: 13px; }
  .stat .s-ic { width: 28px; height: 28px; right: 10px; top: 10px; border-radius: 9px; }
  .stat .s-ic svg { width: 14px; height: 14px; }
  .stat .s-label { font-size: 11.5px; }
  .stat .s-num { font-size: 21px; margin-top: 2px; }
  .stat .s-sub { font-size: 11px; }
  .stat::after { width: 74px; height: 74px; right: -22px; top: -22px; }

  /* 表格 -> 卡片（两列字段网格，紧凑美观） */
  .table { display: block; width: 100%; }
  .table thead { display: none; }
  .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tbody tr {
    display: grid; grid-template-columns: 1fr 1fr; gap: 1px 12px;
    border: 1px solid var(--line); border-radius: 12px; background: #fff;
    padding: 11px 12px 12px; margin-bottom: 9px;
  }
  .table tbody tr:hover td { background: transparent; }
  .table tbody td {
    border: none; padding: 4px 0; display: flex; align-items: flex-start;
    gap: 8px; text-align: left; font-size: 13px; line-height: 1.5;
    min-width: 0; overflow-wrap: anywhere;
  }
  .table tbody td::before {
    content: attr(data-label); flex: none; width: auto; min-width: 56px; max-width: 46%;
    color: var(--faint); font-size: 12px; font-weight: 500; padding-top: 1px;
    white-space: nowrap;
  }
  .table tbody td > * { min-width: 0; }
  /* 首字段作为卡片标题：整行加粗、不带标签 */
  .table tbody td:first-child { grid-column: 1 / -1; font-weight: 600; color: var(--ink); font-size: 13.5px; padding-bottom: 6px; border-bottom: 1px dashed var(--line-2); margin-bottom: 4px; }
  .table tbody td:first-child::before { display: none; }
  /* 值较长的字段占满整行 */
  .table tbody td.full, .table tbody td.acts, .table tbody td.empty { grid-column: 1 / -1; }
  .table tbody td:empty { display: none; }
  .table tbody td.num { text-align: left; }
  .table tbody td.acts { padding: 8px 0 0; margin-top: 4px; border-top: 1px dashed var(--line-2); }
  .table tbody td.acts::before { display: none; }
  .table tbody td.acts .actions { gap: 6px; flex-wrap: wrap; }
  .table tbody td.acts .actions .btn, .table tbody td.acts .actions .inline-act { flex: 1 1 calc(50% - 6px); min-width: calc(50% - 6px); text-align: center; }
  .table tbody td.acts .actions .inline-act .btn { width: 100%; }
  .table tbody td.empty {
    display: block; text-align: center; padding: 26px 0;
  }
  .table tbody td.empty::before { display: none; }
  .table tbody tr:has(td.empty) { border: 0; background: transparent; padding: 0; display: block; }

  /* 输入 16px 防 iOS 缩放 */
  input[type=text], input[type=number], input[type=password], input[type=date],
  input[type=datetime-local], input[type=month], input[type=email], input[type=search],
  select, textarea { font-size: 16px; height: 42px; }
  textarea { height: auto; }
  .btn { height: 40px; padding: 0 14px; font-size: 13.5px; }
  .btn-sm { height: 34px; font-size: 12.5px; }

  .form-grid { grid-template-columns: 1fr; gap: 12px; }
  .inline-form { gap: 9px; }
  .inline-form .field { min-width: 100%; }
  .inline-form .btn { flex: 1 1 auto; }
  .filter-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .filter-grid .field:first-child, .filter-grid .field:nth-child(6) { grid-column: 1 / -1; }
  .filter-actions { grid-column: 1 / -1; justify-content: stretch; }
  .filter-actions .btn, .filter-actions a.btn { flex: 1 1 0; height: 40px; padding: 0 8px; }

  /* 操作台 */
  .seg { padding: 3px; }
  .seg button { font-size: 12px; padding: 9px 2px; }
  .op-left .card, .op-right .card { padding: 14px; }
  .op-layout { gap: 12px; }
  .match-list { max-height: 300px; }
  .op-submit-bar { position: sticky; bottom: 0; background: #fff; margin: 14px -14px -14px; padding: 12px 14px; border-top: 1px solid var(--line-2); border-radius: 0 0 14px 14px; }
  .op-submit-bar .btn-primary { flex: 1 1 100%; height: 44px; font-size: 15px; }
  .op-total { margin-left: 0; }

  /* 二维码 */
  .qr-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .qr-cell { padding: 9px; }

  /* 设置宫格 */
  .settings-tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .settings-tile { padding: 14px; border-radius: 13px; }
  .settings-tile .st-ic { width: 32px; height: 32px; font-size: 16px; }
  .settings-tile .st-title { font-size: 13.5px; }
  .settings-tile .st-sub { font-size: 11.5px; }

  /* 仓库视图 */
  .wv-grid { grid-template-columns: 1fr 1fr !important; gap: 10px; }
  .wv-shelf { min-height: 88px; padding: 11px 12px; }
  .wv-shelf .wv-no { font-size: 14.5px; }
  .wv-shelf::after { display: none; }
  .wv-tab { padding: 7px 13px; font-size: 12.5px; }
  .wv-le-row { gap: 8px 10px; }

  /* 弹窗 -> 底部抽屉 */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal-box, .modal-box.modal-lg {
    width: 100%; max-width: 100%; max-height: 90vh; max-height: 90dvh;
    border-radius: 18px 18px 0 0; animation: sheetUp .24s cubic-bezier(.3, .9, .3, 1);
  }
  .modal-head { padding: 14px 16px; position: sticky; top: 0; background: #fff; border-radius: 18px 18px 0 0; z-index: 2; }
  .modal-head::before {
    content: ''; position: absolute; left: 50%; top: 6px; transform: translateX(-50%);
    width: 38px; height: 4px; border-radius: 4px; background: #e2e8f0;
  }
  .modal-head h3 { font-size: 14.5px; }
  .modal-body { padding: 14px 16px calc(18px + env(safe-area-inset-bottom)); }

  /* 看板 */
  .charts { gap: 12px; }
  .bar-row .bl { width: 96px; font-size: 12px; }
  .bar-row .bv { width: 54px; font-size: 12px; }
  .trend-wrap { height: 180px; }

  .pager a, .pager .dis, .pager .cur { padding: 0 11px; min-height: 36px; }
  .auth-card { padding: 24px 18px 20px; border-radius: 18px; }
  .site-footer { padding: 14px 12px 18px; }
  .site-footer-in { flex-direction: column; align-items: center; gap: 6px; }
}

@media (max-width: 400px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stat .s-num { font-size: 19px; }
  .filter-grid { grid-template-columns: 1fr; }
  .qr-grid { grid-template-columns: 1fr 1fr; }
  .settings-tiles { grid-template-columns: 1fr; }
  .wv-grid { grid-template-columns: 1fr !important; }
  .tabbar a, .tabbar button { font-size: 10px; }
  .tabbar a svg, .tabbar button svg { width: 19px; height: 19px; }
}

/* ============================================================
   二十、打印
   ============================================================ */
@media print {
  .sidebar, .mobilebar, .tabbar, .drawer-mask, .no-print, .btn, .pager,
  .site-footer, .skip, .page-head .page-actions { display: none !important; }
  body { background: #fff; }
  .shell { margin: 0; padding: 0; }
  .wrap { max-width: 100%; margin: 0; padding: 0; }
  .card { border: 0; box-shadow: none; padding: 0; margin-bottom: 10px; }
  .qr-cell { break-inside: avoid; border-color: #ddd; }
  .qr-grid { grid-template-columns: repeat(4, 1fr); }
}

/* 旧版顶栏 class 兼容（若某些页面仍输出，不破坏布局） */
.topbar { display: none; }

/* ============================================================
   二十二、二维码弹窗预览
   ============================================================ */
.qr-modal { width: 348px; }
.qr-modal .modal-body { text-align: center; }
.qr-body img {
  display: block; width: 240px; height: 240px;
  margin: 4px auto 14px; padding: 10px;
  border: 1px solid var(--line); border-radius: 14px; background: #fff;
}
.qr-url {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 16px; text-align: left;
}
.qr-url code {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.qr-acts { justify-content: center; gap: 10px; }
@media (max-width: 1080px) {
  .qr-modal { width: 100%; }
  .qr-body img { width: 210px; height: 210px; }
}

/* ============================================================
   二十一、侧栏折叠（仅桌面端；手机端为抽屉不受影响）
   ============================================================ */

/* 折叠按钮：挂在侧栏右缘的小圆钮 */
.sb-collapse {
  position: absolute; right: -12px; top: 22px; z-index: 20;
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff; border: 1px solid var(--line); color: var(--faint);
  display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .12);
  transition: color .16s, border-color .16s, transform .16s;
}
.sb-collapse:hover { color: var(--brand-600); border-color: var(--brand-300, #93c5fd); transform: scale(1.08); }
.sb-collapse svg { width: 13px; height: 13px; transition: transform .22s ease; }

@media (min-width: 1081px) {
  /* 折叠后：仅留图标列 */
  body.sb-collapsed { --sidebar-w: 72px; }
  body.sb-collapsed .sb-collapse svg { transform: rotate(180deg); }

  body.sb-collapsed .sb-brand { justify-content: center; padding-left: 6px; padding-right: 6px; }
  body.sb-collapsed .sb-brand-t { display: none; }

  body.sb-collapsed .sb-scroll { overflow-x: hidden; padding: 4px 10px 10px; }
  /* 分组标题变成细分隔线 */
  body.sb-collapsed .sb-group-label {
    font-size: 0; height: 1px; padding: 0; margin: 10px 3px;
    background: var(--line-2); border-radius: 1px; overflow: hidden;
  }
  body.sb-collapsed .sb-group + .sb-group { margin-top: 10px; }

  body.sb-collapsed .sb-link { justify-content: center; padding: 10px 0; gap: 0; }
  body.sb-collapsed .sb-link span { display: none; }
  /* 菜单名提示使用链接自带的 title 属性（原生悬停提示），
     不再用 ::after 浮层 —— 浮层即使透明也占布局，会在折叠态撑出横向滚动条 */

  /* 底部用户卡：只留头像 */
  body.sb-collapsed .sb-foot { padding: 10px 8px; }
  body.sb-collapsed .user-btn { justify-content: center; padding: 5px; gap: 0; border: 0; background: transparent; }
  body.sb-collapsed .user-btn:hover { background: #f2f6fd; }
  body.sb-collapsed .user-btn .u-meta,
  body.sb-collapsed .user-btn .caret { display: none; }

  /* 折叠态下拉改为侧栏右侧浮层，避免被 72px 宽度挤扁 */
  body.sb-collapsed .user-drop {
    left: auto; right: auto; bottom: auto;
    position: fixed; left: 80px; bottom: 16px; width: 216px;
  }
}

/* 手机端隐藏折叠按钮（抽屉模式不需要） */
@media (max-width: 1080px) {
  .sb-collapse { display: none; }
}
