:root {
  --bg-page: #f4f7fb;
  --bg-surface: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-hover: #f1f5f9;
  --border-light: #e2e8f0;
  --border-medium: #cbd5e1;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --brand-600: #2563eb;
  --brand-700: #1d4ed8;
  --brand-50: #eff6ff;
  --brand-100: #dbeafe;

  /* 法定假日（需排班） */
  --holiday-bg: #ecfdf5;
  --holiday-border: #6ee7b7;
  --holiday-text: #047857;

  /* 重要长假标识 */
  --major-bg: #fff1f2;
  --major-border: #fda4af;
  --major-text: #e11d48;

  /* 调班补休 / 调休日（需排班） */
  --workday-bg: #e0f2fe;
  --workday-border: #7dd3fc;
  --workday-text: #0369a1;
  --workday-badge: #0284c7;

  /* 已互换（换） */
  --swap-bg: #eef2ff;
  --swap-border: #818cf8;
  --swap-badge: #4f46e5;

  /* 已代班（代） */
  --sub-bg: #fffbeb;
  --sub-border: #fbbf24;
  --sub-badge: #d97706;

  /* 待重新分配 */
  --alert-bg: #fef2f2;
  --alert-border: #f87171;
  --alert-badge: #dc2626;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 16px 36px rgba(15, 23, 42, 0.14);
}

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

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* 顶部导航栏 */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
}

.header-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
  flex-shrink: 0;
}

.brand-title h1 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 年份切换器 */
.year-switcher {
  display: flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.year-btn {
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.18s ease;
}

.year-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.year-btn.active {
  background: var(--brand-600);
  color: #fff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.28);
}

.year-add-btn {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--brand-600);
  font-weight: 600;
}

.year-add-btn:hover {
  background: var(--brand-50);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* 通用按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.16s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--brand-600);
  color: #fff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.22);
}

.btn-primary:hover {
  background: var(--brand-700);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #fff;
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-medium);
}

.btn-soft {
  background: var(--brand-50);
  color: var(--brand-700);
  border: 1px solid var(--brand-100);
}

.btn-soft:hover {
  background: var(--brand-100);
}

.btn-warning {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fcd34d;
}

.btn-warning:hover {
  background: #fef3c7;
}

.btn-danger {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.btn-danger:hover {
  background: #fee2e2;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

/* 主导航栏（桌面端） */
.nav-bar-wrap {
  background: #fff;
  border-bottom: 1px solid var(--border-light);
}

.nav-bar {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.main-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
}

.main-tab {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2.5px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.16s ease;
  white-space: nowrap;
}

.main-tab:hover {
  color: var(--brand-600);
}

.main-tab.active {
  color: var(--brand-600);
  border-bottom-color: var(--brand-600);
}

.tab-badge {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--bg-hover);
  color: var(--text-secondary);
  font-weight: 600;
}

.main-tab.active .tab-badge {
  background: var(--brand-50);
  color: var(--brand-600);
}

.tab-badge.alert {
  background: #dc2626;
  color: #fff;
}

.handoff-hint {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 主内容区 */
.app-main {
  max-width: 1360px;
  margin: 0 auto;
  padding: 20px 20px 90px;
}

/* 预警横幅（人员停用待重新分配） */
.reassign-banner {
  background: linear-gradient(90deg, #fef2f2 0%, #fff1f2 100%);
  border: 1px solid #fca5a5;
  border-left: 4px solid #dc2626;
  border-radius: var(--radius-lg);
  padding: 13px 18px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}

.reassign-banner-text {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: #991b1b;
  font-weight: 500;
}

/* 工具栏与图例 */
.schedule-toolbar {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.segmented-control {
  display: inline-flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 3px;
}

.seg-btn {
  padding: 6px 13px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.15s;
}

.seg-btn.active {
  background: #fff;
  color: var(--brand-600);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.legend-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-secondary);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  display: inline-block;
}

.legend-dot.holiday { background: var(--holiday-bg); border: 1.5px solid var(--holiday-border); }
.legend-dot.workday { background: var(--workday-bg); border: 1.5px solid var(--workday-border); }
.legend-dot.swap { background: var(--swap-bg); border: 1.5px solid var(--swap-border); }
.legend-dot.sub { background: var(--sub-bg); border: 1.5px solid var(--sub-border); }
.legend-dot.alert { background: var(--alert-bg); border: 1.5px solid var(--alert-border); }

.filter-select {
  padding: 6px 11px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: #fff;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
}

.filter-select:focus {
  border-color: var(--brand-600);
}

/* ==================== 节日列表视图 ==================== */
.festival-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.festival-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.festival-card:hover {
  box-shadow: var(--shadow-md);
}

.festival-header {
  padding: 14px 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.festival-card.collapsed .festival-header {
  border-bottom: none;
}

.festival-card.collapsed .festival-body {
  display: none;
}

.festival-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.festival-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}

.badge-major {
  background: var(--major-bg);
  color: var(--major-text);
  border: 1px solid var(--major-border);
}

.badge-count {
  background: var(--holiday-bg);
  color: var(--holiday-text);
  border: 1px solid var(--holiday-border);
}

.badge-workday {
  background: var(--workday-bg);
  color: var(--workday-text);
  border: 1px solid var(--workday-border);
}

.festival-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.festival-body {
  padding: 16px 18px;
}

.duty-slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 12px;
}

.duty-slot-card {
  position: relative;
  border-radius: var(--radius-md);
  padding: 12px 13px;
  background: var(--holiday-bg);
  border: 1.5px solid var(--holiday-border);
  cursor: pointer;
  transition: all 0.16s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.duty-slot-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.08);
}

.duty-slot-card.is-workday {
  background: var(--workday-bg);
  border: 1.5px solid var(--workday-border);
  cursor: pointer;
}

.duty-slot-card.is-swap {
  background: var(--swap-bg);
  border-color: var(--swap-border);
}

.duty-slot-card.is-substitute {
  background: var(--sub-bg);
  border-color: var(--sub-border);
}

.duty-slot-card.is-reassign {
  background: var(--alert-bg);
  border-color: var(--alert-border);
  animation: pulseBorder 2s infinite;
}

.duty-slot-card.is-off-duty {
  background: #f8fafc;
  border: 1.5px dashed var(--border-medium);
  opacity: 0.78;
}

@keyframes pulseBorder {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.18); }
  50% { box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.12); }
}

.slot-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.slot-date {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.slot-weekday {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-left: 4px;
  font-weight: 500;
}

.slot-lunar-tag {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 700;
  background: rgba(15, 23, 42, 0.06);
  color: #334155;
}

.slot-lunar-tag.key-day {
  background: #ffe4e6;
  color: #e11d48;
  border: 1px solid #fecdd3;
}

.slot-badges {
  display: flex;
  align-items: center;
  gap: 4px;
}

.corner-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 5px;
  color: #fff;
  line-height: 1.4;
}

.corner-tag.swap { background: var(--swap-badge); }
.corner-tag.sub { background: var(--sub-badge); }
.corner-tag.alert { background: var(--alert-badge); }
.corner-tag.lieu { background: var(--workday-badge); }
.corner-tag.work { background: #64748b; }
.corner-tag.rest { background: #10b981; }

.lock-icon {
  font-size: 11px;
  color: var(--text-secondary);
}

.slot-person {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
}

.staff-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.staff-name-main {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.staff-phone-sub {
  font-size: 11.5px;
  color: var(--text-secondary);
}

.slot-change-hint {
  font-size: 11.5px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.72);
  padding: 4px 7px;
  border-radius: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==================== 月历视图 ==================== */
.calendar-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 10px;
  flex-wrap: wrap;
}

.months-grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 18px;
}

.months-grid-container.single-month {
  grid-template-columns: 1fr;
}

.month-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.month-card-header {
  padding: 12px 16px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 15px;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: #fff;
  border-bottom: 1px solid var(--border-light);
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 8px 0;
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border-light);
}

.cal-cell {
  background: #fff;
  min-height: 78px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  transition: background 0.14s;
}

.months-grid-container.single-month .cal-cell {
  min-height: 104px;
  padding: 8px 10px;
}

.cal-cell.empty {
  background: #f8fafc;
}

.cal-cell.weekend .cal-day-num {
  color: #64748b;
}

.cal-cell.is-holiday {
  background: var(--holiday-bg);
  cursor: pointer;
}

.cal-cell.is-holiday:hover {
  filter: brightness(0.97);
}

.cal-cell.is-holiday-off {
  background: #f8fafc;
  cursor: pointer;
}

.cal-cell.is-workday {
  background: var(--workday-bg);
  cursor: pointer;
}

.cal-cell.is-workday:hover {
  filter: brightness(0.97);
}

.cal-cell.is-swap {
  background: var(--swap-bg);
  box-shadow: inset 0 0 0 1.5px var(--swap-border);
}

.cal-cell.is-substitute {
  background: var(--sub-bg);
  box-shadow: inset 0 0 0 1.5px var(--sub-border);
}

.cal-cell.is-reassign {
  background: var(--alert-bg);
  box-shadow: inset 0 0 0 2px var(--alert-border);
}

.cal-cell.is-today .cal-day-num {
  background: var(--brand-600);
  color: #fff;
  border-radius: 999px;
  padding: 0 6px;
}

.cal-cell-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
}

.cal-day-num {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.cal-fest-label {
  font-size: 10.5px;
  color: var(--holiday-text);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-fest-label.key-day {
  color: #e11d48;
  font-weight: 700;
}

.cal-lunar-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.cal-lunar-sub.key-day {
  color: #e11d48;
  font-weight: 600;
}

.cal-cell.is-workday .cal-fest-label {
  color: var(--workday-text);
}

.cal-duty-box {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cal-staff-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-staff-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cal-orig-hint {
  font-size: 10px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==================== 悬浮详情 Tooltip ==================== */
.floating-tooltip {
  position: fixed;
  z-index: 999;
  max-width: 290px;
  background: #0f172a;
  color: #f8fafc;
  padding: 10px 13px;
  border-radius: var(--radius-md);
  font-size: 12px;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.28);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
  line-height: 1.55;
}

.floating-tooltip.visible {
  opacity: 1;
}

.tooltip-arrow-line {
  color: #93c5fd;
  font-weight: 600;
  margin: 3px 0;
}

/* ==================== 假期配置 & 人员管理 & 统计面板 ==================== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.section-title h2 {
  font-size: 18px;
  font-weight: 700;
}

.section-title p {
  font-size: 13px;
  color: var(--text-secondary);
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}

.config-card {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.config-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.date-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.date-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--holiday-border);
  background: var(--holiday-bg);
  color: var(--holiday-text);
  transition: all 0.14s;
}

.date-chip.off-duty {
  background: #f8fafc;
  border-color: var(--border-medium);
  color: var(--text-muted);
  text-decoration: line-through;
}

.date-chip.workday-chip {
  background: var(--workday-bg);
  border-color: var(--workday-border);
  color: var(--workday-text);
  cursor: pointer;
}

.date-chip.workday-chip.off-duty {
  background: #f8fafc;
  border-color: var(--border-medium);
  color: var(--text-muted);
  text-decoration: line-through;
}

/* 人员表格与卡片 */
.panel-card {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 18px;
}

.panel-card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table th {
  text-align: left;
  padding: 11px 16px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12.5px;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: #fafcff;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.status-pill.active {
  background: #dcfce7;
  color: #15803d;
}

.status-pill.inactive {
  background: #f1f5f9;
  color: #64748b;
}

.order-btns {
  display: inline-flex;
  gap: 4px;
}

.icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border-light);
  background: #fff;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.icon-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* KPI 统计卡片 */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi-card {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}

.kpi-label {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
}

.kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.bar-track {
  width: 100%;
  max-width: 220px;
  height: 10px;
  background: var(--bg-hover);
  border-radius: 999px;
  overflow: hidden;
  display: flex;
}

.bar-fill-major {
  background: #f43f5e;
  height: 100%;
}

.bar-fill-normal {
  background: #2563eb;
  height: 100%;
}

.bar-fill-lieu {
  background: #0ea5e9;
  height: 100%;
}

/* ==================== 弹窗 Modal ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-dialog {
  background: #fff;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn 0.18s ease-out;
}

.modal-dialog.modal-lg {
  max-width: 740px;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 16.5px;
  font-weight: 700;
}

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 18px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--bg-hover);
}

.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-footer {
  padding: 13px 20px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* 表单组件 */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

.form-hint {
  font-size: 12px;
  color: var(--text-secondary);
}

.form-control {
  padding: 9px 12px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  font-size: 13.5px;
  color: var(--text-primary);
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}

.form-control:focus {
  border-color: var(--brand-600);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

textarea.form-control {
  min-height: 84px;
  resize: vertical;
}

.radio-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radio-card {
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 13px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  transition: all 0.15s;
}

.radio-card.selected {
  border-color: var(--brand-600);
  background: var(--brand-50);
}

.swap-info-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 13px;
}

/* 长图预览容器 */
.poster-preview-wrap {
  background: #e2e8f0;
  border-radius: var(--radius-md);
  padding: 14px;
  max-height: 55vh;
  overflow-y: auto;
  display: flex;
  justify-content: center;
}

.poster-preview-wrap canvas {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.16);
}

/* Toast 提示 */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #0f172a;
  color: #fff;
  padding: 11px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastSlide 0.22s ease-out;
}

.toast.success { border-left: 4px solid #10b981; }
.toast.warning { border-left: 4px solid #f59e0b; }
.toast.error { border-left: 4px solid #ef4444; }

@keyframes toastSlide {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* 移动端底部导航栏 */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-light);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  justify-content: space-around;
}

.mobile-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  position: relative;
}

.mobile-nav-item.active {
  color: var(--brand-600);
}

.mobile-nav-icon {
  font-size: 18px;
}

/* 响应式适配（平板与手机端） */
@media (max-width: 820px) {
  .nav-bar-wrap {
    display: none;
  }

  .mobile-bottom-nav {
    display: flex;
  }

  .header-inner {
    padding: 10px 14px;
  }

  .brand-subtitle {
    display: none;
  }

  .app-main {
    padding: 14px 12px 86px;
  }

  .months-grid-container {
    grid-template-columns: 1fr;
  }

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

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

  .cal-cell {
    min-height: 66px;
    padding: 4px;
  }

  .cal-staff-pill {
    font-size: 11px;
  }

  .toast-container {
    left: 14px;
    right: 14px;
    bottom: 76px;
  }
}

/* ==================== 多账号登录界面 & 换班二级审批样式 ==================== */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 950;
  background: linear-gradient(135deg, #eff6ff 0%, #f1f5f9 50%, #eef2ff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border-radius: 20px;
  padding: 28px 26px 24px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-brand h2 {
  font-size: 19px;
  font-weight: 800;
  color: var(--text-primary);
}

.login-brand p {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-demo-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.login-demo-box summary {
  cursor: pointer;
  font-weight: 600;
  user-select: none;
}

.demo-acc-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.demo-pill {
  padding: 5px 10px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--border-medium);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  transition: all 0.14s;
}

.demo-pill:hover {
  border-color: var(--brand-600);
  color: var(--brand-600);
}

.demo-pill.admin {
  background: var(--brand-50);
  border-color: var(--brand-100);
  color: var(--brand-700);
}

.user-profile-bar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  padding: 3px 6px 3px 11px;
  font-size: 12.5px;
}

.user-role-tag {
  font-weight: 700;
  color: var(--text-primary);
}

/* 员工端“我的排班”高亮 */
.duty-slot-card.is-mine {
  box-shadow: 0 0 0 2px #2563eb;
}

.cal-cell.is-mine {
  box-shadow: inset 0 0 0 2px #2563eb;
}

.corner-tag.mine {
  background: #2563eb;
}

.corner-tag.pending-req {
  background: #7c3aed;
}

.my-duty-strip {
  background: linear-gradient(90deg, #eff6ff 0%, #f5f3ff 100%);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.approval-notice-banner {
  background: linear-gradient(90deg, #eef2ff 0%, #eff6ff 100%);
  border: 1px solid #a5b4fc;
  border-left: 4px solid #4f46e5;
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* 审批卡片与三步流程条 */
.req-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.req-card {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.req-card.highlight-action {
  border-color: #818cf8;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.09);
}

.req-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.req-exchange-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.req-party {
  flex: 1;
  min-width: 180px;
}

.req-arrow {
  font-size: 20px;
  font-weight: 800;
  color: var(--brand-600);
}

.req-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
}

.step-node {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  font-weight: 600;
}

.step-node.done {
  background: #dcfce7;
  color: #15803d;
}

.step-node.current {
  background: #dbeafe;
  color: #1d4ed8;
}

.step-node.rejected {
  background: #fee2e2;
  color: #dc2626;
}

.mobile-unread-dot {
  position: absolute;
  top: 2px;
  right: 22%;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
