/* ============================================================
   仪器出入库登记系统 — 现代企业蓝主题
   设计基调：留白充足 / 层次清晰 / 细腻阴影 / 克制的蓝色点缀
   ============================================================ */
:root {
  /* 主色 */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --primary-ring: rgba(37, 99, 235, .14);

  /* 中性色（slate 系） */
  --ink: #0f172a;
  --text: #1e293b;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e8ecf3;
  --line-soft: #f1f5f9;
  --surface: #ffffff;
  --canvas: #f6f8fc;

  /* 语义色 */
  --success: #10b981;
  --success-soft: #ecfdf5;
  --success-text: #047857;
  --warn: #f59e0b;
  --warn-soft: #fffbeb;
  --warn-text: #b45309;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --danger-text: #b91c1c;
  --info-soft: #eff6ff;
  --info-text: #1d4ed8;

  /* 形状与阴影 */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-sm: 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, .08), 0 2px 4px rgba(15, 23, 42, .04);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .12), 0 4px 8px rgba(15, 23, 42, .04);
  --shadow-blue: 0 8px 20px rgba(37, 99, 235, .25);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  font-size: 15px; line-height: 1.55; color: var(--text);
  background-color: #eef3fb;
  background-image:
    radial-gradient(900px 520px at 12% -10%, #dbe8ff 0%, rgba(219, 232, 255, 0) 62%),
    radial-gradient(760px 480px at 104% 2%, #e6e9ff 0%, rgba(230, 233, 255, 0) 58%),
    radial-gradient(700px 460px at 50% 108%, #e2f0ff 0%, rgba(226, 240, 255, 0) 60%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
.container { max-width: 1080px; margin: 0 auto; padding: 20px 16px 72px; }

svg.ico { width: 18px; height: 18px; fill: none; stroke: currentColor;
  stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- 顶部导航（后台页面） ---------- */
.navbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.navbar-inner {
  max-width: 1080px; margin: 0 auto; padding: 0 16px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 58px;
}
.brand { font-weight: 700; font-size: 16px; color: var(--ink); text-decoration: none;
  margin-right: 12px; letter-spacing: -.02em; }
.brand span { color: var(--primary); }
.nav-links { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.nav-links a {
  color: var(--muted); text-decoration: none; padding: 7px 13px;
  border-radius: var(--r-sm); font-size: 14px; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-links a:hover { background: var(--line-soft); color: var(--ink); }
.nav-links a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-right { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.operator-chip {
  background: var(--line-soft); color: var(--text); padding: 5px 12px;
  border-radius: 999px; font-size: 13px; font-weight: 500;
}
.operator-chip b { color: var(--ink); font-weight: 600; }
.nav-link-quiet { color: var(--muted); text-decoration: none; font-weight: 500; }
.nav-link-quiet:hover { color: var(--danger-text); }
.nav-link-primary { color: var(--primary); text-decoration: none; font-weight: 600; }
.nav-link-primary:hover { text-decoration: underline; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow-xs);
}
.card h2 { font-size: 17px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.card h3 { font-size: 15px; font-weight: 600; color: var(--ink); }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.5;
  white-space: nowrap;
}
.badge-in, .badge-in_stock, .badge-normal, .badge-ok, .badge-restore {
  background: var(--success-soft); color: var(--success-text);
}
.badge-out, .badge-due { background: var(--warn-soft); color: var(--warn-text); }
.badge-expired { background: var(--danger-soft); color: var(--danger-text); }
.badge-repair { background: var(--info-soft); color: var(--info-text); }
.badge-scrapped { background: var(--line-soft); color: var(--muted); }
.equip-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 3px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: var(--r-md); padding: 10px 18px;
  font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none;
  color: #fff; background: var(--primary); font-family: inherit;
  box-shadow: var(--shadow-xs);
  transition: background .15s, box-shadow .15s, transform .08s;
}
.btn:hover { background: var(--primary-hover); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn-block { width: 100%; }
.btn-lg { padding: 12px 20px; font-size: 15px; border-radius: var(--r-md); }
.btn-sm { padding: 6px 13px; font-size: 13px; border-radius: var(--r-sm); box-shadow: none; }
.btn-gray { background: #fff; color: var(--text); border-color: var(--line); }
.btn-gray:hover { background: var(--line-soft); box-shadow: var(--shadow-xs); }
.btn-ok { background: var(--success); }
.btn-ok:hover { background: #059669; }
.btn-warn { background: var(--warn); }
.btn-warn:hover { background: #d97706; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #dc2626; }
.btn-outline { background: #fff; color: var(--primary); border-color: #c7d9f8; }
.btn-outline:hover { background: var(--primary-soft); border-color: var(--primary); }
.btn-ghost-light {
  background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.28);
  backdrop-filter: blur(6px);
}
.btn-ghost-light:hover { background: rgba(255,255,255,.24); }

/* ---------- 表单 ---------- */
label {
  display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px;
  font-weight: 500;
}
input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 10px 13px; border: 1px solid var(--line); border-radius: var(--r-md);
  font-size: 15px; font-family: inherit; background: #fff; color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ring);
}
textarea { resize: vertical; min-height: 64px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .form-row, .form-row-3 { grid-template-columns: 1fr; } }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 14px; text-align: left; white-space: nowrap; }
th {
  color: var(--muted); font-weight: 600; font-size: 12.5px; letter-spacing: .02em;
  background: #fbfcfe; border-bottom: 1px solid var(--line);
  position: sticky; top: 0;
}
td { border-bottom: 1px solid var(--line-soft); color: var(--text); }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: #fbfcfe; }
tbody tr:last-child td { border-bottom: 0; }
td .cell-main { font-weight: 600; color: var(--ink); }
td .cell-sub { color: var(--muted); font-size: 12.5px; }

/* ---------- 统计条（后台页） ---------- */
.stat-row { display: flex; gap: 10px; flex-wrap: wrap; }
.stat-row .stat {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 10px 16px; font-size: 12.5px; color: var(--muted); min-width: 92px;
  box-shadow: var(--shadow-xs);
}
.stat-row .stat b { font-size: 20px; display: block; line-height: 1.3; font-weight: 700; color: var(--ink); }
.stat-row .stat.green b { color: var(--success-text); }
.stat-row .stat.orange b { color: var(--warn-text); }
.stat-row .stat.red b { color: var(--danger-text); }
.stat-row .stat.gray b { color: var(--muted); }
.stat-row .stat.blue b { color: var(--primary); }

/* ---------- 筛选条 ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters input, .filters select { width: auto; flex: 1; min-width: 130px; }

/* ---------- 弹窗 / 底部抽屉 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 23, 42, .45);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn .18s ease;
}
@media (min-width: 640px) { .modal-mask { align-items: center; } }
.modal {
  position: relative; background: #fff; width: 100%; max-width: 560px;
  max-height: 92vh; overflow-y: auto;
  border-radius: var(--r-xl) var(--r-xl) 0 0; padding: 24px 22px 22px;
  box-shadow: var(--shadow-lg);
  animation: sheetUp .26s cubic-bezier(.32, .72, 0, 1);
}
@media (min-width: 640px) { .modal { border-radius: var(--r-xl); } }
.sheet-handle {
  width: 40px; height: 4px; border-radius: 999px; background: #e2e8f0;
  margin: -10px auto 14px;
}
@media (min-width: 640px) { .sheet-handle { display: none; } }
.modal-close {
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--line-soft); color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.modal-close:hover { background: #e2e8f0; color: var(--text); }
.modal-close .ico { width: 15px; height: 15px; stroke-width: 2.2; }
.modal-title { font-size: 17px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.modal-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }

/* 兼容旧页面里的 .close 按钮 */
.modal .close {
  float: right; border: 0; background: var(--line-soft); border-radius: 50%;
  width: 30px; height: 30px; font-size: 16px; cursor: pointer; color: var(--muted);
}
.modal .close:hover { background: #e2e8f0; }

.asset-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; margin: 12px 0;
  font-size: 13px; color: var(--muted); }
.asset-meta b { color: var(--text); font-weight: 600; }
.action-area { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 16px; }
.hint-box {
  background: #fbfcfe; border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 11px 14px; font-size: 13px; color: var(--muted); margin-top: 12px;
}

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(16px);
  background: rgba(15, 23, 42, .94); color: #fff;
  padding: 12px 20px; border-radius: 999px; font-size: 14px; font-weight: 500;
  opacity: 0; pointer-events: none; transition: all .22s cubic-bezier(.32,.72,0,1);
  z-index: 300; max-width: 92vw; text-align: center;
  box-shadow: var(--shadow-lg); backdrop-filter: blur(8px);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.ok { background: rgba(5, 150, 105, .96); }
#toast.err { background: rgba(220, 38, 38, .96); }

/* ---------- 扫码覆盖层 ---------- */
.scan-mask {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(8, 12, 26, .92);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.scan-close {
  position: absolute; top: 20px; right: 20px;
  width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,.12); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.scan-close:hover { background: rgba(255,255,255,.22); }
.scan-tip { color: #cbd5e1; margin-top: 16px; font-size: 14px; min-height: 20px; }

.viewport {
  position: relative; width: min(78vw, 340px); aspect-ratio: 1;
  border-radius: var(--r-xl); overflow: hidden; background: #000;
  box-shadow: 0 0 0 1px rgba(255,255,255,.14), var(--shadow-lg);
}
.viewport video { width: 100%; height: 100%; object-fit: cover; display: block; }
.viewport .overlay {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to right, transparent 45%, rgba(37,99,235,.45) 45%, rgba(37,99,235,.45) 55%, transparent 55%),
    linear-gradient(to bottom, transparent 45%, rgba(37,99,235,.45) 45%, rgba(37,99,235,.45) 55%, transparent 55%);
  mix-blend-mode: screen;
}
.viewport .hint {
  position: absolute; left: 0; right: 0; bottom: 12px; color: #fff; font-size: 12.5px;
  text-align: center; text-shadow: 0 1px 3px rgba(0,0,0,.8);
}
.viewport .corner { position: absolute; width: 30px; height: 30px; border: 3px solid #60a5fa; }
.viewport .corner.tl { top: 14px; left: 14px; border-right: 0; border-bottom: 0; border-radius: 10px 0 0 0; }
.viewport .corner.tr { top: 14px; right: 14px; border-left: 0; border-bottom: 0; border-radius: 0 10px 0 0; }
.viewport .corner.bl { bottom: 14px; left: 14px; border-right: 0; border-top: 0; border-radius: 0 0 0 10px; }
.viewport .corner.br { bottom: 14px; right: 14px; border-left: 0; border-top: 0; border-radius: 0 0 10px 0; }

/* ---------- 标签打印 ---------- */
.label-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.label-option {
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px;
  text-align: center; width: 152px; cursor: pointer; background: #fff;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.label-option:hover { border-color: #c7d9f8; box-shadow: var(--shadow-xs); }
.label-option.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px var(--primary-ring); }
.label-option canvas { display: block; margin: 0 auto 6px; }
.label-option .t { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.label-option .s { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.print-area { display: none; }
@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { display: block; position: absolute; left: 0; top: 0; }
  .print-label {
    display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
    width: 58mm; height: 38mm; border: 1px dashed #999; margin: 1mm;
    font-size: 10px; text-align: center; page-break-inside: avoid; overflow: hidden;
  }
  .print-label .p-code { font-weight: 700; font-size: 12px; letter-spacing: .5px; }
  .print-label .p-name { margin-top: 1px; }
}

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 74vh; display: flex; align-items: center; justify-content: center; padding: 28px 16px;
}
.login-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg); padding: 34px 26px 26px;
  width: 100%; max-width: 384px; text-align: center;
}
.login-logo { width: 62px; height: 62px; border-radius: 17px; margin-bottom: 16px;
  box-shadow: var(--shadow-blue); }
.login-logo.sm { width: 54px; height: 54px; border-radius: 15px; margin-bottom: 12px; }
.login-title { font-size: 21px; font-weight: 700; color: var(--ink); letter-spacing: -.02em;
  margin-bottom: 6px; }
.login-sub { font-size: 13px; color: var(--muted); margin-bottom: 20px; line-height: 1.6; }
.login-card label, .login-modal label { text-align: left; }
.login-card .btn, .login-modal .btn { margin-top: 20px; }
.login-foot { margin-top: 18px; font-size: 13px; }
.login-foot a { color: var(--primary); text-decoration: none; font-weight: 500; }
.login-foot a:hover { text-decoration: underline; }
.login-hint { font-size: 12px; color: var(--faint); margin-top: 14px; line-height: 1.5; }

/* 登录页「保持登录」勾选 */
.remember-row {
  display: flex; align-items: center; gap: 8px; margin: 2px 0 0;
  font-size: 13.5px; color: var(--muted); cursor: pointer; user-select: none;
  text-align: left;
}
.remember-row input[type="checkbox"] {
  width: 17px; height: 17px; margin: 0; flex: none;
  accent-color: var(--primary); cursor: pointer;
}

/* 「该页面仅管理员可访问」提示条 */
.login-notice {
  margin: 0 0 16px; padding: 10px 13px; border-radius: 10px;
  background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8;
  font-size: 12.5px; line-height: 1.5; text-align: left;
}
.pw-row { position: relative; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: none; color: var(--primary); font-size: 13px;
  cursor: pointer; padding: 8px 10px; font-weight: 600; font-family: inherit;
}
.login-modal { text-align: center; }
.login-modal h3 { text-align: center; }

/* 账户面板 */
.acc-head { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.acc-avatar {
  width: 52px; height: 52px; border-radius: 16px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(140deg, #3b82f6, #2563eb); color: #fff;
  font-size: 17px; font-weight: 700; letter-spacing: .02em;
  box-shadow: var(--shadow-blue);
}
.acc-name { font-size: 18px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.acc-sub { font-size: 12.5px; color: var(--faint); margin-top: 1px; }
.acc-tip {
  background: var(--warn-soft); border: 1px solid #fde68a; color: var(--warn-text);
  border-radius: var(--r-md); padding: 10px 14px; font-size: 12.5px; margin: 14px 0 0;
  line-height: 1.5;
}
.account-modal #accPwForm { margin-top: 4px; }

/* 未登录引导块 */
.login-gate {
  background: #fbfcfe; border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 20px 18px; text-align: center;
}
.login-gate .lg-title { font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 5px; }
.login-gate .lg-sub { font-size: 13px; color: var(--muted); margin-bottom: 16px; line-height: 1.55; }

/* 借用人输入建议 */
.ac-wrap { position: relative; }
.ac-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); max-height: 232px; overflow-y: auto; padding: 5px;
}
.ac-item {
  padding: 10px 12px; font-size: 14px; cursor: pointer; border-radius: var(--r-sm);
  color: var(--text); transition: background .12s;
}
.ac-item:hover, .ac-item:active { background: var(--primary-soft); color: var(--primary); }

/* 快捷选项 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--text);
  border-radius: 999px; padding: 7px 15px; font-size: 13px; cursor: pointer;
  font-family: inherit; font-weight: 500;
  transition: all .15s;
}
.chip:hover { border-color: #c7d9f8; color: var(--primary); background: var(--primary-soft); }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ============================================================
   M8 终端首页（app 模式）
   ============================================================ */
body.app-home .navbar { display: none; }
body.app-home { padding-top: 0; }
body.app-home .container { padding: 0; max-width: 620px; }

/* 应用头部 */
.appbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px 13px;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.appbar-left { display: flex; align-items: center; gap: 11px; min-width: 0; flex: 1; }
.appbar-logo { width: 38px; height: 38px; border-radius: 11px; box-shadow: var(--shadow-blue); flex: none; }
.appbar-title { font-size: 16.5px; font-weight: 700; color: var(--ink);
  letter-spacing: -.02em; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar-sub { font-size: 11.5px; color: var(--faint); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar-right { display: flex; align-items: center; gap: 8px; flex: none; }

.pill-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; border: 1px solid var(--line); color: var(--text);
  padding: 7px 13px; border-radius: 999px; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit; max-width: 26vw; flex: none;
  box-shadow: var(--shadow-xs);
  transition: background .15s, border-color .15s, color .15s;
}
.pill-btn:hover { background: var(--primary-soft); border-color: #c7d9f8; color: var(--primary); }
.pill-btn .ico { width: 15px; height: 15px; color: var(--primary); }
.pill-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 36px; height: 36px; border-radius: 50%;
  background: #fff; border: 1px solid var(--line); color: var(--muted);
  box-shadow: var(--shadow-xs);
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--primary-soft); color: var(--primary); border-color: #c7d9f8; }
.icon-btn .ico { width: 17px; height: 17px; }

/* 小屏：收紧头部，避免右侧按钮被挤出 */
@media (max-width: 400px) {
  .appbar { padding: 11px 14px 12px; gap: 8px; }
  .appbar-sub { display: none; }
  .appbar-logo { width: 34px; height: 34px; border-radius: 10px; }
  .pill-btn { max-width: 22vw; padding: 7px 11px; }
}

/* 指标（轻盈玻璃卡） */
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 16px 16px 4px; }
.metric {
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: var(--r-md);
  padding: 11px 14px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .05);
}
.metric-num { font-size: 23px; font-weight: 700; color: var(--ink); line-height: 1.15;
  letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.metric-label { font-size: 12px; color: var(--muted); margin-top: 2px; }
.metric.is-warn .metric-num { color: var(--danger); }

/* 分段控件 */
.segmented {
  display: flex; gap: 4px; margin: 16px 16px 0; padding: 4px;
  background: rgba(226, 234, 246, .7);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-radius: var(--r-md);
}
.seg {
  flex: 1; border: 0; background: transparent; color: var(--muted);
  padding: 8px 0; border-radius: 9px; font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: background .18s, color .18s, box-shadow .18s;
}
.seg.active {
  background: #fff; color: var(--primary);
  box-shadow: 0 2px 8px rgba(15, 23, 42, .09);
}

/* 搜索 */
.search-bar { position: relative; margin: 12px 16px 0; }
.search-bar input {
  padding-left: 40px; border-radius: 999px;
  background: rgba(255, 255, 255, .8);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-color: rgba(255, 255, 255, .8);
  box-shadow: 0 6px 18px rgba(15, 23, 42, .05);
}
.search-bar input:focus { background: #fff; }
.search-ico {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--faint); pointer-events: none;
}
.modal .search-bar { margin: 14px 0 0; }
.modal .search-bar input { box-shadow: none; }

/* 列表 */
#listWrap { padding: 12px 16px 0; }
.list-foot { text-align: center; margin: 18px 0 132px; color: var(--faint); font-size: 12.5px; }
.empty-state {
  text-align: center; padding: 64px 24px; color: var(--faint); font-size: 14px;
}

/* 借用中：紧凑卡片（轻盈毛玻璃） */
.bcard {
  position: relative; overflow: hidden;
  background: rgba(255, 255, 255, .74);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: var(--r-lg);
  padding: 13px 15px 14px;
  margin-bottom: 10px; cursor: pointer;
  box-shadow: 0 6px 20px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .03);
  transition: transform .2s cubic-bezier(.32,.72,0,1), box-shadow .2s;
}
.bcard:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 34px rgba(15, 23, 42, .11), 0 2px 4px rgba(15, 23, 42, .04);
}
.bcard:active { transform: translateY(-1px) scale(.995); }
/* 左侧状态色条 */
.bcard::before {
  content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--warn);
}
.bcard.overdue::before { background: var(--danger); }

.bcard .bc-row1 { display: flex; align-items: center; gap: 8px; }
.bcard .d-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px; color: var(--muted); background: rgba(241, 245, 249, .9);
  padding: 2px 8px; border-radius: 6px; letter-spacing: .01em; flex: none;
}
.bcard .bc-return {
  margin-left: auto; flex: none;
  border: 1px solid rgba(16, 185, 129, .28); background: rgba(236, 253, 245, .85);
  color: var(--success-text); font-size: 12px; font-weight: 600;
  padding: 4px 12px; border-radius: 999px; cursor: pointer; font-family: inherit;
  transition: background .15s, border-color .15s;
}
.bcard .bc-return:hover { background: var(--success); border-color: var(--success); color: #fff; }
.bcard .bc-name {
  font-size: 15.5px; font-weight: 700; color: var(--ink); letter-spacing: -.01em;
  margin: 8px 0 7px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.bcard .bc-line {
  display: flex; flex-wrap: wrap; gap: 4px 16px;
  font-size: 12.5px; color: var(--text); line-height: 1.5;
}
.bcard .bc-line + .bc-line { margin-top: 2px; }
.bcard .bc-line em { font-style: normal; color: var(--faint); margin-right: 4px; }
.bcard .bc-line b { font-weight: 600; }
.bcard .bc-line.is-sub { color: var(--muted); font-size: 12px; }
.bcard .bc-line.is-sub .is-late { color: var(--danger-text); font-weight: 600; }
.bcard .bc-line.is-sub .is-late em { color: rgba(185, 28, 28, .6); }

/* 在库列表行（与卡片同一轻盈质感） */
.row-item {
  background: rgba(255, 255, 255, .74);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: var(--r-lg);
  padding: 12px 15px; margin-bottom: 9px; cursor: pointer;
  box-shadow: 0 6px 20px rgba(15, 23, 42, .055), 0 1px 2px rgba(15, 23, 42, .03);
  transition: transform .2s cubic-bezier(.32,.72,0,1), box-shadow .2s;
}
.row-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 34px rgba(15, 23, 42, .1), 0 2px 4px rgba(15, 23, 42, .04);
}
.row-item:active { transform: translateY(-1px) scale(.995); }
.row-item .ri-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.row-item .ri-right { display: flex; align-items: center; gap: 6px; }
.row-item .d-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px; color: var(--muted); background: rgba(241, 245, 249, .9);
  padding: 2px 8px; border-radius: 6px;
}
.row-item .ri-status { font-size: 12px; font-weight: 600; }
.row-item .ri-name { font-size: 15px; font-weight: 700; color: var(--ink);
  margin: 8px 0 5px; line-height: 1.35; letter-spacing: -.01em; }
.row-item .ri-meta { display: flex; flex-wrap: wrap; gap: 3px 16px; font-size: 12.5px; color: var(--muted); }
.row-item .ri-meta b { color: var(--text); font-weight: 600; }

/* ---------- 借用记录（表格） ---------- */
.rec-filters { padding: 12px 16px 0; }
.rec-filter-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.rec-filter-row input[type=date],
.rec-filter-row select { flex: 1; min-width: 0; font-size: 12.5px; padding: 8px 10px; }
.rec-dash { color: var(--faint); font-size: 13px; flex: none; }
.rec-filter-row .btn { flex: none; padding: 8px 14px; }

.rec-scroll {
  margin: 12px 16px 0; overflow-x: auto; border-radius: var(--r-md);
  border: 1px solid var(--line); background: #fff;
  box-shadow: 0 6px 20px rgba(15, 23, 42, .05);
  -webkit-overflow-scrolling: touch;
}
.rec-scroll-hint {
  margin: 8px 16px 0; text-align: right; color: var(--faint); font-size: 11.5px;
}
table.rec-table { width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: 12px; table-layout: fixed; min-width: 470px; }
table.rec-table th {
  position: sticky; top: 0; z-index: 2;
  background: #f8fafc; color: var(--muted); font-weight: 600; font-size: 11.5px;
  text-align: left; padding: 9px 8px; white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
table.rec-table td {
  padding: 9px 8px; border-bottom: 1px solid var(--line-soft);
  color: var(--text); vertical-align: middle; line-height: 1.4; background: #fff;
}
table.rec-table tbody tr:last-child td { border-bottom: 0; }
table.rec-table tbody tr:hover td { background: #fbfcfe; }

/* 首列（仪器名称）横向滚动时固定在左侧，滑动也能对上是哪台设备 */
table.rec-table th:first-child,
table.rec-table td:first-child {
  position: sticky; left: 0; z-index: 3;
  box-shadow: 1px 0 0 var(--line);
}
table.rec-table th:first-child { z-index: 4; }

/* 列宽 */
table.rec-table col.c-name { width: 132px; }
table.rec-table col.c-code { width: 74px; }
table.rec-table col.c-who { width: 60px; }
table.rec-table col.c-date { width: 54px; }
table.rec-table col.c-dur { width: 64px; }

.rec-name { font-weight: 600; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--muted); font-size: 11px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-time { color: var(--muted); font-size: 11px; white-space: nowrap; }
.rec-dur { font-weight: 600; white-space: nowrap; }
.rec-noreturn { color: var(--warn-text); font-size: 10.5px; }
.rec-tag {
  display: block; margin-top: 2px; padding: 1px 5px; border-radius: 999px;
  background: var(--warn-soft); color: var(--warn-text); font-size: 10px;
  font-weight: 600; width: fit-content;
}
.rec-empty { text-align: center; color: var(--faint); padding: 40px 12px; }
.rec-summary { margin: 12px 16px 120px; text-align: center; color: var(--faint); font-size: 12.5px; }

/* 名称单元格里的编号（窄屏合并显示用，默认隐藏） */
.rec-code-inline { display: none; font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 10.5px; color: var(--faint); font-weight: 400; margin-top: 2px; }

/* 窄屏（手机）：隐藏独立「编号」列，编号并入名称下方，6 列信息一屏看全 */
@media (max-width: 620px) {
  .rec-scroll { margin: 10px 12px 0; }
  table.rec-table { min-width: 0; table-layout: auto; font-size: 11.5px; }
  table.rec-table col.c-code { width: 0; }
  table.rec-table .rec-code { display: none; }
  .rec-code-inline { display: block; }
  table.rec-table th:nth-child(2) { display: none; }
  table.rec-table th, table.rec-table td { padding: 8px 4px; }
  table.rec-table th:first-child, table.rec-table td:first-child { padding-left: 8px; }
  table.rec-table th:last-child, table.rec-table td:last-child { padding-right: 8px; }
  table.rec-table col.c-name { width: auto; }
  table.rec-table col.c-who { width: 52px; }
  table.rec-table col.c-date { width: 42px; }
  table.rec-table col.c-dur { width: 58px; }
  table.rec-table th:first-child,
  table.rec-table td:first-child { position: static; box-shadow: none; }
  .rec-scroll-hint { display: none; }
  .rec-time { font-size: 10.5px; }
  .rec-dur { font-size: 11px; }
}

/* 底部悬浮操作（右下角悬浮按钮组，避免遮挡卡片按钮） */
.fab-bar {
  position: fixed; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
  z-index: 45; pointer-events: none;
}
.fab {
  pointer-events: auto; cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 999px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; white-space: nowrap;
  transition: transform .14s, box-shadow .18s, background .18s;
}
.fab:active { transform: scale(.96); }
.fab-primary {
  background: var(--primary); color: #fff; padding: 15px 22px;
  box-shadow: var(--shadow-blue);
}
.fab-primary:hover { background: var(--primary-hover); }
.fab-primary .ico { width: 19px; height: 19px; }
.fab-ghost {
  background: #fff; color: var(--text); border-color: var(--line);
  padding: 13px 18px; box-shadow: var(--shadow-md);
}
.fab-ghost:hover { background: #fbfcfe; color: var(--primary); border-color: #c7d9f8; }
.fab-ghost .ico { width: 18px; height: 18px; color: var(--muted); }
@media (max-width: 400px) {
  .fab-bar { right: 14px; gap: 9px; }
  .fab-ghost span { display: none; }
  .fab-ghost { padding: 14px; }
}

/* 模糊查找结果 */
.sr-list { margin-top: 14px; max-height: 54vh; overflow-y: auto; }
.sr-hint { color: var(--faint); font-size: 13px; padding: 28px 8px; text-align: center; }
.sr-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 10px;
  border-bottom: 1px solid var(--line-soft); cursor: pointer;
  border-radius: var(--r-sm); transition: background .12s;
}
.sr-item:hover { background: #fbfcfe; }
.sr-item:last-child { border-bottom: 0; }
.sr-main { flex: 1; min-width: 0; }
.sr-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 7px;
}
.sr-name { font-size: 14.5px; font-weight: 600; color: var(--ink); margin: 4px 0; }
.sr-name mark { background: #fef3c7; color: #92400e; padding: 0 2px; border-radius: 3px; }
.sr-sub { font-size: 12.5px; color: var(--muted); }
.sr-go { color: var(--faint); font-size: 19px; }

/* ---------- 动画 ---------- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes sheetUp {
  from { opacity: 0; transform: translateY(28px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.bcard, .row-item { animation: fadeInUp .26s cubic-bezier(.32,.72,0,1) both; }
