/**
 * assets/css/hrm-dashboard.css
 * 근태·인건비 실데이터 대시보드 스타일시트 (AGY-4)
 * 규격: docs/contracts/hrm-dashboard-v1.md (V1.5)
 * 성은 스마트 HR 단일 스크롤 레이아웃 & 테마
 */

.hrm-dashboard-screen {
  padding-bottom: 60px;
}

/* 1. 다크 네이비 히어로 */
.hrm-hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #f8fafc;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.hrm-hero-inner {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.hrm-hero-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.hrm-hero-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.hrm-brand-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 8px;
  border-radius: 4px;
}
.hrm-hero-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hrm-hero-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.hrm-hero-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}
.hrm-hero-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.hrm-hero-title {
  font-size: 26px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
  margin: 0 0 6px 0;
}
.hrm-hero-subtitle {
  font-size: 13px;
  color: #cbd5e1;
  margin: 0;
  opacity: 0.9;
}
.hrm-hero-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.hrm-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: rgba(255, 255, 255, 0.06);
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.hrm-meta-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: #94a3b8;
}
.hrm-meta-val {
  font-size: 14px;
  font-weight: 700;
  color: #f1f5f9;
}

/* 앵커 바 */
.hrm-anchor-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 4px;
}
.hrm-anchor-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.hrm-anchor-link {
  font-size: 12px;
  font-weight: 600;
  color: #cbd5e1;
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 6px;
  transition: all 0.2s ease;
}
.hrm-anchor-link:hover, .hrm-anchor-link.active {
  background: rgba(59, 130, 246, 0.3);
  color: #93c5fd;
}
.hrm-anchor-external {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hrm-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.08);
  color: #93c5fd;
  border: 1px solid rgba(147, 197, 253, 0.3);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.hrm-link-btn:hover {
  background: rgba(147, 197, 253, 0.2);
  color: #fff;
}

/* 뱃지 */
.hrm-badge-live {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}
.hrm-badge-role {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
}
.hrm-role-admin {
  background: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.4);
}
.hrm-role-user {
  background: rgba(148, 163, 184, 0.25);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.4);
}
.hrm-badge-status {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
}
.hrm-badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

/* 2. 공통 필터 바 (Sticky) */
.hrm-filter-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hrm-filter-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}
.hrm-filter-bottom {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.hrm-filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.hrm-filter-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.hrm-filter-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.hrm-select {
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  cursor: pointer;
}
.hrm-select:focus {
  border-color: #3b82f6;
}
.hrm-month-pill-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}
.hrm-pills-scroll,
.hrm-pills-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
.hrm-month-pill {
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.hrm-month-pill:hover {
  background: rgba(59, 130, 246, 0.08);
  border-color: #3b82f6;
  color: #2563eb;
}
.hrm-month-pill.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}
.hrm-search-item {
  flex: 1;
  min-width: 180px;
}
.hrm-input-search {
  width: 100%;
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  outline: none;
}
.hrm-input-search:focus {
  border-color: #3b82f6;
}
.hrm-filter-scope-hint {
  font-size: 11px;
  color: var(--muted);
  width: 100%;
  line-height: 1.4;
  margin-top: 2px;
}

/* 3. 섹션 & 6대 KPI 카드 */
.hrm-section {
  margin-bottom: 32px;
  scroll-margin-top: 70px;
}
.hrm-section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.hrm-section-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 2px 0;
  letter-spacing: -0.01em;
}
.hrm-section-desc {
  font-size: 12px;
  color: var(--muted);
}
.hrm-badge-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
  border: 1px solid rgba(59, 130, 246, 0.2);
}
.hrm-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}
.hrm-kpi-card {
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: 10px;
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.hrm-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
}
.hrm-kpi-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.hrm-kpi-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}
.hrm-kpi-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(148, 163, 184, 0.15);
  color: #64748b;
}
.hrm-kpi-badge.warn {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
}
.hrm-kpi-badge.success {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
}
.hrm-kpi-badge.accent {
  background: rgba(99, 102, 241, 0.15);
  color: #4f46e5;
}
.hrm-kpi-badge.info {
  background: rgba(59, 130, 246, 0.15);
  color: #2563eb;
}
.hrm-kpi-val {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.hrm-kpi-sub {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}
.hrm-card-notice {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 6px;
  border-top: 1px dashed var(--border);
  padding-top: 4px;
}

/* 4. 월별 흐름 차트 */
.hrm-chart-card {
  padding: 20px;
}
.hrm-chart-wrapper {
  width: 100%;
  height: 320px;
  position: relative;
}
.hrm-chart-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}
.hrm-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.hrm-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.hrm-chart-caption {
  font-size: 11px;
  color: var(--muted);
  margin-top: 10px;
  text-align: right;
}
.hrm-chart-bar-group {
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.hrm-chart-bar-group:hover {
  opacity: 0.85;
}

/* 5. 일별 캘린더 그리드 */
.hrm-calendar-card {
  padding: 16px;
}
.hrm-calendar-container {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}
.hrm-cal-th {
  text-align: center;
  padding: 8px 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  background: var(--bg);
  border-radius: 6px;
}
.hrm-cal-th.hrm-sun { color: #ef4444; }
.hrm-cal-th.hrm-sat { color: #3b82f6; }
.hrm-cal-cell {
  min-height: 72px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg, #ffffff);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}
.hrm-cal-cell:hover {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.04);
}
.hrm-cal-cell.selected {
  border-color: #2563eb;
  background: rgba(37, 99, 235, 0.08);
  box-shadow: 0 0 0 1px #2563eb;
}
.hrm-cal-cell.today {
  border-color: #f59e0b;
}
.hrm-cal-cell.today::after {
  content: '오늘';
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 9px;
  font-weight: 700;
  color: #d97706;
}
.hrm-cal-cell.hrm-weekend {
  background: rgba(148, 163, 184, 0.04);
}
.hrm-cal-blank {
  background: transparent;
  border-color: transparent;
  cursor: default;
}
.hrm-cal-date {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.hrm-cal-pills {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
}
.hrm-cal-pill {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pill-att { background: rgba(59, 130, 246, 0.15); color: #2563eb; }
.pill-late { background: rgba(245, 158, 11, 0.15); color: #d97706; }
.pill-leave { background: rgba(16, 185, 129, 0.15); color: #059669; }
.pill-ot { background: rgba(245, 158, 11, 0.1); color: #b45309; }
.hrm-cal-summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

/* 6. 전사 부서 비교 카드 그리드 */
.hrm-dept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.hrm-dept-card {
  padding: 16px;
  border-radius: 10px;
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s ease;
}
.hrm-dept-card:hover {
  transform: translateY(-2px);
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.12);
}
.hrm-dept-card.selected {
  border-color: #2563eb;
  background: rgba(37, 99, 235, 0.05);
  box-shadow: 0 0 0 1px #2563eb;
}
.hrm-dept-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}
.hrm-dept-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  margin-bottom: 4px;
  color: var(--muted);
}
.hrm-dept-stat-val {
  font-weight: 700;
  color: var(--text);
}

/* 7. 근로자 대장 & 상세 패널 */
.hrm-staff-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.hrm-staff-table-card {
  flex: 1;
  min-width: 0;
}
.hrm-table-interactive tbody tr {
  cursor: pointer;
  transition: background 0.15s ease;
}
.hrm-table-interactive tbody tr:hover {
  background: rgba(59, 130, 246, 0.06);
}
.hrm-table-interactive tbody tr.selected {
  background: rgba(37, 99, 235, 0.1);
  font-weight: 600;
}
.hrm-staff-detail-panel {
  width: 320px;
  flex-shrink: 0;
  padding: 18px;
  border-radius: 10px;
  border: 1px solid #3b82f6;
  background: var(--card-bg, #ffffff);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  position: sticky;
  top: 70px;
}
.hrm-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.hrm-detail-name {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 2px 0;
}
.hrm-detail-sub {
  font-size: 12px;
  color: var(--muted);
}
.hrm-detail-close {
  background: transparent;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}
.hrm-detail-close:hover {
  color: var(--text);
}
.hrm-detail-stats {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hrm-dstat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: 6px;
  font-size: 12px;
}
.hrm-dstat-label {
  color: var(--muted);
  font-weight: 600;
}
.hrm-dstat-val {
  font-weight: 800;
  color: var(--text);
}

/* 8. 배너류 */
.hrm-pending-banner, .hrm-forbidden-banner, .hrm-error-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 13px;
}
.hrm-pending-banner { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.hrm-forbidden-banner { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.hrm-error-banner { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.hrm-loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.hrm-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(59, 130, 246, 0.2);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: hrmSpin 0.8s linear infinite;
}
@keyframes hrmSpin {
  to { transform: rotate(360deg); }
}

/* 9. 푸터 */
.hrm-footer {
  margin-top: 40px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 11px;
  color: var(--muted);
}

@media (max-width: 900px) {
  .hrm-staff-layout { flex-direction: column; }
  .hrm-staff-detail-panel { width: 100%; position: static; }
  .hrm-hero-content { flex-direction: column; align-items: flex-start; }
  .hrm-hero-meta { width: 100%; justify-content: space-between; }
}
