/* ==================== 基础变量 ==================== */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --sidebar-width: 220px;
  --topbar-height: 56px;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow: 0 2px 8px rgba(0,0,0,.1);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.15);
}

/* ==================== 重置 ==================== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--gray-50); color: var(--gray-800); font-size: 14px; line-height: 1.5; }
a { text-decoration: none; color: inherit; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }
ul, ol { list-style: none; }

/* ==================== 通用按钮 ==================== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 8px 16px; border: none; border-radius: var(--radius); cursor: pointer; transition: all .15s; font-weight: 500; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(.92); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.92); }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { filter: brightness(.92); }
.btn-outline { background: #fff; color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-400); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ==================== 登录页 ==================== */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.login-card { background: #fff; border-radius: 16px; padding: 40px; width: 400px; max-width: 90vw; box-shadow: var(--shadow-lg); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-icon { font-size: 48px; display: block; margin-bottom: 8px; }
.login-logo h1 { font-size: 22px; color: var(--gray-800); }
.login-subtitle { color: var(--gray-400); font-size: 13px; margin-top: 4px; }
.login-form .form-group { margin-bottom: 18px; }
.login-form label { display: block; margin-bottom: 6px; font-weight: 500; color: var(--gray-600); font-size: 13px; }
.login-form input { width: 100%; padding: 10px 12px; border: 1px solid var(--gray-300); border-radius: var(--radius); outline: none; transition: border-color .15s; }
.login-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.login-error { color: var(--danger); font-size: 13px; margin-bottom: 12px; min-height: 18px; }
.login-hint { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--gray-200); text-align: center; color: var(--gray-400); font-size: 12px; }
.login-hint p { margin-bottom: 4px; }

/* ==================== 主应用布局 ==================== */
.main-app { display: flex; min-height: 100vh; }

/* 侧边栏 */
.sidebar { width: var(--sidebar-width); background: var(--gray-900); color: #fff; display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 100; transition: transform .2s; }
.sidebar-header { display: flex; align-items: center; gap: 8px; padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar-icon { font-size: 24px; }
.sidebar-title { font-size: 16px; font-weight: 600; }
.sidebar-nav { flex: 1; padding: 8px 0; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 20px; color: rgba(255,255,255,.65); transition: all .15s; border-left: 3px solid transparent; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav-item.active { color: #fff; background: rgba(255,255,255,.1); border-left-color: var(--primary); }
.nav-icon { font-size: 18px; width: 20px; text-align: center; }
.sidebar.collapsed { transform: translateX(-100%); }
.admin-only { display: none; }
.admin-only.visible { display: flex; }

/* 内容区 */
.content-area { flex: 1; margin-left: var(--sidebar-width); display: flex; flex-direction: column; min-height: 100vh; }

/* 顶栏 */
.topbar { height: var(--topbar-height); background: #fff; border-bottom: 1px solid var(--gray-200); display: flex; align-items: center; justify-content: space-between; padding: 0 20px; position: sticky; top: 0; z-index: 50; box-shadow: var(--shadow-sm); }
.topbar h2 { font-size: 17px; font-weight: 600; color: var(--gray-800); }
.sidebar-toggle { display: none; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--gray-600); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-info { display: flex; align-items: center; gap: 6px; color: var(--gray-600); font-size: 13px; }
.user-role { background: var(--primary-light); color: var(--primary); padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 500; }

/* 页面内容 */
.page-content { padding: 20px; flex: 1; }

/* ==================== 看板 ==================== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); border-left: 4px solid var(--primary); transition: box-shadow .15s; }
.stat-card:hover { box-shadow: var(--shadow); }
.stat-card .stat-label { color: var(--gray-500); font-size: 13px; margin-bottom: 8px; }
.stat-card .stat-value { font-size: 32px; font-weight: 700; color: var(--gray-800); }
.stat-card .stat-icon { float: right; font-size: 28px; opacity: .3; }
.stat-card.total { border-left-color: var(--primary); }
.stat-card.instock { border-left-color: var(--success); }
.stat-card.borrowed { border-left-color: var(--warning); }
.stat-card.repair { border-left-color: #8b5cf6; }
.stat-card.scrap { border-left-color: var(--danger); }

.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.dashboard-card { background: #fff; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.dashboard-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 16px; color: var(--gray-700); }
.chart-wrapper { position: relative; height: 240px; }

.section-card { background: #fff; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); margin-bottom: 24px; }
.section-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 16px; color: var(--gray-700); display: flex; align-items: center; justify-content: space-between; }

/* ==================== 表格 ==================== */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; padding: 10px 12px; background: var(--gray-50); color: var(--gray-500); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; border-bottom: 2px solid var(--gray-200); white-space: nowrap; }
.data-table td { padding: 12px; border-bottom: 1px solid var(--gray-100); color: var(--gray-700); }
.data-table tbody tr:hover { background: var(--gray-50); }
.data-table .table-actions { display: flex; gap: 4px; flex-wrap: wrap; }

/* 状态标签 */
.status-tag { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; }
.status-instock { background: var(--success-light); color: var(--success); }
.status-borrowed { background: var(--warning-light); color: var(--warning); }
.status-repair { background: #ede9fe; color: #7c3aed; }
.status-scrap { background: var(--danger-light); color: var(--danger); }

/* 使用区域标签 */
.area-tag { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 12px; font-weight: 500; background: var(--primary-light); color: var(--primary); }

/* 模具尺寸标签 */
.size-tag { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 12px; font-weight: 500; background: var(--gray-100); color: var(--gray-700); white-space: nowrap; }

/* ==================== 搜索筛选栏 ==================== */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .search-input { flex: 1; min-width: 200px; max-width: 400px; padding: 8px 12px; border: 1px solid var(--gray-300); border-radius: var(--radius); outline: none; }
.toolbar .search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.toolbar select { padding: 8px 12px; border: 1px solid var(--gray-300); border-radius: var(--radius); background: #fff; cursor: pointer; outline: none; }
.toolbar .spacer { flex: 1; }

/* ==================== 模态框 ==================== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1000; display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 40px 20px; }
.modal-container { background: #fff; border-radius: var(--radius); width: 600px; max-width: 95vw; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; border-bottom: 1px solid var(--gray-200); position: sticky; top: 0; background: #fff; border-radius: var(--radius) var(--radius) 0 0; z-index: 1; }
.modal-header h3 { font-size: 17px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--gray-400); line-height: 1; padding: 0; }
.modal-close:hover { color: var(--gray-700); }
.modal-body { padding: 24px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 12px; padding: 16px 24px; border-top: 1px solid var(--gray-200); }

/* ==================== 表单 ==================== */
.form-row { display: flex; gap: 16px; margin-bottom: 16px; }
.form-row .form-group { flex: 1; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; color: var(--gray-600); font-size: 13px; }
.form-group label .required { color: var(--danger); }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 8px 12px; border: 1px solid var(--gray-300); border-radius: var(--radius); outline: none; transition: border-color .15s; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-hint { color: var(--gray-400); font-size: 12px; margin-top: 4px; }

/* 图片上传 */
.image-upload { display: flex; align-items: center; gap: 16px; }
.image-preview { width: 120px; height: 120px; border: 2px dashed var(--gray-300); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; overflow: hidden; background: var(--gray-50); cursor: pointer; position: relative; }
.image-preview img { width: 100%; height: 100%; object-fit: cover; }
.image-preview .placeholder { color: var(--gray-400); text-align: center; font-size: 12px; }
.image-upload input[type="file"] { position: absolute; width: 0; height: 0; opacity: 0; overflow: hidden; pointer-events: none; }

/* ==================== Toast ==================== */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 20px; border-radius: var(--radius); color: #fff; font-size: 13px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 8px; animation: toastIn .25s ease; min-width: 250px; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--primary); }
.toast.warning { background: var(--warning); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ==================== 确认对话框 ==================== */
.confirm-dialog { background: #fff; border-radius: var(--radius); padding: 28px; width: 420px; max-width: 90vw; box-shadow: var(--shadow-lg); text-align: center; }
.confirm-dialog p { margin-bottom: 20px; font-size: 15px; color: var(--gray-700); }
.confirm-dialog #confirmMessage { white-space: pre-line; }
.confirm-actions { display: flex; justify-content: center; gap: 12px; }

/* ==================== 二维码页面 ==================== */
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.qr-card { background: #fff; border-radius: var(--radius); padding: 16px; text-align: center; box-shadow: var(--shadow-sm); }
.qr-card .qr-image { display: flex; justify-content: center; margin-bottom: 12px; }
.qr-card .qr-image canvas, .qr-card .qr-image img { border: 1px solid var(--gray-200); border-radius: 4px; }
.qr-card .qr-code { font-weight: 600; margin-bottom: 4px; color: var(--gray-800); }
.qr-card .qr-name { font-size: 12px; color: var(--gray-500); margin-bottom: 12px; }

/* ==================== 空状态 ==================== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--gray-400); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state .empty-text { font-size: 15px; }

/* ==================== 分页 ==================== */
.pagination { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 16px; }
.pagination button { min-width: 32px; height: 32px; border: 1px solid var(--gray-300); background: #fff; border-radius: 4px; cursor: pointer; padding: 0 8px; font-size: 13px; }
.pagination button:hover { border-color: var(--primary); color: var(--primary); }
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }

/* ==================== 手机端模具卡片 ==================== */
.mold-cards { display: none; }
.borrow-cards { display: none; }
.user-cards { display: none; }
.perm-list { display: none; }

/* 移动端侧边栏遮罩（桌面端隐藏，由 app.js 同步开关） */
.sidebar-backdrop { display: none; }

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  /* 遮罩：位于内容(z-index 默认)之上、侧边栏(100)之下；点它收起侧边栏 */
  .sidebar-backdrop.show {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 99;
  }
  .content-area { margin-left: 0; }
  .sidebar-toggle { display: block; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; gap: 0; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat-card .stat-value { font-size: 24px; }
  .topbar h2 { font-size: 15px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .search-input { max-width: none; }

  /* 手机端隐藏表格，显示卡片 */
  .data-table { display: none; }
  .mold-cards { display: block; }
  .mold-card { background: #fff; border-radius: var(--radius); padding: 12px; margin-bottom: 12px; box-shadow: var(--shadow-sm); }
  .mold-card-top { display: flex; gap: 12px; align-items: flex-start; }
  .mold-card-img { flex-shrink: 0; }
  .mold-card-info { flex: 1; min-width: 0; overflow: hidden; }
  .mold-card-code { font-size: 16px; font-weight: 600; color: var(--gray-800); margin-bottom: 4px; word-break: break-all; }
  .mold-card-name { font-size: 14px; font-weight: 500; color: var(--gray-700); margin-bottom: 4px; word-break: break-all; }
  .mold-card-sub { font-size: 13px; color: var(--gray-500); margin-bottom: 2px; line-height: 1.4; word-break: break-all; }
  .mold-card-cat { color: var(--gray-700); }
  .mold-card-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--gray-100); }

  /* 领用记录手机卡片 */
  .borrow-cards { display: block; }
  .borrow-card { background: #fff; border-radius: var(--radius); padding: 12px; margin-bottom: 12px; box-shadow: var(--shadow-sm); }
  .borrow-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
  .borrow-card-code { font-size: 16px; font-weight: 600; color: var(--gray-800); word-break: break-all; }
  .borrow-card-body { font-size: 13px; }
  .borrow-card-row { display: flex; justify-content: space-between; padding: 3px 0; color: var(--gray-600); border-bottom: 1px solid var(--gray-50); }
  .borrow-card-row span:first-child { color: var(--gray-400); flex-shrink: 0; width: 70px; }
  .borrow-card-row span:last-child { font-weight: 500; text-align: right; word-break: break-all; }
  .borrow-card-actions { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--gray-100); }

  /* 用户管理手机卡片 */
  .user-cards { display: block; }
  .user-card { background: #fff; border-radius: var(--radius); padding: 12px; margin-bottom: 12px; box-shadow: var(--shadow-sm); }
  .user-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
  .user-card-name { font-size: 16px; font-weight: 600; color: var(--gray-800); word-break: break-all; }
  .user-card-body { font-size: 13px; }
  .user-card-row { display: flex; justify-content: space-between; padding: 3px 0; color: var(--gray-600); border-bottom: 1px solid var(--gray-50); }
  .user-card-row span:first-child { color: var(--gray-400); flex-shrink: 0; width: 70px; }
  .user-card-row span:last-child { font-weight: 500; text-align: right; word-break: break-all; }
  .user-card-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--gray-100); }

  /* 权限说明手机列表 */
  .perm-list { display: block; }
  .perm-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--gray-100); font-size: 13px; }
  .perm-name { color: var(--gray-700); flex: 1; padding-right: 8px; }
  .perm-val { color: var(--gray-500); flex-shrink: 0; margin-left: 12px; font-size: 12px; }
}

/* 打印样式 */
@media print {
  .sidebar, .topbar, .toolbar, .modal-footer, .modal-close { display: none !important; }
  .content-area { margin-left: 0; }
  .qr-card { page-break-inside: avoid; }
}

/* 表格图片缩略图 */
.thumb-img { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; border: 1px solid var(--gray-200); }
.thumb-placeholder { width: 40px; height: 40px; background: var(--gray-100); border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 20px; }

/* 徽标 */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 500; }
.badge-count { background: var(--danger-light); color: var(--danger); }

/* 滚动条 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

/* ==================== 云端同步状态 ==================== */
.sync-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--gray-500);
  white-space: nowrap;
}
.sync-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gray-300);
}
.sync-status.syncing .sync-dot {
  background: var(--warning);
  animation: sync-pulse 1s infinite;
}
.sync-status.synced .sync-dot { background: var(--success); }
.sync-status.error .sync-dot { background: var(--danger); }
.sync-status.offline .sync-dot { background: var(--gray-400); }
.sync-status.local .sync-dot { background: var(--success); }

@keyframes sync-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* 登录页加载提示 */
.login-loading {
  text-align: center;
  padding: 8px;
  color: var(--primary);
  font-size: 13px;
  margin-bottom: 8px;
}

/* 顶栏刷新按钮 */
.topbar-right .btn-sm {
  margin-right: 8px;
}

/* ==================== 扫码详情页 ==================== */
.scan-detail-page {
  min-height: 100vh;
  background: var(--gray-50);
}

/* 顶部栏 */
.scan-header {
  height: 48px;
  background: var(--gray-900);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.scan-header-icon { font-size: 20px; }
.scan-header-title { font-size: 15px; font-weight: 600; }

/* 内容区 */
.scan-detail-content {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px;
}

/* 加载中 */
.scan-loading {
  text-align: center;
  padding: 80px 20px;
  color: var(--gray-400);
}
.scan-loading p { margin-top: 16px; font-size: 14px; }
.scan-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto;
  animation: scan-spin 0.8s linear infinite;
}
@keyframes scan-spin { to { transform: rotate(360deg); } }

/* 顶部图片 */
.scan-hero {
  width: 100%;
  margin-bottom: 16px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--gray-100);
}
.scan-hero-img {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  display: block;
}
.scan-hero-placeholder {
  height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: var(--gray-300);
}
.scan-hero-placeholder span { font-size: 13px; margin-top: 8px; }

/* 编号区 */
.scan-code-section {
  text-align: center;
  margin-bottom: 20px;
}
.scan-mold-code {
  font-size: 24px;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 4px;
}
.scan-mold-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--gray-600);
  margin-bottom: 8px;
}
.scan-tags {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.scan-category-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  background: var(--primary-light);
  color: var(--primary);
}

/* 信息卡片 */
.scan-info-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.scan-info-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-500);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gray-100);
}
.scan-info-row {
  display: flex;
  padding: 6px 0;
  font-size: 14px;
}
.scan-info-label {
  width: 110px;
  flex-shrink: 0;
  color: var(--gray-400);
}
.scan-info-value {
  flex: 1;
  color: var(--gray-800);
  font-weight: 500;
  word-break: break-all;
}
.scan-empty { color: var(--gray-300); }

/* 保养进度条 */
.scan-progress-section { margin-top: 12px; }
.scan-progress-label {
  font-size: 13px;
  color: var(--gray-500);
  margin-bottom: 6px;
}
.scan-progress-bar {
  height: 8px;
  background: var(--gray-100);
  border-radius: 4px;
  overflow: hidden;
}
.scan-progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .3s;
}

/* 当前领用高亮 */
.scan-borrow-active {
  border-left: 4px solid var(--warning);
}

/* 领用历史 */
.scan-record-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-50);
}
.scan-record-item:last-child { border-bottom: none; }
.scan-record-person {
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-800);
  margin-bottom: 4px;
}
.scan-record-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}
.scan-record-active {
  background: var(--warning-light);
  color: var(--warning);
}
.scan-record-time {
  font-size: 12px;
  color: var(--gray-400);
  margin-bottom: 2px;
}

/* 备注 */
.scan-notes {
  font-size: 14px;
  color: var(--gray-700);
  line-height: 1.6;
  word-break: break-all;
}

/* 时间戳 */
.scan-timestamps {
  text-align: center;
  font-size: 12px;
  color: var(--gray-300);
  margin: 16px 0;
  line-height: 1.8;
}

/* 进入管理系统按钮 */
.scan-enter-btn {
  display: block;
  text-align: center;
  padding: 12px 20px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  margin: 16px 0 32px;
  transition: background .15s;
}
.scan-enter-btn:hover { background: var(--primary-dark); }

/* 未找到 */
.scan-not-found {
  text-align: center;
  padding: 60px 20px;
}
.scan-not-found-icon { font-size: 48px; margin-bottom: 16px; }
.scan-not-found h2 { font-size: 18px; color: var(--gray-700); margin-bottom: 8px; }
.scan-not-found p { font-size: 14px; color: var(--gray-500); margin-bottom: 4px; }
.scan-not-found code {
  background: var(--gray-100);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 13px;
}
.scan-hint { color: var(--gray-400); font-size: 13px; margin-top: 8px; }

/* 二维码卡片提示 */
.qr-hint {
  font-size: 11px;
  color: var(--gray-400);
  margin-bottom: 8px;
}

/* ===== 领用表单模具选择器 ===== */
.mold-picker-list {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-top: 8px;
  background: var(--bg-color);
}
.mold-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--gray-100);
  transition: background 0.15s;
}
.mold-picker-item:last-child { border-bottom: none; }
.mold-picker-item:hover { background: var(--gray-100); }
.mold-picker-item-selected {
  background: var(--primary-light, #e3f0ff);
  border-left: 3px solid var(--primary, #2563eb);
  padding-left: 11px;
}
.mold-picker-item-code {
  font-weight: 600;
  font-size: 14px;
  color: var(--gray-700);
  min-width: 80px;
  white-space: nowrap;
}
.mold-picker-item-info {
  flex: 1;
  font-size: 13px;
  color: var(--gray-500);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mold-picker-item-status {
  font-size: 12px;
  color: var(--gray-400);
  white-space: nowrap;
}
/* 模具选择器中「已被领用」的项 */
.mold-picker-item-disabled {
  background: #fafafa;
  opacity: .72;
  cursor: not-allowed;
  filter: grayscale(.4);
}
.mold-picker-item-disabled:hover { background: #f4f4f5; }
.occupy-flag { color: var(--gray-500); }
.occupy-tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
  background: var(--danger-light, #fee2e2);
  color: var(--danger, #dc2626);
  white-space: nowrap;
}
.mold-picker-empty {
  padding: 20px;
  text-align: center;
  color: var(--gray-400);
  font-size: 13px;
}

/* ===== 领用详情网格 ===== */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.detail-item label {
  display: block;
  font-size: 12px;
  color: var(--gray-400);
  margin-bottom: 4px;
}
.detail-item p {
  font-size: 14px;
  color: var(--gray-700);
  margin: 0;
  word-break: break-all;
}
.detail-full {
  grid-column: 1 / -1;
}
@media (max-width: 768px) {
  .detail-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

/* ==================== 导入导出页栅格 ==================== */
/* 原为内联 grid-template-columns，内联样式优先级高于媒体查询，
   手机端无法降为单列，两列被压到 ~170px 导致页面错乱 → 改用 class。 */
.io-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  max-width: 800px;
}
@media (max-width: 768px) {
  .io-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* ==================== 备案号 footer ==================== */
.site-footer {
  text-align: center;
  padding: 16px 10px 20px;
  font-size: 12px;
  color: #9aa0a6;
  line-height: 1.6;
}
.site-footer a {
  color: #9aa0a6;
  text-decoration: none;
}
.site-footer a:hover {
  color: #c0c4cc;
  text-decoration: underline;
}
