/* ============================================================
   仓储出入库管理系统 · 设计系统
   ============================================================ */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --info: #0891b2;
  --info-light: #cffafe;
  --sidebar-bg: #172033;
  --sidebar-hover: #22304a;
  --sidebar-active: #2563eb;
  --sidebar-text: #9aa8bd;
  --body-bg: #f1f5f9;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --border-dark: #cbd5e1;
  --text: #1e293b;
  --text-mid: #475569;
  --text-light: #94a3b8;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, .1);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .18);
  --sidebar-w: 216px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--body-bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}

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

/* ---------------- 布局 ---------------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  position: fixed; inset: 0 auto 0 0;
  display: flex; flex-direction: column;
  z-index: 50;
  transition: transform .22s ease;
}
.sidebar-brand {
  height: 60px; display: flex; align-items: center; gap: 10px;
  padding: 0 18px; border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.sidebar-brand .logo {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(135deg, #2563eb, #0891b2);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 15px;
}
.sidebar-brand .txt { color: #fff; font-size: 15px; font-weight: 600; letter-spacing: .3px; }
.sidebar-brand .txt small { display: block; font-size: 10px; color: var(--sidebar-text);
  font-weight: 400; letter-spacing: 1px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 0 20px; }
.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px; }

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 18px; color: var(--sidebar-text);
  font-size: 13.5px; cursor: pointer; position: relative;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--sidebar-active); color: #fff; font-weight: 500; }
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: #7dd3fc;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; stroke-width: 1.9; }
.nav-item .badge-dot {
  margin-left: auto; background: var(--danger); color: #fff;
  font-size: 10px; min-width: 17px; height: 17px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; padding: 0 5px;
}

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 58px; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px; padding: 0 22px;
  position: sticky; top: 0; z-index: 40;
}
.topbar .page-title { font-size: 16px; font-weight: 600; }
.topbar .spacer { flex: 1; }
.topbar .menu-btn { display: none; background: none; border: 0; cursor: pointer; padding: 6px; }

.user-box { position: relative; }
.user-box > button {
  display: flex; align-items: center; gap: 8px; background: none;
  border: 1px solid var(--border); border-radius: 20px; padding: 5px 12px 5px 5px;
  cursor: pointer; font-size: 13px; color: var(--text); font-family: inherit;
}
.user-box > button:hover { background: #f8fafc; }
.avatar {
  width: 26px; height: 26px; border-radius: 50%; background: var(--primary);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; flex-shrink: 0;
}
.dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); min-width: 190px; padding: 6px; display: none; z-index: 60;
}
.dropdown.open { display: block; }
.dropdown a, .dropdown button {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 9px 11px; border: 0; background: none; border-radius: 6px;
  font-size: 13px; color: var(--text); cursor: pointer; font-family: inherit;
}
.dropdown a:hover, .dropdown button:hover { background: #f1f5f9; text-decoration: none; }
.dropdown .divider { height: 1px; background: var(--border); margin: 5px 0; }
.dropdown .uinfo { padding: 9px 11px; border-bottom: 1px solid var(--border); margin-bottom: 5px; }
.dropdown .uinfo b { display: block; font-size: 13.5px; }
.dropdown .uinfo span { font-size: 11.5px; color: var(--text-light); }

.content { padding: 20px 22px 40px; flex: 1; }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow); margin-bottom: 18px;
}
.card-head {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.card-head h3 { font-size: 14.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-head .spacer { flex: 1; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

/* ---------------- 统计卡 ---------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat::after {
  content: ''; position: absolute; right: -18px; top: -18px; width: 70px; height: 70px;
  border-radius: 50%; background: var(--primary-light); opacity: .55;
}
.stat .label { font-size: 12.5px; color: var(--text-mid); margin-bottom: 7px; position: relative; }
.stat .value { font-size: 25px; font-weight: 700; letter-spacing: -.5px; position: relative; }
.stat .value small { font-size: 13px; font-weight: 500; color: var(--text-light); margin-left: 3px; }
.stat .foot { font-size: 11.5px; color: var(--text-light); margin-top: 5px; position: relative; }
.stat.c-green::after { background: var(--success-light); }
.stat.c-green .value { color: var(--success); }
.stat.c-red::after { background: var(--danger-light); }
.stat.c-red .value { color: var(--danger); }
.stat.c-orange::after { background: var(--warning-light); }
.stat.c-orange .value { color: var(--warning); }
.stat.c-blue::after { background: var(--info-light); }
.stat.c-blue .value { color: var(--info); }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  background: #f8fafc; color: var(--text-mid); font-weight: 600;
  text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border);
  white-space: nowrap; font-size: 12.5px;
}
table.tbl td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
table.tbl tbody tr:hover { background: #f8fafc; }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
table.tbl .nowrap { white-space: nowrap; }
.empty { text-align: center; color: var(--text-light); padding: 44px 20px; }
.empty svg { width: 42px; height: 42px; opacity: .35; margin-bottom: 10px; }

/* ---------------- 徽章 ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px;
  border-radius: 11px; font-size: 11.5px; font-weight: 500; white-space: nowrap;
  background: #f1f5f9; color: var(--text-mid); line-height: 1.7;
}
.badge.blue { background: var(--primary-light); color: var(--primary-dark); }
.badge.green { background: var(--success-light); color: #15803d; }
.badge.red { background: var(--danger-light); color: #b91c1c; }
.badge.orange { background: var(--warning-light); color: #b45309; }
.badge.cyan { background: var(--info-light); color: #0e7490; }
.badge.gray { background: #f1f5f9; color: #64748b; }
.badge.purple { background: #ede9fe; color: #6d28d9; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 15px; border-radius: var(--radius); border: 1px solid var(--border-dark);
  background: #fff; color: var(--text); font-size: 13px; cursor: pointer;
  font-family: inherit; white-space: nowrap; transition: all .15s; line-height: 1.4;
}
.btn:hover { background: #f8fafc; border-color: var(--text-light); text-decoration: none; }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn.success { background: var(--success); border-color: var(--success); color: #fff; }
.btn.success:hover { background: #15803d; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { background: #b91c1c; }
.btn.warn { background: var(--warning); border-color: var(--warning); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--primary); }
.btn.ghost:hover { background: var(--primary-light); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn.lg { padding: 11px 22px; font-size: 14.5px; }
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------- 表单 ---------------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 15px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; color: var(--text-mid); font-weight: 500; }
.field label .req { color: var(--danger); margin-left: 2px; }
.field .hint { font-size: 11.5px; color: var(--text-light); }
input[type=text], input[type=password], input[type=number], input[type=date],
input[type=month], input[type=email], input[type=tel], select, textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--border-dark);
  border-radius: var(--radius); font-size: 13.5px; font-family: inherit;
  color: var(--text); background: #fff; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
input[readonly] { background: #f8fafc; color: var(--text-mid); }
textarea { resize: vertical; min-height: 70px; }
select { cursor: pointer; }

.filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
  padding: 14px 18px; border-bottom: 1px solid var(--border); background: #fcfdfe;
}
.filters .field { min-width: 130px; }
.filters .field.wide { min-width: 210px; }
.filters .spacer { flex: 1; }

/* ---------------- 分页 ---------------- */
.pager { display: flex; align-items: center; gap: 6px; padding: 14px 18px; flex-wrap: wrap; }
.pager .info { color: var(--text-light); font-size: 12.5px; margin-right: auto; }
.pager a, .pager span.pg {
  min-width: 32px; height: 32px; padding: 0 9px; display: inline-flex;
  align-items: center; justify-content: center; border: 1px solid var(--border);
  border-radius: 6px; font-size: 13px; color: var(--text-mid); background: #fff;
}
.pager a:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.pager .active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 500; }
.pager .disabled { opacity: .45; pointer-events: none; }

/* ---------------- 弹窗 ---------------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .5);
  display: none; align-items: flex-start; justify-content: center;
  z-index: 100; padding: 40px 16px; overflow-y: auto;
}
.modal-mask.open { display: flex; }
.modal {
  background: #fff; border-radius: var(--radius-lg); width: 100%; max-width: 620px;
  box-shadow: var(--shadow-lg); animation: pop .18s ease; margin: auto 0;
}
.modal.wide { max-width: 940px; }
.modal.xwide { max-width: 1180px; }
@keyframes pop { from { transform: translateY(-10px) scale(.99); opacity: 0; } }
.modal-head {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-head h3 { font-size: 15px; font-weight: 600; }
.modal-head .x { background: none; border: 0; cursor: pointer; color: var(--text-light); padding: 4px; line-height: 0; }
.modal-head .x:hover { color: var(--danger); }
.modal-body { padding: 20px; max-height: 66vh; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 9px; }

/* ---------------- 提示 ---------------- */
#toasts { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 9px; }
.toast {
  background: #fff; border-left: 4px solid var(--primary); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 12px 16px; font-size: 13.5px;
  min-width: 250px; max-width: 400px; animation: slideIn .2s ease;
  display: flex; align-items: flex-start; gap: 9px;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warning); }
@keyframes slideIn { from { transform: translateX(24px); opacity: 0; } }

.alert {
  padding: 11px 15px; border-radius: var(--radius); font-size: 13px;
  margin-bottom: 14px; display: flex; align-items: flex-start; gap: 9px;
}
.alert.info { background: var(--primary-light); color: var(--primary-dark); }
.alert.warn { background: var(--warning-light); color: #92400e; }
.alert.danger { background: var(--danger-light); color: #991b1b; }
.alert.success { background: var(--success-light); color: #166534; }

/* ---------------- 进度 / 步骤条 ---------------- */
.steps { display: flex; align-items: center; gap: 0; flex-wrap: wrap; margin: 6px 0 18px; }
.step { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-light); }
.step .n {
  width: 25px; height: 25px; border-radius: 50%; background: #e2e8f0; color: var(--text-light);
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600;
}
.step.done .n { background: var(--success); color: #fff; }
.step.done { color: var(--success); font-weight: 500; }
.step.cur .n { background: var(--primary); color: #fff; }
.step.cur { color: var(--primary); font-weight: 600; }
.step.rej .n { background: var(--danger); color: #fff; }
.step.rej { color: var(--danger); font-weight: 500; }
.step-line { width: 40px; height: 2px; background: #e2e8f0; margin: 0 10px; }
.step-line.done { background: var(--success); }

/* ---------------- 明细行编辑 ---------------- */
.item-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.item-table th {
  background: #f8fafc; padding: 9px 10px; text-align: left; font-size: 12.5px;
  color: var(--text-mid); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.item-table td { padding: 6px 7px; border-bottom: 1px solid #f1f5f9; }
.item-table input, .item-table select { padding: 6px 8px; font-size: 13px; }
.item-table .del { color: var(--danger); cursor: pointer; background: none; border: 0; padding: 5px; line-height: 0; }

.search-box { position: relative; }
.search-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: #fff;
  border: 1px solid var(--border-dark); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  max-height: 320px; overflow-y: auto; z-index: 30; display: none;
}
.search-results.open { display: block; }
.search-results .item { padding: 9px 12px; cursor: pointer; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
.search-results .item:last-child { border-bottom: 0; }
.search-results .item:hover, .search-results .item.hl { background: var(--primary-light); }
.search-results .item .t { font-weight: 500; }
.search-results .item .s { font-size: 11.5px; color: var(--text-light); margin-top: 2px; }
.search-results .item .r { float: right; font-size: 11.5px; color: var(--primary); }

/* ---------------- 扫码 ---------------- */
.scan-layout { display: grid; grid-template-columns: 1fr 1.25fr; gap: 18px; align-items: start; }
#reader { width: 100%; border-radius: var(--radius-lg); overflow: hidden; background: #0f172a; min-height: 260px; }
#reader video { width: 100% !important; border-radius: var(--radius-lg); }
.scan-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.scan-tab {
  flex: 1; padding: 11px; text-align: center; border: 1px solid var(--border-dark);
  border-radius: var(--radius); cursor: pointer; font-size: 13.5px; font-weight: 500; background: #fff;
}
.scan-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.scan-tab.out.active { background: var(--danger); border-color: var(--danger); }
.big-input { font-size: 16px !important; padding: 12px 14px !important; }
#submitBar { }

/* ---- 手机端扫码作业优化 ---- */
@media (max-width: 1000px) {
  /* 摄像头/模式区置顶，明细区在下 */
  .scan-layout > div:first-child { order: 1; }
  .scan-layout > div:last-child  { order: 2; }
  .scan-tab { padding: 14px; font-size: 15px; }
  #reader { min-height: 300px; }
}
@media (max-width: 820px) {
  /* 底部固定提交栏：合计 + 确认按钮常驻 */
  #submitBar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: #fff; border-top: 1px solid var(--border);
    box-shadow: 0 -4px 16px rgba(15,23,42,.10);
    padding: 11px 13px calc(11px + env(safe-area-inset-bottom));
    border-radius: 0;
  }
  #submitBar .card-body { padding: 0; }
  #submitBar .mb2 { margin-bottom: 9px !important; }
  #submitBar .alert { display: none; }        /* 手机上隐藏长提示，省空间 */
  .scan-page .content { padding-bottom: 96px; } /* 给固定栏留位 */
  #reader { min-height: 320px; }
  #camBtn { padding: 10px 18px; font-size: 15px; }
  .item-table th, .item-table td { padding: 8px 6px; }
  .item-table .q-in, .item-table .p-in { padding: 7px 6px; font-size: 15px; }
}
/* 摄像头全屏取景（手机横竖屏都友好） */
#reader img { display: none !important; }
#reader { position: relative; }
#reader::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 240px; height: 160px; transform: translate(-50%,-50%);
  border: 2px solid rgba(37,99,235,.85); border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(15,23,42,.28); pointer-events: none;
}
#reader:empty::after, #reader:not(:has(video))::after { display: none; }

/* ---------------- 打印 ---------------- */
@media print {
  .sidebar, .topbar, .no-print, .filters, .pager { display: none !important; }
  .main { margin-left: 0 !important; }
  .content { padding: 0 !important; }
  body { background: #fff; font-size: 12px; }
  .card { box-shadow: none; border: 0; margin: 0; }
  .print-page { page-break-after: always; }
  .print-page:last-child { page-break-after: auto; }
  @page { size: A4; margin: 12mm 10mm; }
}
.print-sheet { background: #fff; padding: 10px; }
.print-title { text-align: center; font-size: 19px; font-weight: 700; margin-bottom: 6px; letter-spacing: 2px; }
.print-sub { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 9px; flex-wrap: wrap; gap: 8px; }
table.print-tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
table.print-tbl th, table.print-tbl td { border: 1px solid #333; padding: 5px 7px; }
table.print-tbl th { background: #f2f2f2; text-align: center; font-weight: 600; }
table.print-tbl td.num { text-align: right; }
table.print-tbl td.ctr { text-align: center; }
.sign-row { display: flex; gap: 30px; margin-top: 26px; font-size: 12.5px; flex-wrap: wrap; }
.sign-row .s { flex: 1; min-width: 150px; }
.sign-row .s .line { border-bottom: 1px solid #333; height: 34px; }

/* ---------------- 其他 ---------------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.dl { display: grid; grid-template-columns: 92px 1fr; gap: 9px 14px; font-size: 13.5px; }
.dl dt { color: var(--text-light); font-size: 12.5px; }
.dl dd { color: var(--text); word-break: break-all; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tabs a {
  padding: 9px 16px; font-size: 13.5px; color: var(--text-mid); border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs a:hover { color: var(--primary); text-decoration: none; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.muted { color: var(--text-light); }
.small { font-size: 12px; }
.mt0 { margin-top: 0; } .mt1 { margin-top: 10px; } .mt2 { margin-top: 18px; }
.mb1 { margin-bottom: 10px; } .mb2 { margin-bottom: 18px; }
.text-right { text-align: right; } .text-center { text-align: center; }
.flex { display: flex; } .flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap1 { gap: 10px; } .gap2 { gap: 18px; }
.fw6 { font-weight: 600; }
.w-full { width: 100%; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.chart-box { height: 260px; position: relative; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; font-size: 12.5px; }
.bar-row .nm { width: 120px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .bar { flex: 1; height: 15px; background: #f1f5f9; border-radius: 8px; overflow: hidden; }
.bar-row .bar i { display: block; height: 100%; background: var(--primary); border-radius: 8px; }
.bar-row .vl { width: 92px; text-align: right; flex-shrink: 0; font-variant-numeric: tabular-nums; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1000px) {
  .scan-layout, .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .topbar .menu-btn { display: block; }
  .content { padding: 14px 13px 30px; }
  .dl { grid-template-columns: 80px 1fr; }
  .stat .value { font-size: 21px; }
}
.sidebar-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 45; display: none;
}
.sidebar-mask.open { display: block; }
