/* ============================================================
 * style.css — 礼品管家 样式
 * 浅色主题 · 卡片式布局 · 响应式
 * ============================================================ */

/* ---------- 重置 & 变量 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* —— V2 勃艮第蓝调主题（红 #9e1b32 × 湾蓝 #5686BB × 暖橘 #D1601F × 暖白底）2026-09-08 定稿 —— */
  --primary: #9e1b32;
  --primary-light: #fbe4e8;
  --primary-dark: #771224;
  --grad: linear-gradient(135deg, #9e1b32, #b03a48);
  --sec: #5686BB;          /* 湾蓝辅助色 */
  --sec-dark: #4a74a6;     /* 湾蓝深化：小号按钮文字保证对比度 */
  --sec-light: #e3edf7;
  --sec-b: #c3d4e6;
  --grad-blue: linear-gradient(135deg, #5686BB, #4a74a6);

  --success: #22c55e;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --info: #0ea5e9;
  --info-light: #f0f9ff;

  --text: #4a0e1c;
  --text-primary: #4a0e1c;
  --text-secondary: #a14554;
  --text-light: #bd8d96;
  --bg: #fbf7f4;
  --bg-light: #f7edea;
  --bg-white: #ffffff;
  --card-bg: #ffffff;
  --border: #f0dade;
  --border-light: #f7edea;
  --imgbg: linear-gradient(135deg, #e3edf7, #fbe4e8);
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.1);
  --radius: 12px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --sidebar-w: 240px;
}

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

#app { display: flex; min-height: 100vh; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #771224, #9e1b32);
  border-right: 1px solid rgba(255,255,255,0.12);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.25s ease;
  overflow: hidden;
}

/* ---------- 乱序咬合压印层（v42 方案 F）：纯装饰，不占布局、不挡点击 ---------- */
.sb-scatter {
  position: absolute;
  inset: 0;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}
.sb-scatter span {
  position: absolute;
  font-weight: 900;
  line-height: 1;
  font-family: Arial Black, Arial, sans-serif;
}
.sidebar .nav, .sidebar .sidebar-footer { position: relative; z-index: 2; }

/* ---------- 徒步小熊：导航与角色卡之间居中站立（v48），纯装饰不挡点击 ---------- */
.sb-bear-zone {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  padding: 0 0 10px;
  pointer-events: none;
  user-select: none;
}
.sb-bear-zone img {
  width: 112px;
  filter: drop-shadow(0 8px 16px rgba(40,5,12,.45));
}
@media (max-height: 700px) {
  .sb-bear-zone img { width: 84px; }
}

/* ---------- 小熊情绪节点组件（v48）：欢迎弹窗 / 搜索空态 / 成功时刻 ---------- */
/* 欢迎弹窗顶部：拿花熊 + 引导语 */
.bear-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 6px 0 14px;
}
.bear-hero img {
  width: 96px;
  flex: none;
  filter: drop-shadow(0 6px 14px rgba(122,15,35,.25));
}
.bear-lead {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.7;
}
.bear-lead .bear-lead-title {
  display: block;
  font-size: 16.5px;
  font-weight: 800;
  margin-bottom: 2px;
}
/* 搜索空态：望远镜熊 */
.bear-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 26px 16px 30px;
}
.bear-empty img {
  width: 120px;
  filter: drop-shadow(0 8px 18px rgba(122,15,35,.22));
  margin-bottom: 10px;
}
.bear-empty b {
  font-size: 15px;
  color: var(--text);
  margin-bottom: 5px;
}
.bear-empty span {
  font-size: 12.5px;
  color: var(--text2);
  line-height: 1.7;
  max-width: 280px;
  margin-bottom: 14px;
}
/* 成功时刻弹窗：对勾 + 小熊 */
.bear-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 10px 4px 4px;
  position: relative;
}
.bear-success::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 16%, rgba(209,96,31,.10), transparent 55%);
  pointer-events: none;
}
.bear-success-chk {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #22c55e;
  color: #fff;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  box-shadow: 0 6px 16px rgba(34,197,94,.35);
  position: relative;
}
.bear-success img {
  width: 128px;
  filter: drop-shadow(0 10px 20px rgba(122,15,35,.25));
  margin-bottom: 8px;
  position: relative;
}
.bear-success p {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.8;
  margin: 0 0 8px;
  position: relative;
}
.bear-success p b { color: var(--text); }
@media (max-width: 768px) {
  .bear-hero { gap: 10px; }
  .bear-hero img { width: 72px; }
  .bear-lead { font-size: 12.5px; }
  .bear-lead .bear-lead-title { font-size: 15px; }
  .bear-empty img { width: 100px; }
  .bear-success img { width: 96px; }
  .bear-success-chk { width: 38px; height: 38px; font-size: 19px; }
  .bear-success p { font-size: 12px; }
}

.role-info {
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.14);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.role-info.admin { background: rgba(255,255,255,0.20); border: 1px solid rgba(255,255,255,0.28); }
.role-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  align-self: flex-start;
}
.role-tag.admin { background: #D1601F; color: #fff; }
.role-tag.user { background: rgba(255,255,255,0.30); color: #fff; }
.role-name { font-size: 12px; color: #f3dde1; }
.role-action {
  background: none;
  border: none;
  color: #ffd9b8;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  padding: 0;
  font-weight: 600;
}
.role-action:hover { text-decoration: underline; }

.nav { flex: 1; padding: 22px 10px 12px; overflow-y: auto; }
.nav-item {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  color: #f3dde1;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
  margin-bottom: 2px;
  position: relative;
  text-decoration: none;
}
.nav-item[data-role="any"], .nav-item[data-role].show { display: flex; }
.nav-item:hover { background: rgba(255,255,255,0.10); color: #fff; }
.nav-item.active { background: rgba(255,255,255,0.14); color: #fff; font-weight: 600; }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3.5px;
  border-radius: 0 4px 4px 0;
  background: #D1601F;
}
.nav-ico { font-size: 16px; width: 20px; text-align: center; }

.badge {
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 10px;
  margin-left: auto;
  font-weight: 600;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.12);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.btn-text {
  background: none;
  border: none;
  color: #f3dde1;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  text-align: left;
  transition: all 0.15s;
}
.btn-text:hover { background: rgba(255,255,255,0.10); color: #fff; }

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

.topbar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.page-title { font-size: 18px; font-weight: 700; flex: 1; }
.tb-love {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--primary);
  white-space: nowrap;
  user-select: none;
}
.tb-love .heart { color: #e0245e; font-size: 21px; padding: 0 2px; }
.menu-toggle { display: none; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text); }
.topbar-actions { display: flex; gap: 10px; }

.views { padding: 24px; flex: 1; }
.view { display: none; }
.view.active { display: block; animation: fadeIn 0.2s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- 按钮 ---------- */
.btn {
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.btn-primary { background: var(--grad); color: #fff; }
.btn-primary:hover { filter: brightness(0.92); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(0.92); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(0.92); }
.btn-outline { background: var(--card-bg); color: var(--sec-dark); border: 1px solid var(--sec-b); }
.btn-outline:hover { border-color: var(--sec); color: var(--sec-dark); background: var(--sec-light); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--border-light); color: var(--text); }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title { font-size: 15px; font-weight: 700; }
.card-body { padding: 20px; }

/* ---------- KPI 卡片 ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kpi-card .kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-icon {
  font-size: 26px;
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
/* KPI 图标底色：V2 四色轮换（粉 / 浅蓝 / 橘奶油 / 雾蓝） */
.kpi-grid .kpi-card:nth-child(4n+1) .kpi-icon { background: #fbe4e8; }
.kpi-grid .kpi-card:nth-child(4n+2) .kpi-icon { background: #e3edf7; }
.kpi-grid .kpi-card:nth-child(4n+3) .kpi-icon { background: #fae4d6; }
.kpi-grid .kpi-card:nth-child(4n+4) .kpi-icon { background: #e9f1f8; }
.kpi-label { color: var(--text-secondary); font-size: 13px; }
.kpi-value { font-size: 26px; font-weight: 700; }
.kpi-sub { font-size: 12px; color: var(--text-light); }

/* ---------- KPI Mini (for report sub-stats) ---------- */
.kpi-mini {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}
.kpi-mini-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.kpi-mini-label {
  font-size: 12px;
  color: var(--text-secondary);
}
.kpi-mini-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ---------- 进度条 ---------- */
.progress {
  height: 8px;
  background: var(--border-light);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 6px;
}
.progress-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}
.progress-bar.ok { background: var(--success); }
.progress-bar.warn { background: var(--warning); }
.progress-bar.over { background: var(--danger); }

/* ---------- 状态标签 ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.tag-pending { background: var(--warning-light); color: var(--warning); }
.tag-approved { background: var(--success-light); color: var(--success); }
.tag-rejected { background: var(--danger-light); color: var(--danger); }
.tag-danger { background: var(--danger-light); color: var(--danger); }
.tag-info { background: var(--info-light); color: var(--info); }
.tag-stock-ok { background: var(--success-light); color: var(--success); }
.tag-stock-low { background: var(--danger-light); color: var(--danger); }
.tag-gift-available { background: var(--success-light); color: var(--success); }
.tag-gift-low { background: var(--warning-light); color: var(--warning); }
.tag-gift-out { background: var(--danger-light); color: var(--danger); }
.tag-gift-purchasing { background: #f0fdf4; color: #166534; }
.tag-source-office { background: #fef3c7; color: #92400e; }
.tag-source-external { background: #e0e7ff; color: #3730a3; }
.tag-source-school { background: #fce7f3; color: #9f1239; }
.tag-source-logistics { background: #ecfdf5; color: #065f46; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left;
  padding: 12px 14px;
  color: var(--text-secondary);
  font-weight: 600;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  background: var(--border-light);
}
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
tbody tr:hover { background: var(--border-light); }
tbody tr:last-child td { border-bottom: none; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-light); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.fw-bold { font-weight: 700; }

/* ---------- 表单 ---------- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 13px; color: var(--text); }
.form-label .req { color: var(--danger); }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: var(--card-bg);
  color: var(--text);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.form-textarea { resize: vertical; min-height: 70px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-hint { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

/* ---------- 筛选栏 ---------- */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-bar .form-select, .filter-bar .form-input { width: auto; min-width: 140px; }
.filter-bar .spacer { flex: 1; }

/* ---------- 标签栏 ---------- */
.tab-bar {
  display: flex;
  gap: 8px;
  background: var(--bg-light);
  border-radius: var(--radius-md);
  padding: 6px;
}
.tab-btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}
.tab-btn:hover {
  background: var(--bg-white);
  color: var(--text-primary);
}
.tab-btn.active {
  background: var(--primary);
  color: #fff;
}

/* ---------- 提示框 ---------- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  margin-bottom: 12px;
}
.alert-danger { background: var(--danger-light); color: #991b1b; }
.alert-warn { background: var(--warning-light); color: #92400e; }
.alert-info { background: var(--info-light); color: #075985; }
.alert-success { background: var(--success-light); color: #166534; }
.alert-icon { font-size: 16px; flex-shrink: 0; }

/* ---------- 空状态 ---------- */
.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-light);
}
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-text { font-size: 14px; }

/* ---------- 模态框 ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-backdrop.show { display: flex; animation: fadeIn 0.15s ease; }
.modal {
  background: var(--card-bg);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-light); padding: 4px; line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 22px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ---------- Toast ---------- */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideIn 0.2s ease;
  max-width: 340px;
}
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast-success { background: var(--success); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }
.toast-info { background: var(--info); color: #fff; }

/* ---------- 小熊 toast 卡（v59） ---------- */
.toast-bear {
  position: relative;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 13px 20px 13px 62px;
  box-shadow: 0 12px 30px rgba(90, 15, 30, 0.18);
  overflow: visible;
}
.toast-bear::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
  border-radius: 16px 0 0 16px;
  background: linear-gradient(180deg, var(--primary), #D1601F);
}
.toast-bear img {
  position: absolute;
  left: -26px;
  top: 50%;
  transform: translateY(-52%);
  width: 66px;
  filter: drop-shadow(0 6px 12px rgba(122, 15, 35, 0.22));
}
.toast-bear .bt-msg { font-size: 14.5px; font-weight: 800; color: var(--primary); }
.toast-bear .bt-sub { font-size: 11.5px; color: var(--text-secondary, #6b5257); margin-top: 2px; line-height: 1.6; }
.toast-bear-error {
  background: linear-gradient(135deg, #e2444c, #d63841);
  border: none;
  padding-left: 74px;
  box-shadow: 0 12px 30px rgba(160, 30, 40, 0.30);
}
.toast-bear-error::before { display: none; }
.toast-bear-error img {
  left: -24px;
  width: 70px;
  filter: drop-shadow(0 5px 10px rgba(90, 10, 15, 0.35));
}
.toast-bear-error .bt-msg { color: #fff; }
.toast-bear-error .bt-sub { color: rgba(255, 255, 255, 0.88); }
.toast-bear-info {
  background: linear-gradient(135deg, #3d87c9, #2f74b5);
  border: none;
  padding-left: 74px;
  box-shadow: 0 12px 30px rgba(30, 80, 130, 0.30);
}
.toast-bear-info::before { display: none; }
.toast-bear-info img {
  left: -24px;
  width: 70px;
  filter: drop-shadow(0 5px 10px rgba(15, 45, 75, 0.35));
}
.toast-bear-info .bt-msg { color: #fff; }
.toast-bear-info .bt-sub { color: rgba(255, 255, 255, 0.88); }
@media (max-width: 768px) {
  .toast-bear { padding: 11px 16px 11px 50px; border-radius: 14px; max-width: 300px; }
  .toast-bear img { width: 52px; left: -20px; }
  .toast-bear .bt-msg { font-size: 13.5px; }
  .toast-bear .bt-sub { font-size: 10.5px; }
  .toast-bear-error, .toast-bear-info { padding-left: 58px; }
  .toast-bear-error img, .toast-bear-info img { width: 54px; left: -18px; }
}

/* ---------- 预警列表 ---------- */
.alert-list { display: flex; flex-direction: column; gap: 10px; }
.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card-bg);
}
.alert-item.danger { border-left: 4px solid var(--danger); background: var(--danger-light); }
.alert-item.warn { border-left: 4px solid var(--warning); background: var(--warning-light); }
.alert-item.info { border-left: 4px solid var(--info); background: var(--info-light); }
.alert-item-icon { font-size: 20px; }
.alert-item-content { flex: 1; }
.alert-item-title { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.alert-item-msg { font-size: 12px; color: var(--text-secondary); }

/* ---------- 图表条 ---------- */
.bar-chart { display: flex; flex-direction: column; gap: 14px; }
.bar-row { display: flex; align-items: center; gap: 12px; }
.bar-label { width: 100px; font-size: 12px; color: var(--text-secondary); flex-shrink: 0; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; height: 24px; background: var(--border-light); border-radius: 6px; overflow: hidden; position: relative; }
.bar-fill { height: 100%; border-radius: 6px; transition: width 0.5s ease; display: flex; align-items: center; padding-left: 8px; color: #fff; font-size: 11px; font-weight: 600; }
.bar-value { font-size: 12px; color: var(--text); font-weight: 600; min-width: 60px; }

/* ---------- 礼品卡片（同事浏览视图） ---------- */
.gift-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.gift-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.2s;
}
.gift-card:hover { box-shadow: var(--shadow-lg); border-color: var(--primary); }
.gift-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  min-height: 120px; /* 兜底：不支持 aspect-ratio 的老手机浏览器图区不再塌成 0（图片看不到） */
  background: var(--imgbg);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.gift-img img { width: 100%; height: 100%; object-fit: cover; }
.gift-img .placeholder { font-size: 48px; opacity: 0.4; }
.gift-img .top-tags { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.gift-info { padding: 12px 14px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.gift-name { font-weight: 600; font-size: 14px; line-height: 1.4; }
.gift-meta { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text-secondary); }
.gift-price { font-size: 18px; font-weight: 700; color: var(--primary); }
.gift-actions { padding: 0 14px 14px; }

/* ---------- 图片上传 ---------- */
.image-upload {
  display: flex;
  gap: 12px;
  align-items: center;
}
.image-preview {
  width: 96px;
  height: 96px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  background: var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.image-preview img { width: 100%; height: 100%; object-fit: cover; }
.image-preview .placeholder { font-size: 32px; color: var(--text-light); }
.image-upload-input { display: none; }
.image-upload-btn {
  flex: 1;
  padding: 10px 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--border-light);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  transition: all 0.15s;
}
.image-upload-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* ---------- 内联添加礼品表单 ---------- */
.inline-form-grid {
  display: grid;
  grid-template-columns: auto 1fr 1fr 1fr 1fr auto;
  gap: 16px;
  align-items: start;
}
@media (max-width: 768px) {
  .inline-form-grid { grid-template-columns: 1fr; }
}
.image-upload-sm {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  position: relative;
}
.image-preview-sm {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  background: var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.image-preview-sm img { width: 100%; height: 100%; object-fit: cover; }
.image-preview-sm .placeholder { font-size: 20px; color: var(--text-light); }
.image-upload-btn-sm {
  padding: 4px 10px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--border-light);
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  transition: all 0.15s;
  white-space: nowrap;
}
.image-upload-btn-sm:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* ---------- 摘要卡片 (活动/模块) ---------- */
.summary-card { display: flex; flex-direction: column; gap: 8px; }
.summary-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--border-light);
  font-size: 13px;
}
.summary-rank { font-weight: 700; color: var(--primary); width: 24px; }
.summary-name { flex: 1; font-weight: 500; }
.summary-amount { font-weight: 700; color: var(--text); }
.summary-count { font-size: 11px; color: var(--text-light); margin-left: 6px; }

/* ---------- 状态徽章（在标题里） ---------- */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-title { font-size: 18px; font-weight: 700; }
.section-subtitle { color: var(--text-secondary); font-size: 13px; margin-top: 2px; }

/* ---------- 工具类 ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.flex-wrap { flex-wrap: wrap; }

/* 表格内的缩略图 */
.thumb {
  width: 44px; height: 44px; border-radius: 6px;
  background: var(--border-light);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0;
  font-size: 20px; color: var(--text-light);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-lg { width: 96px; height: 96px; border-radius: 8px; }

/* ---------- 图片裁剪选取浮层 ---------- */
.crop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 1500; /* 高于礼品编辑弹窗(.modal-backdrop 1000)，低于 toast(2000) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.crop-panel {
  background: #fff;
  border-radius: 12px;
  padding: 16px 20px 20px;
  max-width: 600px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.crop-title { font-size: 16px; font-weight: 700; color: var(--text); }
.crop-hint { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.crop-stage {
  position: relative;
  margin: 0 auto;
  line-height: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #f1f5f9;
  touch-action: none; /* 触屏上拖动平移图片，不滚动页面 */
  cursor: grab;
}
.crop-stage.panning { cursor: grabbing; }
.crop-stage img { display: block; user-select: none; -webkit-user-drag: none; transform-origin: center center; will-change: transform; }
.crop-box {
  position: absolute;
  box-sizing: border-box;
  border: 2px solid #fff;
  border-radius: 4px;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.55); /* 选区外压暗 */
  cursor: move;
  touch-action: none;
}
.crop-handle {
  position: absolute;
  right: -7px;
  bottom: -7px;
  width: 14px;
  height: 14px;
  background: #fff;
  border: 2px solid var(--primary, #8a1538);
  border-radius: 50%;
  cursor: nwse-resize;
}
.crop-zoombar {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  border-radius: 999px;
  padding: 3px 6px;
  line-height: 1;
  user-select: none;
  z-index: 6; /* 高于选框压暗阴影 */
}
.crop-zoombar button {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 15px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}
.crop-zoombar button:hover:not(:disabled) { background: rgba(255, 255, 255, 0.2); }
.crop-zoombar button:disabled { opacity: 0.35; cursor: default; }
.crop-zoombar .crop-zoom-val { font-size: 12px; min-width: 42px; text-align: center; }
.crop-zoombar #cropZoomFit { width: auto; padding: 0 8px; border-radius: 999px; font-size: 12px; }
.crop-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- 供应商管理 ---------- */
.sup-tag {
  display: inline-block;
  padding: 2px 8px;
  margin: 2px 4px 2px 0;
  font-size: 12px;
  border-radius: 10px;
  background: var(--primary-light, #f7ecee);
  color: var(--primary, #8a1538);
  white-space: nowrap;
}
.sup-tag-more { background: var(--border-light, #f1f5f9); color: var(--text-secondary, #64748b); }
.sup-tags-box {
  min-height: 34px;
  padding: 4px 8px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: #fafbfc;
}
.sup-tag-x { padding-right: 4px; }
.sup-x {
  margin-left: 5px;
  cursor: pointer;
  opacity: 0.6;
  font-size: 11px;
}
.sup-x:hover { opacity: 1; }
.purchase-form-box {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 10px;
  background: #fafbfc;
}
.purchase-row {
  display: grid;
  grid-template-columns: 2fr 0.7fr 1fr 1.5fr auto;
  gap: 8px;
  margin-bottom: 6px;
  align-items: center;
}
@media (max-width: 768px) {
  .purchase-row { grid-template-columns: 1fr 1fr; }
}
.purchase-item {
  padding: 8px 10px;
  margin-bottom: 6px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: #fff;
}
.pur-attach-list { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.pur-attach-chip a { text-decoration: none; }
.pur-attach-chip a:hover { text-decoration: underline; }

/* ---------- 数据备份 ---------- */
.backup-hint {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--info-light);
  border: 1px solid var(--info);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  line-height: 1.6;
}

/* ---------- 年度分析报告 ---------- */
.annual-charts {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 20px;
}
.annual-chart-box { min-width: 0; }
.annual-chart-title { font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.annual-legend {
  display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px;
  font-size: 12px; color: var(--text-secondary);
}
.annual-legend span { display: flex; align-items: center; gap: 4px; }
.annual-legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.annual-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.annual-table th { text-align: left; color: var(--text-secondary); font-weight: 500; padding: 4px 0; }
.annual-table td { padding: 6px 0; border-top: 1px solid var(--border-light); }
.annual-fallback-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.annual-fallback-table td { padding: 4px 0; border-bottom: 1px dashed var(--border-light); }
/* 年度报告 KPI 四列（移动端由媒体查询收为两列） */
.kpi-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ---------- A4 打印（年度报告） ---------- */
@media print {
  .sidebar, .topbar, .overlay, .modal-backdrop, .toast-container { display: none !important; }
  .main { margin-left: 0 !important; padding: 0 !important; }
  body { background: #fff !important; }
  #view-reports > *:not(.annual-report) { display: none !important; }
  .annual-report { border: none !important; box-shadow: none !important; }
  .annual-report .no-print { display: none !important; }
  .annual-charts { break-inside: avoid; }
  .kpi-card, .kpi-grid { break-inside: avoid; }
}

/* ---------- 响应式 ---------- */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 99;
}
.overlay.show { display: block; }

@media (max-width: 768px) {
  /* 侧边栏改为 fixed 抽屉：脱离 flex 布局流，不再挤压主内容 */
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 100; transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .tb-love { display: none; } /* 手机顶栏窄，居中标识降级隐藏；抽屉压印层与桌面同款（overflow:hidden 兜底） */
  /* 手机抽屉更高（100vh），字母放大保持满铺密度（v48 整体缩小 12% 后的尺寸） */
  .sb-G { font-size: 270px !important; }
  .sb-E { font-size: 188px !important; }
  .sb-M { font-size: 270px !important; }
  .sb-B { font-size: 218px !important; }
  .sb-A { font-size: 235px !important; }
  /* 抽屉里的徒步小熊：收窄至 98px */
  .sb-bear-zone img { width: 98px; }
  /* flex 项最小宽度归零：任何视图的宽内容都不再撑爆整体布局（根因修复） */
  .main { margin-left: 0; min-width: 0; }
  #app { overflow-x: hidden; }
  .menu-toggle { display: block; }
  .views { padding: 16px; }
  .topbar { padding: 0 16px; }
  .form-row { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-top { flex-wrap: wrap; }
  .kpi-value { font-size: 20px; }
  .topbar-actions .btn { padding: 7px 12px; font-size: 12px; }
  .bar-label { width: 70px; }
  .modal { max-width: 100%; }
  /* --- v39 手机适配补充 --- */
  .page-title { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; margin-right: 8px; }
  .card { overflow-x: auto; } /* 卡片内宽表格可横向滑动，不再被裁切 */
  .card-header { flex-wrap: wrap; row-gap: 8px; }
  .card-header > div { flex-wrap: wrap; row-gap: 6px; }
  .annual-charts { grid-template-columns: 1fr; }
  .tab-bar { overflow-x: auto; max-width: 100%; }
  .tab-btn { white-space: nowrap; flex-shrink: 0; }
  .form-input, .form-select, .form-textarea { font-size: 16px; } /* ≥16px 防 iOS 聚焦自动放大 */
  .filter-bar .form-select, .filter-bar .form-input { min-width: 120px; }
  .crop-panel { padding: 12px 14px 16px; }
  .crop-zoombar button { width: 32px; height: 32px; }
  .modal-body { padding: 16px; }
  /* --- v40 礼品卡片：手机一排两个 --- */
  .gift-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .gift-info { padding: 10px 10px 12px; gap: 4px; }
  .gift-name { font-size: 13px; }
  .gift-price { font-size: 16px; }
  .gift-img .placeholder { font-size: 32px; }
  .gift-img .top-tags { top: 6px; left: 6px; right: 6px; }
  .top-tags .tag { font-size: 10px; padding: 2px 7px; }
}

/* ---------- 新建领取 — 多步骤表单 ---------- */
.claim-type-options {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.claim-type-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  background: var(--card-bg);
}
.claim-type-option:hover { border-color: var(--primary); background: var(--primary-light); }
.claim-type-option input[type=radio] { accent-color: var(--primary); }
.claim-type-label { font-size: 14px; font-weight: 500; }
.claim-type-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
}
.claim-gift-row {
  display: grid;
  grid-template-columns: 1fr 80px 80px 32px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  padding: 8px;
  background: var(--bg);
  border-radius: var(--radius);
}
.claim-gift-select select { width: 100%; }
.claim-gift-qty input { width: 100%; text-align: center; }
.claim-gift-subtotal {
  text-align: right;
  font-size: 14px;
  font-weight: 600;
  min-width: 60px;
}

/* ---------- 历史礼品参考面板 ---------- */
.gift-ref-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.gift-ref-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: var(--card-bg);
  border-radius: 6px;
  border: 1px solid var(--border-light);
}
.gift-ref-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.gift-ref-info {
  font-size: 11px;
  color: var(--text-light);
}

/* ===== v62：礼品卡片升级（来源色条 + 全胶囊 + 悬浮抬升）===== */
.gift-grid .gift-card{position:relative;overflow:hidden;border-radius:14px;transition:transform .22s ease,box-shadow .22s ease;cursor:pointer}
.gift-grid .gift-card::before{content:"";position:absolute;top:0;left:0;right:0;height:4px;z-index:2;background:linear-gradient(90deg,#5686BB,#8fb3d9)}
.gift-grid .gc-src-office_custom::before{background:linear-gradient(90deg,#f5a300,#ffd75e)}
.gift-grid .gc-src-logistics::before{background:linear-gradient(90deg,#16a34a,#6ee7a0)}
.gift-grid .gc-src-external::before{background:linear-gradient(90deg,#5686BB,#8fb3d9)}
.gift-grid .gc-src-school_store::before{background:linear-gradient(90deg,#9e1b32,#d05a68)}
.gift-grid .gift-card:hover{transform:translateY(-6px);box-shadow:0 16px 34px rgba(158,27,50,.18)}
.gift-img{overflow:hidden}
.gift-img img{transition:transform .3s ease}
.gift-grid .gift-card:hover .gift-img img{transform:scale(1.06)}
.gift-grid .gift-card .tag{border-radius:14px;font-weight:700;padding:2px 12px;font-size:11px;box-shadow:0 2px 8px rgba(0,0,0,.14)}
.gift-grid .gift-price{background:var(--primary-light);color:var(--primary);border-radius:14px;padding:2px 12px;font-size:13px;display:inline-block}
.stock-pill{border-radius:14px;padding:2px 10px;font-size:11px;font-weight:600;background:var(--sec-light);color:var(--sec-dark);display:inline-block}
.stock-pill.sp-low{background:#fdeedd;color:#c05613}
.stock-pill.sp-out{background:#f6dfe2;color:#a03040}
.stock-pill.sp-purchasing{background:#f0fdf4;color:#166534}
@media (max-width:768px){
  .gift-grid .gift-price{font-size:12px;padding:2px 10px}
  .stock-pill{font-size:10px;padding:2px 8px}
  .gift-grid .gift-card:active{transform:translateY(-3px)}
}

/* ===== v63 申领类型专属色条 ===== */
/* 记录组卡左侧色条 */
.ct-bar { position: relative; overflow: hidden; }
.ct-bar::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; }
.ct-module::before          { background: linear-gradient(180deg, #5686BB, #85a9d4); }
.ct-student::before         { background: linear-gradient(180deg, #D1601F, #f0975c); }
.ct-recruitment::before     { background: linear-gradient(180deg, #9e1b32, #cf4a5f); }
.ct-alumni::before          { background: linear-gradient(180deg, #f5a300, #ffd75e); }
.ct-professor_thanks::before{ background: linear-gradient(180deg, #6b0e1e, #a03049); }
/* 新建领取类型选择卡 */
.claim-type-option { border-left-width: 6px; }
.claim-type-option.ct-module          { border-left-color: #5686BB; }
.claim-type-option.ct-student         { border-left-color: #D1601F; }
.claim-type-option.ct-recruitment     { border-left-color: #9e1b32; }
.claim-type-option.ct-alumni          { border-left-color: #f5a300; }
.claim-type-option.ct-professor_thanks{ border-left-color: #6b0e1e; }
.claim-type-option.ct-module:has(input:checked)          { border-color: #5686BB; background: #eef4fb; }
.claim-type-option.ct-student:has(input:checked)         { border-color: #D1601F; background: #fdf1e9; }
.claim-type-option.ct-recruitment:has(input:checked)     { border-color: #9e1b32; background: #faedf0; }
.claim-type-option.ct-alumni:has(input:checked)          { border-color: #f5a300; background: #fdf6e3; }
.claim-type-option.ct-professor_thanks:has(input:checked){ border-color: #6b0e1e; background: #f6e9ec; }

/* ===== v64 顶栏升级（B 方案：精致线条 + 胶囊焕新） ===== */
.topbar { border-bottom: none; }
.topbar::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: linear-gradient(90deg, #9e1b32, #D1601F 45%, rgba(209,97,31,0));
}
.page-title { padding-left: 14px; position: relative; }
.page-title::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 4px; height: 18px; border-radius: 2px; background: linear-gradient(180deg, #9e1b32, #D1601F);
}
#btnQuickClaim {
  border-radius: 999px; padding: 9px 22px; font-weight: 600;
  background: linear-gradient(135deg, #9e1b32, #c23a52);
  box-shadow: 0 3px 10px rgba(158,27,50,.28);
  transition: transform .15s, box-shadow .15s, filter .15s;
}
#btnQuickClaim:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(158,27,50,.34); filter: brightness(1.04); }
#btnQuickClaim:active { transform: scale(.95); }
#btnLang { border-radius: 999px; padding: 8px 15px; }
.tb-love .heart { display: inline-block; animation: tbHeartBeat 2.4s ease-in-out infinite; }
@keyframes tbHeartBeat { 0%,100% { transform: scale(1); } 12% { transform: scale(1.28); } 24% { transform: scale(1); } }
@media (max-width: 768px) {
  #btnQuickClaim { padding: 7px 14px; }
}

/* ===== v71 管理员礼品卡片视图 ===== */
.gift-admin-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border, #e5ddd5);
  flex-wrap: wrap;
}
.gift-admin-actions .btn-sm { padding: 4px 10px; font-size: 12px; }
.gift-card.ga-inactive { opacity: 0.55; }
