:root {
  color-scheme: light;
  --bg: #f4f7f6;
  --surface: #ffffff;
  --surface-soft: #f7faf9;
  --text: #172420;
  --muted: #66756f;
  --line: #dce5e1;
  --line-strong: #c8d5d0;
  --brand: #0b6b57;
  --brand-strong: #085645;
  --brand-soft: #e6f4ef;
  --coral: #e96e63;
  --amber: #d89518;
  --blue: #3976c6;
  --violet: #7654b5;
  --danger: #ba3f3f;
  --sidebar: 236px;
  --radius: 6px;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  letter-spacing: 0;
}

button, input, select { font: inherit; letter-spacing: 0; }
button { color: inherit; }

.app-shell { min-height: 100vh; }
.site-footer { padding: 0 22px 14px calc(var(--sidebar) + 22px); color: var(--muted); font-size: 10px; text-align: center; }
.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover { color: var(--brand); text-decoration: underline; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  background: #103f36;
  color: #ecf7f3;
  border-right: 1px solid #174d43;
}

.brand {
  min-height: 78px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 16px 17px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: #d9f16f;
  color: #173d35;
  border-radius: 6px;
  font-weight: 800;
}

.brand strong, .brand span { display: block; }
.brand strong { font-size: 15px; }
.brand span { margin-top: 3px; color: #a9c7be; font-size: 11px; }

.primary-nav { padding: 12px 10px 8px; }
.nav-item {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #bdd4cd;
  cursor: pointer;
  text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: #1d5c50; color: #fff; font-weight: 700; }
.nav-glyph { width: 18px; font-size: 17px; text-align: center; }

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 20px 8px;
  color: #86aba1;
  font-size: 11px;
  font-weight: 700;
}
.department-total {
  min-width: 22px;
  padding: 2px 6px;
  border-radius: 10px;
  background: rgba(255,255,255,.09);
  text-align: center;
}
.department-header-actions { display: flex; align-items: center; gap: 7px; }
.sidebar-add-button { width: 23px; height: 23px; display: grid; place-items: center; padding: 0; border: 1px solid rgba(255,255,255,.2); border-radius: 4px; background: transparent; color: #d5e7e2; cursor: pointer; font-size: 18px; line-height: 1; }
.sidebar-add-button:hover { border-color: rgba(255,255,255,.45); background: rgba(255,255,255,.08); color: #fff; }
.admin-only[hidden] { display: none !important; }

.department-list { flex: 1; min-height: 0; overflow: auto; padding: 0 10px 12px; }
.department-entry { min-width: 0; }
.department-entry.has-delete { display: grid; grid-template-columns: minmax(0, 1fr) 24px; align-items: center; gap: 2px; }
.department-button {
  width: 100%;
  min-height: 44px;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #c8dcd6;
  cursor: pointer;
  text-align: left;
}
.department-button:hover { background: rgba(255,255,255,.06); }
.department-button.management { margin-bottom: 5px; background: rgba(126,214,188,.07); }
.department-button.management:hover { background: rgba(126,214,188,.13); }
.department-button.active { background: #e8f4ee; color: #173d35; }
.department-button.management.active { background: #e8f4ee; }
.department-avatar {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  background: rgba(255,255,255,.09);
  font-size: 12px;
  font-weight: 800;
}
.department-button.active .department-avatar { background: #c8e9dc; color: #075846; }
.department-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; }
.department-count { font-size: 11px; color: #89aaa1; }
.department-button.active .department-count { color: #517168; }
.department-delete-button { width: 24px; height: 28px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: #83a69d; cursor: pointer; font-size: 17px; line-height: 1; }
.department-delete-button:hover, .department-delete-button:focus-visible { background: #7a2f35; color: #fff; outline: 0; }

.sidebar-footer { padding: 14px 17px 18px; border-top: 1px solid rgba(255,255,255,.1); }
.save-state { display: flex; align-items: center; gap: 7px; color: #afc9c2; font-size: 11px; }
.save-dot { width: 7px; height: 7px; border-radius: 50%; background: #8ccf92; }
.text-button { margin-top: 9px; padding: 0; border: 0; background: transparent; color: #d2e2dd; font-size: 11px; cursor: pointer; }
.text-button:hover { color: #fff; text-decoration: underline; }

.main-area { min-height: 100vh; margin-left: var(--sidebar); }
.topbar {
  min-height: 78px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.page-heading { min-width: 180px; margin-right: auto; }
.page-heading h1 { margin: 0; font-size: 20px; line-height: 1.3; }
.page-heading p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.user-menu-button { height: 36px; display: flex; align-items: center; gap: 7px; padding: 0 9px 0 5px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: #fff; cursor: pointer; }
.user-menu-button span { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 4px; background: var(--brand-soft); color: var(--brand); font-size: 11px; font-weight: 800; }
.user-menu-button strong { max-width: 82px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }

.search-box {
  width: 230px;
  height: 36px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
}
.search-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(11,107,87,.12); }
.search-box input { min-width: 0; flex: 1; border: 0; outline: 0; color: var(--text); background: transparent; }

.button, .icon-button {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.button { padding: 0 13px; font-size: 12px; font-weight: 700; }
.button.primary { background: var(--brand); color: #fff; }
.button.primary:hover { background: var(--brand-strong); }
.button.secondary { background: #fff; border-color: var(--line-strong); color: #2d403a; }
.button.secondary:hover { background: var(--surface-soft); border-color: #aebfba; }
.attendance-edit-mode-button { min-width: 82px; }
.attendance-edit-mode-button.active { border-color: var(--brand); background: var(--brand); color: #fff; }
.attendance-edit-mode-button.active:hover { background: var(--brand-strong); }
.button:disabled, .icon-button:disabled { opacity: .45; cursor: not-allowed; }
.icon-button { width: 36px; padding: 0; background: #fff; border-color: var(--line-strong); font-size: 20px; line-height: 1; }
.icon-button:hover { background: var(--surface-soft); }

.workspace-view { display: none; padding: 18px 22px 30px; }
.workspace-view.active { display: block; }

.control-band {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 14px;
}
.period-controls, .command-controls { display: flex; align-items: end; gap: 8px; }
.attendance-mode-state { min-width: 66px; height: 36px; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; font-weight: 700; white-space: nowrap; }
.attendance-mode-state::before { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #9caaa6; content: ""; }
.attendance-mode-state.active { color: var(--brand-strong); }
.attendance-mode-state.active::before { background: #19a47e; box-shadow: 0 0 0 3px rgba(25,164,126,.13); }
.period-controls label { display: grid; gap: 4px; color: var(--muted); font-size: 10px; font-weight: 700; }
select {
  height: 36px;
  min-width: 82px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  outline: none;
}
select:focus { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(11,107,87,.12); }

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.summary-item { min-height: 76px; padding: 13px 16px; border-right: 1px solid var(--line); }
.summary-item:last-child { border-right: 0; }
.summary-item span, .summary-item strong { display: block; }
.summary-item span { color: var(--muted); font-size: 11px; }
.summary-item strong { margin-top: 5px; font-size: 22px; line-height: 1; }
.summary-item em { margin-left: 6px; color: var(--muted); font-size: 11px; font-style: normal; font-weight: 400; }

.status-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 13px 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow-x: auto;
}
.status-toolbar::before { content: "状态"; margin: 0 6px 0 2px; color: var(--muted); font-size: 11px; font-weight: 700; }
.status-button {
  min-width: 54px;
  height: 31px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
  white-space: nowrap;
  font-size: 11px;
}
.status-button .status-symbol { font-size: 13px; font-weight: 800; }
.status-button.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-strong); box-shadow: inset 0 0 0 1px var(--brand); }
.status-button.clear.active { border-color: #7b8985; background: #eef2f1; color: #30433d; box-shadow: inset 0 0 0 1px #7b8985; }
.status-button:disabled { cursor: default; opacity: .55; }

.table-frame { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.table-meta { min-height: 50px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 13px; border-bottom: 1px solid var(--line); }
.table-meta strong { font-size: 13px; }
.table-meta > div > span { margin-left: 8px; color: var(--muted); font-size: 11px; }
.legend { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.legend-item { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 10px; }
.legend-swatch { width: 8px; height: 8px; border-radius: 2px; }
.table-scroller { max-height: calc(100vh - 340px); min-height: 330px; overflow: auto; }

.attendance-table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: 11px; }
.attendance-table th, .attendance-table td { height: 34px; padding: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fff; text-align: center; }
.attendance-table thead th { position: sticky; top: 0; z-index: 7; height: 48px; background: #eef7f3; color: #36564d; font-weight: 700; }
.attendance-table th:last-child, .attendance-table td:last-child { border-right: 0; }
.attendance-table tbody tr:last-child td { border-bottom: 0; }
.attendance-table tbody tr:hover td { background: #f8fbfa; }
.attendance-table .sticky-number { position: sticky; left: 0; z-index: 5; width: 44px; min-width: 44px; background: #fff; }
.attendance-table .sticky-name { position: sticky; left: 44px; z-index: 5; width: 164px; min-width: 164px; padding: 0 9px; background: #fff; text-align: left; box-shadow: 4px 0 5px rgba(33,64,56,.05); }
.attendance-table thead .sticky-number, .attendance-table thead .sticky-name { z-index: 9; background: #dcefe7; }
.attendance-table .day-heading { width: 32px; min-width: 32px; }
.attendance-table .day-heading span { display: block; }
.attendance-table .day-heading small { display: block; margin-top: 3px; color: #75877f; font-size: 9px; font-weight: 500; }
.attendance-table .weekend { background: #f0f8f2; }
.attendance-table tbody tr:hover .weekend { background: #e9f5ec; }
.attendance-table .today-heading { background: #fff1a9; color: #513f00; }
.attendance-table .stat-heading { min-width: 46px; background: #f7dedc; color: #80423e; }
.attendance-table .note-heading { min-width: 120px; background: #dcefe7; }
.attendance-table .status-cell { width: 32px; min-width: 32px; cursor: pointer; user-select: none; font-size: 12px; font-weight: 800; }
.attendance-table.attendance-locked .status-cell { cursor: default; }
.attendance-table .status-cell:focus { position: relative; z-index: 4; outline: 2px solid var(--brand); outline-offset: -2px; }
.attendance-table .status-cell[data-status="√"] { color: #08765e; background: #edf8f3; }
.attendance-table .status-cell[data-status="休"] { color: #397359; background: #eff6e7; }
.attendance-table .status-cell[data-status="事"] { color: #8a5c13; background: #fff5dc; }
.attendance-table .status-cell[data-status="旷"] { color: #a53333; background: #fde8e6; }
.attendance-table .status-cell[data-status="迟"] { color: #b45d13; background: #ffeedf; }
.attendance-table .status-cell[data-status="外"] { color: #2f63a5; background: #eaf2fc; }
.attendance-table .status-cell[data-status="带"] { color: #66469c; background: #f0eafa; }
.attendance-table .status-cell[data-status="请"] { color: #8c4f75; background: #f9eaf2; }
.attendance-table .status-cell.employment-inactive, .attendance-table tbody tr:hover .status-cell.employment-inactive { background: #edf0ef; cursor: not-allowed; }
.attendance-table .stat-cell { min-width: 46px; color: #40544e; font-variant-numeric: tabular-nums; }
.attendance-table .stat-cell.has-value { font-weight: 800; color: #182b25; }
.attendance-table .note-cell { min-width: 120px; padding: 0 8px; }
.note-input { width: 100%; border: 0; outline: 0; background: transparent; font-size: 11px; }
.employee-name-wrap { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.employee-identity, .personnel-person-name, .report-person-name { min-width: 0; display: flex; align-items: center; gap: 5px; }
.employee-name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.position-badge { height: 18px; display: inline-grid; place-items: center; flex: 0 0 auto; padding: 0 5px; border: 1px solid transparent; border-radius: 3px; font-size: 9px; font-weight: 800; line-height: 1; white-space: nowrap; }
.position-badge.director { border-color: #8fc5b8; background: #e4f3ee; color: #075846; }
.position-badge.deput { border-color: #e1c17b; background: #fff4d8; color: #7b5410; }
.employment-badge { height: 18px; display: inline-grid; place-items: center; flex: 0 0 auto; padding: 0 5px; border: 1px solid #d9aaa6; border-radius: 3px; background: #fbeceb; color: #9b3737; font-size: 9px; font-weight: 800; line-height: 1; white-space: nowrap; }
.remove-employee { width: 22px; height: 22px; flex: 0 0 auto; border: 0; border-radius: 4px; background: transparent; color: #98a8a2; cursor: pointer; opacity: 0; }
tr:hover .remove-employee, .remove-employee:focus { opacity: 1; }
.remove-employee:hover { background: #fbe8e7; color: var(--danger); }

.empty-state { min-height: 280px; display: grid; place-content: center; text-align: center; }
.empty-state strong { font-size: 15px; }
.empty-state span { margin-top: 5px; color: var(--muted); font-size: 12px; }

.overview-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.overview-header h2 { margin: 0; font-size: 18px; }
.overview-header p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.overview-actions { display: flex; align-items: end; gap: 8px; }
.report-actions { display: flex; align-items: center; gap: 8px; }
.overview-day-control { display: grid; gap: 4px; color: var(--muted); font-size: 10px; font-weight: 700; }
.overview-day-control select { min-width: 96px; }
#overviewDepartmentSelect, #monthlyDepartmentSelect { min-width: 120px; }
.overview-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.kpi-card { min-height: 104px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.kpi-card span, .kpi-card strong { display: block; }
.kpi-card span { color: var(--muted); font-size: 11px; }
.kpi-card strong { margin-top: 12px; font-size: 26px; }
.kpi-card small { color: var(--muted); font-size: 10px; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); gap: 12px; }
.report-panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.panel-heading { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 15px; border-bottom: 1px solid var(--line); }
.panel-heading h3 { margin: 0; font-size: 13px; }
.panel-heading span { color: var(--muted); font-size: 10px; }
.department-progress { display: grid; gap: 13px; padding: 15px; }
.progress-row { display: grid; grid-template-columns: 70px 1fr 62px; align-items: center; gap: 10px; font-size: 11px; }
.progress-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-track { height: 8px; border-radius: 4px; background: #e9efed; overflow: hidden; }
.progress-fill { height: 100%; background: var(--brand); border-radius: inherit; }
.progress-value { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.distribution { display: grid; grid-template-columns: 142px 1fr; align-items: center; gap: 18px; padding: 19px; }
.donut {
  width: 132px;
  height: 132px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--brand) 0 100%);
}
.donut::after { content: ""; width: 78px; height: 78px; border-radius: 50%; background: #fff; }
.distribution-legend { display: grid; gap: 7px; }
.distribution-row { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 7px; font-size: 10px; }
.distribution-row b { width: 8px; height: 8px; border-radius: 2px; }
.distribution-row span { color: var(--muted); }
.distribution-row strong { font-variant-numeric: tabular-nums; }
.overview-table-panel { margin-top: 12px; }
.overview-table-wrap { overflow-x: auto; }
.overview-table { width: 100%; min-width: 800px; border-collapse: collapse; font-size: 11px; }
.overview-table th, .overview-table td { height: 38px; padding: 0 12px; border-bottom: 1px solid var(--line); text-align: right; }
.overview-table th { color: var(--muted); background: var(--surface-soft); font-size: 10px; }
.overview-table th:first-child, .overview-table td:first-child { text-align: left; }
.overview-table .overview-total-row td { background: #edf6f2; border-bottom-color: #bfd8ce; color: #163f34; font-weight: 700; }
.overview-table tr:last-child td { border-bottom: 0; }
.daily-roster-panel { margin-top: 12px; }
.daily-status-roster { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.status-roster-group { min-height: 154px; padding: 14px 15px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.status-roster-group:nth-child(4n) { border-right: 0; }
.status-roster-group:nth-child(n+5) { border-bottom: 0; }
.status-roster-heading { display: flex; align-items: center; gap: 7px; margin-bottom: 10px; }
.status-roster-heading i { width: 9px; height: 9px; border-radius: 2px; }
.status-roster-heading strong { font-size: 12px; }
.status-roster-heading span { margin-left: auto; color: var(--muted); font-size: 10px; }
.status-roster-names { display: grid; gap: 6px; }
.status-roster-person { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; align-items: baseline; font-size: 10px; }
.status-roster-person strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.status-roster-person span { color: var(--muted); white-space: nowrap; }
.status-roster-empty { color: #97a6a1; font-size: 10px; }
.monthly-overview-section { margin-top: 0; padding-top: 18px; border-top: 0; }
.monthly-overview-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.monthly-overview-heading h2 { margin: 0; font-size: 18px; }
.monthly-overview-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.monthly-actions { display: flex; align-items: end; gap: 12px; }
.monthly-period-controls { display: flex; align-items: end; gap: 8px; }
.monthly-period-controls label { display: grid; gap: 4px; color: var(--muted); font-size: 10px; font-weight: 700; }
.monthly-rate-section { padding: 14px 0 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.monthly-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.monthly-section-heading h3 { margin: 0; font-size: 13px; }
.monthly-section-heading span { color: var(--muted); font-size: 10px; }
.department-rate-grid { display: grid; grid-template-columns: repeat(7, minmax(116px, 1fr)); gap: 9px; }
.department-rate-item { min-height: 190px; display: grid; justify-items: center; align-content: center; gap: 9px; padding: 12px 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.department-rate-ring { width: 102px; height: 102px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--ring-color) 0 var(--rate), #e7eeeb var(--rate) 100%); }
.department-rate-ring::before { content: ""; grid-area: 1 / 1; width: 72px; height: 72px; border-radius: 50%; background: #fff; }
.department-rate-ring strong { grid-area: 1 / 1; z-index: 1; font-size: 19px; }
.department-rate-item > strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.department-rate-item > span { color: var(--muted); font-size: 9px; }
.monthly-insight-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-top: 12px; }
.full-attendance-list { min-height: 260px; max-height: 420px; overflow: auto; display: grid; align-content: start; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; padding: 8px 15px 14px; }
.full-attendance-person { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 38px; border-bottom: 1px solid var(--line); font-size: 10px; }
.full-attendance-person strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.full-attendance-person span { color: var(--muted); white-space: nowrap; }
.monthly-empty { min-height: 150px; display: grid; place-items: center; color: #97a6a1; font-size: 11px; }
.exception-ranking { min-height: 260px; padding: 8px 15px 14px; }
.exception-person { min-height: 45px; display: grid; grid-template-columns: 26px minmax(0, 1fr); align-items: center; gap: 9px; border-bottom: 1px solid var(--line); }
.exception-person:last-child { border-bottom: 0; }
.exception-rank { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 4px; background: #edf3f1; color: #4c625b; font-size: 10px; font-weight: 800; }
.exception-person div { min-width: 0; }
.exception-person strong, .exception-person small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exception-person strong { font-size: 11px; }
.exception-person small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.monthly-attendance-panel { margin-top: 12px; min-width: 0; }
.monthly-attendance-details { overflow-x: auto; }
.monthly-attendance-table { --badge-width: 48px; --name-gap: 5px; width: 100%; min-width: 850px; table-layout: fixed; border-collapse: collapse; font-size: 11px; font-variant-numeric: tabular-nums; }
.monthly-attendance-table th, .monthly-attendance-table td { padding: 10px 6px; border-bottom: 1px solid var(--line); text-align: center; overflow-wrap: anywhere; }
.monthly-attendance-table th { background: var(--surface-soft); color: var(--muted); font-size: 10px; }
.monthly-attendance-table th:first-child { width: 46px; }
.monthly-attendance-table th:nth-child(2) { width: 23%; }
.monthly-attendance-table th:nth-child(3) { width: 15%; }
.monthly-attendance-table th:nth-child(2), .monthly-attendance-table th:nth-child(3),
.monthly-attendance-table td:nth-child(2), .monthly-attendance-table td:nth-child(3) { text-align: left; }
.monthly-name-label { display: block; padding-left: calc(var(--badge-width) + var(--name-gap)); }
.monthly-person-name { display: grid; grid-template-columns: var(--badge-width) minmax(0, 1fr); align-items: center; gap: var(--name-gap); min-height: 18px; }
.monthly-person-badges { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.monthly-person-name strong { min-width: 0; }
.monthly-attendance-table .zero-count { color: var(--muted); }
.monthly-attendance-table tbody tr:last-child td { border-bottom: 0; }

.pdf-export-stage { position: relative; z-index: 10000; width: 1040px; padding: 0; background: #fff; color: #18342c; pointer-events: none; }
.pdf-report-header { min-height: 112px; display: flex; flex-direction: column; justify-content: center; padding: 0 4px 18px; border-bottom: 3px solid var(--brand); }
.pdf-report-header span { color: var(--brand); font-size: 11px; font-weight: 800; }
.pdf-report-header h1 { margin: 8px 0 5px; font-size: 27px; letter-spacing: 0; }
.pdf-report-header p { margin: 0; color: var(--muted); font-size: 12px; }
.pdf-report-content { display: block !important; width: 1040px !important; max-width: none !important; margin: 0 !important; padding: 20px 0 0 !important; background: #fff !important; }
.pdf-report-content .overview-actions,
.pdf-report-content .monthly-actions { display: none !important; }
.pdf-report-content .overview-kpis { gap: 12px; }
.pdf-report-content .kpi-card { min-height: 96px; border-color: #cfdcd8; }
.pdf-report-content .department-rate-item,
.pdf-report-content .kpi-card { break-inside: avoid; page-break-inside: avoid; box-shadow: none; }
.pdf-report-content .pdf-rate-ring { background: none !important; }
.pdf-report-content .pdf-rate-ring::before { display: none; }
.pdf-report-content .pdf-rate-ring-image { width: 102px; height: 102px; grid-area: 1 / 1; }
.pdf-report-content .report-panel,
.pdf-report-content .monthly-rate-section { box-shadow: none; }
.pdf-report-content .status-roster-group { break-inside: avoid; page-break-inside: avoid; }
.pdf-report-content .status-roster-group { min-height: 0; padding: 10px 12px; }
.pdf-report-content .status-roster-heading { margin-bottom: 6px; }
.pdf-report-content .status-roster-names { gap: 2px; }
.pdf-report-content .status-roster-person { gap: 5px; font-size: 9px; line-height: 1.25; }
.pdf-report-content .panel-heading { background: #f4f8f6; }
.pdf-report-content .overview-table { min-width: 0; table-layout: fixed; }
.pdf-report-content .overview-table th,
.pdf-report-content .overview-table td { padding: 0 7px; }
.pdf-report-content .overview-table th:first-child { width: 108px; }
.pdf-report-content .full-attendance-list { max-height: none; overflow: visible; }
.pdf-report-content .department-rate-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.pdf-report-content .daily-status-roster { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pdf-monthly-report .monthly-insight-grid { display: block; }
.pdf-monthly-report .monthly-insight-grid > .report-panel + .report-panel { margin-top: 12px; }
.pdf-monthly-report .pdf-exception-panel { break-inside: avoid; page-break-inside: avoid; }
.pdf-monthly-report .exception-ranking {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  padding: 0;
}
.pdf-monthly-report .exception-person {
  min-height: 58px;
  grid-template-columns: 24px minmax(0, 1fr);
  align-content: center;
  padding: 10px 12px;
  border-right: 1px solid var(--line);
  break-inside: avoid;
  page-break-inside: avoid;
}
.pdf-monthly-report .exception-person small { white-space: normal; line-height: 1.4; }
.pdf-monthly-report .full-attendance-list {
  min-height: 0;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0 14px;
  padding: 4px 14px 10px;
}
.pdf-monthly-report .full-attendance-person { min-height: 24px; font-size: 8px; }
.pdf-monthly-report .monthly-insight-grid .panel-heading { break-after: avoid; page-break-after: avoid; }
.pdf-monthly-report .monthly-attendance-details { overflow: visible; }
.pdf-monthly-report .monthly-attendance-table { min-width: 0; font-size: 10px; }
.pdf-monthly-report .monthly-attendance-table th, .pdf-monthly-report .monthly-attendance-table td { padding: 7px 6px; }
.pdf-monthly-report .monthly-attendance-table tr { break-inside: avoid; page-break-inside: avoid; }
.pdf-monthly-report .monthly-attendance-panel > .panel-heading { break-after: avoid; page-break-after: avoid; }
.pdf-daily-report .overview-table-panel,
.pdf-daily-report .daily-roster-panel,
.pdf-monthly-report .monthly-insight-grid,
.pdf-monthly-report .monthly-attendance-panel { margin-top: 0; }

.modal { width: min(420px, calc(100vw - 30px)); padding: 0; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 18px 60px rgba(20,45,38,.22); }
.modal::backdrop { background: rgba(17,35,30,.42); }
.modal form { padding: 18px; }
.modal-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.modal-heading h2 { margin: 0; font-size: 17px; }
.modal-heading p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.field-label { display: grid; gap: 7px; margin-top: 20px; color: #43564f; font-size: 11px; font-weight: 700; }
.field-label[hidden] { display: none; }
.field-label input { height: 40px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: var(--radius); outline: 0; }
.field-label input:focus { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(11,107,87,.12); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.personnel-modal { width: min(980px, calc(100vw - 30px)); max-height: calc(100vh - 30px); overflow: auto; }
.personnel-dialog-body { padding: 18px; }
.personnel-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 22px; margin-top: 18px; }
.personnel-section { min-width: 0; }
.personnel-section form { padding: 0; }
.personnel-section + .personnel-section { padding-left: 22px; border-left: 1px solid var(--line); }
.personnel-section-heading { min-height: 30px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.personnel-section-heading h3 { margin: 0; font-size: 13px; }
.personnel-section-heading span, .select-all-people { color: var(--muted); font-size: 10px; }
.personnel-names-label { margin-top: 11px; }
.personnel-names-label textarea { width: 100%; min-height: 150px; resize: vertical; padding: 10px 11px; border: 1px solid var(--line-strong); border-radius: var(--radius); outline: 0; font: inherit; line-height: 1.65; }
.personnel-names-label textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(11,107,87,.12); }
.personnel-add-options { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.personnel-add-options .field-label { margin-top: 11px; }
.personnel-add-options select { width: 100%; }
.select-all-people { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.select-all-people input, .personnel-item input { accent-color: var(--brand); }
.personnel-list { height: 260px; overflow: auto; margin-top: 11px; border: 1px solid var(--line); border-radius: var(--radius); }
.personnel-item { min-height: 48px; display: grid; grid-template-columns: auto minmax(0, 1fr) 78px auto; align-items: center; gap: 8px; padding: 5px 8px 5px 11px; border-bottom: 1px solid var(--line); font-size: 11px; }
.personnel-item:last-child { border-bottom: 0; }
.personnel-item:hover { background: var(--surface-soft); }
.personnel-person-name > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.personnel-person-identity { min-width: 0; }
.personnel-person-identity small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; white-space: nowrap; }
.personnel-position-select { width: 78px; height: 30px; padding: 0 6px; border: 1px solid var(--line-strong); border-radius: 4px; background: #fff; color: var(--text); font-size: 10px; outline: 0; }
.personnel-position-select:focus { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(11,107,87,.12); }
.personnel-empty { height: 100%; display: grid; place-items: center; color: var(--muted); font-size: 11px; }
.personnel-delete-actions { align-items: center; justify-content: space-between; margin-top: 12px; }
.personnel-delete-actions span { color: var(--muted); font-size: 10px; }
.personnel-row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.personnel-row-actions .mini-button { white-space: nowrap; }
.personnel-row-actions .leave-button { border-color: #e4b8b5; color: var(--danger); }
.archived-personnel-section { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.archived-personnel-section .personnel-section-heading > div { display: flex; align-items: baseline; gap: 8px; }
.archived-personnel-section input[type="search"] { width: 220px; height: 32px; padding: 0 9px; border: 1px solid var(--line-strong); border-radius: 4px; outline: 0; }
.archived-personnel-list { max-height: 210px; overflow: auto; margin-top: 10px; border: 1px solid var(--line); border-radius: var(--radius); }
.archived-personnel-item { min-height: 48px; display: grid; grid-template-columns: minmax(140px, .8fr) minmax(0, 1.8fr) auto; align-items: center; gap: 12px; padding: 7px 10px; border-bottom: 1px solid var(--line); font-size: 10px; }
.archived-personnel-item:last-child { border-bottom: 0; }
.archived-personnel-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.archived-personnel-item strong .position-badge { margin-right: 5px; }
.archived-personnel-item span { color: var(--muted); line-height: 1.45; }
.archive-empty { min-height: 64px; display: grid; place-items: center; color: var(--muted); font-size: 10px; }
.employment-history-body { padding: 18px; }
.employment-history-list { max-height: 390px; overflow: auto; margin-top: 18px; border: 1px solid var(--line); border-radius: var(--radius); }
.employment-history-item { min-height: 72px; display: grid; gap: 5px; padding: 11px 12px; border-bottom: 1px solid var(--line); }
.employment-history-item:last-child { border-bottom: 0; }
.employment-history-item > div { display: flex; align-items: center; gap: 7px; }
.employment-history-item .history-correction-button { margin-left: auto; }
.employment-history-item span, .employment-history-item small { color: var(--muted); font-size: 10px; }
.employment-history-item small { color: #8a5c13; }
.danger-button { border-color: #e4b8b5; background: #fff; color: var(--danger); }
.danger-button:hover { border-color: var(--danger); background: #fbe8e7; }
.compact-modal { width: min(460px, calc(100vw - 30px)); }
.backup-actions { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 18px; }
.backup-option { min-height: 92px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 5px; padding: 13px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-soft); cursor: pointer; text-align: left; }
.backup-option:hover { border-color: var(--brand); background: var(--brand-soft); }
.backup-option strong { font-size: 13px; }
.backup-option span { color: var(--muted); font-size: 10px; }
.backup-option input { display: none; }
.account-actions { display: grid; gap: 9px; margin-top: 18px; }
.danger-option strong { color: var(--danger); }
.users-modal { width: min(920px, calc(100vw - 30px)); }
.users-dialog-body { padding: 18px; }
.new-user-form { display: grid; grid-template-columns: 1fr 1fr 1.2fr 90px 130px auto; gap: 8px; margin: 18px 0 12px; }
.new-user-form input { height: 36px; min-width: 0; padding: 0 9px; border: 1px solid var(--line-strong); border-radius: var(--radius); }
.new-user-form select, .users-table select { height: 36px; min-width: 0; border: 1px solid var(--line-strong); border-radius: var(--radius); background: #fff; }
.users-table-wrap { max-height: 420px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.users-table { width: 100%; border-collapse: collapse; font-size: 10px; }
.users-table th, .users-table td { height: 42px; padding: 0 10px; border-bottom: 1px solid var(--line); text-align: left; }
.users-table th { position: sticky; top: 0; background: var(--surface-soft); color: var(--muted); }
.users-table tr:last-child td { border-bottom: 0; }
.users-table select { height: 30px; min-width: 82px; }
.mini-button { height: 29px; padding: 0 8px; border: 1px solid var(--line); border-radius: 4px; background: #fff; cursor: pointer; font-size: 9px; }
.mini-button:hover { border-color: var(--brand); }
.role-badge { display: inline-block; padding: 3px 6px; border-radius: 4px; background: var(--brand-soft); color: var(--brand); }

.login-screen { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 18px; background: #edf3f1; }
.login-screen.hidden { display: none; }
.login-panel { width: min(390px, 100%); padding: 28px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; box-shadow: 0 22px 70px rgba(20,52,43,.14); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-brand .brand-mark { width: 42px; height: 42px; }
.login-brand h1 { margin: 0; font-size: 20px; }
.login-brand p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.login-panel label { display: grid; gap: 6px; margin-top: 13px; color: #40544d; font-size: 11px; font-weight: 700; }
.login-panel input { height: 42px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: var(--radius); outline: none; }
.login-panel input:focus { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(11,107,87,.12); }
.login-panel > .button { width: 100%; height: 42px; margin-top: 8px; }
.login-panel > span { display: block; margin-top: 13px; color: var(--muted); text-align: center; font-size: 9px; }
.login-record-link { display: block; margin-top: 8px; color: var(--muted); font-size: 9px; text-align: center; text-decoration: none; }
.login-record-link:hover { color: var(--brand); text-decoration: underline; }
.login-error { min-height: 18px; margin: 7px 0 0; color: var(--danger); font-size: 10px; }
.viewer-mode .write-control, .viewer-mode #statusToolbar, .viewer-mode #undoButton, .viewer-mode #fillTodayButton, .viewer-mode #addEmployeeButton { display: none !important; }
.viewer-mode .status-cell { cursor: default; }

.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: grid; gap: 8px; pointer-events: none; }
.toast { min-width: 240px; padding: 11px 13px; border-radius: var(--radius); background: #173d35; color: #fff; box-shadow: 0 10px 30px rgba(18,47,39,.24); font-size: 11px; animation: toast-in .18s ease-out; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

.mobile-only { display: none; }
.sidebar-scrim { display: none; }

@media (max-width: 1160px) {
  .department-rate-grid { grid-template-columns: repeat(4, minmax(116px, 1fr)); }
}

@media (max-width: 980px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 12px 0 40px rgba(12,40,33,.2); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 20; background: rgba(12,31,26,.38); }
  .sidebar-scrim.open { display: block; }
  .main-area { margin-left: 0; }
  .mobile-only { display: inline-grid; place-items: center; }
  .brand .mobile-only { margin-left: auto; background: transparent; border-color: rgba(255,255,255,.2); color: #fff; }
  .overview-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .site-footer { padding: 0 10px 12px; }
  .topbar { min-height: auto; flex-wrap: wrap; padding: 11px 12px; }
  .page-heading { min-width: 0; flex: 1; }
  .page-heading h1 { font-size: 17px; }
  .topbar-actions { width: 100%; }
  .search-box { flex: 1; width: auto; }
  .topbar-actions .button { padding: 0 10px; }
  .user-menu-button strong { display: none; }
  .new-user-form { grid-template-columns: 1fr; }
  .personnel-grid { grid-template-columns: 1fr; }
  .personnel-section + .personnel-section { padding-top: 18px; padding-left: 0; border-top: 1px solid var(--line); border-left: 0; }
  .personnel-names-label textarea { min-height: 150px; }
  .personnel-list { height: 220px; }
  .archived-personnel-item { grid-template-columns: minmax(100px, .8fr) minmax(0, 1.2fr) auto; }
  .workspace-view { padding: 12px 10px 24px; }
  .control-band { align-items: stretch; flex-direction: column; }
  .period-controls { align-items: end; }
  .period-controls label { flex: 1; }
  .period-controls select { width: 100%; }
  .command-controls { overflow-x: auto; }
  .command-controls .button { white-space: nowrap; }
  .summary-strip { grid-template-columns: repeat(2, 1fr); }
  .summary-item { min-height: 66px; border-bottom: 1px solid var(--line); }
  .summary-item:nth-child(2) { border-right: 0; }
  .summary-item:nth-child(3), .summary-item:nth-child(4) { border-bottom: 0; }
  .summary-item strong { font-size: 19px; }
  .table-meta { align-items: flex-start; flex-direction: column; }
  .legend { justify-content: flex-start; }
  .table-scroller { max-height: calc(100vh - 420px); }
  .overview-kpis { grid-template-columns: repeat(2, 1fr); }
  .overview-header { align-items: flex-start; }
  .overview-actions { align-items: stretch; flex-direction: column; }
  .overview-actions .report-actions { width: 100%; }
  .overview-actions .report-actions .button { flex: 1; }
  .overview-day-control select { width: 100%; }
  .distribution { grid-template-columns: 120px 1fr; }
  .donut { width: 112px; height: 112px; }
  .donut::after { width: 68px; height: 68px; }
  .daily-status-roster { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .department-rate-grid { grid-template-columns: repeat(2, minmax(116px, 1fr)); }
  .status-roster-group:nth-child(4n) { border-right: 1px solid var(--line); }
  .status-roster-group:nth-child(2n) { border-right: 0; }
  .status-roster-group:nth-child(n+5) { border-bottom: 1px solid var(--line); }
  .status-roster-group:nth-child(n+7) { border-bottom: 0; }
}

@media (max-width: 480px) {
  .personnel-add-options { grid-template-columns: 1fr; }
  .archived-personnel-section .personnel-section-heading { align-items: stretch; flex-direction: column; }
  .archived-personnel-section input[type="search"] { width: 100%; }
  .archived-personnel-item { grid-template-columns: 1fr auto; }
  .archived-personnel-item span { grid-column: 1 / -1; grid-row: 2; }
  .daily-status-roster { grid-template-columns: 1fr; }
  .status-roster-group, .status-roster-group:nth-child(4n), .status-roster-group:nth-child(2n) { border-right: 0; border-bottom: 1px solid var(--line); }
  .status-roster-group:last-child { border-bottom: 0; }
  .monthly-overview-heading { align-items: flex-start; flex-direction: column; }
  .monthly-actions { width: 100%; align-items: stretch; flex-direction: column; }
  .monthly-period-controls { width: 100%; }
  .monthly-period-controls label { flex: 1; }
  .monthly-period-controls select { width: 100%; }
  .department-rate-grid { grid-template-columns: repeat(2, minmax(116px, 1fr)); }
  .monthly-insight-grid { grid-template-columns: 1fr; }
  .full-attendance-list { grid-template-columns: 1fr; }
  .monthly-section-heading { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 420px) {
  .department-rate-grid { grid-template-columns: 1fr; }
  .department-rate-item { min-height: 168px; }
}

@media print {
  .sidebar, .topbar, .control-band, .status-toolbar, .report-actions { display: none !important; }
  .main-area { margin: 0; }
  .workspace-view { padding: 0; }
  .table-scroller { max-height: none; overflow: visible; }
  .table-frame, .report-panel { border-color: #bbb; }
  .attendance-table { transform-origin: top left; }
  .full-attendance-list { max-height: none; overflow: visible; }
  .monthly-attendance-details { overflow: visible; }
  .monthly-attendance-table { min-width: 0; font-size: 9px; }
  .monthly-attendance-table tr { break-inside: avoid; page-break-inside: avoid; }
}
