/* ============ 保修员工作系统 共享样式 ============ */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --success: #10b981;
  --success-light: #ecfdf5;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --info: #0ea5e9;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, .08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  font-size: 14px;
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }

/* 布局 */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: #fff; border-right: 1px solid var(--gray-200);
  padding: 20px 12px; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; font-weight: 700; font-size: 16px; color: var(--gray-900); }
.sidebar .brand .logo {
  width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--primary), #60a5fa);
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 15px;
}
.sidebar .nav-group { margin-top: 8px; }
.sidebar .nav-group .group-title { font-size: 11px; color: var(--gray-400); padding: 10px 10px 6px; letter-spacing: 1px; }
.sidebar .nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px;
  color: var(--gray-600); cursor: pointer; font-size: 14px; transition: all .15s;
}
.sidebar .nav-item:hover { background: var(--gray-100); color: var(--gray-800); }
.sidebar .nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.sidebar .nav-item .badge {
  margin-left: auto; background: var(--danger); color: #fff; font-size: 11px;
  min-width: 18px; height: 18px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 5px;
}
.sidebar .nav-item .badge.hidden { display: none; }

.main { flex: 1; padding: 24px 28px; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 16px; margin-bottom: 20px;
}
.topbar h1 { font-size: 20px; font-weight: 700; color: var(--gray-900); }
.topbar .spacer { flex: 1; }
.topbar .user-chip {
  display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--gray-200);
  padding: 6px 14px; border-radius: 20px; font-size: 13px; color: var(--gray-700); box-shadow: var(--shadow-sm);
}
.topbar .btn-plain { background: none; border: none; color: var(--gray-500); cursor: pointer; font-size: 13px; }
.topbar .btn-plain:hover { color: var(--danger); }

/* 卡片 */
.card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200); margin-bottom: 16px;
}
.card .card-head {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px;
  border-bottom: 1px solid var(--gray-100); font-weight: 600; color: var(--gray-800);
}
.card .card-head .spacer { flex: 1; }
.card .card-body { padding: 18px; }

/* 统计卡片 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { background: #fff; border-radius: var(--radius); border: 1px solid var(--gray-200); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.stat-card .stat-label { font-size: 12px; color: var(--gray-500); }
.stat-card .stat-value { font-size: 26px; font-weight: 700; color: var(--gray-900); margin-top: 4px; }
.stat-card .stat-sub { font-size: 12px; color: var(--gray-400); margin-top: 2px; }
.stat-card .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 4px; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; gap: 6px; border: none; cursor: pointer;
  padding: 8px 16px; border-radius: 8px; font-size: 14px; font-weight: 500; transition: all .15s;
  background: var(--gray-100); color: var(--gray-700);
}
.btn:hover { filter: brightness(.96); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-outline { background: #fff; border: 1px solid var(--gray-300); color: var(--gray-700); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 6px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 输入 */
.input, .select, .textarea {
  width: 100%; padding: 8px 12px; border: 1px solid var(--gray-300); border-radius: 8px;
  font-size: 14px; background: #fff; color: var(--gray-800); outline: none; transition: border .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.textarea { resize: vertical; min-height: 60px; }
.label { display: block; font-size: 13px; color: var(--gray-600); margin-bottom: 6px; font-weight: 500; }
.form-row { display: flex; gap: 12px; }
.form-row .field { flex: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field + .field { }
.req::after { content: ' *'; color: var(--danger); }

/* 标签 */
.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 500;
}
.tag-red { background: var(--danger-light); color: var(--danger); }
.tag-green { background: var(--success-light); color: var(--success); }
.tag-orange { background: var(--warning-light); color: var(--warning); }
.tag-gray { background: var(--gray-100); color: var(--gray-500); }
.tag-blue { background: var(--primary-light); color: var(--primary); }
.tag-yellow { background: var(--warning-light); color: var(--warning); }

/* 表格 */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; padding: 10px 12px; font-size: 12px; color: var(--gray-500);
  border-bottom: 1px solid var(--gray-200); background: var(--gray-50); font-weight: 600;
}
.table td { padding: 11px 12px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.table tr:hover td { background: var(--gray-50); }
.table .actions { display: flex; gap: 6px; }
.table .empty { text-align: center; padding: 40px; color: var(--gray-400); }

/* 列表条目 */
.record-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--gray-100); transition: background .15s;
}
.record-item:last-child { border-bottom: none; }
.record-item:hover { background: var(--gray-50); }
.record-item .ri-main { flex: 1; min-width: 0; }
.record-item .ri-title { font-weight: 600; color: var(--gray-800); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.record-item .ri-sub { font-size: 12px; color: var(--gray-500); margin-top: 3px; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 760px; max-height: 88vh;
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg); overflow: hidden;
}
.modal .modal-head {
  padding: 16px 22px; border-bottom: 1px solid var(--gray-100); display: flex; align-items: center; gap: 12px;
  font-size: 16px; font-weight: 700;
}
.modal .modal-head .spacer { flex: 1; }
.modal .modal-body { padding: 20px 22px; overflow-y: auto; }
.modal .modal-foot { padding: 14px 22px; border-top: 1px solid var(--gray-100); display: flex; gap: 10px; justify-content: flex-end; }
.modal-close { background: none; border: none; font-size: 20px; color: var(--gray-400); cursor: pointer; }
.modal-close:hover { color: var(--gray-700); }

/* 文件缩略 */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.file-cell {
  border: 1px solid var(--gray-200); border-radius: 10px; overflow: hidden; background: var(--gray-50); position: relative;
}
.file-cell .file-thumb { aspect-ratio: 4/3; display: flex; align-items: center; justify-content: center; background: var(--gray-100); }
.file-cell .file-thumb img, .file-cell .file-thumb video { width: 100%; height: 100%; object-fit: cover; }
.file-cell .file-thumb .video-icon { font-size: 30px; color: var(--gray-400); }
.file-cell .file-name {
  font-size: 11px; color: var(--gray-600); padding: 6px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: #fff;
}
.file-cell .file-ops {
  position: absolute; top: 6px; right: 6px; display: none; gap: 4px;
}
.file-cell:hover .file-ops { display: flex; }
.file-cell .file-ops .btn { padding: 3px 7px; font-size: 11px; }

/* 上传区 */
.upload-zone {
  border: 2px dashed var(--gray-300); border-radius: 10px; padding: 16px; text-align: center;
  color: var(--gray-500); cursor: pointer; transition: all .15s; background: var(--gray-50);
}
.upload-zone:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* 分组上传卡片 */
.cat-block { border: 1px solid var(--gray-200); border-radius: 10px; margin-bottom: 14px; overflow: hidden; }
.cat-block .cat-head {
  padding: 10px 14px; background: var(--gray-50); font-weight: 600; font-size: 13px; color: var(--gray-700);
  display: flex; align-items: center; gap: 8px;
}
.cat-block .cat-body { padding: 12px 14px; }

/* 时间线/步骤 */
.steps { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.step {
  flex: 1; min-width: 130px; border: 1px solid var(--gray-200); border-radius: 10px; padding: 12px 14px;
  background: #fff; position: relative;
}
.step .step-num {
  width: 24px; height: 24px; border-radius: 50%; background: var(--gray-200); color: var(--gray-600);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; margin-bottom: 8px;
}
.step.active .step-num { background: var(--primary); color: #fff; }
.step.done .step-num { background: var(--success); color: #fff; }
.step .step-title { font-size: 13px; font-weight: 600; color: var(--gray-700); }
.step .step-sub { font-size: 12px; color: var(--gray-400); margin-top: 2px; }

/* 提示 */
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 300;
  background: var(--gray-900); color: #fff; padding: 10px 20px; border-radius: 10px;
  font-size: 14px; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 8px;
  animation: slideDown .25s ease; max-width: 90vw;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warn { background: var(--warning); }
@keyframes slideDown { from { transform: translate(-50%, -12px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* 通用工具 */
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.muted { color: var(--gray-400); }
.small { font-size: 12px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }
.text-center { text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.progress-bar { height: 6px; background: var(--gray-100); border-radius: 3px; overflow: hidden; }
.progress-bar .fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width .3s; }
.progress-bar .fill.green { background: var(--success); }

/* 登录页 */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 50%, #ecfdf5 100%); padding: 20px;
}
.login-box {
  background: #fff; border-radius: 20px; box-shadow: var(--shadow-lg); padding: 40px 42px; width: 100%; max-width: 400px;
}
.login-box .logo {
  width: 56px; height: 56px; border-radius: 16px; background: linear-gradient(135deg, var(--primary), #60a5fa);
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 24px; font-weight: 800; margin-bottom: 16px;
}
.login-box h2 { font-size: 20px; color: var(--gray-900); margin-bottom: 4px; }
.login-box .sub { color: var(--gray-500); font-size: 13px; margin-bottom: 24px; }

/* 状态条 */
.banner {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 10px; margin-bottom: 14px; font-size: 13px;
}
.banner-red { background: var(--danger-light); color: var(--danger); border: 1px solid #fecaca; }
.banner-yellow { background: var(--warning-light); color: #b45309; border: 1px solid #fde68a; }
.banner-blue { background: var(--primary-light); color: var(--primary); border: 1px solid #bfdbfe; }

/* 批次卡片 */
.batch-card { border: 1px solid var(--gray-200); border-radius: 12px; padding: 16px 18px; background: #fff; margin-bottom: 12px; box-shadow: var(--shadow-sm); }
.batch-card:hover { box-shadow: var(--shadow-md); }

/* 核对区 */
.check-panel { background: var(--gray-50); border-radius: 12px; padding: 16px; border: 1px solid var(--gray-200); }
.check-result {
  margin-top: 12px; padding: 12px 16px; border-radius: 10px; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 10px;
}
.check-result.ok { background: var(--success-light); color: var(--success); border: 1px solid #a7f3d0; }
.check-result.bad { background: var(--danger-light); color: var(--danger); border: 1px solid #fecaca; }
.check-result.warn-c { background: var(--warning-light); color: #b45309; border: 1px solid #fde68a; }
.check-result .big { font-size: 22px; }

/* 库位提醒（核对扫码后显示） */
.loc-hint {
  margin-top: 10px; padding: 12px 14px; border-radius: 10px; font-size: 14px;
  background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; line-height: 1.7;
}
.loc-hint b { color: #1d4ed8; }
/* 库位分布标签 */
.loc-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 6px 14px; border-radius: 999px;
  background: var(--primary-light); color: var(--primary); font-size: 14px; border: 1px solid #bfdbfe;
}
.loc-chip b { font-size: 16px; }
.loc-chip-red { background: var(--danger-light); color: var(--danger); border-color: #fecaca; }

@media (max-width: 900px) {
  .sidebar { width: 64px; padding: 12px 6px; }
  .sidebar .brand span.text, .sidebar .nav-item span:not(.badge) { display: none; }
  .sidebar .nav-group .group-title { display: none; }
  .main { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
}
