/* ============================================================================
   轮休日历 v2 · calendar.css（独立模块：月历 / 部门统计 / 小组统计）
   ----------------------------------------------------------------------------
   规范：珊瑚橙扁平化（无阴影堆叠、无渐变、无模糊），token 全部来自 variables.css
   结构：
     1. 页面骨架 + Hero + 月份导航
     2. Tab 分段器
     3. 月历网格（星期行 + 42 格）
     4. 统计视图（指标瓦片 / 零休名单 / 排名条 / 小组卡）
     5. 弹窗（日期详情 / 确认框）+ 表单
     6. 响应式（≤768 移动端适配）
   ============================================================================ */

/* ========== 1. 页面骨架 + Hero + 月份导航 ========== */
.cal-page {
  max-width: var(--content-max);
  margin: 0 auto;
}

.cal-hero { flex-direction: column; align-items: stretch; gap: 12px; }
.cal-hero .vac-hero-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.cal-month-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--r-full);
}
.cal-nav-btn {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: var(--slate-600);
  cursor: pointer;
  transition: background var(--dur-1), color var(--dur-1);
}
.cal-nav-btn:hover { background: var(--brand-100); color: var(--brand-600); }
.cal-nav-btn svg { width: 17px; height: 17px; }
.cal-nav-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.cal-month-label {
  min-width: 96px;
  text-align: center;
  font-size: var(--fs-md);
  color: var(--slate-900);
}
.cal-month-label b { font-weight: 750; }
.cal-month-label em { font-style: normal; font-weight: 750; color: var(--brand); }

.cal-today-btn {
  height: 30px;
  padding: 0 14px;
  background: var(--brand-100);
  border: none;
  border-radius: var(--r-full);
  color: var(--brand-600);
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur-1);
}
.cal-today-btn:hover { background: #fed7aa; }

/* ========== 2. Tab 分段器 ========== */
.cal-tabs {
  display: inline-flex;
  gap: 2px;
  width: fit-content;
  max-width: 100%;
  padding: 3px;
  background: var(--slate-100);
  border-radius: var(--r-full);
}
.cal-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 18px;
  border: none;
  background: transparent;
  border-radius: var(--r-full);
  color: var(--slate-500);
  font-size: var(--fs-sm);
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur-1), color var(--dur-1);
}
.cal-tab svg { width: 15px; height: 15px; }
.cal-tab:hover { color: var(--slate-800); }
.cal-tab.active {
  background: #fff;
  color: var(--brand-600);
  font-weight: 700;
}
/* 小组统计：次级小组切换 Tab（横向可滚动） */
.cal-subtabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px;
  margin-bottom: 12px;
  scrollbar-width: none;
}
.cal-subtabs::-webkit-scrollbar { display: none; }
.cal-subtab {
  flex: none;
  height: 30px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--slate-700);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur-1), border-color var(--dur-1), color var(--dur-1);
}
.cal-subtab:hover {
  background: #fff;
  border-color: var(--brand-400);
  color: var(--brand-600);
}
.cal-subtab.active {
  background: var(--brand-600);
  border-color: var(--brand-600);
  color: #fff;
}
.cal-tab .cal-tab-badge {
  min-width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 5px;
  background: var(--brand);
  border-radius: var(--r-full);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

/* ---------- 视图容器 ---------- */
.cal-view { animation: cal-fade-in var(--dur-2) var(--ease-out); }
@keyframes cal-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ========== 3. 月历网格 ========== */
.cal-cal-card {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--r-lg);
  padding: 12px;
}

.cal-weekrow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 6px;
}
.cal-weekday {
  text-align: center;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--slate-400);
  padding: 4px 0;
}
.cal-weekday.weekend { color: var(--cat-7); }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.cal-cell {
  position: relative;
  min-height: 84px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px 7px;
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--r-sm);
  cursor: pointer;
  overflow: hidden;
  transition: border-color var(--dur-1), background var(--dur-1), transform var(--dur-1) var(--ease-snap);
}
.cal-cell:hover { border-color: var(--brand-400); background: var(--brand-100); }
.cal-cell:active { transform: scale(0.97); }
.cal-cell.cross-month { opacity: 0.42; }
.cal-cell.cross-month:hover { opacity: 0.75; }

/* 有轮休人员的日子：浅橙底标识 */
.cal-cell.has-rest { background: #fff7ed; border-color: #fed7aa; }
.cal-cell.has-rest:hover { background: var(--brand-100); }

/* 今天：日期数字橙色圆点 */
.cal-cell.today { border-color: var(--brand); }
.cal-daynum {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--slate-700);
  line-height: 1.2;
}
.cal-cell.today .cal-daynum {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand);
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
}

/* 右上角角标：锁（管理员替换锁定）/ 管（站内管控） */
.cal-badge {
  position: absolute;
  top: 5px; right: 5px;
  width: 16px; height: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
}
.cal-badge.lock { right: 24px; background: var(--state-locked); }
.cal-badge.admin { background: var(--brand); }

/* 人员 chips */
.cal-occs {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 0;
}
.cal-occ-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  max-width: 100%;
}
.cal-occ-dot {
  flex: none;
  width: 6px; height: 6px;
  border-radius: 50%;
}
.cal-occ-name {
  font-size: var(--fs-xs);
  color: var(--slate-700);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-occ-item.locked .cal-occ-name { color: var(--slate-400); }
.cal-occ-more {
  font-size: 11px;
  font-weight: 600;
  color: var(--brand-600);
}
.cal-reason-chip {
  flex: none;
  max-width: 64px;
  padding: 0 5px;
  background: var(--slate-200);
  border-radius: var(--r-xs);
  font-size: 10px;
  line-height: 16px;
  color: var(--slate-600);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 图例 */
.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
  padding: 0 2px;
}
.cal-leg-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  color: var(--slate-500);
}
.cal-leg-swatch {
  width: 12px; height: 12px;
  border-radius: 4px;
  border: 1px solid var(--slate-300);
  background: var(--slate-50);
}
.cal-leg-swatch.rest { background: #fff7ed; border-color: #fed7aa; }
.cal-leg-swatch.today { background: var(--brand); border-color: var(--brand); }
.cal-leg-dot {
  width: 14px; height: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: #fff;
  font-size: 9px; font-weight: 700;
}

/* ========== 4. 统计视图 ========== */
.cal-stats-wrap { display: flex; flex-direction: column; gap: 14px; }

/* 周期区块标题 */
.cal-period-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}
.cal-period-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-md);
  font-weight: 750;
  color: var(--slate-900);
}
.cal-period-title.is-week { color: var(--accent); }
.cal-period-range {
  font-size: var(--fs-xs);
  color: var(--slate-400);
}

/* 指标瓦片 */
.cal-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.cal-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--r-md);
}
.cal-tile-num {
  font-size: var(--fs-2xl);
  font-weight: 800;
  line-height: 1.15;
  color: var(--slate-900);
  font-variant-numeric: tabular-nums;
}
.cal-tile-num em {
  font-style: normal;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--slate-400);
}
.cal-tile-num.is-brand { color: var(--brand); }
.cal-tile-num.is-accent { color: var(--accent); }
.cal-tile-label {
  font-size: var(--fs-xs);
  color: var(--slate-500);
}
.cal-tile-sub {
  font-size: 11px;
  color: var(--slate-400);
}

/* 名单卡（零休人员） */
.cal-lists {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.cal-card {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--r-md);
  padding: 14px 16px;
}
.cal-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.cal-card-title {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--slate-800);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cal-card-title svg { width: 15px; height: 15px; color: var(--warning); }
.cal-card-count {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--danger);
  background: #fee2e2;
  border-radius: var(--r-full);
  padding: 2px 9px;
}
.cal-card-count.zero-ok {
  color: var(--success);
  background: #dcfce7;
}
.cal-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cal-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  color: var(--slate-600);
}
.cal-chip b { font-weight: 600; color: var(--slate-800); }
.cal-empty-ok {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 12px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--r-sm);
  color: var(--success);
  font-size: var(--fs-xs);
  font-weight: 600;
}
.cal-empty-ok svg { width: 15px; height: 15px; }

/* 排名 */
.cal-rank-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
}
.cal-rank-row + .cal-rank-row { border-top: 1px solid var(--slate-100); }
.cal-rank-idx {
  flex: none;
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--slate-100);
  color: var(--slate-500);
  font-size: 11px;
  font-weight: 700;
}
.cal-rank-idx.top1 { background: var(--brand); color: #fff; }
.cal-rank-idx.top2 { background: var(--brand-400); color: #fff; }
.cal-rank-idx.top3 { background: var(--brand-100); color: var(--brand-600); }
.cal-rank-name {
  flex: none;
  width: 72px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--slate-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-rank-track {
  flex: 1 1 auto;
  height: 8px;
  background: var(--slate-100);
  border-radius: var(--r-full);
  overflow: hidden;
}
.cal-rank-fill {
  height: 100%;
  background: var(--brand);
  border-radius: var(--r-full);
  transition: width var(--dur-4) var(--ease-out);
}
.cal-rank-num {
  flex: none;
  min-width: 34px;
  text-align: right;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--slate-700);
  font-variant-numeric: tabular-nums;
}
.cal-rank-empty {
  padding: 12px 0 4px;
  text-align: center;
  font-size: var(--fs-xs);
  color: var(--slate-400);
}

/* 小组统计卡 */
.cal-rank-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.cal-tiles.mini { gap: 8px; }
.cal-tiles.mini .cal-tile { padding: 10px 13px; border-radius: var(--r-sm); }
.cal-tiles.mini .cal-tile-num { font-size: var(--fs-xl); }
.cal-group-card {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--r-lg);
  padding: 16px 18px;
}
.cal-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.cal-group-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-md);
  font-weight: 750;
  color: var(--slate-900);
}
.cal-group-name::before {
  content: '';
  width: 4px; height: 16px;
  border-radius: var(--r-full);
  background: var(--brand);
}
.cal-group-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-xs);
  color: var(--slate-500);
}
.cal-group-total {
  padding: 2px 9px;
  background: var(--brand-100);
  border-radius: var(--r-full);
  color: var(--brand-600);
  font-weight: 700;
}
.cal-group-section { margin-top: 12px; }
.cal-group-subtitle {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--slate-500);
  margin-bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cal-group-subtitle::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.cal-group-subtitle.is-week { color: var(--accent); }

/* ========== 5. 弹窗 ========== */
.cal-mask {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-2);
}
.cal-mask.is-open { opacity: 1; pointer-events: auto; }

.cal-modal {
  width: 92%;
  max-width: 520px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--r-lg);
  overflow: hidden;
  transform: scale(0.95);
  transition: transform var(--dur-3) var(--ease-spring);
}
.cal-mask.is-open .cal-modal { transform: scale(1); }
.cal-modal.small { max-width: 380px; }

.cal-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--slate-100);
}
.cal-modal-title { font-size: var(--fs-lg); font-weight: 750; line-height: 1.3; }
.cal-modal-sub { margin-top: 3px; font-size: var(--fs-xs); color: var(--text-light); }
.cal-close {
  flex: none;
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--slate-100);
  border: none;
  border-radius: 50%;
  color: var(--slate-500);
  cursor: pointer;
  transition: background var(--dur-1), color var(--dur-1);
}
.cal-close:hover { background: #fee2e2; color: var(--danger); }
.cal-close svg { width: 15px; height: 15px; }

.cal-modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cal-modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--slate-100);
}

/* 管控提示条（日期弹窗内） */
.cal-lock-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--brand-100);
  border: 1px solid #fed7aa;
  border-radius: var(--r-sm);
  color: var(--brand-600);
  font-size: var(--fs-xs);
  font-weight: 600;
}
.cal-lock-banner svg { flex: none; width: 15px; height: 15px; }
/* 历史日期只读横幅（中性灰） */
.cal-lock-banner.is-muted {
  background: var(--slate-100);
  border-color: var(--slate-200);
  color: var(--slate-500);
}

/* 新增轮休区块 */
.cal-add-block { margin-top: 4px; }
.cal-add-block .js-toggle-add {
  width: 100%;
  border-style: dashed;
  border-color: var(--brand-400);
  background: var(--brand-50);
  color: var(--brand-600);
}
.cal-add-block .js-toggle-add:hover { background: var(--brand-100); border-color: var(--brand-500); color: var(--brand-700); }
.cal-hint {
  font-size: 11px;
  line-height: 1.5;
  color: var(--slate-400);
}

/* 当日轮休人员卡 */
.cal-occ-card {
  border: 1px solid var(--slate-200);
  border-radius: var(--r-md);
  padding: 12px 14px;
}
.cal-occ-card.locked { background: var(--slate-50); }
.cal-occ-head { display: flex; align-items: center; gap: 10px; }
.cal-avatar {
  flex: none;
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 700;
}
.cal-occ-info { flex: 1 1 auto; min-width: 0; }
.cal-occ-line1 {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--slate-900);
}
.cal-flag {
  flex: none;
  width: 16px; height: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--state-locked);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}
.cal-occ-erp { margin-top: 2px; font-size: 11px; color: var(--text-muted); }
.cal-reason-tag {
  flex: none;
  max-width: 130px;
  padding: 3px 9px;
  background: var(--slate-200);
  border-radius: var(--r-full);
  font-size: 11px;
  color: var(--slate-600);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-occ-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

/* 按钮 */
.cal-btn {
  height: 34px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur-1), border-color var(--dur-1), color var(--dur-1), transform var(--dur-1) var(--ease-snap);
}
/* 关键：限制按钮内嵌图标尺寸，防止 SVG 无宽高时被撑成巨图 */
.cal-btn svg {
  width: 15px;
  height: 15px;
  flex: none;
}
.cal-btn:active { transform: scale(0.97); }
.cal-btn.primary { background: var(--brand); color: #fff; }
.cal-btn.primary:hover { background: var(--brand-600); }
.cal-btn.danger-ghost { background: #fff; border-color: #fecaca; color: var(--danger); }
.cal-btn.danger-ghost:hover { background: #fef2f2; }
.cal-btn.solid-danger { background: var(--danger); color: #fff; }
.cal-btn.solid-danger:hover { background: #dc2626; }
.cal-btn.ghost { background: #fff; border-color: var(--slate-200); color: var(--slate-600); }
.cal-btn.ghost:hover { background: var(--slate-50); }
.cal-btn.sm { height: 30px; padding: 0 13px; font-size: var(--fs-xs); }
.cal-btn.block { width: 100%; }

/* 展开式替换表单 */
.cal-replace-form {
  margin-top: 10px;
  padding: 12px;
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--r-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cal-field { display: flex; flex-direction: column; gap: 5px; }
.cal-label { font-size: var(--fs-xs); font-weight: 600; color: var(--slate-700); }
.cal-input,
.cal-select {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  color: var(--slate-900);
  outline: none;
  transition: border-color var(--dur-1), box-shadow var(--dur-1);
}
.cal-input:focus,
.cal-select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12); }
.cal-textarea {
  width: 100%;
  min-height: 58px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color var(--dur-1), box-shadow var(--dur-1);
}
.cal-textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12); }

/* 确认框提示文本 */
.cal-confirm-msg {
  font-size: var(--fs-sm);
  line-height: 1.7;
  color: var(--slate-600);
  white-space: pre-line;
  word-break: break-all;
}
.cal-confirm-msg b { color: var(--slate-900); }

/* 日历空态/加载失败 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 56px 20px;
  color: var(--slate-400);
}
.empty-state svg { width: 44px; height: 44px; }
.empty-state p { font-size: var(--fs-sm); }

/* ========== 6. 响应式 ========== */
@media (max-width: 900px) {
  .cal-tiles { grid-template-columns: repeat(2, 1fr); }
  .cal-lists { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .cal-page { padding: 0; }
  .cal-hero { padding: 14px 14px 12px; }
  .cal-hero .vac-hero-tags { gap: 8px; }
  .cal-tabs { width: 100%; }
  .cal-tab { flex: 1; justify-content: center; padding: 0 8px; }
  .cal-tab span.txt { font-size: var(--fs-xs); }
  .cal-tab svg { display: none; }
  .cal-view { padding: 0 14px 20px; }
  .cal-cal-card { padding: 8px; border-radius: var(--r-md); }
  .cal-grid, .cal-weekrow { gap: 4px; }
  .cal-cell { min-height: 62px; padding: 4px 5px; border-radius: var(--r-xs); }
  .cal-cell.today .cal-daynum { width: 19px; height: 19px; font-size: 10px; }
  .cal-badge { top: 3px; right: 3px; width: 14px; height: 14px; font-size: 9px; }
  .cal-badge.lock { right: 19px; }
  .cal-occ-item.locked .cal-reason-chip { display: none; }
  .cal-legend { gap: 10px; }
  .cal-modal-body { padding: 14px; }
  .cal-modal-foot { padding: 12px 14px; }
  .cal-rank-name { width: 60px; }
}
@media (max-width: 375px) {
  .cal-tiles { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .cal-tile { padding: 11px 12px; }
  .cal-tile-num { font-size: var(--fs-xl); }
}

/* ========== 7. 统计改版：信号灯 / 关怀清单 / PK竞争 / 趋势 / 干预 / 组间对比 / 个人档案 ========== */

/* 竞争热度角标（PK 抢夺≥1 次的日期，置于左上避免与管/锁重叠） */
.cal-badge.hot {
  left: 3px;
  right: auto;
  width: auto;
  min-width: 16px;
  padding: 0 4px;
  background: var(--danger);
}
.cal-leg-dot.hot { background: var(--danger); }

/* 信号灯汇总条 */
.cal-sigbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--r-md);
}
.cal-sig-item { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--slate-600); }
.cal-sig-item b { font-weight: 750; color: var(--slate-900); }
.sig-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sig-dot.red { background: var(--danger); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15); }
.sig-dot.yellow { background: var(--warning); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15); }
.sig-dot.green { background: var(--success); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15); }

/* 休息关怀 · 介入清单 */
.cal-care-list { display: flex; flex-direction: column; }
.cal-care-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 2px;
  cursor: pointer;
  transition: background var(--dur-1);
}
.cal-care-row:hover { background: var(--slate-50); }
.cal-care-row.sig-red { border-left: 3px solid var(--danger); }
.cal-care-row.sig-yellow { border-left: 3px solid var(--warning); }
.cal-care-row.sig-green { border-left: 3px solid var(--success); opacity: 0.75; }
.cal-avatar.sm { width: 26px; height: 26px; font-size: var(--fs-xs); flex-shrink: 0; }
.cal-avatar.sm { border-radius: 50%; align-items: center; justify-content: center; display: inline-flex; color: #fff; font-weight: 700; overflow: hidden; }
.cal-care-main { flex: 1; min-width: 0; }
.cal-care-l1 { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; font-size: var(--fs-sm); }
.cal-care-l1 b { font-weight: 700; color: var(--slate-900); }
.cal-care-grp {
  font-size: var(--fs-xs);
  color: var(--accent);
  background: rgba(14, 165, 233, 0.1);
  padding: 1px 6px;
  border-radius: var(--r-full);
}
.cal-care-metrics { font-size: var(--fs-xs); color: var(--slate-500); word-break: break-all; }
.cal-care-l2 { margin-top: 5px; display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.cal-reason-pill {
  font-size: var(--fs-xs);
  color: var(--slate-600);
  background: var(--slate-100);
  padding: 2px 8px;
  border-radius: var(--r-full);
}
.cal-reason-pill.warn { color: #b45309; background: #fef3c7; }
.cal-care-tip { font-size: var(--fs-xs); color: var(--brand-600); }
.cal-care-left { font-size: var(--fs-xs); color: var(--slate-400); flex-shrink: 0; }

.cal-card-count.is-warn { background: #fee2e2; color: var(--danger); }

/* PK 竞争 */
.cal-period-title svg { width: 15px; height: 15px; flex-shrink: 0; }
.cal-period-title.is-pk { color: var(--danger); }
.cal-tile-num.is-pk { color: var(--danger); }
.cal-tile-num.over { color: var(--danger); }
.cal-pk-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 2px;
  font-size: var(--fs-xs);
  color: var(--slate-600);
}
.cal-pk-row + .cal-pk-row { border-top: 1px dashed var(--slate-200); }
.cal-pk-row svg { width: 13px; height: 13px; color: var(--slate-300); flex-shrink: 0; }
.cal-pk-mode {
  flex-shrink: 0;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: var(--r-full);
  background: var(--brand-100);
  color: var(--brand-600);
}
.cal-pk-row.is-win .cal-pk-mode { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.cal-pk-res { margin-left: auto; flex-shrink: 0; color: var(--slate-500); }
.cal-pk-row.is-win .cal-pk-res { color: var(--danger); font-weight: 600; }
.cal-pk-date { flex-shrink: 0; color: var(--slate-400); }

/* 趋势环比 */
.cal-trend-rows { display: flex; flex-direction: column; }
.cal-trend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 2px;
  font-size: var(--fs-xs);
  color: var(--slate-500);
}
.cal-trend-row + .cal-trend-row { border-top: 1px dashed var(--slate-200); }
.cal-trend-row b { font-weight: 650; color: var(--slate-800); font-size: var(--fs-sm); }
.tr { font-style: normal; font-weight: 800; }
.tr.up { color: var(--brand); }
.tr.down { color: var(--accent); }
.tr.flat { color: var(--slate-300); }
.cal-trend-row em {
  font-style: normal;
  margin-left: auto;
  min-width: 34px;
  text-align: right;
  font-weight: 700;
  color: var(--slate-700);
}

/* 管控干预 */
.cal-admin-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cal-admin-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 4px;
  background: var(--slate-50);
  border-radius: var(--r-sm);
}
.cal-admin-cell b { font-size: var(--fs-lg); font-weight: 750; color: var(--slate-800); }
.cal-admin-cell span { font-size: var(--fs-xs); color: var(--slate-500); }

/* 组间对比 */
.cal-cmp-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 2px;
  cursor: pointer;
  border-radius: var(--r-xs);
  transition: background var(--dur-1);
}
.cal-cmp-row:hover { background: var(--slate-50); }
.cal-cmp-row.active .cal-rank-fill { background: var(--accent); }
.cal-cmp-name { width: 72px; font-size: var(--fs-xs); font-weight: 600; color: var(--slate-700); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; }
.cal-cmp-val { width: 92px; flex-shrink: 0; text-align: right; font-size: var(--fs-xs); font-weight: 700; color: var(--slate-800); }
.cal-cmp-val i { font-style: normal; font-weight: 400; color: var(--slate-400); margin-left: 4px; }

.subtab-red {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 15px;
  height: 15px;
  margin-left: 5px;
  padding: 0 4px;
  border-radius: var(--r-full);
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
}
.cal-sig-chip {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--r-full);
}
.cal-sig-chip.red { background: #fee2e2; color: var(--danger); }
.cal-sig-chip.yellow { background: #fef3c7; color: #b45309; }

/* 个人档案弹层 */
#calProfileBody { max-height: 66vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.cal-profile-labels { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.cal-profile-rows { margin-top: 12px; }
.cal-profile-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 2px;
  font-size: var(--fs-sm);
  color: var(--slate-500);
}
.cal-profile-row + .cal-profile-row { border-top: 1px dashed var(--slate-200); }
.cal-profile-row b { font-weight: 650; color: var(--slate-900); }
.cal-profile-sec {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--slate-100);
  font-size: var(--fs-xs);
  font-weight: 650;
  color: var(--slate-600);
}
.cal-profile-dates { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cal-pd {
  position: relative;
  font-size: var(--fs-xs);
  padding: 3px 8px;
  border-radius: var(--r-full);
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: var(--brand-600);
  font-weight: 600;
}
.cal-pd.past { opacity: 0.55; }
.cal-pd i {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 14px;
  height: 14px;
  line-height: 14px;
  border-radius: 50%;
  background: var(--state-locked);
  color: #fff;
  font-size: 8px;
  font-style: normal;
  text-align: center;
}
.cal-profile-acts { margin-top: 8px; display: flex; flex-direction: column; }
.cal-profile-act {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 2px;
  font-size: var(--fs-xs);
  color: var(--slate-600);
}
.cal-profile-act + .cal-profile-act { border-top: 1px dashed var(--slate-200); }
.cal-profile-act i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cal-profile-act i.pk { background: var(--danger); }
.cal-profile-act i.admin { background: var(--brand); }
.cal-profile-act span { flex: 1; min-width: 0; }
.cal-profile-act em { font-style: normal; color: var(--slate-400); flex-shrink: 0; }

@media (max-width: 768px) {
  .cal-sigbar { padding: 9px 12px; gap: 6px 12px; }
  .cal-admin-grid { grid-template-columns: repeat(2, 1fr); }
  .cal-care-metrics { width: 100%; }
  .cal-cmp-name { width: 58px; }
  .cal-cmp-val { width: 78px; }
  .cal-badge.hot { left: 3px; min-width: 14px; height: 14px; font-size: 9px; line-height: 14px; }
}
