/* ============ 迷笛 HR 工作台 - 浅绿主题 ============ */
:root {
  --primary: #2f8f5b;
  --primary-dark: #267a4d;
  --primary-light: #e8f5ee;
  --primary-bg: #f4f9f6;
  --bg: #f5f8f6;
  --card: #ffffff;
  --border: #e2ebe5;
  --text: #1f2d27;
  --text-sub: #5a6b62;
  --danger: #d9534f;
  --warn: #f0ad4e;
  --info: #4a90d9;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
}

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

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

/* ============ 顶部导航 ============ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  padding: 0 24px;
  height: 64px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 40px; height: 40px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #4cb97c);
  color: #fff; font-weight: 700; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
}
.brand-name { font-size: 17px; font-weight: 700; }
.brand-sub { font-size: 12px; color: var(--text-sub); }

.main-nav { display: flex; gap: 6px; }
.nav-item {
  border: none; background: transparent;
  padding: 9px 18px; border-radius: 8px;
  cursor: pointer; font-size: 14px; color: var(--text-sub);
  transition: all .15s;
}
.nav-item:hover { background: var(--primary-light); color: var(--primary-dark); }
.nav-item.active { background: var(--primary); color: #fff; font-weight: 600; }

/* ============ 容器 ============ */
.container { max-width: 1400px; margin: 20px auto; padding: 0 24px; }
.module { animation: fadeIn .2s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.module-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; flex-wrap: wrap; gap: 12px;
}
.module-head h2 { font-size: 20px; }

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

/* ============ 按钮 ============ */
.btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  padding: 8px 16px; border-radius: 8px;
  cursor: pointer; font-size: 13px; transition: all .15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary-dark); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-danger { color: var(--danger); border-color: #f2c9c7; }
.btn-danger:hover { background: #fdf0ef; border-color: var(--danger); }

/* ============ 输入 ============ */
.input, select.input, textarea.input {
  border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px;
  font-size: 13px; color: var(--text);
  background: #fff; outline: none;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,143,91,.12); }
textarea.input { resize: vertical; min-height: 60px; }

/* ============ 子 Tab ============ */
.sub-tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.sub-tab {
  border: none; background: transparent;
  padding: 10px 20px; cursor: pointer; font-size: 14px;
  color: var(--text-sub); border-bottom: 2px solid transparent;
  transition: all .15s;
}
.sub-tab:hover { color: var(--primary-dark); }
.sub-tab.active { color: var(--primary-dark); border-bottom-color: var(--primary); font-weight: 600; }

/* ============ 表格 ============ */
.table-wrap { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead th {
  background: var(--primary-light);
  color: var(--primary-dark);
  text-align: left; padding: 12px 14px;
  font-weight: 600; white-space: nowrap;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
}
.data-table tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table tbody tr:hover { background: var(--primary-bg); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* 状态徽标 */
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.badge-在职 { background: #e8f5ee; color: #2f8f5b; }
.badge-待入职 { background: #fff4e5; color: #e08a1e; }
.badge-离职 { background: #f3f4f6; color: #6b7280; }
.badge-增员 { background: #e8f5ee; color: #2f8f5b; }
.badge-减员 { background: #fdf0ef; color: #d9534f; }
.badge-正常 { background: #eef4fb; color: #4a90d9; }
.badge-上班 { background: #e8f5ee; color: #2f8f5b; }
.badge-周六班 { background: #eef4fb; color: #4a90d9; }
.badge-休息 { background: #f3f4f6; color: #9aa3a0; }

/* 考勤制度内联编辑 */
.rule-inline {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 6px;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px dashed #b7dfc8;
  transition: all .15s;
  white-space: nowrap;
}
.rule-inline:hover { background: #dff1e7; border-style: solid; border-color: var(--primary); }
.rule-inline .muted { font-weight: 400; }
.muted { color: #9aa3a0; }
.rule-select { padding: 4px 8px; font-size: 12px; min-width: 128px; }

/* 部门级联下拉 + 部门管理树 */
.dept-cascader { display: flex; flex-wrap: wrap; gap: 8px; }
.dept-sel { padding: 7px 10px; font-size: 13px; min-width: 150px; }
.dept-path { display: inline-block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.dept-mgr-toolbar { margin-bottom: 12px; }
.dept-tree { max-height: 52vh; overflow-y: auto; }
.dept-row { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px; }
.dept-row:hover { background: var(--primary-bg); }
.dept-name { font-weight: 600; }
.dept-actions { margin-left: auto; display: flex; gap: 6px; }

/* ============ 卡片 ============ */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.rule-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; border-left: 4px solid var(--primary);
}
.rule-card h4 { margin-bottom: 8px; }
.rule-card .meta { font-size: 12px; color: var(--text-sub); margin-bottom: 4px; }
.rule-card .actions { margin-top: 12px; display: flex; gap: 8px; }

.summary-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-bottom: 16px; }
.summary-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; text-align: center;
}
.summary-card .num { font-size: 26px; font-weight: 700; color: var(--primary-dark); }
.summary-card .label { font-size: 12px; color: var(--text-sub); margin-top: 4px; }

/* ============ 弹窗 ============ */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center; z-index: 200;
  padding: 20px;
}
.modal {
  background: var(--card); border-radius: 14px;
  width: 100%; max-width: 760px; max-height: 90vh;
  overflow-y: auto; padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal h3 { margin-bottom: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-item label { display: block; font-size: 12px; color: var(--text-sub); margin-bottom: 5px; }
.form-item .input, .form-item select.input { width: 100%; }
.form-section { grid-column: 1 / -1; font-size: 13px; font-weight: 600; color: var(--primary-dark); margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ============ 提示 ============ */
.toast {
  position: fixed; top: 80px; left: 50%; transform: translateX(-50%);
  background: #1f2d27; color: #fff; padding: 10px 20px; border-radius: 8px;
  font-size: 13px; z-index: 300; box-shadow: var(--shadow);
  animation: fadeIn .2s;
}

.check-label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-sub); cursor: pointer; }

.pager { margin-top: 14px; text-align: center; color: var(--text-sub); font-size: 13px; }

.empty-tip { text-align: center; color: var(--text-sub); padding: 40px 0; }

/* ============ 假勤日历（月历网格） ============ */
.cal-legend { display: flex; flex-wrap: wrap; gap: 16px; margin: 4px 0 14px; }
.lg-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-sub); }
.lg-dot { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.lg-work { background: var(--primary-light); border: 1px solid #b7dfc8; }
.lg-rest { background: #f3f4f6; border: 1px solid #d9dde1; }
.lg-holiday { background: #fdf0ef; border: 1px solid #f2c4c2; }
.lg-makeup { background: #fff4e5; border: 1px solid #f5d9ac; }
.lg-satwork { background: #e8f5ee; border: 1px solid #9fd6ba; }

/* 考勤组月度汇总（应出勤/应休息/应带薪） */
.cal-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 0 0 14px;
}
.cal-sum-group {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}
.cal-sum-name {
  font-weight: 700; font-size: 14px; color: var(--primary-dark);
  margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.cal-sum-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 0; font-size: 13px;
}
.cs-label { color: var(--text-sub); }
.cs-val { font-weight: 600; color: var(--text); }

.cal-box { display: flex; background: var(--card); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.cal-side {
  writing-mode: vertical-rl; text-orientation: upright;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, var(--primary), #4cb97c);
  color: #fff; font-weight: 700; font-size: 16px;
  padding: 16px 10px; letter-spacing: 4px;
}
.cal-main { flex: 1; }
.cal-head, .cal-body { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-head .cal-hcell {
  background: #f0f7f3; border-bottom: 1px solid var(--border);
  font-weight: 700; color: var(--primary-dark); font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  min-height: 40px;
}
.cal-body { border-top: 1px dashed var(--border); border-left: 1px dashed var(--border); }
.cal-cell {
  border-right: 1px dashed var(--border); border-bottom: 1px dashed var(--border);
  min-height: 92px; padding: 8px;
}
.cal-empty { background: #fafbfa; }

.cal-day { position: relative; }
.cal-day-top { display: flex; align-items: center; gap: 6px; }
.cal-day-num {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 26px; padding: 0 6px;
  border-radius: 6px; font-weight: 700; font-size: 14px;
  background: var(--primary-light); color: var(--primary-dark);
}
.cal-day-tag { font-size: 12px; font-weight: 600; }
.cal-day-sub { margin-top: 6px; font-size: 11px; color: var(--text-sub); line-height: 1.4; }

/* 各状态配色 */
.cal-work .cal-day-num { background: var(--primary-light); color: var(--primary-dark); }
.cal-rest { background: #fafbfa; }
.cal-rest .cal-day-num { background: #f3f4f6; color: #9aa3a0; }
.cal-rest .cal-day-tag { color: #b4bab7; }
.cal-holiday { background: #fdf6f5; }
.cal-holiday .cal-day-num { background: #fdecea; color: #d9534f; }
.cal-holiday .cal-day-tag { color: #d9534f; }
.cal-holiday .cal-day-sub { color: #d9534f; font-weight: 600; }
.cal-makeup { background: #fffaf1; }
.cal-makeup .cal-day-num { background: #fff4e5; color: #e08a1e; }
.cal-makeup .cal-day-tag { color: #e08a1e; }
.cal-satwork { background: #edf8f1; }
.cal-satwork .cal-day-num { background: var(--primary); color: #fff; }
.cal-satwork .cal-day-tag { color: var(--primary-dark); }
.cal-satwork .cal-day-sub { color: var(--primary-dark); font-weight: 600; }

.cal-click { cursor: pointer; transition: all .12s; }
.cal-click:hover { box-shadow: inset 0 0 0 2px var(--primary); background: #e3f5ea; }

.cal-hint { margin-top: 10px; font-size: 12px; color: var(--text-sub); }

@media (max-width: 768px) {
  .topbar { flex-direction: column; height: auto; padding: 12px; gap: 10px; }
  .form-grid { grid-template-columns: 1fr; }
  .cal-cell { min-height: 64px; padding: 5px; }
  .cal-summary { grid-template-columns: 1fr 1fr; }
}
