/* 新致林生产管理后台 - 网页端独立人事管理后台 补充样式
   布局框架（深蓝侧边栏 + 顶部栏 + 内容区）复用 web/css/style.css 中 .app/.sidebar/.side-brand/.main/.topbar
*/
/* ========== 通用容器（原型视觉：白底圆角卡片） ========== */
.hr-page { padding: 0; }
.hr-card { background: #fff; border: 1px solid #e3e8f0; border-radius: 6px; padding: 14px; margin-bottom: 12px; box-shadow: none; }
.hr-card-title { font-size: 13px; font-weight: bold; color: #1a3c5e; margin-bottom: 10px; border-left: none; padding-left: 0; }
.hr-flex { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.hr-grow { flex: 1; }

/* ========== 表格（原型：th 浅灰 #f3f6fa、td 下边框 #eef1f5） ========== */
.hr-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.hr-table th, .hr-table td { border: none; padding: 7px 8px; text-align: left; }
.hr-table th { background: #f3f6fa; color: #555; font-weight: 600; border-bottom: 1px solid #dfe6f0; }
.hr-table td { border-bottom: 1px solid #eef1f5; }
.hr-table tr:hover td { background: #f7fafc; }
.hr-table .op a { color: #1a3c5e; margin-right: 8px; text-decoration: none; cursor: pointer; }
.hr-table .op a.danger { color: #e74c3c; }

/* ========== 状态徽标（原型四色：on绿 / warn橙 / gray灰 / blue蓝） ========== */
.hr-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; }
.hr-badge.on, .hr-badge.active { background: #e8f7ef; color: #1f8a4c; }
.hr-badge.warn, .hr-badge.probation { background: #fff4e5; color: #b26a00; }
.hr-badge.blue, .hr-badge.pending { background: #e8f0fe; color: #1a56b0; }
.hr-badge.gray, .hr-badge.offboard, .hr-badge.disabled { background: #f0f2f5; color: #888; }

/* 员工档案/审批等页面使用的 .tag 状态点（原型 badge 四色） */
.tag.ok, .tag.on { background: #e8f7ef; color: #1f8a4c; }
.tag.warn { background: #fff4e5; color: #b26a00; }
.tag.pend, .tag.blue { background: #e8f0fe; color: #1a56b0; }
.tag.off, .tag.offboard, .tag.disabled, .tag.gray { background: #f0f2f5; color: #888; }

/* ========== 组织架构 ========== */
.hr-company-box { border: 1px solid #e3e8ee; border-radius: 6px; margin-bottom: 14px; overflow: hidden; }
.hr-company-head { background: #1a3c5e; color: #fff; padding: 10px 14px; display: flex; justify-content: space-between; align-items: center; }
.hr-company-head .name { font-size: 15px; font-weight: 600; }
.hr-company-head .meta { font-size: 12px; opacity: .85; }
/* 组织架构公司头：部门/在职人数紧凑徽标 */
.org-company-meta { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.org-company-meta .stat-chip { display: inline-flex; align-items: baseline; gap: 3px; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .12); border-radius: 10px; padding: 2px 9px; font-size: 12px; color: #dce6f0; white-space: nowrap; line-height: 1.5; }
.org-company-meta .stat-chip b { font-size: 13px; color: #fff; }
.hr-dept-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px 8px 28px; border-bottom: 1px dashed #eef1f5; font-size: 14px; }
.hr-dept-row:last-child { border-bottom: none; }
.hr-dept-row .dept-name { font-weight: 500; color: #2c3e50; }
.hr-dept-row .dept-meta { color: #7f8c8d; font-size: 12px; }

/* ========== 表单（原型 form-grid：左标签右输入，容器类整行） ========== */
.hr-form { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 6px 16px; align-items: center; }
.hr-form > label { font-size: 12px; color: #666; white-space: nowrap; }
.hr-form > .input { width: 100%; margin-bottom: 0; height: 36px; font-size: 13px; }
.hr-form > .hr-flex, .hr-form > .hr-check, .hr-form > .hr-form-grid, .hr-form > .hr-form-item, .hr-form > div { grid-column: 1 / -1; }
.hr-form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.hr-form-item label { display: block; font-size: 12px; color: #666; margin-bottom: 4px; }
.hr-form-item .req { color: #e74c3c; }
.hr-form-item .input { width: 100%; }
.hr-form-actions { margin-top: 14px; }

/* ========== 弹窗 ========== */
.hr-modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: none; align-items: center; justify-content: center; z-index: 999; }
.hr-modal-mask.show { display: flex; }
.hr-modal { background: #fff; border-radius: 8px; width: 560px; max-width: 92vw; max-height: 86vh; overflow: auto; padding: 20px; }
.hr-modal-title { font-size: 16px; font-weight: 600; color: #1a3c5e; margin-bottom: 14px; }
.hr-modal-actions { margin-top: 16px; text-align: right; }
/* 员工详情弹窗底部按钮：分组弹性布局（仅 #detailOps 生效，不影响其它弹窗） */
#detailOps { display: flex; flex-direction: column; gap: 12px; text-align: left; }
#detailOps .dops-group { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
#detailOps .dops-group + .dops-group { border-top: 1px solid #eef1f5; padding-top: 12px; }

/* ========== 员工详情弹窗（org.html openMember / staff.html openDetail） ========== */
.hr-modal-detail { width: 640px; }
.dtable { width: 100%; border-collapse: collapse; font-size: 13px; }
.dtable td { padding: 8px 12px; border-bottom: 1px solid #eef1f5; line-height: 1.55; color: #333; vertical-align: top; }
.dtable tr:last-child td { border-bottom: none; }
.dtable td.dlbl { width: 116px; background: #f3f6fa; color: #1a3c5e; font-weight: 600; white-space: nowrap; }
.dtable td.dsec { background: #dce5f1; color: #1a3c5e; font-weight: 600; padding: 7px 12px; border-left: 3px solid #1a3c5e; border-bottom: none; }
.dtable td.dtext { background: #fbfcfe; color: #444; }
.dtable .dv { word-break: break-all; }

/* ========== Toast / Loading ========== */
.hr-toast { position: fixed; left: 50%; top: 40%; transform: translateX(-50%); background: rgba(0,0,0,.78); color: #fff; padding: 10px 20px; border-radius: 6px; font-size: 14px; z-index: 1000; display: none; max-width: 80vw; }
.hr-loading { position: fixed; inset: 0; background: rgba(255,255,255,.6); display: none; align-items: center; justify-content: center; z-index: 999; }
.hr-loading span { background: rgba(0,0,0,.7); color: #fff; padding: 10px 22px; border-radius: 6px; }

/* ========== 工资条 / 打印 ========== */
.hr-slip { border: 1px solid #d7dde5; padding: 12px; margin-bottom: 12px; page-break-inside: avoid; }
.hr-slip h4 { margin: 0 0 8px; color: #1a3c5e; }
.hr-slip table { width: 100%; border-collapse: collapse; font-size: 13px; }
.hr-slip table th, .hr-slip table td { border: 1px solid #ccd3dc; padding: 5px 8px; text-align: center; }
.hr-slip .total-row td { font-weight: 600; background: #f4f7fa; }

/* ========== 统计卡（原型 stat-box：白底、大数字+小文字） ========== */
.hr-stats { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 12px; }
.stat-item { flex: 1; min-width: 118px; background: #fff; border: 1px solid #e3e8f0; border-radius: 6px; padding: 12px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.stat-item .stat-num { font-size: 22px; font-weight: bold; color: #1a3c5e; line-height: 1.2; }
.stat-item .stat-num.warn { color: #e74c3c; }
.stat-item .stat-label { font-size: 11px; color: #888; margin-top: 2px; }
.stat-insure { cursor: pointer; border-color: #f0b9b9; background: #fdf6f6; }
.stat-insure:hover { border-color: #e74c3c; box-shadow: 0 1px 4px rgba(231,76,60,.2); }
.stat-insure.on { border-color: #e74c3c; background: #fdecea; }

/* ========== 统计卡（staff.html 使用：可点击查看明细） ========== */
.hr-stat-card { flex: 1; min-width: 118px; max-width: 170px; background: #fff; border: 1px solid #e3e8f0; border-radius: 6px; padding: 12px; display: flex; flex-direction: column; align-items: center; text-align: center; cursor: pointer; transition: border-color .15s, box-shadow .15s; user-select: none; }
.hr-stat-card .num { font-size: 22px; font-weight: bold; color: #1a3c5e; line-height: 1.2; }
.hr-stat-card .label { font-size: 11px; color: #888; margin-top: 2px; }
.hr-stat-card:hover { border-color: #2f6fb3; box-shadow: 0 2px 8px rgba(31, 60, 94, .15); }
.hr-stat-card.stat-warn { border-color: #f0b9b9; background: #fdf6f6; }
.hr-stat-card.stat-warn .num { color: #e74c3c; }
.hr-stat-card.stat-warn:hover { border-color: #e74c3c; box-shadow: 0 2px 8px rgba(231, 76, 60, .2); }
.hr-stat-card .stat-tip { font-size: 10px; color: #2f6fb3; margin-top: 4px; opacity: 0; transition: opacity .15s; }
.hr-stat-card:hover .stat-tip { opacity: 1; }
/* 状态统计卡配色：在职蓝 / 试用期橙 / 离职灰 / 待审批红 */
.hr-stat-card.stat-blue { border-color: #b8d4f0; background: #f4f9ff; }
.hr-stat-card.stat-blue .num { color: #2f6fb3; }
.hr-stat-card.stat-blue:hover { border-color: #2f6fb3; box-shadow: 0 2px 8px rgba(47, 111, 179, .2); }
.hr-stat-card.stat-orange { border-color: #f0cfb9; background: #fff8f4; }
.hr-stat-card.stat-orange .num { color: #e67e22; }
.hr-stat-card.stat-orange:hover { border-color: #e67e22; box-shadow: 0 2px 8px rgba(230, 126, 34, .2); }
.hr-stat-card.stat-gray { border-color: #dde3ea; background: #f8fafc; }
.hr-stat-card.stat-gray .num { color: #7f8c8d; }
.hr-stat-card.stat-gray:hover { border-color: #95a5a6; box-shadow: 0 2px 8px rgba(127, 140, 141, .2); }
.hr-stat-card.stat-danger { border-color: #f0b9b9; background: #fdf6f6; }
.hr-stat-card.stat-danger .num { color: #e74c3c; }
.hr-stat-card.stat-danger:hover { border-color: #e74c3c; box-shadow: 0 2px 8px rgba(231, 76, 60, .2); }

/* ========== 工资明细表（A4 打印预览，列多使用窄字体） ========== */
.a4-salary-detail { width: 96%; border-collapse: collapse; font-size: 10px; }
.a4-salary-detail th, .a4-salary-detail td { border: 1px solid #000; padding: 3px 4px; text-align: center; white-space: nowrap; }
.a4-salary-detail th { background: #eef2f7; font-weight: normal; }
.a4-salary-detail td.l { text-align: left; }
.a4-salary-detail tfoot td { font-weight: normal; background: #f4f7fa; }

/* ========== 筛选标签（原型 filter-tab：激活深蓝底白字） ========== */
.hr-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.hr-chip { border: 1px solid #dfe6f0; background: #fff; color: #555; border-radius: 3px; padding: 4px 12px; font-size: 12px; cursor: pointer; }
.hr-chip:hover { border-color: #1a3c5e; color: #1a3c5e; }
.hr-chip.on { background: #1a3c5e; color: #fff; border-color: #1a3c5e; }
.hr-chip.insure { border-color: #f0b4b4; color: #c0392b; }
.hr-chip.insure.on { background: #e74c3c; color: #fff; border-color: #e74c3c; }

/* ========== 保险徽标（参保判定统一后：已参保绿 / 未参保红） ========== */
.ins-badge { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 11px; margin-right: 4px; }
.ins-badge.ok { background: #e8f7ef; color: #1f8a4c; }
.ins-badge.no { background: #fdecea; color: #c62828; }

/* ========== 打印：隐藏侧边栏与顶栏 ========== */
@media print {
  .sidebar, .topbar { display: none !important; }
  .app { display: block !important; }
  .main { padding: 0 !important; background: #fff !important; }
  .hr-card { border: none !important; padding: 0 !important; box-shadow: none !important; }
  /* 修复打印出现空白首页：隐藏页面主体（筛选控件等），仅打印 A4 预览内容 */
  .hr-page { display: none !important; }
  /* 预览层在打印时改为普通文档流，避免 fixed 全屏遮罩被打印成空白第一页 */
  .a4-preview-mask { position: static !important; display: block !important; background: #fff !important; padding: 0 !important; inset: auto !important; z-index: auto !important; overflow: visible !important; }
  .a4-preview-card { width: auto !important; max-height: none !important; box-shadow: none !important; overflow: visible !important; display: block !important; border-radius: 0 !important; }
  .a4-preview-head { display: none !important; }
  .a4-preview-body { flex: none !important; overflow: visible !important; padding: 0 !important; background: #fff !important; display: block !important; align-items: stretch !important; gap: 0 !important; }
  /* 每张 A4 纸一页，去除固定高度与内边距（由 @page margin 控制），避免溢出导致空白页 */
  .a4-sheet { width: auto !important; min-height: 0 !important; box-shadow: none !important; padding: 0 !important; flex: none !important; margin: 0 !important; page-break-after: always; break-after: page; }
  .a4-sheet:last-child { page-break-after: auto; break-after: auto; }
}

/* ========== 员工信息表打印 ========== */
.print-header { font-size: 16px; font-weight: 600; color: #1a3c5e; text-align: center; margin: 10px 0 14px; }
.print-staff-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 14px; page-break-inside: avoid; }
.print-staff-table th, .print-staff-table td { border: 1px solid #ccd3dc; padding: 5px 8px; text-align: center; }
.print-staff-table th { background: #f0f4f8; color: #1a3c5e; font-weight: 600; }
.print-photo-cell img { width: 60px; height: 75px; object-fit: contain; display: block; margin: 0 auto; }
.print-photo-placeholder { width: 60px; height: 75px; border: 1px dashed #ccd3dc; color: #aaa; font-size: 12px; display: flex; align-items: center; justify-content: center; margin: 0 auto; }
.print-staff-foot { display: flex; justify-content: space-between; gap: 20px; margin-top: 10px; font-size: 13px; color: #333; }

/* ========== A4 打印预览层（与小程序 canvas 1588×2246 同结构：794×1123 逻辑坐标） ========== */
@page { size: A4; margin: 7.5mm 7.5mm; }
.a4-preview-mask { position: fixed; inset: 0; background: rgba(15, 25, 40, .55); display: none; align-items: center; justify-content: center; z-index: 1000; padding: 20px; box-sizing: border-box; }
.a4-preview-mask.show { display: flex; }
.a4-preview-card { background: #fff; border-radius: 8px; width: min(980px, 96vw); max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 12px 40px rgba(0, 0, 0, .35); }
.a4-preview-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: #1a3c5e; color: #fff; font-size: 14px; flex: none; }
.a4-preview-head .spacer { flex: 1; }
.a4-preview-head .a4-preview-title { font-weight: 600; }
.a4-preview-head button { background: #fff; color: #1a3c5e; border: none; padding: 6px 16px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.a4-preview-head button.primary { background: #2f6fb3; color: #fff; }
.a4-preview-head button:hover { opacity: .9; }
.a4-preview-body { flex: 1; overflow: auto; padding: 22px; background: #e6ebf2; display: flex; flex-direction: column; align-items: center; gap: 18px; box-sizing: border-box; }
.a4-sheet { background: #fff; width: 794px; min-height: 1123px; box-shadow: 0 2px 12px rgba(0, 0, 0, .18); padding: 28px; box-sizing: border-box; flex: none; }
.a4-sheet.a4-sheet-landscape { width: 1123px; min-height: 794px; }
.a4-sheet:last-child { margin-bottom: 4px; }

/* A4 表格通用（个人档案/入职登记，与小程序 hr-canvas 同构：7 列网格、标签灰底、分区浅蓝、照片 G4:G7） */
.a4 table.a4, table.a4 { width: 100%; border-collapse: collapse; table-layout: fixed; }
.a4 td { border: 1px solid #000; padding: 4px 6px; font-size: 11px; word-break: break-all; }
.a4 .title { font-size: 18px; font-weight: bold; text-align: center; border: none; padding: 10px 0 4px; }
.a4 .meta { border: none; font-size: 9px; color: #555; text-align: right; padding: 2px 4px; }
.a4 .meta-left { border: none; font-size: 9px; color: #555; text-align: left; padding: 2px 4px; }
.a4 .sec { background: #dce5f1; font-weight: bold; text-align: center; font-size: 12px; height: 26px; }
.a4 .lbl { background: #f0f3f7; font-weight: bold; text-align: center; width: 80px; }
.a4 .photo { text-align: center; vertical-align: middle; width: 96px; }
.a4 .photo-box { width: 80px; height: 104px; margin: 0 auto; border: 1px dashed #aaa; display: flex; align-items: center; justify-content: center; font-size: 10px; color: #999; }
.a4 .photo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
/* 档案/入职表数据行固定行高（对齐云函数 Excel 行高：基本信息 28px、数据行 22px、表头 24px），
   内容不再换行撑高，保证预览与 E 表单元格高度一致 */
.a4 .binfo td { height: 28px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.a4 .drow td { height: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.a4 .hrow td { height: 24px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.a4 .opinion td { height: 78px; vertical-align: top; }
.a4 .sign td { height: 42px; vertical-align: middle; }
.a4-foot { display: flex; justify-content: space-between; gap: 20px; padding: 10px 0 0; font-size: 12px; color: #333; }

/* 员工信息表 A4（对齐小程序 drawStaffTablePage：灰底表头、行高 30/110、照片 66×84 2寸等比、页脚三栏） */
.a4-staff-title { font-size: 20px; font-weight: 600; text-align: center; margin: 0 0 6px; color: #000; }
.a4-staff-meta { text-align: center; font-size: 12px; color: #555; margin-bottom: 10px; }
table.a4-staff { width: 100%; border-collapse: collapse; table-layout: fixed; }
.a4-staff th, .a4-staff td { border: 1px solid #000; padding: 0; text-align: center; font-size: 12px; vertical-align: middle; }
.a4-staff th { background: #f2f4f7; height: 30px; font-weight: 600; }
.a4-staff td { height: 30px; }
.a4-staff td.row-photo { height: 110px; }
.a4-staff .photo-box { width: 66px; height: 84px; margin: 0 auto; border: 1px dashed #aaa; display: flex; align-items: center; justify-content: center; font-size: 10px; color: #999; }
.a4-staff .photo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.a4-staff-foot { display: flex; justify-content: space-between; gap: 20px; padding: 8px 0 0; font-size: 12px; color: #333; }

/* 工资条 A4（对齐小程序 renderSalarySlip：标题/月份/收入/扣款/合计/签字/页脚） */
.a4-salary-title { font-size: 20px; font-weight: 600; text-align: center; margin: 0 0 6px; color: #000; }
.a4-salary-meta { text-align: center; font-size: 12px; color: #555; margin-bottom: 10px; }
.a4-salary-head { font-size: 15px; margin: 8px 0 14px; }
.a4-salary-section { font-size: 13px; color: #1a3c5e; font-weight: 600; margin: 12px 0 4px; }
.a4-salary-row { display: flex; justify-content: space-between; font-size: 14px; line-height: 34px; border-bottom: 1px dotted #e0e4ea; padding: 0 4px; }
.a4-salary-row .amt { font-weight: 500; }
.a4-salary-total { font-size: 16px; color: #1a3c5e; font-weight: 600; margin: 12px 0 0; }
.a4-salary-net { font-size: 20px; color: #1a3c5e; font-weight: 700; margin: 14px 0 0; }
.a4-salary-remark { font-size: 12px; color: #555; margin-top: 8px; }
.a4-salary-divider { border: none; border-top: 1px solid #999; margin: 22px 0 6px; }
.a4-salary-sign { text-align: center; font-size: 13px; margin-top: 4px; }
.a4-salary-foot { text-align: center; font-size: 12px; color: #555; margin-top: 40px; }

/* 工资汇总表 A4（一人一行：打印导出-工资表 / hrExport.salarySlips 对齐） */
table.a4-salary-summary { width: 100%; border-collapse: collapse; table-layout: fixed; margin-top: 10px; }
.a4-salary-summary th, .a4-salary-summary td { border: 1px solid #000; padding: 5px 4px; text-align: center; font-size: 12px; vertical-align: middle; }
.a4-salary-summary th { background: #f2f4f7; height: 30px; font-weight: 600; }
.a4-salary-summary td { height: 28px; }
.a4-salary-summary td.l { text-align: left; }
.a4-salary-summary td.net { font-weight: 600; }
.a4-salary-summary-foot { display: flex; justify-content: space-between; gap: 20px; padding: 8px 2px 0; font-size: 12px; color: #333; font-weight: 500; }

/* 打印：仅输出 A4 预览内容，隐藏页面框架与预览 UI */
@media print {
  .sidebar, .topbar, .hr-page, .hr-modal-mask { display: none !important; }
  .app { display: block !important; }
  .main { padding: 0 !important; background: #fff !important; }
  .hr-card { border: none !important; padding: 0 !important; box-shadow: none !important; }
  .a4-preview-mask { display: block !important; position: static !important; background: #fff !important; padding: 0 !important; }
  .a4-preview-card { width: auto !important; max-height: none !important; border-radius: 0 !important; box-shadow: none !important; }
  .a4-preview-head { display: none !important; }
  .a4-preview-body { display: block !important; padding: 0 !important; background: #fff !important; overflow: visible !important; gap: 0 !important; }
  .a4-sheet { width: auto !important; min-height: 0 !important; box-shadow: none !important; padding: 0 !important; page-break-after: always; }
  /* 横板明细表：1123px 超出 A4 横向可打印区（约 1066px）会溢出产生首张空白页，打印时收窄到 1060px */
  .a4-sheet.a4-sheet-landscape { width: 1060px !important; }
  .a4-sheet:last-child { page-break-after: auto; }
  #printArea { display: none !important; }
}
/* insurance switch + date same row */
.ins-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.ins-check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #333; white-space: nowrap; width: 110px; flex: 0 0 auto; cursor: pointer; }
.ins-row .ins-date { flex: 1; min-width: 0; margin-bottom: 0; }
