/* =========================================================
   考勤核算助手 - 主样式表
   设计风格：现代简洁（Apple Design 风格，毛玻璃顶栏 + 卡片式布局）
   色彩体系：以主题色变量统一管理，主色为蓝色渐变
   ========================================================= */

/* ---------- 主题色变量 ---------- */
:root {
  /* 主色（蓝色渐变） */
  --primary: #2B7DED;
  --primary-light: #3D92FF;
  --primary-grad: linear-gradient(135deg, #3D92FF 0%, #2B7DED 100%);
  --primary-weak: #EAF3FF;

  /* 语义色 */
  --danger: #FF6B6B;        /* 危险/警示 */
  --warning: #FFB800;       /* 警告 */
  --success: #67C23A;       /* 成功 */
  --theme-green: #00A473;   /* 主题绿（次要操作） */

  /* 考勤标注色（与导出格式一致） */
  --late-color: #E5484D;          /* 迟到：红色字体 */
  --missed-fill: #FFF3C2;         /* 未打卡：淡黄色填充 */
  --exclude-color: #8B5CF6;       /* 迟到不统计：紫色字体 */
  --holiday-color: #E5484D;       /* 节假日文字 */

  /* 中性色 */
  --bg: #F5F7FB;                  /* 页面背景 */
  --card: #FFFFFF;                /* 卡片背景 */
  --text: #1F2D3D;                /* 主文字 */
  --text-2: #5A6B85;              /* 次级文字 */
  --muted: #8A94A6;               /* 弱化文字 */
  --line: #E8ECF3;                /* 分割线 */
  --border: #D9E0EB;              /* 边框（表格/卡片描边，比分割线略深保证可见） */
  --hover: #F3F7FE;               /* 悬停背景 */

  /* 圆角与阴影 */
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(31, 45, 61, .06);
  --shadow-md: 0 6px 20px rgba(31, 45, 61, .08);
  --shadow-pop: 0 12px 32px rgba(31, 45, 61, .16);
}

/* ---------- 基础重置 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
}

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

button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

/* ---------- 细滚动条（全局统一 6px 圆角样式） ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #C8CCD1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9AA0A6; }
* { scrollbar-width: thin; scrollbar-color: #C8CCD1 transparent; }

/* =========================================================
   顶部导航栏（毛玻璃）
   ========================================================= */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, .78);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid rgba(232, 236, 243, .9);
}

.header-left { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.logo-mark {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--primary-grad);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(43, 125, 237, .35);
}

.header-title h1 { font-size: 17px; font-weight: 700; letter-spacing: .5px; }
.header-sub { font-size: 12px; color: var(--muted); }

/* 三步流程指示器（置于标题后方，与标题同行） */
.step-nav { display: flex; align-items: center; gap: 8px; margin-left: 16px; padding-left: 16px; border-left: 1px solid var(--border); }

.step {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  background: transparent;
  transition: all .25s ease;
}

.step i {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #E4E9F2;
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .25s ease;
}

.step.active { color: var(--primary); background: var(--primary-weak); font-weight: 600; }
.step.active i { background: var(--primary-grad); color: #fff; }
.step.done { color: var(--theme-green); }
.step.done i { background: var(--theme-green); color: #fff; }

.step-arrow {
  width: 20px;
  height: 1px;
  background: #D7DEE9;
  position: relative;
}
.step-arrow::after {
  content: "";
  position: absolute;
  right: 0;
  top: -2.5px;
  border-left: 5px solid #D7DEE9;
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
}

.header-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; margin-left: auto; }

/* =========================================================
   按钮体系（主色渐变 / 次级描边 / 幽灵 / 危险）
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  transition: all .18s ease;
  white-space: nowrap;
  user-select: none;
}

.btn:active { transform: scale(.97); }
.btn svg { flex-shrink: 0; }

.btn-primary {
  background: var(--primary-grad);
  color: #fff;
  box-shadow: 0 4px 12px rgba(43, 125, 237, .3);
}
.btn-primary:hover { filter: brightness(1.06); box-shadow: 0 6px 16px rgba(43, 125, 237, .4); }

/* 已确认考勤态：主题绿（再次点击可取消确认） */
.btn-confirmed {
  background: #00A473;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 164, 115, .3);
}
.btn-confirmed:hover { filter: brightness(1.06); box-shadow: 0 6px 16px rgba(0, 164, 115, .4); }

.btn-secondary {
  background: #fff;
  border-color: var(--line);
  color: var(--text-2);
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-weak); }

.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--hover); color: var(--primary); }

.btn-danger { background: #fff1f1; color: var(--danger); border-color: #ffdcdc; }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; border-radius: 8px; }

/* =========================================================
   主体布局
   ========================================================= */
.app-main {
  /* 不限制最大宽度：打卡明细表格需占满整个界面宽度 */
  width: 100%;
  margin: 0 auto;
  padding: 20px 24px 20px;
  box-sizing: border-box;
}

/* 标签页切换条 */
.tab-bar {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: #ECEFF5;
  border-radius: 12px;
  margin-bottom: 16px;
}

/* 头部内嵌模式（置于标题与流程说明之间）：去掉独立条的下外边距，整体左右加边距与标题/流程说明拉开间距 */
.tab-bar.in-header { margin: 0 14px; flex-shrink: 0; }
.tab-bar.in-header .tab-item { padding: 7px 16px; }

.tab-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  padding: 8px 20px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  transition: all .2s ease;
}

.tab-item:hover { color: var(--primary); }
.tab-item.active { background: #fff; color: var(--primary); font-weight: 600; box-shadow: var(--shadow-sm); }

.tab-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--primary-weak);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tab-panel { display: none; animation: fadeIn .25s ease; }
.tab-panel.active { display: block; }

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

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(232, 236, 243, .8);
}

.table-card { overflow: hidden; }

.card-title { font-size: 15px; font-weight: 600; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 0;
}

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

.panel-toolbar.inside-card {
  padding: 14px 20px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--line);
}

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

/* ---------- 部门多选筛选下拉 ---------- */
.dept-select { position: relative; display: inline-block; }
.dept-toggle { width: 170px; text-align: left; cursor: pointer; justify-content: space-between; display: flex; align-items: center; }
.dept-toggle::after { content: '▾'; margin-left: 8px; color: var(--muted); font-size: 12px; }
.dept-toggle.has-sel { border-color: var(--primary); color: var(--primary); background: var(--primary-weak); }
.dept-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 120;
  min-width: 200px;
  max-height: 320px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-pop);
  padding: 6px;
}
/* 面板顶部操作按钮组（全选/反选/清除） */
.dept-panel .dp-actions {
  display: flex;
  gap: 6px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
.dept-panel .dp-btn {
  flex: 1;
  padding: 5px 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
  transition: all .15s ease;
}
.dept-panel .dp-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-weak); }
.dept-panel label.dp-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
  border-radius: 6px;
  white-space: nowrap;
}
.dept-panel label.dp-item:hover { background: var(--hover); }
.dept-panel input[type="checkbox"] { accent-color: var(--primary); cursor: pointer; }

.field-inline { display: inline-flex; align-items: center; gap: 8px; }
.field-label { font-size: 13px; color: var(--text-2); white-space: nowrap; }

/* ---------- 输入控件 ---------- */
.input {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(43, 125, 237, .12); }
.input-month { width: 150px; }
.input-search { width: 200px; }
.input-date { width: 150px; }
.input-date-name { width: 130px; }

/* ---------- 图例 ---------- */
.legend-group { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }

.dot { width: 10px; height: 10px; border-radius: 3px; }
.dot-late { background: transparent; border: 2px solid var(--late-color); }
.dot-missed { background: var(--missed-fill); border: 1px solid #F2DF9B; }
.dot-exclude { background: transparent; border: 2px solid var(--exclude-color); }
.dot-holiday { background: #FBEAEA; }

/* ---------- 空状态 ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 72px 24px;
  color: var(--muted);
  text-align: center;
}

.empty-icon { color: #C4CCDA; margin-bottom: 4px; }
.empty-title { font-size: 15px; font-weight: 600; color: var(--text-2); }
.empty-desc { font-size: 13px; max-width: 420px; }

/* =========================================================
   打卡明细表（对应图1：人员 x 日期 打卡矩阵）
   ========================================================= */
/* 表格滚动区：预留高度随标签条上移头部而减少（原 250px → 170px），表格可视区域相应增大 */
.table-scroll { overflow: auto; max-height: calc(100vh - 170px); }

.detail-table { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; }

.detail-table th, .detail-table td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid #F0F3F8;
  padding: 0;
  text-align: center;
  background: #fff;
}

/* 表头：日期 */
.detail-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #F7F9FC;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-2);
  padding: 8px 0 2px;
}

.detail-table thead .day-week { display: block; font-size: 11px; color: var(--muted); font-weight: 400; padding-bottom: 6px; }

/* 周末列头标红 */
.detail-table thead th.is-weekend .day-num { color: var(--warning); }
/* 节假日列头标红 */
.detail-table thead th.is-holiday .day-num { color: var(--holiday-color); }
.detail-table thead th.is-holiday .day-week { color: var(--holiday-color); }
/* 调休上班日列头标绿 */
.detail-table thead th.is-adjust .day-num { color: var(--theme-green); }

/* 负责人列（第一列，左侧固定）：连续相同负责人纵向合并，整格负责人浅色背景 */
.detail-table .col-leader {
  position: sticky;
  left: 0;
  z-index: 6;
  min-width: 76px;
  text-align: center;
  vertical-align: middle;
  background: #fff;
}
.detail-table thead .col-leader { z-index: 7; background: #F7F9FC; }
.leader-text {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* 姓名列（左侧固定，偏移到负责人列右侧）：数据格左对齐，仅表头标题居中 */
.detail-table .col-name {
  position: sticky;
  left: 76px;
  z-index: 6;
  min-width: 132px;
  text-align: left;
  background: #fff;
}
.detail-table thead .col-name { z-index: 7; background: #F7F9FC; text-align: center; }

.name-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
}

.name-cell .p-name { font-weight: 600; font-size: 13px; color: var(--text); white-space: nowrap; }
.name-cell .p-meta { font-size: 11px; color: var(--muted); white-space: nowrap; }
.name-cell .p-meta b { color: var(--primary); font-weight: 600; }
.name-cell .p-meta b.late { color: var(--late-color); }

/* 日期单元格 */
.day-cell {
  min-width: 46px;
  height: 44px;
  padding: 3px 4px;
  font-size: 12px;
  cursor: pointer;
  transition: background .15s ease;
  position: relative;
}

.day-cell:hover { background: var(--hover); }
.day-cell .t { display: block; line-height: 1.35; }

/* 周末背景弱化 */
.day-cell.is-weekend { background: #FAFBFD; }
.day-cell.is-holiday { background: #FBEAEA; }
.day-cell.is-holiday .t { color: #D9A0A0; }
.day-cell.is-adjust { background: #F0FAF5; }

/* 迟到：红色字体（可叠加未打卡填充） */
.day-cell.is-late .t { color: var(--late-color); font-weight: 600; }

/* 迟到不统计：紫色字体 */
.day-cell.is-excluded .t { color: var(--exclude-color); font-weight: 600; }

/* 未打卡：淡黄色填充 */
.day-cell.is-missed { background: var(--missed-fill) !important; }

/* 已标记覆盖的单元格右上角小圆点 */
.day-cell.has-override::after {
  content: "";
  position: absolute;
  top: 3px;
  right: 3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--exclude-color);
  opacity: .7;
}

/* 行选中高亮 */
.detail-table tr.row-selected td { background: #F0F6FF !important; }
/* 已确认考勤的人员姓名栏浅绿背景（明细表 + 统计表，需覆盖固定列白底） */
.detail-table td.col-name.name-confirmed,
.stats-table td.sum-name.name-confirmed { background: #E8F7F0 !important; }

/* 离职人员（姓名带「(离)」后缀）：姓名单元格红色背景（明细/统计/申报三表一致） */
.detail-table td.col-name.name-resigned,
.stats-table td.sum-name.name-resigned { background: #FDE2E2 !important; }
.declare-table td.d-resigned { background: #FDE2E2; }

/* 姓名可点击：打开该人员考勤详情弹窗（蓝字可点击，悬停加深 + 下划线；与离职红底共存） */
.declare-table td.d-name-click { color: var(--primary); font-weight: 600; cursor: pointer; user-select: none; transition: background .12s; }
.declare-table td.d-name-click:hover { color: #1E66C9; text-decoration: underline; background: var(--primary-weak); }
.declare-table td.d-name-click.d-resigned { color: #C0404C; } /* 离职姓名保持红调但同样可点击 */

.detail-table tr.row-selected td.col-name { background: #F0F6FF !important; }

/* =========================================================
   明细表右侧汇总列（应出勤/实出勤/迟到各档/未打卡/外勤/加班）
   ========================================================= */
.detail-table .sum-head {
  min-width: 48px;         /* 与日期列宽度保持一致 */
  max-width: 64px;
  padding: 6px 4px;
  background: #EEF3FB;     /* 与日期列头区分的淡蓝底 */
  line-height: 1.3;
  vertical-align: middle;
  word-break: break-all;   /* 允许表头文字换行 */
}

.detail-table .sum-cell {
  min-width: 48px;
  max-width: 64px;
  padding: 0 4px;
  font-size: 12px;
  background: #FAFBFD;     /* 汇总区浅灰底，与日期格区分 */
  height: 44px;
  word-break: break-all;   /* 允许数字换行（如 270.67） */
  line-height: 1.4;
}

/* 迟到分档各列与加班总时长列：固定宽度 48px（用户指定） */
.detail-table .col-tier,
.detail-table .col-ot-min { min-width: 48px; max-width: 48px; }

/* 备注列（明细表最后）：固定宽度、左对齐、自动换行 */
.detail-table .note-head {
  min-width: 300px;
  max-width: 300px;
}
.detail-table .note-cell {
  min-width: 300px;
  max-width: 300px;
  padding: 0 6px;
  font-size: 12px;
  background: #FAFBFD;
  text-align: left;
  line-height: 1.5;
  word-break: break-all;   /* 长备注自动换行 */
}

/* 汇总区与日期区的分隔粗边框 */
.detail-table .sum-first {
  border-left: 2px solid #DCE3EE;
}

/* 汇总数值颜色标注（与统计结果页一致） */
.detail-table td.num-late { color: var(--late-color); font-weight: 600; }
.detail-table td.num-missed { color: #C58A00; font-weight: 600; }
.detail-table td.num-exclude { color: var(--exclude-color); font-weight: 600; }
.detail-table td.num-waiqin { color: var(--primary); font-weight: 600; }
.detail-table td.num-ot { color: var(--primary); font-weight: 600; }
/* 应出勤/实出勤不一致标识：实出勤不足红色警示，超出蓝色提示 */
.detail-table td.num-under { color: var(--late-color); font-weight: 700; background: #FFF5F5; }
.detail-table td.num-over { color: var(--primary); font-weight: 700; background: #F0F7FF; }

/* 外勤/外出打卡标识：明细格子内"外勤"/"外出"字样蓝色突出 */
.day-cell .wq-mark { font-style: normal; color: var(--primary); font-weight: 600; }
/* 人员弹框日历格内的「外勤」/「外出」字样：与明细表同款蓝色加粗 */
.pm-day .wq-mark { font-style: normal; color: var(--primary); font-weight: 600; }
/* 弹层汇总明细行的「外出」/「外勤」字样：同款蓝色加粗 */
.popover-body .wq-mark { font-style: normal; color: var(--primary); font-weight: 600; }

/* ---------- 待确认（需沟通核对）标识体系 ---------- */
/* 弹框底部「标记待确认」按钮：橙色警示风格（确认考勤前的过渡操作） */
.btn-pending {
  background: #FFF7E8;
  color: #B27B00;
  border: 1px solid #F0D9A8;
}
.btn-pending:hover { background: #FFEFCE; }
/* 已标记状态：橙色加深填充（按钮文字变为「取消待确认」） */
.btn-pending.btn-pending-on {
  background: #E8A23D;
  color: #fff;
  border-color: #E8A23D;
}
/* 待确认徽章（明细表姓名旁 / 统计表姓名旁 / 弹框标题旁） */
.need-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  font-style: normal;
  font-size: 10px;
  font-weight: 600;
  border-radius: 999px;
  background: #FFF3D6;
  color: #B27B00;
  border: 1px solid #F0D9A8;
  vertical-align: middle;
  line-height: 16px;
}
/* 待确认人员姓名格背景（明细表 col-name / 统计表 sum-name）：淡橙底 */
td.name-need { background: #FFF7E8; }

/* ---------- 申报表单元格点击编辑 ---------- */
/* 可编辑单元格：悬停蓝色描边提示可点击；编辑态白底蓝框聚焦 */
.declare-table td.dec-cell { cursor: pointer; }
.declare-table td.dec-cell:hover { box-shadow: inset 0 0 0 1.5px var(--primary); }
.declare-table td.dec-cell[contenteditable="true"] {
  cursor: text;
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  background: #fff;
  box-shadow: none;
}
/* 手动编辑过的单元格：浅黄底提示为手动值（清空内容即恢复系统值） */
.declare-table td.dec-edited { background: #FFFBEB; }

/* 姓名列外勤徽章（有外勤打卡的人员突出显示） */
.p-name .wq-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  font-style: normal;
  font-size: 10px;
  font-weight: 600;
  line-height: 16px;
  color: var(--primary);
  background: #EAF2FE;
  border: 1px solid #BCD7FC;
  border-radius: 8px;
  vertical-align: 1px;
}

/* =========================================================
   KPI 汇总卡片
   ========================================================= */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.kpi-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(232, 236, 243, .8);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform .2s ease, box-shadow .2s ease;
}

.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.kpi-label { font-size: 12px; color: var(--muted); }
.kpi-value { font-size: 26px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 3px; }
.kpi-value.c-danger { color: var(--danger); }
.kpi-value.c-warning { color: var(--warning); }
.kpi-value.c-primary { color: var(--primary); }
.kpi-value.c-green { color: var(--theme-green); }

/* =========================================================
   统计结果表（对应图2数据格式）
   ========================================================= */
.stats-table { border-collapse: separate; border-spacing: 0; width: 100%; }

.stats-table th, .stats-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 12px;
  font-size: 13px;
  text-align: center;
  white-space: nowrap;
}

.stats-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #F7F9FC;
  color: var(--text-2);
  font-weight: 600;
  font-size: 12px;
  border-bottom: 1px solid var(--line);
}

.stats-table td:first-child, .stats-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 4;
  background: #fff;
  text-align: left;
  font-weight: 600;
  box-shadow: 4px 0 8px -6px rgba(31, 45, 61, .12);
}

.stats-table thead th:first-child { z-index: 6; background: #F7F9FC; }

.stats-table tbody tr { transition: background .15s ease; }
.stats-table tbody tr:hover { background: var(--hover); }
.stats-table tr.row-selected td { background: #F0F6FF !important; }

/* 数值颜色标注：迟到 >0 标红 */
.stats-table td.num-late { color: var(--late-color); font-weight: 600; }
.stats-table td.num-missed { color: #C58A00; font-weight: 600; }
.stats-table td.num-ot { color: var(--primary); font-weight: 600; }
/* 应出勤/实出勤不一致标识：与明细表同色系 */
.stats-table td.num-under { color: var(--late-color); font-weight: 700; background: #FFF5F5; }
.stats-table td.num-over { color: var(--primary); font-weight: 700; background: #F0F7FF; }
.stats-table td.num-waiqin { color: var(--primary); font-weight: 600; }

/* 表头红色标注：扣除列有数据时（迟到扣除/未打卡扣除）标题标红，无数据保持普通色 */
.stats-table th.head-danger,
.detail-table th.head-danger {
  color: var(--late-color) !important;
  font-weight: 700;
}

/* =========================================================
   部门核算规则编辑区（规则配置页）
   ========================================================= */
.dept-rules-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* 最大高度 80vh，超出显示滚动条（全局细滚动条样式） */
  max-height: 80vh;
  overflow-y: auto;
  padding-right: 4px; /* 预留滚动条空间，避免遮挡卡片内容 */
}

/* ============ 考勤申报表（22 列对齐 HR 上报 Excel：全边框 + 表头固定 + 宽度不超出界面） ============ */
/* 申报表外层容器：内部滚动（表头 sticky 吸顶），页面整体不出现滚动条 */
.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 175px); /* 视口高度减去顶部导航与工具条占位 */
}

/* =========================================================
   考勤申报表（Excel 申报格式 21 列）
   宽度策略：width:100% + min-width 下限 —— 屏宽足够时占满不出滚动，
   屏宽不足时在 .table-wrap 容器内横向滚动（页面布局不被撑破）
   border-collapse: separate —— 配合表头 sticky（collapse 模式下吸顶表头边框会丢失）
   ========================================================= */
.declare-table {
  width: 100%;
  min-width: 1600px;         /* 列宽下限：屏宽足够时占满容器不出滚动；屏宽不足时容器内横向滚动（表头随内容一起滚动，纵向仍吸顶） */
  table-layout: fixed;       /* 固定布局：列宽按表头比例分配，总宽度受 min-width 约束 */
  border-collapse: separate;
  border-spacing: 0;         /* 无间隙，单元格边框拼成完整网格 */
  background: #fff;
  font-size: 12.5px;
}
.declare-table th, .declare-table td {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 7px 8px;
  text-align: center;        /* 申报表列内容居中对齐 */
  word-break: break-all;     /* 内容可断行，配合 fixed 布局确保不撑宽 */
  overflow: hidden;
}
/* 网格封口（separate 模式需手动补齐四周）：表头上边框 + 各行首列左边框 */
.declare-table thead th {
  position: sticky;          /* 表头固定：容器内滚动时表头吸顶 */
  top: 0;
  z-index: 2;
  background: #F5F7FB;
  font-weight: 600;
  color: var(--text);
  white-space: normal;       /* 长表头（房补200/餐补300 等）允许换行压缩列宽 */
  border-top: 1px solid var(--border);
}
.declare-table tr > *:first-child { border-left: 1px solid var(--border); }
.declare-table tbody tr { height: 36px; }        /* 数据行固定行高 */
.declare-table tbody td {
  height: 36px;
  white-space: nowrap;      /* 数据行不换行：内容超出时横向裁剪，保证行高严格一致 */
}
.declare-table tbody tr:hover { background: #F8FAFD; }
/* 关键列宽（fixed 布局列宽由表头行决定，其余列自动均分） */
.declare-table thead th:nth-child(1) { width: 3.5%; }   /* 序号 */
.declare-table thead th:nth-child(2) { width: 6.5%; }   /* 部门（位于姓名前） */
.declare-table thead th:nth-child(3) { width: 6.5%; }   /* 姓名 */
.declare-table thead th:nth-child(4) { width: 5.5%; }   /* 职务 */
.declare-table thead th:nth-child(5) { width: 6%; }     /* 入职日期 */
.declare-table thead th:nth-child(23) { width: 400px; }  /* 备注（最后列，固定 400px 宽） */
/* 扣除三列（迟到早退扣除/未打卡扣除/应扣除餐补）：表头与有数据单元格均为红字 */
.declare-table .d-red { color: var(--late-color); }
/* 应出勤与实出勤不相等：两个单元格同时标红 */
.declare-table td.cell-diff { color: var(--late-color); font-weight: 600; }
/* 备注列：左对齐，红色字体，允许换行完整显示手动备注（覆盖数据行 nowrap，长备注自动撑高行） */
.declare-table td.d-note {
  text-align: left;
  white-space: normal;
  word-break: break-all;
  line-height: 1.6;
  color: var(--late-color);  /* 备注字体红色（与扣除列同色） */
}

.dept-rule-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #FAFBFD;
  overflow: hidden; /* 折叠时圆角内裁剪 */
}

/* 折叠头：点击展开/折叠整条规则（默认折叠，用户 2026-10-14 要求） */
.dept-rule-card .dr-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
}
.dept-rule-card .dr-head:hover { background: #F2F5FA; }
.dept-rule-card .dr-arrow {
  font-size: 10px;
  color: var(--text-3, #999);
  transition: transform 0.15s ease;
}
.dept-rule-card.open .dr-arrow { transform: rotate(90deg); }
.dept-rule-card .dr-head-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1, #333);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis; /* 摘要过长省略 */
}
.dept-rule-card .dr-head .dept-rule-del { flex-shrink: 0; }

/* 规则内容区：默认折叠隐藏，open 时展开 */
.dept-rule-card .dr-body { display: none; padding: 2px 16px 14px; }
.dept-rule-card.open .dr-body { display: block; }

.dept-rule-card .dr-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
}

.dept-rule-card .dr-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-2, #666);
}

.dept-rule-card .dr-field .input {
  width: 150px;
  height: 32px;
}

/* 加班分段行 */
.dr-segments { margin-top: 10px; }
.dr-seg-label { display: block; font-size: 12px; color: var(--text-2, #666); margin-bottom: 6px; }
.dr-seg-rows { display: flex; flex-direction: column; gap: 6px; }
.dr-seg-row { display: flex; align-items: center; gap: 6px; }
.dr-seg-row .input { width: 110px; height: 30px; }
.dr-seg-row .seg-sep { font-size: 12px; color: var(--text-3, #999); }
/* 早/中/晚班时间配置行 */
.dr-shifts { margin-top: 10px; }
.dr-shift-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dr-shift-row .input { width: 110px; height: 30px; }
/* 班次半天分段输入（上午下班/下午上班）：略窄于起止时间输入 */
.dr-shift-row .input.dr-shift-amend, .dr-shift-row .input.dr-shift-pmstart { width: 88px; }
.dr-shift-row .seg-sep { font-size: 12px; color: var(--text-3, #999); }
.dr-shift-row .shift-name { display: inline-block; min-width: 34px; text-align: center; font-size: 12px; color: var(--text-2, #666); background: var(--bg-2, #F5F7FA); border-radius: 4px; padding: 4px 6px; }
/* 晚班行跨天说明（跨天班次无半天分段，仅起止两框） */
.dr-shift-row .shift-tip { font-size: 12px; color: var(--text-3, #999); }
.dr-seg-del, .dept-rule-del {
  border: none; background: transparent; cursor: pointer;
  color: var(--late-color); font-size: 13px; padding: 4px 8px; border-radius: 6px;
}
.dr-seg-del:hover, .dept-rule-del:hover { background: #FDECEC; }
.dr-seg-none { font-size: 12px; color: var(--text-3, #999); }

.dept-empty {
  padding: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-3, #999);
  border: 1px dashed var(--border);
  border-radius: 10px;
}

.dept-tip { color: var(--text-2, #666); }
.stats-table td.num-fine { color: var(--danger); font-weight: 600; }

/* 合计行 */
.stats-table tr.sum-row td {
  background: #F7F9FC;
  font-weight: 700;
  border-top: 2px solid var(--line);
}

/* 备注可编辑单元格 */
.remark-cell {
  min-width: 300px;
  max-width: 300px;
  white-space: normal;
  text-align: left;
  color: var(--text-2);
  outline: none;
  border-radius: 6px;
  transition: box-shadow .15s ease;
}
.remark-cell:focus { box-shadow: 0 0 0 2px rgba(43, 125, 237, .25); background: #fff; }
.remark-cell:empty::before { content: "点击填写备注"; color: #C4CCDA; }

/* =========================================================
   规则配置页
   ========================================================= */
.config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr; /* 基础规则/迟到分档/节假日调休三卡并排等分撑满整行（用户 2026-10-14 要求） */
  gap: 16px;
  align-items: start;
}

.config-card { padding: 0 0 18px; }

/* 部门核算规则卡片：跨全部列宽 */
.config-card-wide { grid-column: 1 / -1; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
  padding: 16px 20px 0;
}

/* 基础规则表单输入框撑满所在栏位（卡片加宽后输入框同步拉伸，不留右侧空白） */
.form-grid .form-field .input { width: 100%; }

.form-field { display: flex; flex-direction: column; gap: 6px; }
/* 仅记出勤人员名单输入框：占满整行（姓名列表较长） */
.form-field-wide { grid-column: 1 / -1; }
.form-field .field-label { font-size: 12px; color: var(--text-2); }

.form-field-switch { flex-direction: row; align-items: center; justify-content: space-between; padding-top: 14px; }

.form-tip { padding: 12px 20px 0; font-size: 12px; color: var(--muted); }

/* ---------- 部门负责人分配（每部门一行：部门名左侧固定宽，负责人复选框列对齐） ---------- */
.dept-leader-wrap { padding: 8px 20px 16px; }
.dl-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
}
.dl-row:last-child { border-bottom: none; }
.dl-dept { min-width: 200px; font-size: 13px; font-weight: 500; color: var(--text); }
.dl-checks { display: flex; gap: 4px; }
.dl-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 96px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}
.dl-item input { accent-color: var(--primary); cursor: pointer; }
.dl-item:hover { color: var(--primary); }

/* 开关 */
.switch-wrap { position: relative; display: inline-block; width: 42px; height: 24px; }
.switch-input { opacity: 0; width: 0; height: 0; }
.switch-ui {
  position: absolute;
  inset: 0;
  background: #D8DEE9;
  border-radius: 12px;
  cursor: pointer;
  transition: background .2s ease;
}
.switch-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform .2s ease;
}
.switch-input:checked + .switch-ui { background: var(--primary); }
.switch-input:checked + .switch-ui::after { transform: translateX(18px); }

/* 迟到分档编辑表 */
.tier-table {
  width: calc(100% - 40px);
  margin: 12px 20px 0;
  border-collapse: collapse;
}

.tier-table th {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
}

.tier-table td { padding: 6px 4px; border-bottom: 1px dashed #EEF1F6; }

.tier-table .input { height: 30px; font-size: 12px; width: 100%; padding: 0 8px; }
.tier-table td.col-del { width: 32px; text-align: center; }

.tier-del {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .15s ease;
}
.tier-del:hover { background: #FFF1F1; color: var(--danger); }

/* 节假日 / 调休 */
.date-add-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 20px 4px;
  flex-wrap: wrap;
}

.date-chip-area { padding: 8px 20px 0; }

.chip-group-label { font-size: 12px; color: var(--muted); margin: 8px 0 6px; }

.chip-list { display: flex; flex-wrap: wrap; gap: 8px; min-height: 30px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12px;
  background: #FBEAEA;
  color: #C0504D;
}

.chip.chip-adjust { background: #E8F7F0; color: var(--theme-green); }
.chip .chip-x {
  border: none;
  background: transparent;
  color: inherit;
  opacity: .55;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  display: flex;
}
.chip .chip-x:hover { opacity: 1; }
.chip-empty { font-size: 12px; color: #C4CCDA; }

/* =========================================================
   日期单元格详情弹层
   ========================================================= */
.popover-mask {
  position: fixed;
  inset: 0;
  z-index: 305; /* 高于人员弹框（300）：日历格子操作弹层需覆盖在弹框之上 */
  background: transparent;
}

/* ---------- 每日备注红三角角标（右上角，人员弹框日历格与明细表日期格同步显示） ---------- */
.has-comment { position: relative; }
.has-comment::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  border-style: solid;
  border-width: 0 11px 11px 0;
  border-color: transparent var(--danger) transparent transparent;
  pointer-events: none; /* 角标不拦截点击：点击格子整体打开弹层查看备注 */
}

/* ---------- 弹层当日备注编辑区 ---------- */
.popover-comment { margin: 10px 14px 12px; }
.popover-comment .pc-label {
  display: block;
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 4px;
}
.popover-comment textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12.5px;
  font-family: inherit;
  line-height: 1.5;
  color: var(--text);
  resize: vertical;
  min-height: 44px;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.popover-comment textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(43, 125, 237, .12);
}

/* ---------- 弹层「按小时核算出勤」输入行 ---------- */
.popover-actions .ph-label {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
  align-self: center;
}
.popover-actions .input { height: 28px; width: 100%; padding: 0 8px; font-size: 12.5px; }

/* ---------- 按小时核算出勤：浅绿底突出 + 格内小时数标签 ---------- */
/* 明细表日期格：浅绿底 + 绿色描边，与迟到红/未打卡黄/不统计紫区分 */
.detail-table .day-cell.is-hours {
  background: #E8F7F0;
  box-shadow: inset 0 0 0 1px #7FD8B5;
}
/* 人员弹框日历格：同样的浅绿突出 */
.pm-day.is-hours {
  background: #E8F7F0;
  border-color: #7FD8B5;
}
/* 出勤小时数标签（如「出勤6.5小时」）：绿色小标签，明细表与弹框日历共用 */
.h-mark {
  display: inline-block;
  margin-top: 2px;
  padding: 1px 6px;
  border-radius: 4px;
  background: #D9F2E5;
  color: #00875A;
  font-size: 11px;
  font-style: normal;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.cell-popover {
  position: fixed;
  z-index: 310; /* 高于人员弹框（300） */
  width: 440px;  /* 左右布局加宽：左侧信息+备注 / 右侧操作按钮 */
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  border: 1px solid var(--line);
  animation: popIn .18s ease;
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(6px) scale(.97); }
  to { opacity: 1; transform: none; }
}

.popover-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  font-size: 13px;
}

/* 左右布局容器：左侧当日信息+备注，右侧操作按钮列 */
.popover-main { display: flex; align-items: stretch; }
.popover-left { flex: 1; min-width: 0; }       /* 左栏自适应宽度，长文本可换行 */
.popover-right {
  width: 136px;                                 /* 右栏固定宽度容纳按钮文字 */
  flex-shrink: 0;
  border-left: 1px solid var(--line);
  background: #FAFBFD;                          /* 浅灰底区分操作区与信息区 */
  border-radius: 0 0 var(--radius) 0;           /* 适配弹层右下圆角 */
}

.popover-body { padding: 12px 14px 0; font-size: 12px; color: var(--text-2); }
.popover-body .kv-row { display: flex; justify-content: space-between; padding: 3px 0; }
.popover-body .kv-row b { font-weight: 600; color: var(--text); text-align: right; }
.popover-body .v-late { color: var(--late-color); }
.popover-body .v-exclude { color: var(--exclude-color); }
.popover-body .v-warn { color: #C58A00; }

.popover-actions { display: flex; flex-direction: column; gap: 6px; padding: 12px; }
.popover-actions .btn { width: 100%; height: 32px; font-size: 12px; }

/* =========================================================
   人员月度考勤弹框（日历视图）
   布局：左侧月度日历（每日格子填充汇总表明细）+ 右侧汇总统计
   ========================================================= */
/* hidden 属性强制生效：.person-modal 的 display:flex 与 .person-modal-body 的
   display:grid 会覆盖 UA 默认的 [hidden]{display:none}，导致弹框初始即显示、
   点击 × 后 hidden 置位也无法关闭（用户反馈：弹框默认展示/点×不关闭） */
.person-modal[hidden],
.person-modal-mask[hidden],
.person-modal-body[hidden] { display: none !important; }

.person-modal-mask {
  position: fixed;
  inset: 0;
  z-index: 290;
  background: rgba(31, 45, 61, .45);
}

/* =========================================================
   登录验证门（强验证：未登录全屏覆盖，验证通过才进入系统）
   ========================================================= */
.login-gate {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #17325E 0%, #2B7DED 60%, #4D9BFF 100%);
}

/* 登录通过后用 hidden 隐藏：必须显式覆盖上面的 display:flex，否则登录层不会消失 */
.login-gate[hidden] { display: none; }

.login-card {
  width: 360px;
  background: rgba(255, 255, 255, .97);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(10, 30, 65, .4);
  padding: 36px 34px 30px;
  text-align: center;
}

.login-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 15px;
  background: var(--primary-grad);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(43, 125, 237, .4);
}

.login-title { font-size: 20px; font-weight: 700; letter-spacing: .5px; }
.login-sub { font-size: 12px; color: var(--muted); margin: 6px 0 22px; }

.login-error {
  background: #FFF1F1;
  color: var(--danger);
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 14px;
  text-align: left;
}

.login-field { display: block; text-align: left; margin-bottom: 14px; }
.login-field span { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.login-field .input { width: 100%; height: 40px; }

.login-remember {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-2);
  margin: 2px 0 18px;
  cursor: pointer;
  user-select: none;
}
.login-remember input { accent-color: var(--primary); }

.login-btn { width: 100%; height: 42px; font-size: 14px; }
.login-btn:disabled { opacity: .7; cursor: not-allowed; }

/* 右上角登录人徽章 */
.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--primary-weak);
  color: var(--primary);
  font-weight: 600;
}

/* ---------- 覆盖确认弹窗（导入覆盖已确认考勤提醒：紧凑居中卡片，警示标红） ---------- */
.ow-mask {
  position: fixed;
  inset: 0;
  z-index: 390;
  background: rgba(31, 45, 61, .45);
}
.ow-modal {
  position: fixed;
  z-index: 400;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 400px;
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  padding: 28px 26px 22px;
  text-align: center;
}
.ow-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: #FFF1F1;
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ow-title { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.ow-text { font-size: 13px; color: var(--text-2); line-height: 1.7; margin-bottom: 18px; }
.ow-red { color: var(--danger); font-weight: 700; }
.ow-actions { display: flex; justify-content: center; gap: 12px; }
/* 导入月份选择：居中月份输入框 */
.im-month { width: 200px; margin: 0 auto 18px; text-align: center; }

/* ---------- 使用说明弹框（顶栏「使用说明」按钮打开：固定高度、内容滚动、左对齐文档式排版） ---------- */
.help-modal {
  position: fixed;
  z-index: 400;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(760px, calc(100vw - 48px));
  height: min(640px, calc(100vh - 64px)); /* 高度固定：内容多时走内部滚动，弹框尺寸稳定 */
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* display:flex 会覆盖 HTML hidden 属性的 display:none，必须显式声明（防弹框默认展开） */
.help-modal[hidden] { display: none; }
.help-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, #F0F7FF, #F8FBFF); /* 蓝色渐变头部呼应主色 */
  flex-shrink: 0;
}
.help-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
}
.help-title svg { color: #2B7DED; }
.help-close {
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--text-3);
  font-size: 20px;
  line-height: 1;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.help-close:hover { background: #EFF2F6; color: var(--text-1); }
.help-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px;
  /* 细滚动条（6px 圆角、透明轨道、浅灰滑块，hover 加深） */
  scrollbar-width: thin;
  scrollbar-color: #C8CCD1 transparent;
}
.help-body::-webkit-scrollbar { width: 6px; }
.help-body::-webkit-scrollbar-track { background: transparent; }
.help-body::-webkit-scrollbar-thumb { background: #C8CCD1; border-radius: 3px; }
.help-body::-webkit-scrollbar-thumb:hover { background: #9AA0A6; }
.help-sec { margin-bottom: 18px; }
.help-sec:last-child { margin-bottom: 4px; }
.help-sec-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #2B7DED;
  margin-bottom: 8px;
  padding-left: 9px;
  border-left: 3px solid #2B7DED; /* 蓝色竖条小节标题 */
  line-height: 1.4;
}
.help-list { margin: 0; padding-left: 18px; }
.help-list li {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.8;
  margin-bottom: 2px;
}
.help-list li b { color: var(--text-1); }
.help-tag {
  display: inline-block;
  padding: 0 5px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.help-tag.resigned { background: #FEF0F0; color: #E5484D; }
.help-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}

.person-modal {
  position: fixed;
  z-index: 300;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(1280px, calc(100vw - 48px));
  height: 85vh; /* 高度固定为 85vh，内容超出时弹框内部滚动 */
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  display: flex;
  flex-direction: column;
  /* 专用入场动画：不能复用 popIn——其关键帧 transform 会覆盖居中定位的
     translate(-50%,-50%)，导致弹框动画期间停在右下角、结束时瞬间跳回居中 */
  animation: modalIn .18s ease;
  overflow: hidden;
}

@keyframes modalIn {
  from { opacity: 0; transform: translate(-50%, -50%) translateY(6px) scale(.97); }
  to { opacity: 1; transform: translate(-50%, -50%); }
}

.person-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}

.pm-head-info { flex: 1; min-width: 0; }
.pm-title { font-size: 15px; font-weight: 600; color: var(--text); }
.pm-title .pm-sub { margin-left: 10px; font-size: 12px; font-weight: 400; color: var(--muted); }

/* 考勤规则标签：标题下方展示命中的部门核算规则关键参数 */
.pm-rule {
  margin-top: 4px;
  font-size: 12px;
  color: var(--primary);
  background: var(--primary-weak);
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pm-close {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.pm-close:hover { background: var(--hover); color: var(--text); }

.person-modal-body {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 16px;
  padding: 16px 20px 20px;
  overflow: auto;
  flex: 1; /* 弹框 flex 列布局：内容区占满剩余空间，底部操作栏固定 */
  min-height: 0;
}

/* --- 左侧日历 --- */
.pm-calendar { min-width: 0; }

.pm-cal-week,
.pm-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }

.pm-cal-week span {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  padding: 4px 0;
}

.pm-day {
  height: 96px;          /* 每日格子固定高度，全月一致 */
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 6px;
  background: #fff;
  overflow: hidden;      /* 超出内容裁剪，不撑破固定高度 */
}
/* 统一高亮色（用户要求所有筛选一致）：点击右侧汇总条目后，命中日期蓝边+浅蓝底 */
/* 高亮优先级最高：覆盖节假日/调休/外勤/迟到/缺卡/不统计等一切状态底色与边框，
   筛选日期颜色保持一致（双类名 + !important 确保压过同级状态类，用户 2026-10-14 要求） */
.pm-day.pm-day.is-hl {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 2px var(--primary) !important;
  background: #EAF3FF !important;
}
.pm-day.is-empty { border: none; background: transparent; }
.pm-day.is-holiday { background: #FFF5F5; }
/* 节假日名称：日期数字后的粉色小角标（如「中秋节」） */
.pm-day .d-holiday {
  font-style: normal;
  margin-left: 5px;
  font-size: 11px;
  color: #E0566B;
  background: #FFE9EC;
  padding: 1px 6px;
  border-radius: 999px;
  vertical-align: 1px;
}
.pm-day.is-adjust { background: var(--primary-weak); }
/* 状态标注：迟到红边/未打卡黄底/不统计紫边紫底/外勤蓝边蓝底（与明细表同色系）；
   外勤规则在前（异常色优先显示）；周六日不做特殊标注 */
.pm-day.is-waiqin { border-color: var(--primary); background: var(--primary-weak); }
.pm-day.is-late { border-color: var(--late-color); background: #FFF7F7; }
.pm-day.is-missed { background: var(--missed-fill); }
.pm-day.is-excluded { border-color: var(--exclude-color); background: #F3EEFF; }

.pm-day .d-num {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
}
.pm-day.is-holiday .d-num { color: var(--holiday-color); }

.pm-day .d-text {
  display: block;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-2);
  word-break: break-all;
}

.pm-empty { padding: 32px 0; text-align: center; color: var(--muted); font-size: 13px; }

/* --- 日历格子可点击操作（点击打开当天数据操作弹层） --- */
.pm-day-act { cursor: pointer; transition: box-shadow .15s ease, border-color .15s ease; }
.pm-day-act:hover { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-weak); }

/* --- 底部操作栏：上一个/下一个 + 备注输入 + 确认考勤 --- */
.person-modal-foot {
  /* 与主体两栏同模板（1fr auto + 16px 间距）：输入框占满剩余宽度，
     按钮组列宽随按钮数量自适应（新增「标记待确认」后固定 300px 已不够用，
     会导致按钮组溢出与备注框重叠，故改为 auto——备注框 min-width:0 自动收缩让位） */
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: #FAFBFD;
}
.pm-nav {
  display: flex;
  justify-self: end; /* 按钮组靠右列右缘对齐统计区 */
  flex-shrink: 0;
  gap: 10px; /* 按钮独立排列，间距 10px（用户反馈拼接样式不好看，恢复分开） */
}
/* 备注多行输入框：默认 2 行高度，可拖拽向下扩展 */
.pm-remark-input {
  width: 100%;          /* 占满左列（与日历区同宽） */
  min-width: 0;
  height: 52px;          /* 2 行文字高度 */
  min-height: 52px;
  max-height: 120px;     /* 拖拽扩展上限 */
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
  line-height: 20px;     /* 2 行 = 52px 高度（6+40+6） */
  color: var(--text);
  background: #fff;
  outline: none;
  resize: vertical;      /* 允许纵向拖拽调整高度 */
  font-family: inherit;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.pm-remark-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-weak); }
.pm-remark-input::placeholder { color: var(--muted); }
/* 按钮置灰态：上一个/下一个首尾边界、确认考勤已确认 */
.btn:disabled,
.btn[disabled] {
  opacity: .5;
  cursor: not-allowed;
  filter: grayscale(1);
}
.btn:disabled:active { transform: none; }

/* --- 右侧汇总统计 --- */
.pm-summary {
  border-left: 1px solid var(--line);
  padding-left: 16px;
  font-size: 12px;
}

.pm-kv {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 5px 4px; /* 左右 4px 留白：可点击条目高亮底色不贴边 */
  border-bottom: 1px dashed var(--line);
  color: var(--text-2);
}
/* 可点击汇总条目：悬停反馈，点击后日历高亮对应日期（用户 2026-10-14 要求） */
.pm-stat-clickable { cursor: pointer; border-radius: 6px; transition: background .15s ease; }
.pm-stat-clickable:hover { background: var(--primary-weak); }
.pm-stat-clickable.is-active { background: var(--primary-weak); box-shadow: inset 0 0 0 1px var(--primary); }
.pm-kv:last-child { border-bottom: none; }
.pm-kv b { font-weight: 600; color: var(--text); text-align: right; }
.pm-kv.pm-note { flex-direction: column; align-items: flex-start; gap: 2px; }
.pm-kv.pm-note b { font-weight: 400; color: var(--text-2); text-align: left; word-break: break-all; }

/* 数值语义色（与统计表一致） */
.pm-summary .v-late { color: var(--late-color); }
.pm-summary .v-exclude { color: var(--exclude-color); }
.pm-summary .v-missed { color: #C58A00; }
.pm-summary .v-waiqin { color: var(--primary); }
.pm-summary .v-ot { color: var(--primary); }
.pm-summary .v-under { color: var(--danger); }
.pm-summary .v-over { color: var(--primary); }

/* =========================================================
   轻提示 Toast（成功提示不带图标）
   ========================================================= */
.toast-container {
  position: fixed;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 9px 18px;
  border-radius: 10px;
  background: rgba(31, 45, 61, .88);
  color: #fff;
  font-size: 13px;
  box-shadow: var(--shadow-pop);
  animation: toastIn .25s ease;
  max-width: 480px;
  text-align: center;
}

.toast.toast-error { background: rgba(229, 72, 77, .92); }
.toast.toast-success { background: rgba(0, 164, 115, .92); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}
.toast.hide { opacity: 0; transition: opacity .3s ease; }

/* =========================================================
   响应式适配
   ========================================================= */
@media (max-width: 1080px) {
  .app-header { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  /* 窄屏时标签条与步骤指示器恢复独占一行（此时它们在 header-left 内，需允许换行展示） */
  .step-nav { margin-left: 0; padding-left: 0; border-left: none; width: 100%; }
  .tab-bar.in-header { width: 100%; margin: 0; }
  .header-left { flex-wrap: wrap; }
  .app-main { padding: 16px 16px 32px; }
  .config-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .header-actions .btn span-text { display: none; }
}

/* =========================================================
 * 补贴设置页表格（导入的餐补/房补/绩效等补贴数据）
 * ======================================================= */
.subsidy-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

/* 完整边框（与申报表/明细表风格一致） */
.subsidy-table th,
.subsidy-table td {
  border: 1px solid var(--line);
  padding: 7px 10px;
  text-align: center;
  white-space: nowrap;
}

/* 表头：浅灰底加粗 */
.subsidy-table thead th {
  background: #F5F7FA;
  font-weight: 600;
  color: var(--text);
  position: sticky;
  top: 0;
  z-index: 2;
}

/* 数据行：白底 + 悬停浅蓝 */
.subsidy-table tbody tr { background: #fff; }
.subsidy-table tbody tr:nth-child(even) { background: #FAFBFC; }
.subsidy-table tbody tr:hover { background: #F0F6FF; }

/* 序号列：窄列居中 */
.subsidy-table .col-idx {
  width: 48px;
  color: #8A94A6;
  font-size: 12px;
}

/* 姓名列：居中加粗 */
.subsidy-table td:nth-child(2) {
  text-align: center;
  font-weight: 600;
  min-width: 88px;
}

/* 离职人员姓名红底（与其他页面口径一致） */
.subsidy-table td.name-resigned { background: #FDE2E2 !important; }

/* 数值列居中（等宽数字更整齐），无数据显示空白 */
.subsidy-table td.num-cell { text-align: center; font-variant-numeric: tabular-nums; }

/* 文本列（提成/备注）居中 */
.subsidy-table td.text-cell { text-align: center; }

/* 备注列红字（与导入表格样式呼应） */
.subsidy-table td.sub-note { color: #E0566B; }
/* 操作列：删除按钮（红字小按钮，悬停反白红底） */
.subsidy-table td.op-cell { width: 64px; }
.subsidy-table .sub-del {
  border: none;
  background: transparent;
  color: var(--danger);
  font-size: 12px;
  cursor: pointer;
  padding: 3px 10px;
  border-radius: 6px;
  transition: all .15s ease;
  user-select: none;
}
.subsidy-table .sub-del:hover { background: var(--danger); color: #fff; }

/* 可编辑格：悬停蓝边提示可点击，聚焦蓝光圈（与申报表编辑一致） */
.subsidy-table td[contenteditable] { cursor: text; transition: box-shadow .12s, background .12s; }
.subsidy-table td[contenteditable]:hover { background: #F0F6FF; box-shadow: inset 0 0 0 1px var(--primary); }
.subsidy-table td[contenteditable]:focus {
  outline: none;
  background: #fff;
  box-shadow: inset 0 0 0 2px var(--primary);
}
