:root {
  --xinje-blue: #0a5cb8;
  --xinje-blue-deep: #084a96;
  --xinje-blue-soft: rgba(10, 92, 184, 0.08);
  --ink: #1f2733;
  --ink-sub: #6b7686;
  --line: #e6ebf2;
  --bg: #eef2f7;
  --card: #ffffff;
  --radius: 14px;
}

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

html, body { height: 100%; }

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

/* 后台模式：纯白底，隐藏科技粒子背景 */
body.admin-mode {
  background: #fff;
}
body.admin-mode #bgCanvas {
  display: none !important;
}

/* ---------- 整体布局 ---------- */
.layout {
  display: flex;
  gap: 16px;
  min-height: calc(100vh - 68px);
  padding: 16px;
}

/* ---------- 左侧导航 ---------- */
.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 4px 24px rgba(15, 42, 80, 0.10);
  position: sticky;
  top: 80px;
  height: calc(100vh - 96px);
  overflow-y: auto;
}

.side-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.side-logo { width: 150px; height: auto; }

.side-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--xinje-blue);
  text-align: center;
}

.nav-section { display: flex; flex-direction: column; gap: 2px; }

.nav-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-sub);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0 10px;
  margin-bottom: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.nav-item:hover { background: var(--xinje-blue-soft); }

.nav-item.active {
  background: var(--xinje-blue);
  color: #fff;
}

.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }

/* 有待审批记录时导航按钮右上角的小红点 */
.nav-dot {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d4380d;
  box-shadow: 0 0 0 2px #fff;
}
.nav-dot[hidden] { display: none; }

.nav-divider {
  height: 1px;
  background: var(--line);
  margin: 2px 0;
}

/* ---------- 主内容区 ---------- */
.content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 4px;
}

.content-header h2 {
  font-size: 20px;
  font-weight: 700;
}

/* ---------- 右上角用户信息 + 退出 ---------- */
.header-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* 两行身份区：第一行姓名，第二行身份·负责方向 */
.header-user-id {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  line-height: 1.35;
}

.header-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-sub);
}

.header-user-role {
  font-size: 11px;
  color: var(--ink-sub);
  opacity: 0.85;
  white-space: nowrap;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 后台顶栏（工程师/admin）：与学生端同款，浅蓝底 */
.admin-header {
  background: rgba(10, 92, 184, 0.06);
  border-bottom: 1px solid var(--line);
}

.side-logo-sm { width: 84px; height: auto; }
.admin-header .student-title { font-size: 15px; }

/* 工程师上下班切换：分段按钮组（信捷蓝风格） */
.work-status-group {
  display: inline-flex;
  border: 1px solid var(--line, #e6ebf2);
  border-radius: 9px;
  overflow: hidden;
  background: #fff;
}
.ws-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 12px;
  height: 32px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-sub, #6b7686);
  background: #fff;
  border: none;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
  white-space: nowrap;
}
.ws-btn + .ws-btn { border-left: 1px solid var(--line, #e6ebf2); }
.ws-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.ws-btn:hover { background: var(--xinje-blue-soft, rgba(10,92,184,.08)); color: var(--xinje-blue, #0a5cb8); }
.ws-btn.active { color: #fff; }
.ws-btn.ws-on.active { background: #1e8e4e; }
.ws-btn.ws-rest.active { background: #c77c11; }
.ws-btn.ws-off.active { background: #8a93a3; }
.work-schedule-hint {
  margin: 0;
  max-width: 220px;
  color: #8a6a32;
  font-size: 11px;
  line-height: 1.5;
}

/* 分类权重编辑网格（admin 账户弹窗） */
.weights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.weight-item { display: flex; flex-direction: column; gap: 4px; }
.weight-item label { font-size: 12px; color: var(--ink-sub); }
.weight-input { padding: 6px 10px; font-size: 13px; }

.logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  height: 36px;
  font-size: 13px;
  font-weight: 600;
  color: #d4380d;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
  border: 1px solid rgba(212, 56, 13, 0.25);
  background: rgba(212, 56, 13, 0.04);
  white-space: nowrap;
}

.logout-btn:hover { background: rgba(212, 56, 13, 0.10); }
.logout-btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.settings-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
 font-size: 13px;
  font-weight: 600;
  color: var(--ink-sub);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
  border: 1px solid var(--line);
  background: #fff;
  white-space: nowrap;
}
.settings-btn:hover { background: #f0f4f8; color: var(--xinje-blue); }
.settings-btn svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ---------- 视图 ---------- */
.view { display: none; }
.view.active { display: block; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: 0 4px 24px rgba(15, 42, 80, 0.10);
}

/* ---------- 库存统计圆角块（可点选） ---------- */
.inv-stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

/* 设备使用记录：四枚分类方块 */
.inv-stats.inv-stats-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* 归还审批头部：页签居左，快速归还按钮居右 */
.return-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.return-head .tab-bar { margin-bottom: 0; }

/* 快速归还弹窗：扫码输入行 + 设备识别结果 */
.scan-input-row {
  display: flex;
  gap: 8px;
}

.scan-input-row .form-input { flex: 1; }

.quick-device-info {
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(10, 92, 184, 0.06);
  border: 1px dashed rgba(10, 92, 184, 0.25);
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink);
}

.quick-device-info.warn {
  background: rgba(217, 145, 30, 0.08);
  border-color: rgba(217, 145, 30, 0.35);
  color: #b97a12;
}

.quick-device-info strong { color: var(--xinje-blue); }

.qr-scan-btn{display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;border:1px solid var(--line);border-radius:8px;background:#fff;color:var(--ink);cursor:pointer;flex-shrink:0;transition:background .15s ease,border-color .15s ease,color .15s ease}.qr-scan-btn:hover{background:var(--xinje-blue-soft);border-color:var(--xinje-blue);color:var(--xinje-blue)}.qr-scan-btn svg{width:20px;height:20px}.qr-scan-body{padding:0}.qr-scan-video-wrap{position:relative;width:100%;aspect-ratio:4/3;background:#000;border-radius:8px;overflow:hidden;margin-bottom:14px}.qr-scan-video-wrap video{width:100%;height:100%;object-fit:cover;display:block}.qr-scan-overlay{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:62%;aspect-ratio:1;border:2px solid rgba(255,255,255,.85);border-radius:8px;box-shadow:0 0 0 9999px rgba(0,0,0,.35);pointer-events:none}.qr-scan-hint{position:absolute;bottom:10px;left:0;right:0;text-align:center;color:#fff;font-size:13px;text-shadow:0 1px 3px rgba(0,0,0,.6);pointer-events:none}.qr-scan-actions{display:flex;gap:8px;justify-content:center;margin-bottom:10px}.qr-scan-divider{text-align:center;color:var(--ink-sub);font-size:13px;margin:10px 0}.qr-import-btn{cursor:pointer}


.inv-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 22px 12px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(15, 42, 80, 0.08);
  border: 2px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.inv-stat:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 36px rgba(15, 42, 80, 0.14);
  border-color: rgba(10, 92, 184, 0.18);
}

.inv-stat.active {
  border-color: var(--xinje-blue);
  box-shadow: 0 8px 28px rgba(10, 92, 184, 0.16);
}

.inv-stat-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-sub);
}

.inv-stat-num {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
}

.num-total { color: var(--xinje-blue); }
.num-borrowed { color: #4f46b8; }
.num-available { color: #1f9d55; }
.num-damaged { color: #d4380d; }
.num-repairing { color: #d48806; }
.num-scrapped { color: #8a93a3; }

/* 实训箱区域卡片（第二排）：与区域徽章同一套配色 */
.num-east { color: #0a5cb8; }
.num-south { color: #1f9e5c; }
.num-west { color: #b45309; }
.num-north { color: #6d28d9; }
.num-central { color: #0d9488; }
.num-factory { color: #4a5a70; }

/* 表格内的状态下拉：选中即保存 */
.unit-status-select {
  height: 30px;
  padding: 0 10px;
  border-radius: 15px;
  border: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  text-align: center;
  cursor: pointer;
  outline: none;
  background: #fff;
}

.unit-status-select:focus { border-color: var(--xinje-blue); }

/* 展开的下拉选项列表同样居中 */
.unit-status-select option,
.unit-loc-select option { text-align: center; }

.unit-status-select.st-available { color: #1f9d55; background: rgba(31, 157, 85, 0.08); border-color: rgba(31, 157, 85, 0.3); }
.unit-status-select.st-borrowed { color: #4f46b8; background: rgba(79, 70, 184, 0.08); border-color: rgba(79, 70, 184, 0.3); }
.unit-status-select.st-damaged { color: #d4380d; background: rgba(212, 56, 13, 0.08); border-color: rgba(212, 56, 13, 0.3); }
.unit-status-select.st-repairing { color: #d48806; background: rgba(212, 136, 6, 0.10); border-color: rgba(212, 136, 6, 0.35); }
.unit-status-select.st-scrapped { color: #8a93a3; background: rgba(138, 147, 163, 0.10); border-color: rgba(138, 147, 163, 0.35); }

/* 实训箱表格内的位置下拉：选中即保存 */
.unit-loc-select {
  height: 30px;
  padding: 0 10px;
  border-radius: 15px;
  border: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  text-align: center;
  cursor: pointer;
  outline: none;
  background: #fff;
}

.unit-loc-select:focus { border-color: var(--xinje-blue); }

.unit-loc-select.loc-east { color: #0a5cb8; background: rgba(10, 92, 184, 0.08); border-color: rgba(10, 92, 184, 0.3); }
.unit-loc-select.loc-south { color: #1f9e5c; background: rgba(31, 158, 92, 0.10); border-color: rgba(31, 158, 92, 0.3); }
.unit-loc-select.loc-west { color: #b45309; background: rgba(217, 119, 6, 0.10); border-color: rgba(217, 119, 6, 0.32); }
.unit-loc-select.loc-north { color: #6d28d9; background: rgba(124, 58, 237, 0.08); border-color: rgba(124, 58, 237, 0.28); }
.unit-loc-select.loc-central { color: #0d9488; background: rgba(13, 148, 136, 0.10); border-color: rgba(13, 148, 136, 0.3); }
.unit-loc-select.loc-factory { color: #4a5a70; background: rgba(82, 102, 130, 0.10); border-color: rgba(82, 102, 130, 0.32); }

/* ---------- 借用管理（可借开关 + 限借数量） ---------- */
.pool-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.pool-badge.pb-devices { background: rgba(10, 92, 184, 0.10); color: #0a5cb8; }
.pool-badge.pb-training { background: rgba(13, 148, 136, 0.12); color: #0d9488; }
.pool-badge.pb-materials { background: rgba(217, 119, 6, 0.12); color: #b45309; }

/* 滑动开关：打开 = 学生可借 */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
}
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background 0.2s ease;
}
.switch-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 42, 80, 0.25);
  transition: transform 0.2s ease;
}
.switch input:checked + .switch-slider { background: var(--xinje-blue); }
.switch input:checked + .switch-slider::before { transform: translateX(20px); }
.switch input:focus-visible + .switch-slider { outline: 2px solid rgba(10, 92, 184, 0.4); outline-offset: 2px; }

.rule-max-input {
  width: 84px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  text-align: center;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.rule-max-input:focus { border-color: var(--xinje-blue); box-shadow: 0 0 0 3px rgba(10, 92, 184, 0.12); }

/* 借用管理：全局设置条（队伍单次借用开关） */
.rule-settings {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--xinje-blue-soft);
}
.rule-settings-text { min-width: 0; }
.rule-settings-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.rule-settings-title::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--xinje-blue);
  flex-shrink: 0;
}
.rule-settings-desc { font-size: 12px; color: var(--ink-sub); margin-top: 4px; padding-left: 16px; }
.rule-settings-side { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.rule-settings-state { font-size: 13px; color: var(--ink-sub); min-width: 42px; text-align: right; }
.rule-settings-state.on { color: var(--xinje-blue); font-weight: 600; }

@media (max-width: 1200px) {
  .inv-stats { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- 工具栏 ---------- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  background: #f5f7fa;
  border: 1px solid var(--line);
  width: 300px;
  max-width: 100%;
}

.search-box svg { width: 15px; height: 15px; color: var(--ink-sub); flex-shrink: 0; }

.search-box input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-size: 13px;
  color: var(--ink);
}

.filter-select {
  height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  background: #f5f7fa;
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  outline: none;
}

.toolbar-right { display: flex; align-items: center; gap: 12px; }

/* ---------- 按钮 ---------- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  height: 40px;
  border: none;
  border-radius: 8px;
  background: var(--xinje-blue);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
  white-space: nowrap;
}

.btn-primary:hover { background: var(--xinje-blue-deep); }
.btn-primary svg { width: 15px; height: 15px; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.btn-secondary:hover { background: var(--xinje-blue-soft); border-color: var(--xinje-blue); color: var(--xinje-blue); }
.btn-secondary svg { width: 15px; height: 15px; }

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  height: 40px;
  border: 1px solid #d4380d;
  border-radius: 8px;
  background: #fff;
  color: #d4380d;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}
.btn-danger:hover { background: #fff1f0; }
.btn-danger svg { width: 15px; height: 15px; }

.btn-text {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
  white-space: nowrap;
}

.btn-text.edit { background: var(--xinje-blue-soft); color: var(--xinje-blue); }
.btn-text.edit:hover { background: rgba(10, 92, 184, 0.15); }
.btn-text.approve { background: rgba(31, 158, 92, 0.12); color: #1f9e5c; }
.btn-text.approve:hover { background: rgba(31, 158, 92, 0.20); }
.btn-text.reject { background: rgba(212, 56, 13, 0.10); color: #d4380d; }
.btn-text.reject:hover { background: rgba(212, 56, 13, 0.18); }

.btn-icon-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 6px;
  background: rgba(212, 56, 13, 0.08);
  color: #d4380d;
  cursor: pointer;
  transition: background 0.15s ease;
  flex-shrink: 0;
}

.btn-icon-del:hover { background: rgba(212, 56, 13, 0.15); }
.btn-icon-del svg { width: 15px; height: 15px; flex-shrink: 0; }

#batchDeleteStudentsBtn { width: 36px; height: 36px; }
#batchDeleteStudentsBtn svg { width: 17px; height: 17px; }

/* ---------- 表格 ---------- */
.data-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: center;
  font-weight: 600;
  color: var(--ink-sub);
  padding: 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  line-height: 1.5;
  vertical-align: middle;
  height: 44px;
  box-sizing: border-box;
}

.data-table td {
  padding: 12px;
  text-align: center;
  border-bottom: 1px solid #f0f3f8;
  line-height: 1.5;
  white-space: nowrap;
  vertical-align: middle;
  height: 44px;
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* checkbox & action columns: keep overflow visible for buttons */
.data-table td.col-check,
.data-table td.col-actions,
.data-table th.col-check,
.data-table th.col-actions {
  overflow: visible;
}

.data-table tbody tr:hover { background: #f8fafc; }
.data-table tbody tr:last-child td { border-bottom: none; }

/* 账户管理：固定列宽，表头与内容逐列对齐 */
#accTable th,
#accTable td { text-align: center; }
#accTable .acc-col-username { width: 24%; }
#accTable .acc-col-name { width: 20%; }
#accTable .acc-col-status { width: 12%; }
#accTable .acc-col-actions { width: 20%; text-align: center; }
#accTable .acc-col-actions .op-btn { margin: 0 3px; }
#accTable .acc-col-categories { width: 24%; }
#accTable .acc-col-school { width: 18%; }
#accTable .acc-col-email { width: 22%; }
#accTable .acc-col-quota { width: 10%; }

@media (max-width: 1100px) {
  #accTable { min-width: 760px; }
}

.col-actions { white-space: nowrap; text-align: center; }
.col-actions .btn-text { margin-right: 4px; }

.col-check { text-align: center; vertical-align: middle; }
.col-check input { cursor: pointer; width: 16px; height: 16px; vertical-align: middle; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table-empty {
  text-align: center;
  color: var(--ink-sub);
  font-size: 13px;
  padding: 32px 0 16px;
}

/* ---------- 状态标签 ---------- */
.status-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.status-badge.pending { background: rgba(217, 145, 30, 0.12); color: #b97a12; }
.status-badge.approved { background: rgba(31, 158, 92, 0.12); color: #1f9e5c; }
.status-badge.rejected { background: rgba(212, 56, 13, 0.10); color: #d4380d; }
.status-badge.cancelled { background: rgba(107, 118, 134, 0.12); color: #6b7686; }
.status-badge.borrowing { background: rgba(10, 92, 184, 0.10); color: #0a5cb8; }

/* ---------- 区域徽章 ---------- */
.region-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
  white-space: nowrap;
}
.region-badge.east { background: rgba(10, 92, 184, 0.10); color: #0a5cb8; }
.region-badge.south { background: rgba(31, 158, 92, 0.12); color: #1f9e5c; }
.region-badge.west { background: rgba(217, 119, 6, 0.12); color: #b45309; }
.region-badge.north { background: rgba(124, 58, 237, 0.10); color: #6d28d9; }
.region-badge.central { background: rgba(13, 148, 136, 0.12); color: #0d9488; }
.region-badge.all { background: rgba(82, 102, 130, 0.12); color: #4a5a70; }
.region-badge[hidden] { display: none; }

/* ---------- 同步徽章 ---------- */
.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
  white-space: nowrap;
  background: rgba(31, 158, 92, 0.12);
  color: #1f9e5c;
}
.sync-badge svg { width: 14px; height: 14px; }
.sync-badge[hidden] { display: none; }

/* ---------- 模态框 ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 42, 80, 0.35);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(2px);
}

.modal-overlay.show { display: flex; }

.modal {
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 24px 60px rgba(15, 42, 80, 0.2);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-sm { max-width: 360px; }
.modal-lg { max-width: 760px; }

/* 样机借用协议：学生端上传预览 + 审批/库存查看大图 */
.agreement-preview { margin-top: 8px; }
.agreement-preview img {
  display: block;
  max-width: 220px;
  max-height: 140px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7f9fc;
}
.agreement-view {
  max-height: 68vh;
  overflow: auto;
  text-align: center;
  background: #f7f9fc;
  border-radius: 8px;
  padding: 10px;
}
.agreement-view img { display: block; max-width: 100%; margin: 0 auto; }
input[type="file"].form-input { padding: 7px 12px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title { font-size: 17px; font-weight: 700; }

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--ink-sub);
  cursor: pointer;
  border-radius: 6px;
}

.modal-close:hover { background: #f0f3f8; }
.modal-close svg { width: 16px; height: 16px; }

/* ---------- 表单 ---------- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field[hidden] { display: none; }
.form-field.full { grid-column: 1 / -1; }

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.form-input,
.form-select {
  height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--xinje-blue);
  box-shadow: 0 0 0 3px var(--xinje-blue-soft);
}

.form-textarea {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  outline: none;
  resize: vertical;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-textarea:focus {
  border-color: var(--xinje-blue);
  box-shadow: 0 0 0 3px var(--xinje-blue-soft);
}

.form-tip {
  min-height: 18px;
  font-size: 12px;
  color: #d4380d;
  margin-top: 8px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.btn-cancel {
  padding: 0 16px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink-sub);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-cancel:hover { background: #f5f7fa; }

/* ---------- 空状态 ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  color: var(--ink-sub);
  gap: 12px;
}

.empty-state svg { width: 48px; height: 48px; }
.empty-state h3 { font-size: 16px; font-weight: 700; color: var(--ink); }
.empty-state p { font-size: 13px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  top: 28px;
  left: 50%;
  transform: translate(-50%, -16px);
  padding: 10px 22px;
  border-radius: 8px;
  background: rgba(31, 39, 51, 0.92);
  color: #fff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 300;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .layout { flex-direction: column; }

  .sidebar {
    width: 100%;
    height: auto;
    position: static;
  }

  .form-grid { grid-template-columns: 1fr; }
}

/* ---------- 审批中心：页签 ---------- */
.tab-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.tab-btn {
  padding: 8px 16px;
  border: none;
  background: none;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink-sub);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.tab-btn:hover { color: var(--xinje-blue); }

.tab-btn.active {
  color: var(--xinje-blue);
  font-weight: 600;
  border-bottom-color: var(--xinje-blue);
}
