/* ===================== 商用级 · 专业蓝 / 石板灰主题 ===================== */
:root {
  /* 背景 / 表面 */
  --bg:            #f1f5f9;
  --bg-2:          #e2e8f0;
  --surface:       #ffffff;
  --surface-soft:  #f8fafc;

  /* 文字 */
  --text:          #0f172a;
  --text-muted:    #64748b;
  --text-on-dark:  #f1f5f9;

  /* 边框 */
  --border:        #e2e8f0;
  --border-strong: #cbd5e1;

  /* 主色（专业蓝）+ 辅色 */
  --primary:        #2563eb;
  --primary-hover:  #1d4ed8;
  --primary-soft:   #dbeafe;
  --primary-ring:   rgba(37, 99, 235, 0.22);
  --accent:         #0ea5e9;

  /* 导航：深石板 */
  --nav-bg:         #0f172a;
  --nav-bg-2:       #1e293b;
  --nav-text:       #cbd5e1;
  --nav-text-soft:  #94a3b8;

  /* 状态色 */
  --ok:      #16a34a; --ok-bg:   #dcfce7; --ok-text:   #15803d;
  --warn:    #d97706; --warn-bg: #fef3c7; --warn-text: #92400e;
  --err:     #dc2626; --err-bg:  #fee2e2; --err-text:  #b91c1c;

  /* 阴影 / 圆角 */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow:    0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 16px 40px -16px rgba(15, 23, 42, 0.28), 0 4px 12px rgba(15, 23, 42, 0.06);
  --radius:    8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
}

* { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3 { color: #0f172a; letter-spacing: -0.01em; font-weight: 650; }
h1 { font-size: 22px; }
h2 { font-size: 20px; margin: 4px 0 18px; }
h3 { font-size: 16px; margin: 18px 0 10px; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; }

code {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: #1e3a8a;
  padding: 1px 7px;
  border-radius: 5px;
  font-family: "JetBrains Mono", "SF Mono", Consolas, "Courier New", monospace;
  font-size: 13px;
}

/* ===================== 顶部导航 ===================== */
.topnav {
  display: flex; align-items: center; gap: 4px;
  flex-wrap: wrap;
  background: var(--nav-bg);
  color: var(--nav-text);
  padding: 0 24px;
  min-height: 56px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04), 0 2px 8px rgba(15, 23, 42, 0.12);
  position: sticky; top: 0; z-index: 50;
}
.topnav .brand {
  font-weight: 700; letter-spacing: 0.2px;
  margin-right: 18px; color: #f8fafc;
  padding-right: 16px;
  border-right: 1px solid rgba(255,255,255,0.10);
}
.topnav a {
  color: var(--nav-text);
  text-decoration: none;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
  font-size: 14px;
}
.topnav a:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
  text-decoration: none;
}
.topnav a.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.2);
}
.topnav .spacer { flex: 1; }
.topnav .muted { color: var(--nav-text-soft); font-size: 13px; }
.topnav button.link {
  background: transparent; border: 1px solid transparent;
  color: var(--nav-text); cursor: pointer;
  font: inherit; padding: 6px 12px; border-radius: var(--radius-sm);
}
.topnav button.link:hover {
  color: #ffffff; border-color: rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.05);
}

/* 汉堡按钮：桌面端隐藏 */
.nav-toggle {
  display: none;
  background: transparent; border: 0; cursor: pointer;
  padding: 6px 4px;
  flex-direction: column; gap: 4px;
}
.nav-toggle span {
  display: block; width: 20px; height: 2px;
  background: var(--nav-text); border-radius: 2px;
  transition: transform 0.25s, opacity 0.2s;
}
/* 展开时的 X 动画 */
.nav-toggle.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* 桌面端 nav-links 保持水平排列 */
.nav-links {
  display: flex; align-items: center; gap: 4px;
  flex: 1;
}

/* ===================== 容器 / 主标题 ===================== */
.container { max-width: 1200px; margin: 28px auto; padding: 0 24px 60px; }

/* ===================== Flash 提示 ===================== */
.flash {
  padding: 11px 16px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  border: 1px solid transparent;
  font-size: 14px;
}
.flash-error   { background: var(--err-bg);  color: var(--err-text);  border-color: #fecaca; }
.flash-success { background: var(--ok-bg);   color: var(--ok-text);   border-color: #bbf7d0; }

/* ===================== 卡片 ===================== */
.card {
  background: var(--surface);
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.card label { display: block; margin: 12px 0; font-size: 14px; color: #334155; }

/* ===================== 表单元素 ===================== */
input[type=text], input[type=password], input[type=number],
input[type=date], input:not([type]), select, textarea {
  font: inherit;
  padding: 8px 11px;
  border: 1px solid var(--border-strong);
  background: #ffffff;
  border-radius: var(--radius-sm);
  color: var(--text);
  min-width: 200px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px var(--primary-ring);
}
input::placeholder { color: #94a3b8; }

.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.toolbar { margin: 14px 0 8px; color: var(--text-muted); font-size: 14px; }

/* ===================== 按钮 ===================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 16px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 500;
  transition: background 0.15s, border-color 0.15s, transform 0.05s, box-shadow 0.15s;
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--surface-soft); border-color: var(--primary); color: var(--primary); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:disabled:hover { background: var(--surface); border-color: var(--border-strong); color: var(--text); }

.btn.primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.35);
}
.btn.primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #ffffff;
}
.btn.danger {
  background: var(--err);
  color: #ffffff;
  border-color: var(--err);
}
.btn.danger:hover { background: #b91c1c; border-color: #b91c1c; color: #ffffff; }

.btn-sm { padding: 4px 12px; font-size: 12.5px; }

button.link {
  background: transparent; border: 0; cursor: pointer;
  font: inherit;
}

/* 表单中无 class 的 button：默认有点样式，不至于光秃秃 */
form button:not(.btn):not(.link) {
  font: inherit;
  padding: 7px 14px;
  margin-left: 6px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
form button:not(.btn):not(.link):hover { background: var(--surface-soft); border-color: var(--primary); }

/* ===================== 表格 ===================== */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  font-size: 14px;
}
.table th, .table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
.table thead th {
  background: var(--surface-soft);
  color: #475569;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-strong);
}
.table tbody tr { transition: background 0.12s; }
.table tbody tr:nth-child(even) { background: #fbfcfe; }
.table tbody tr:hover { background: var(--primary-soft); }
.table tbody tr:last-child td { border-bottom: 0; }

/* ===================== 文案修饰 ===================== */
.muted { color: var(--text-muted); font-size: 13px; }
.warning {
  background: var(--warn-bg); color: var(--warn-text);
  padding: 12px 16px; border-radius: var(--radius);
  border: 1px solid #fde68a;
}

/* ===================== 出库扫码 ===================== */
.scan-input {
  width: 100%;
  font-size: 26px;
  padding: 16px 18px;
  border: 2px solid var(--primary);
  background: #ffffff;
  border-radius: var(--radius);
  letter-spacing: 1px;
  font-family: "JetBrains Mono", "SF Mono", Consolas, monospace;
  box-shadow: 0 0 0 4px var(--primary-ring), var(--shadow);
}
.scan-input:focus {
  outline: none;
  border-color: var(--primary-hover);
  box-shadow: 0 0 0 4px var(--primary-ring), 0 0 0 6px rgba(14, 165, 233, 0.10), var(--shadow);
}

.scan-feedback {
  margin-top: 14px; padding: 14px 16px; border-radius: var(--radius);
  font-size: 16px; min-height: 1.6em;
  border: 1px solid transparent;
  transition: background 0.15s;
}
.scan-feedback.ok   { background: var(--ok-bg);   color: var(--ok-text);   border-color: #bbf7d0; }
.scan-feedback.warn { background: var(--warn-bg); color: var(--warn-text); border-color: #fde68a; }
.scan-feedback.err  { background: var(--err-bg);  color: var(--err-text);  border-color: #fecaca; }

/* ===================== Tab ===================== */
.tabs {
  display: flex; gap: 2px;
  margin-bottom: 16px;
  background: var(--surface-soft);
  padding: 4px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  width: fit-content;
}
.tab {
  background: transparent; border: 0;
  padding: 8px 18px;
  font: inherit; font-size: 14px;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
}
.tab:hover { color: var(--text); background: #ffffff; }
.tab.active {
  background: var(--surface);
  color: var(--primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.panel { display: none; }
.panel.active { display: block; }

/* ===================== 登录 / 改密 ===================== */
.login-box {
  max-width: 380px;
  margin: 100px auto 0;
  background: var(--surface);
  padding: 32px 30px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  position: relative;
}
.login-box::before {
  content: "";
  position: absolute; top: -3px; left: 24px; right: 24px;
  height: 4px; border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}
.login-box h1 { margin: 4px 0 16px; text-align: center; }
.login-box label { display: block; margin: 14px 0; font-size: 14px; color: #334155; }
.login-box input { width: 100%; }
.login-box button { width: 100%; margin-top: 18px; padding: 10px 14px; font-size: 15px; }

.form-narrow {
  max-width: 460px;
  background: var(--surface);
  padding: 22px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.form-narrow label { display: block; margin: 12px 0; }
.form-narrow input { width: 100%; }

/* ===================== 杂项 ===================== */
pre {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  overflow: auto;
  font-size: 12.5px;
  font-family: "JetBrains Mono", "SF Mono", Consolas, "Courier New", monospace;
  color: #334155;
}

/* ===================== 模态框 ===================== */
.modal {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.50);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  animation: modalFadeIn 0.15s ease-out;
}
.modal[hidden] { display: none; }
.modal-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 26px 28px;
  min-width: 380px;
  max-width: 90vw;
  box-shadow: var(--shadow-lg);
  animation: modalPop 0.18s ease-out;
}
.modal-card h3 { margin: 0 0 10px 0; font-size: 17px; }
.modal-card label { display: block; margin: 12px 0; font-size: 14px; color: #334155; }
.modal-card input { width: 100%; }
.modal-actions {
  margin-top: 18px;
  display: flex; gap: 10px; justify-content: flex-end;
}

@keyframes modalFadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes modalPop    { from { transform: scale(0.96); opacity: 0 } to { transform: scale(1); opacity: 1 } }

/* ===================== 分页器 ===================== */
#tx-pager { margin-top: 12px; color: var(--text-muted); font-size: 13px; }
#tx-pager button {
  margin-left: 6px;
  padding: 5px 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit; font-size: 13px;
  color: var(--text);
}
#tx-pager button:hover { background: var(--surface-soft); border-color: var(--primary); color: var(--primary); }

/* ===================== 当前库存「在库」列加粗描蓝 ===================== */
#cur-rows td:last-child b { color: var(--primary); }

/* ===================== 流水表「补录字段」折叠 ===================== */
.table.meta-col-hidden .col-meta { display: none; }
/* 折叠时，若该行已有补录内容，在操作列前显示一个小蓝点提醒 */
.meta-dot {
  display: inline-block;
  margin-right: 6px;
  color: var(--primary);
  font-size: 14px;
  line-height: 1;
  vertical-align: middle;
  cursor: help;
}
.table:not(.meta-col-hidden) .meta-dot { display: none; }

/* ===================== 仪表盘卡片 ===================== */
.dash-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-top: 8px;
}
.dash-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  position: relative;
}
.dash-card .label { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.dash-card .num   { font-size: 30px; font-weight: 700; color: var(--text); margin-top: 6px; line-height: 1.1; letter-spacing: -0.02em; }
.dash-card.primary {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-color: #bfdbfe;
}
.dash-card.primary .num { color: var(--primary-hover); }
.dash-card.alert {
  background: #fffbeb;
  border-color: #fde68a;
}
.dash-card.alert .num { color: #92400e; }
.dash-card .link {
  position: absolute; bottom: 10px; right: 14px;
  font-size: 12px; color: var(--primary);
}

/* ===================== 图表网格 ===================== */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 16px;
  margin-top: 18px;
}
.chart-card h3 { margin-top: 0; }
.chart-card canvas {
  width: 100% !important;
  height: 260px !important;
  max-height: 280px;
}

/* ===================== 缺货预警行 + 标识 ===================== */
.row-alert { background: #fffbeb !important; }
.row-alert td { color: #92400e; }
.badge-alert {
  display: inline-block;
  background: var(--err); color: #fff;
  padding: 2px 10px; border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-zero {
  display: inline-block;
  background: #e2e8f0; color: #475569;
  padding: 2px 10px; border-radius: 999px;
  font-size: 12px;
}
.cur-fold-toggle td { background: var(--surface-soft); font-size: 13px; padding: 8px; }
.cur-fold-toggle:hover td { background: #eef2f7; }
.cur-fold-row td { opacity: 0.65; }

/* ===================== 批次进度条 ===================== */
.bar {
  display: inline-block;
  width: 120px; height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  vertical-align: middle;
  margin-right: 6px;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--primary));
}

/* ===================== 流水批量补录工具条 ===================== */
.bulk-bar {
  margin: 12px 0;
  padding: 10px 14px;
  background: var(--primary-soft);
  color: var(--primary-hover);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  display: flex; align-items: center; gap: 10px;
}
.bulk-bar b { font-size: 16px; }

/* ===================== 型号编码链接 ===================== */
a.code-link { text-decoration: none; }
a.code-link code { transition: background 0.15s; }
a.code-link:hover code { background: var(--primary-soft); border-color: var(--primary); }

/* ===================== Capacitor / Android 专用 ===================== */
/* 「用摄像头扫码」按钮默认隐藏；在 Android App (Capacitor) 中才显示 */
.camera-btn { display: none; }
html.capacitor-native .camera-btn {
  display: inline-flex;
  margin-left: 8px;
  vertical-align: middle;
}
/* Android 应用里把扫码输入框设大一点便于触屏操作 */
html.capacitor-native .scan-input,
html.capacitor-native input[type=text],
html.capacitor-native input[type=number] { font-size: 18px; }

/* ===================== 摄像头扫码透明化覆盖层（startScan 模式）=====================
   触发时：JS 给 <html> 和 <body> 加 .barcode-scanner-active；
   原理：整页 visibility:hidden 让 WebView 把原生摄像头预览露出来，
        只有 .barcode-scanner-modal 元素（取消按钮等）保留可见。 */
html.barcode-scanner-active,
html.barcode-scanner-active body {
  background: transparent !important;
}
body.barcode-scanner-active {
  visibility: hidden;
}
body.barcode-scanner-active .barcode-scanner-modal,
body.barcode-scanner-active .barcode-scanner-modal * {
  visibility: visible;
}

/* 浮层取消按钮 */
#bc-cancel {
  position: fixed;
  left: 50%;
  bottom: max(28px, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 999999;
  padding: 12px 36px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  border: 2px solid #fff;
  border-radius: 999px;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 1px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#bc-cancel:active { background: rgba(0, 0, 0, 0.85); }

/* ===================== 移动端适配（手机 / APK） ===================== */
@media (max-width: 768px) {
  body { line-height: 1.5; }
  h1 { font-size: 19px; }
  h2 { font-size: 17px; margin: 4px 0 12px; }
  h3 { font-size: 15px; margin: 14px 0 8px; }

  /* 顶部导航：折叠式菜单 */
  .topnav {
    padding: 14px 18px;
    min-height: 0;
    padding-top: calc(14px + env(safe-area-inset-top, 0px));
    padding-left: calc(18px + env(safe-area-inset-left, 0px));
    padding-right: calc(18px + env(safe-area-inset-right, 0px));
    gap: 0;
    flex-wrap: nowrap;
    overflow: visible;
    position: sticky; top: 0; z-index: 60;
  }
  .topnav .brand {
    margin-right: auto;
    padding-right: 10px;
    font-size: 18px;
    border-right: none;
  }
  /* 汉堡按钮：移动端显示，加大触摸区域 */
  .nav-toggle {
    display: flex;
    padding: 10px 8px;
  }
  .nav-toggle span {
    width: 24px; height: 2.5px;
  }

  /* 悬浮下拉面板 */
  .nav-links {
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: var(--nav-bg);
    padding: 10px 18px 18px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.35);
    z-index: 61;
  }
  .nav-links.open { display: flex; }

  /* 遮罩层 */
  .nav-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 55;
  }
  .nav-overlay.open { display: block; }

  .topnav a, .topnav button.link {
    padding: 13px 16px;
    font-size: 16px;
    white-space: nowrap;
    border-radius: var(--radius-sm);
  }
  .topnav a:hover { background: rgba(255, 255, 255, 0.07); }
  .topnav .spacer { display: none; }
  .topnav .muted { font-size: 14px; }
  .nav-links form[style] { display: block !important; }
  .nav-links form button.link { width: 100%; text-align: left; }

  /* 主容器 */
  .container {
    margin: 14px auto;
    padding: 0 12px;
    padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
  }

  /* 卡片 */
  .card { padding: 14px; margin-bottom: 14px; border-radius: 12px; }
  .card label { margin: 10px 0; font-size: 13px; }

  /* 表单元素：取消最小宽度，撑满父容器；字号 ≥16px 防止 iOS 聚焦缩放 */
  input[type=text], input[type=password], input[type=number],
  input[type=date], input:not([type]), select, textarea {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    padding: 10px 11px;
    font-size: 16px;
  }
  /* 覆盖个别页面通过 style="width:..." 写死的大宽度 */
  input[style*="width"], select[style*="width"] {
    width: 100% !important;
    max-width: 100% !important;
  }
  /* 库龄页阈值天数等小输入框允许保留窄宽度 */
  input[type=number][style*="6em"] { width: 6em !important; }

  /* 行内表单 → 纵向堆叠 */
  .inline-form { gap: 8px; }
  .inline-form > input,
  .inline-form > select,
  .inline-form > textarea,
  .inline-form > label { width: 100%; }
  .inline-form > button { flex: 1 1 auto; }
  .inline-form > .btn { min-height: 40px; }

  /* 按钮 */
  .btn { padding: 9px 14px; font-size: 14px; min-height: 40px; }
  .btn-sm { padding: 5px 10px; font-size: 12px; min-height: 0; }
  form button:not(.btn):not(.link) { padding: 8px 14px; min-height: 38px; }

  /* 表格：变成块级容器，横向滚动；内容不换行避免列被压扁 */
  .table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  .table th, .table td {
    padding: 9px 10px;
    font-size: 13px;
  }
  .table thead th { font-size: 11px; }
  /* 表格里的小输入框（如「最低库存」）允许窄一点 */
  .table input[type=number] { width: 5em; min-width: 0; }

  /* 模态框：撑满屏幕宽度，可上下滚动 */
  .modal-card,
  .modal-card[style] {
    min-width: 0 !important;
    width: calc(100vw - 20px) !important;
    max-width: calc(100vw - 20px) !important;
    padding: 18px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    box-sizing: border-box;
  }
  .modal-card h3 { font-size: 16px; }
  .modal-actions { flex-wrap: wrap; gap: 8px; }
  .modal-actions .btn { flex: 1 1 45%; }

  /* 登录 / 改密 */
  .login-box {
    margin: 36px 14px 0;
    padding: 24px 20px;
    max-width: none;
  }
  .form-narrow { padding: 18px 16px; max-width: none; }

  /* 仪表盘卡片：两列布局 */
  .dash-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .dash-card { padding: 12px 14px; }
  .dash-card .label { font-size: 12px; }
  .dash-card .num { font-size: 22px; }
  .dash-card .link { font-size: 11px; bottom: 8px; right: 12px; }

  /* 图表网格 → 单列 */
  .charts-grid { grid-template-columns: 1fr; gap: 12px; }
  .chart-card canvas { height: 220px !important; max-height: 240px; }

  /* Tab 条横向滚动 */
  .tabs {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab {
    padding: 8px 12px;
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* 出库扫码输入框 */
  .scan-input {
    font-size: 20px;
    padding: 12px 14px;
    letter-spacing: 0.5px;
  }
  .scan-feedback { font-size: 14px; padding: 10px 12px; }

  /* 批量补录工具条 */
  .bulk-bar { flex-wrap: wrap; padding: 8px 10px; font-size: 13px; gap: 8px; }
  .bulk-bar b { font-size: 14px; }

  /* Flash 提示 */
  .flash { padding: 10px 12px; font-size: 13px; }

  /* 分页器 */
  #tx-pager { font-size: 12px; }
  #tx-pager button { padding: 5px 10px; min-height: 32px; margin-left: 4px; }

  /* pre 块 */
  pre { font-size: 12px; padding: 10px 12px; }

  /* 进度条窄一点 */
  .bar { width: 80px; }

  /* 摄像头扫码按钮：手机上独立成行 */
  html.capacitor-native .camera-btn {
    display: flex;
    width: 100%;
    margin-left: 0;
    margin-top: 6px;
    min-height: 40px;
  }
}

/* 超窄屏（≤380px 的小手机）单列仪表盘、再缩边距 */
@media (max-width: 380px) {
  .container { padding-left: 10px; padding-right: 10px; }
  .dash-cards { grid-template-columns: 1fr; }
  .topnav .brand { font-size: 14px; }
}
</content>
</invoke>
