/* ==========================================================
   재단 급여관리 플랫폼 — UI 디자인 시스템
   자매 프로젝트(재단 자금 관리 통합 플랫폼)의 화이트 미니멀 테마 준수.
   토큰 정의는 UI-design.md §1, 컴포넌트는 §3 기준.
   ========================================================== */

:root {
  /* ─── 텍스트 ─── */
  --text-title:     #111827;
  --text-body:      #1f2937;
  --text-body-2:    #374151;
  --text-link:      #4b5563;
  --text-label:     #6b7280;
  --text-caption:   #9ca3af;

  /* ─── 배경 ─── */
  --bg-main:        #ffffff;
  --bg-sidebar:     #f8f9fa;
  --bg-featured:    #f9f9f9;
  --bg-panel-head:  #fafafa;
  --bg-submenu:     #f0f2f5;

  /* ─── 테두리 ─── */
  --border-card:    #e8e8e8;
  --border-form:    #e5e7eb;
  --border-featured:#e0e0e0;
  --border-inner:   #f0f0f0;

  /* ─── 액센트 ─── */
  /* 브랜드 색상 통일: 사이드바 액티브와 모든 primary 버튼이 동일 마젠타 사용 */
  --accent-sidebar: #e91e63;
  --primary:        #e91e63;
  --primary-hover:  #c2185b;
  --danger:         #dc2626;
  --success:        #16a34a;
  --warning:        #f97316;
  --info:           #2563eb;
  --stat:           #5b21b6;
  /* 분석 보드 막대 — 브랜드 마젠타는 면적이 넓으면 눈이 피로 → 차분한 인디고 */
  --viz-bar:        #6366f1;
  --viz-bar-soft:   #c7d2fe;

  /* ─── 그림자 ─── */
  --shadow-rest:    0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-hover:   0 4px 16px rgba(0, 0, 0, 0.09);
  --shadow-sidebar: 2px 0 8px rgba(0, 0, 0, 0.05);
  --shadow-modal:   0 20px 60px rgba(0, 0, 0, 0.2);
  --shadow-panel:   -4px 0 24px rgba(0, 0, 0, 0.1);

  /* ─── 둥글기 ─── */
  --radius-card:    10px;
  --radius-modal:   1rem;
  --radius-pill:    9999px;
  --radius-input:   8px;

  /* ─── 트랜지션 ─── */
  --tr-fast:        0.15s ease;
  --tr-normal:      0.2s ease;
  --tr-slow:        0.3s ease;
}

/* ─── 기본 리셋 ─── */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family:
    "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    system-ui, Roboto, "Helvetica Neue", "Segoe UI",
    "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic",
    "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
  color: var(--text-body);
  background: var(--bg-main);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* =================== 레이아웃 =================== */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: 220px;
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-form);
  box-shadow: var(--shadow-sidebar);
  overflow: hidden;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform var(--tr-slow);
}

/* ── 브랜드 헤더 (상단 고정) ── */
.sidebar-brand {
  flex: 0 0 auto;
  padding: 1.1rem 1rem 0.9rem;
  background: var(--bg-main);
  border-bottom: 1px solid var(--border-form);
  display: block;
  text-decoration: none;
  color: inherit;
  transition: background var(--tr-fast);
  cursor: pointer;
}
.sidebar-brand:hover { background: var(--bg-featured); }
.sidebar-brand:focus-visible {
  outline: 2px solid var(--accent-sidebar);
  outline-offset: -2px;
}
.sidebar-brand .brand {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-title);
  letter-spacing: -0.015em;
  line-height: 1.25;
}
.sidebar-brand .brand-sub {
  font-size: 0.68rem;
  color: var(--text-caption);
  margin-top: 4px;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

/* ── 네비게이션(그룹 트리) ── */
.sidebar-nav {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.35rem 0 0.5rem;
}

.nav-group {
  border-bottom: 1px solid var(--border-inner);
}
.nav-group:last-child { border-bottom: none; }

/* 단일 항목 그룹 — <details> 없이 직접 링크 */
.nav-group-direct {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 1rem;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-label);
  text-decoration: none;
  border-bottom: 1px solid var(--border-inner);
  transition: background var(--tr-normal), color var(--tr-normal);
}
.nav-group-direct:hover { background: var(--bg-main); color: var(--text-body); }
.nav-group-direct.is-active { color: var(--accent-sidebar); background: var(--bg-main); }
.nav-group-direct.is-active .nav-group-icon { color: var(--accent-sidebar); }

.nav-group-header {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 1rem;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-label);
  text-transform: none;
  letter-spacing: -0.005em;
  list-style: none;
  user-select: none;
  transition: background var(--tr-normal), color var(--tr-normal);
}
.nav-group-header::-webkit-details-marker { display: none; }
.nav-group-header:hover {
  background: var(--bg-main);
  color: var(--text-body);
}
.nav-group.is-active > .nav-group-header {
  color: var(--text-title);
  background: var(--bg-main);
}

.nav-group-icon {
  width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-label);
  flex: 0 0 18px;
}
.nav-group.is-active > .nav-group-header .nav-group-icon {
  color: var(--accent-sidebar);
}
.nav-group-label { flex: 1 1 auto; }
.nav-group-chevron {
  width: 12px; height: 12px;
  color: var(--text-caption);
  transition: transform var(--tr-normal);
  flex: 0 0 12px;
}
.nav-group[open] > .nav-group-header .nav-group-chevron {
  transform: rotate(90deg);
}

.nav-group-items {
  padding: 0.2rem 0 0.5rem;
  background: var(--bg-sidebar);
}
.nav-sublink {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem 0.45rem 2.6rem;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-link);
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: background var(--tr-normal), color var(--tr-normal), border-color var(--tr-normal);
}
.nav-sublink:hover {
  background: var(--bg-main);
  color: var(--text-body);
}
.nav-sublink.is-active {
  background: var(--bg-main);
  color: var(--text-title);
  font-weight: 700;
  border-left-color: var(--accent-sidebar);
}
.nav-sublink.is-disabled {
  color: var(--text-caption);
  cursor: not-allowed;
  opacity: 0.7;
}
.nav-sublink.is-disabled:hover { background: transparent; color: var(--text-caption); }
.nav-sublink-label { flex: 1 1 auto; }
.nav-sublink-badge {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-caption);
  background: var(--bg-submenu);
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.02em;
}

/* ── 사용자 푸터 (하단 고정) ── */
.sidebar-footer {
  flex: 0 0 auto;
  padding: 0.75rem 1rem 0.9rem;
  background: var(--bg-main);
  border-top: 1px solid var(--border-form);
}
.sidebar-user {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-bottom: 0.5rem;
}
.sidebar-user-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-body);
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-user-meta {
  font-size: 0.68rem;
  color: var(--text-caption);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-user-role {
  display: inline-block;
  align-self: flex-start;
  margin-top: 3px;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--accent-sidebar);
  background: var(--bg-submenu);
  padding: 1px 8px;
  border-radius: var(--radius-pill);
}
.sidebar-logout {
  display: inline-block;
  font-size: 0.72rem;
  color: var(--text-caption);
  border-top: 1px dashed var(--border-inner);
  padding-top: 0.5rem;
  width: 100%;
  transition: color var(--tr-normal);
}
.sidebar-logout:hover { color: var(--danger); }

/* ── 레거시 호환(구 구조 잔존 대비, 신규 마크업에서는 미사용) ── */
.sidebar-header {
  padding: 1.1rem 1rem;
  background: var(--bg-main);
  border-bottom: 1px solid var(--border-form);
}
.sidebar-header .brand { font-size: 0.95rem; font-weight: 700; color: var(--text-body); }
.sidebar-header .brand-sub { font-size: 0.72rem; color: var(--text-label); margin-top: 2px; }
.sidebar a.nav-link {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 1rem; font-size: 13px; font-weight: 500;
  color: var(--text-link); border-left: 3px solid transparent;
  transition: background var(--tr-normal), color var(--tr-normal), border-color var(--tr-normal);
}
.sidebar a.nav-link:hover,
.sidebar a.nav-link.active {
  background: var(--bg-main); color: var(--text-body);
  border-left-color: var(--accent-sidebar);
}
.sidebar .nav-link .icon { width: 16px; height: 16px; flex: 0 0 16px; }

.main-content {
  margin-left: 220px;
  padding: 2rem 3rem;
  min-height: 100vh;
}

/* 모바일 토글 */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: 0.75rem; left: 0.75rem;
  z-index: 101;
  background: var(--bg-main);
  border: 1px solid var(--border-form);
  border-radius: 8px;
  padding: 0.4rem 0.55rem;
  cursor: pointer;
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 1rem; }
  .mobile-menu-toggle { display: inline-flex; }
}

/* =================== 설정 페이지 (adm-) =================== */
.adm-shell { display: flex; flex-direction: column; gap: 0.5rem; }

.adm-cat-nav {
  display: flex;
  gap: 0.25rem;
  background: var(--bg-panel-head);
  padding: 0.35rem;
  border-radius: var(--radius-input);
  border: 1px solid var(--border-form);
  width: fit-content;
}
.adm-cat-btn {
  appearance: none;
  background: transparent;
  border: none;
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-link);
  cursor: pointer;
  border-radius: calc(var(--radius-input) - 2px);
  transition: background var(--tr-normal), color var(--tr-normal);
}
.adm-cat-btn:hover { color: var(--text-title); }
.adm-cat-btn.is-active {
  background: var(--bg-main);
  color: var(--text-title);
  box-shadow: var(--shadow-rest);
}

.adm-tab-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.5rem 0 0.75rem;
  border-bottom: 1px solid var(--border-form);
  margin-bottom: 0.75rem;
}
.adm-tab-nav[hidden] { display: none !important; }
.adm-tab-btn {
  appearance: none;
  background: var(--bg-main);
  border: 1px solid var(--border-form);
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-link);
  cursor: pointer;
  border-radius: var(--radius-pill);
  transition: all var(--tr-normal);
}
.adm-tab-btn:hover {
  color: var(--text-title);
  border-color: var(--text-caption);
}
.adm-tab-btn.is-active {
  background: var(--accent-sidebar);
  color: #fff;
  border-color: var(--accent-sidebar);
}

.adm-panel { min-height: 200px; }
.adm-tab-panel[hidden] { display: none !important; }

/* 공용 모달 (adm-modal) */
.adm-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}
.adm-modal[hidden] { display: none !important; }

/* =================== 조회 전용 안내 배너 =================== */
.info-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  margin-bottom: 1rem;
  background: var(--bg-featured);
  border: 1px solid var(--border-featured);
  border-left: 3px solid var(--accent-sidebar);
  border-radius: var(--radius-input);
  font-size: 0.82rem;
  color: var(--text-body-2);
}
.info-banner strong { color: var(--text-title); font-weight: 700; }
.info-banner .info-banner-link {
  margin-left: auto;
  font-weight: 700;
  color: var(--accent-sidebar);
  white-space: nowrap;
}
.info-banner .info-banner-link:hover { text-decoration: underline; }

/* =================== 헤더 =================== */
.page-header { margin-bottom: 1.75rem; }
.page-header h1 {
  font-size: clamp(1.6rem, 2.2vw, 2.25rem);
  font-weight: 800;
  color: var(--text-title);
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
}
.page-header p {
  margin: 0;
  color: var(--text-link);
  font-size: 0.875rem;
}

/* =================== 카드 =================== */
.card {
  background: var(--bg-main);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-rest);
  padding: 1.5rem;
  transition: box-shadow var(--tr-normal);
}
.card:hover { box-shadow: var(--shadow-hover); }
.card--featured {
  background: var(--bg-featured);
  border-color: var(--border-featured);
}
.card-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-label);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}
.card-value {
  display: block;
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-title);
  letter-spacing: -0.03em;
}
.card-value.red   { color: var(--danger); }
.card-value.green { color: var(--success); }
.card-sub {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-caption);
  text-transform: uppercase;
}

/* =================== 테이블 =================== */
.table-wrap {
  background: var(--bg-main);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-rest);
  overflow: hidden;
}
.table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-inner);
  background: var(--bg-panel-head);
}
/* 테이블 타이틀 — 캡션(대문자)이 아닌 실제 섹션 제목 톤.
   2026-04-24 플랫폼 전역 기준 상향(1rem → 1.125rem). 자매 페이지 공통. */
.table-head h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-title, var(--text-body));
}
/* 테이블 헤더의 보조 정보(건수·합계 등). 페이지 공통 앵커(#*-summary / #*-count)
   에 개별 인라인 font-size 를 두지 말고 이 클래스에 맞출 것. */
.table-head .table-head-summary,
.table-head #pay-summary,
.table-head #ret-summary,
.table-head #emp-summary,
.table-head #ot-summary,
.table-head #ay-summary,
.table-head #sp-summary {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-body-2);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.table-head .table-head-summary strong,
.table-head #pay-summary strong,
.table-head #ret-summary strong,
.table-head #emp-summary strong,
.table-head #ot-summary strong,
.table-head #ay-summary strong,
.table-head #sp-summary strong {
  font-weight: 700;
  color: var(--text-title, var(--text-body));
  font-size: 0.96rem;
  letter-spacing: -0.01em;
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
table.data thead th {
  text-align: left;
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-title, var(--text-body));
  border-bottom: 1px solid var(--border-inner);
}
table.data tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-inner);
  color: var(--text-body-2);
}
table.data tbody tr:hover { background: var(--bg-panel-head); }
table.data tbody tr:last-child td { border-bottom: none; }
/* 합계 행 — 상단 divider + 여유로운 패딩 + 본문보다 강조된 타이포. */
table.data tfoot tr {
  background: var(--bg-panel-head);
}
table.data tfoot td {
  padding: 0.95rem 1rem;
  border-top: 2px solid var(--border-inner);
  border-bottom: none;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-title, var(--text-body));
  letter-spacing: -0.01em;
}
table.data tfoot td.num {
  font-size: 0.98rem;
}
/* 부모 컨테이너에 max-height + overflow-y 가 있는 경우 내부 스크롤 시 헤더 고정.
   수당현황 대시보드 "개인별 집계" 에서 사용 (2026-04-24). */
table.data.data--sticky thead th {
  position: sticky;
  top: 0;
  background: var(--bg-panel-head);
  z-index: 1;
}
/* tfoot 은 sticky 하지 않는다 — 데이터 행 아래로 자연스럽게 한 칸 내려 합계가 표시되도록.
   (2026-04-24 운영자 지시: 합계를 한 칸 더 내려 시각 여백 확보) */
/* 개인별 집계 클릭 가능 행 — 성명 클릭 시 세부내역 필터 동작. */
table.data tr.ot-personal-row:hover td {
  background: var(--bg-panel-head);
}

/* =================== 뱃지 =================== */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge--ok       { background: #f0fdf4; color: #166534; border-color: #86efac; }
.badge--warn     { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.badge--danger   { background: #fef2f2; color: #991b1b; border-color: #fca5a5; }
.badge--info     { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.badge--neutral  { background: #f8fafc; color: #475569; border-color: #cbd5e1; }
.badge--stat     { background: #f5f3ff; color: #5b21b6; }

/* =================== 버튼 =================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 1.1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-input);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--tr-fast), border-color var(--tr-fast), box-shadow var(--tr-fast);
  user-select: none;
  background: var(--bg-main);
  color: var(--text-body-2);
}
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.18);
}
.btn--primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn--primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn--secondary {
  background: var(--bg-main);
  border-color: var(--border-form);
  color: var(--text-body-2);
}
.btn--secondary:hover:not(:disabled) { background: #f3f4f6; }
.btn--dark {
  background: #111827;
  color: #fff;
  border-color: #111827;
}
.btn--dark:hover:not(:disabled) { background: #374151; border-color: #374151; }
.btn--danger {
  background: #fff;
  color: var(--danger);
  border-color: #fecaca;
}
.btn--danger:hover:not(:disabled) { background: #fef2f2; border-color: #fca5a5; color: #b91c1c; }
.btn--danger-solid {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn--danger-solid:hover:not(:disabled) { background: #b91c1c; border-color: #b91c1c; }
.btn--sm {
  padding: 2px 8px;
  font-size: 11px;
  line-height: 1.4;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* =================== 공용 모달 (alert/confirm/prompt 대체) =================== */
.ui-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: ui-modal-fade 0.14s ease-out;
}
.ui-modal-card {
  background: var(--bg-main, #fff);
  border-radius: 12px;
  box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.25), 0 4px 10px rgba(0, 0, 0, 0.08);
  min-width: 360px;
  max-width: 480px;
  width: calc(100vw - 2rem);
  overflow: hidden;
  animation: ui-modal-slide 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.ui-modal-head {
  padding: 1rem 1.25rem 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.ui-modal-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.ui-modal-icon--info    { background: #eef2ff; color: #4338ca; }
.ui-modal-icon--warn    { background: #fef3c7; color: #b45309; }
.ui-modal-icon--danger  { background: #fee2e2; color: #b91c1c; }
.ui-modal-icon--success { background: #dcfce7; color: #047857; }
.ui-modal-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-body-2, #111);
}
.ui-modal-body {
  padding: 0.4rem 1.25rem 0.9rem;
  font-size: 0.88rem;
  color: var(--text-body-2, #374151);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.ui-modal-body .ui-modal-input {
  margin-top: 0.6rem;
}
.ui-modal-foot {
  padding: 0.75rem 1.25rem 1rem;
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
  border-top: 1px solid var(--border, #e5e7eb);
  background: #fafafa;
}
@keyframes ui-modal-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes ui-modal-slide {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* =================== 폼(form) 모달 — 가로 와이드 =================== */
.ui-modal-card.ui-modal--form { width: min(940px, 95vw); max-width: 940px; }
.ui-modal-card.ui-modal--form .ui-modal-body {
  max-height: 72vh;
  overflow-y: auto;
  white-space: normal;
  padding: 0.6rem 1.4rem 1rem;
}
.ui-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.6rem 0.9rem;
  align-items: end;
}
.ui-form-field { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.ui-form-field--full { grid-column: 1 / -1; }
.ui-form-field > label {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-caption, #6b7280);
  letter-spacing: -0.01em;
}
.ui-form-field .input { width: 100%; }
.ui-form-field .input[readonly] {
  background: var(--bg-panel-head, #f3f4f6);
  color: var(--text-caption, #6b7280);
  cursor: not-allowed;
}
.ui-form-field input[type="number"] { text-align: right; font-variant-numeric: tabular-nums; }
.ui-form-field--check {
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.1rem;
}
.ui-form-field--check label { font-size: 0.84rem; color: var(--text-body-2, #374151); font-weight: 500; }
.ui-form-hint { font-size: 0.7rem; color: var(--text-caption, #9ca3af); }
.ui-form-section {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.7rem 0 0.1rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-body-2, #374151);
}
.ui-form-section::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-card, #e5e7eb);
}
.ui-form-section:first-child { margin-top: 0; }
.ui-form-intro {
  font-size: 0.82rem;
  color: var(--text-caption, #6b7280);
  margin: 0 0 0.7rem;
  padding: 0.5rem 0.7rem;
  background: var(--bg-panel-head, #f9fafb);
  border-radius: 8px;
}

/* =================== 명단(roster) 모달 =================== */
.ui-modal-card.ui-modal--roster { width: min(520px, 92vw); }
.ui-modal-card.ui-modal--roster .ui-modal-body {
  max-height: 64vh;
  overflow-y: auto;
  white-space: normal; /* 부모의 pre-wrap 무력화 (HTML 본문) */
}
.ui-roster { display: grid; gap: 1rem; }
.ui-roster--empty { color: var(--text-caption); font-size: 0.85rem; }
.ui-roster-sec { display: grid; gap: 0.4rem; }
.ui-roster-sec-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.1rem 0.3rem;
  border-bottom: 1px solid var(--border-card, #e5e7eb);
}
.ui-roster-chip {
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.ui-roster-count {
  font-size: 0.74rem;
  color: var(--text-caption, #6b7280);
  font-variant-numeric: tabular-nums;
}
.ui-roster-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.25rem;
}
.ui-roster-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  background: var(--bg-sidebar, #f8f9fb);
  transition: background 0.12s ease;
}
.ui-roster-item:hover { background: rgba(99, 102, 241, 0.07); }
.ui-roster-name {
  font-size: 0.86rem;
  color: var(--text-title, #1e293b);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}
.ui-roster-pos {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.06rem 0.42rem;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.12);
  color: #4f46e5;
  white-space: nowrap;
}
.ui-roster-date {
  font-size: 0.75rem;
  color: var(--text-caption, #6b7280);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* 3-column 변형 — 연봉 표기 + 클릭 드릴다운(직원 1인 연봉이력) */
.ui-roster-item.ui-roster-item--3col {
  grid-template-columns: 1fr auto auto;
}
.ui-roster-salary {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-title, #1e293b);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding-left: 0.6rem;
  border-left: 1px solid var(--border-card, #e5e7eb);
}
.ui-roster-item--clickable { cursor: pointer; }
.ui-roster-item--clickable:hover {
  background: rgba(14, 165, 233, 0.1);
  outline: 1px solid rgba(14, 165, 233, 0.35);
}
.ui-roster-item--clickable:hover .ui-roster-name {
  color: var(--viz-bar, #6366f1);
}

/* =================== 폼 =================== */
.input, .select, .textarea {
  width: 100%;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border-form);
  border-radius: var(--radius-input);
  font-size: 0.85rem;
  color: var(--text-body-2);
  background: var(--bg-main);
  outline: none;
  transition: border-color var(--tr-fast), box-shadow var(--tr-fast);
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.12);
}
.form-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-link);
}

/* =================== 기타 =================== */
.search-bar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-form);
  border-radius: var(--radius-card);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.spinner {
  display: inline-block;
  width: 1rem; height: 1rem;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top-color: var(--info);
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.progress {
  background: #f1f5f9;
  border-radius: var(--radius-pill);
  height: 7px;
  overflow: hidden;
}
.progress > .bar {
  height: 100%;
  background: var(--primary-hover);
  border-radius: var(--radius-pill);
  transition: width 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.guide-box {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-form);
  border-radius: var(--radius-card);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.guide-box h4 {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-body-2);
}
.guide-box p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-link);
  line-height: 1.55;
}

.stack-md > * + * { margin-top: 1rem; }
.stack-lg > * + * { margin-top: 1.5rem; }
.grid-kpi {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.empty-state {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--text-caption);
  font-size: 0.875rem;
}

/* =================== Markdown 렌더 =================== */
.md-body { line-height: 1.7; font-size: 0.92rem; color: var(--text-primary); }
.md-body .md-h1 { font-size: 1.25rem; margin: 0.4rem 0 0.5rem; font-weight: 700; }
.md-body .md-h2 { font-size: 1.1rem; margin: 0.85rem 0 0.4rem; font-weight: 700; padding-bottom: 0.25rem; border-bottom: 1px solid var(--border-light, #e5e7eb); }
.md-body .md-h3 { font-size: 0.98rem; margin: 0.7rem 0 0.3rem; font-weight: 700; color: var(--text-link, #2563eb); }
.md-body .md-h4 { font-size: 0.9rem; margin: 0.6rem 0 0.25rem; font-weight: 600; }
.md-body p { margin: 0.35rem 0; }
.md-body .md-ul, .md-body .md-ol { margin: 0.3rem 0 0.5rem 1.25rem; padding: 0; }
.md-body .md-ul li, .md-body .md-ol li { margin: 0.15rem 0; }
.md-body .md-ul { list-style: disc; }
.md-body .md-ol { list-style: decimal; }
.md-body strong { font-weight: 700; }
.md-body em { font-style: italic; }
.md-body code { background: var(--bg-panel-head, #f3f4f6); padding: 0.05rem 0.3rem; border-radius: 3px; font-family: ui-monospace, SFMono-Regular, monospace; font-size: 0.86em; }
.md-body blockquote { margin: 0.5rem 0; padding: 0.4rem 0.75rem; border-left: 3px solid var(--text-link, #2563eb); background: var(--bg-panel-head, #f9fafb); color: var(--text-caption); font-size: 0.88rem; }

/* =================== 퇴직금 시뮬레이션 (그룹형 레이아웃) =================== */
/* 그룹 1 — 기본정보 카드 */
.ret-sim-info__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
}
@media (max-width: 1024px) { .ret-sim-info__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px)  { .ret-sim-info__grid { grid-template-columns: 1fr; } }
.ret-sim-info__lab { display: block; font-size: 0.78rem; color: var(--text-caption); }
.ret-sim-info__val { display: block; font-weight: 600; margin-top: 0.15rem; font-size: 0.95rem; }
.ret-sim-info__sub {
  margin-top: 0.55rem; padding-top: 0.5rem;
  border-top: 1px solid var(--border-inner, #f0f0f0);
  display: flex; gap: 0.5rem; align-items: center;
  font-size: 0.85rem; color: var(--text-caption);
  flex-wrap: wrap;
}
.ret-sim-info__chip {
  display: inline-block; padding: 0.1rem 0.5rem; border-radius: 9999px;
  font-size: 0.78rem; font-weight: 600;
}
.ret-sim-info__chip--interim { background: #eef2ff; color: #4338ca; }
.ret-sim-info__chip--retire  { background: #fef2f2; color: #b91c1c; }

/* 정산기준일 라벨 옆 ⓘ 툴팁 — title 속성 기반, 호버 시 브라우저 기본 툴팁 + 커서 변경 */
.rsim-tip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.05rem; height: 1.05rem; border-radius: 50%;
  background: #e0e7ff; color: #4338ca;
  font-size: 0.72rem; font-weight: 700; line-height: 1;
  cursor: help; user-select: none;
  transition: background-color 0.15s;
}
.rsim-tip:hover, .rsim-tip:focus { background: #c7d2fe; outline: none; }

/* 그룹 2 — KPI 카드 */
.ret-sim-kpi {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
  margin-top: 0.6rem;
}
@media (max-width: 1024px) { .ret-sim-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px)  { .ret-sim-kpi { grid-template-columns: 1fr; } }
.ret-sim-kpi .card { position: relative; }
.ret-sim-kpi__lab { font-size: 0.78rem; color: var(--text-caption); }
.ret-sim-kpi__val { font-weight: 700; font-size: 1.18rem; margin-top: 0.2rem; font-variant-numeric: tabular-nums; }
.ret-sim-kpi__cap { font-size: 0.78rem; color: var(--text-caption); margin-top: 0.2rem; }
.ret-sim-kpi__badge {
  position: absolute; top: 0.5rem; right: 0.5rem;
  background: #eef2ff; color: #4338ca;
  font-size: 0.72rem; font-weight: 600;
  padding: 0.1rem 0.45rem; border-radius: 9999px;
}
.ret-sim-kpi__card--total {
  background: #eef2ff; border-color: #c7d2fe;
}
.ret-sim-kpi__card--total .ret-sim-kpi__lab { color: #4338ca; }
.ret-sim-kpi__card--total .ret-sim-kpi__val { color: #3730a3; font-size: 1.28rem; }
.ret-sim-kpi__card--total .ret-sim-kpi__cap { color: #4338ca; }

/* 그룹 3 — 좌우 산식 분할 */
.ret-sim-formula {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  margin-top: 0.6rem;
  align-items: start;
}
@media (max-width: 1024px) { .ret-sim-formula { grid-template-columns: 1fr; } }
.ret-sim-formula h4 {
  margin: 0 0 0.45rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-title);
}
.ret-sim-formula .row {
  display: flex; justify-content: space-between; gap: 0.6rem;
  padding: 0.32rem 0;
  border-bottom: 1px dashed var(--border-inner, #f0f0f0);
  font-size: 0.88rem;
}
.ret-sim-formula .row:last-child { border-bottom: none; }
.ret-sim-formula .row .k { color: var(--text-body-2, #374151); }
.ret-sim-formula .row .v { font-variant-numeric: tabular-nums; font-weight: 600; }
.ret-sim-formula .row--strong { background: #f9fafb; padding-left: 0.4rem; padding-right: 0.4rem; border-radius: 4px; }
.ret-sim-formula .row--strong .v { color: var(--primary); }
.ret-sim-formula__divider {
  border: none; border-top: 1px solid var(--border-inner, #f0f0f0);
  margin: 0.45rem 0;
}

/* 펼치기/접기 (네이티브 details) */
.ret-sim-foldable {
  margin-top: 0.5rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--border-inner, #f0f0f0);
}
.ret-sim-foldable + .ret-sim-foldable {
  margin-top: 0.35rem; padding-top: 0.35rem;
}
.ret-sim-foldable > summary {
  cursor: pointer; padding: 0.3rem 0;
  font-size: 0.86rem; font-weight: 600;
  display: flex; justify-content: space-between; align-items: center;
  list-style: none;
  user-select: none;
}
.ret-sim-foldable > summary::-webkit-details-marker { display: none; }
.ret-sim-foldable > summary::before {
  content: "▸"; color: var(--text-caption); margin-right: 0.35rem;
  display: inline-block; transition: transform 0.15s ease;
}
.ret-sim-foldable[open] > summary::before { content: "▾"; }
.ret-sim-foldable > summary .preview {
  font-weight: 400; color: var(--text-caption); font-size: 0.82rem;
}

/* 펼친 표 컴팩트화 */
.ret-sim-foldable .table-wrap { margin-top: 0.35rem; }
.ret-sim-foldable table.data { font-size: 0.82rem; }
.ret-sim-foldable table.data th,
.ret-sim-foldable table.data td {
  padding: 0.32rem 0.5rem;
}
.ret-sim-foldable table.data tfoot td {
  background: #f9fafb;
  font-weight: 600;
  border-top: 2px solid var(--border-form, #e5e7eb);
}

/* ── 적용 산식 카드 ─────────────────────────────────────────────
   퇴직금 시뮬레이션 결과 하단의 "최종 산식" 카드. 다른 카드들과 톤 통일
   (인디고 계열 + 기본 .card 보더). 분수형(재직일수/365) 시각화는 유지. */
.ret-sim-applied {
  margin-top: 0.75rem;
  padding: 1rem 1.1rem;
}
.ret-sim-applied__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.55rem;
}
.ret-sim-applied__title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
  letter-spacing: -0.01em;
}
.ret-sim-applied__badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  background: #eef2ff;
  color: #4338ca;
  letter-spacing: -0.005em;
}
.ret-sim-applied__formula {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.55rem;
  padding: 0.55rem 0.2rem 0.35rem;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}
.rsa-tok {
  display: inline-flex;
  align-items: baseline;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
  white-space: nowrap;
}
.rsa-tok__unit {
  font-size: 0.78em;
  font-weight: 500;
  color: var(--text-caption, #64748b);
  margin-left: 0.08em;
}
.rsa-tok--const { color: var(--text-caption, #64748b); font-weight: 600; }
.rsa-tok--total {
  color: #3730a3;
  font-weight: 700;
  font-size: 1.28rem;
  padding: 0.15rem 0.6rem;
  background: #eef2ff;
  border-radius: 6px;
}
.rsa-op {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-caption, #94a3b8);
  padding: 0 0.05rem;
}
.rsa-op--eq {
  color: var(--text-primary, #1e293b);
  font-weight: 700;
  font-size: 1.1rem;
}
/* 분수형 (재직일수 / 365) — 세로 적층 */
.rsa-frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
  font-size: 0.88rem;
  padding: 0 0.1rem;
}
.rsa-frac__num {
  font-weight: 700;
  color: var(--text-primary, #1e293b);
  padding: 0 0.35rem 0.12rem;
}
.rsa-frac__bar {
  width: 100%;
  min-width: 3.2rem;
  height: 1.5px;
  background: var(--text-caption, #94a3b8);
  border-radius: 2px;
}
.rsa-frac__den {
  font-weight: 600;
  color: var(--text-caption, #64748b);
  padding: 0.12rem 0.35rem 0;
}
.ret-sim-applied__sub {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px dashed var(--border-form, #e5e7eb);
  font-size: 0.78rem;
  color: var(--text-caption, #64748b);
  letter-spacing: -0.005em;
}
.ret-sim-applied__sub b {
  color: var(--text-primary, #1e293b);
  font-weight: 700;
}
@media (max-width: 640px) {
  .ret-sim-applied__formula { font-size: 0.95rem; }
  .rsa-tok--total { font-size: 1.12rem; }
}

/* 급여대장 — 가로 폭 절약을 위한 컴팩트 표.
   요약 페이지 14열 / 상세 페이지 32열 모두 노트북 해상도에서 한 화면에 들어가게.
   headerless white-space:nowrap 으로 "회 계 구 분" 처럼 한 글자씩 세로로 쪼개지는 현상 차단. */
table.data.data--compact { font-size: 0.78rem; }
table.data.data--compact thead th {
  padding: 0.45rem 0.45rem;
  white-space: nowrap;
  line-height: 1.2;
}
table.data.data--compact tbody td {
  padding: 0.4rem 0.45rem;
  white-space: nowrap;
}
table.data.data--compact tfoot td { padding: 0.5rem 0.45rem; }
table.data.data--compact tfoot td.num { font-size: 0.85rem; }

/* 32열 상세 테이블 — 헤더는 <br/> 로만 줄바꿈, 추가 wrap 차단 (한 글자씩 세로 쪼개짐 방지).
   font-size 를 0.68rem 로 축소 + padding 축소로 좁은 컬럼에서도 2줄 유지. */
table.data.data--compact-2line thead th {
  padding: 0.4rem 0.3rem;
  white-space: nowrap;     /* 텍스트 자동 wrap 금지 — <br/> 만 줄바꿈 */
  line-height: 1.2;
  font-size: 0.68rem;
  vertical-align: middle;
  text-align: center;
  word-break: keep-all;
}
table.data.data--compact-2line tbody td {
  padding: 0.35rem 0.4rem;
  white-space: nowrap;
  font-size: 0.74rem;
}
table.data.data--compact-2line tfoot td {
  padding: 0.45rem 0.4rem;
  white-space: nowrap;
  font-size: 0.74rem;
}
table.data.data--compact-2line tfoot td.num { font-size: 0.78rem; }

/* 맨 위로 플로팅 버튼 — 살짝 투명 + 호버 시 진하게. */
.scroll-top-fab {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 999px;
  border: 1px solid var(--border-form, #e5e7eb);
  background: rgba(255, 255, 255, 0.55);
  color: var(--text-title, #111827);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 400;
  backdrop-filter: blur(4px);
  transition: opacity 0.15s ease, background-color 0.15s ease;
}
.scroll-top-fab:hover {
  background: rgba(255, 255, 255, 0.95);
}
.scroll-top-fab.is-visible { display: flex; }

/* =================== 메인 대시보드 (dash-) =================== */
/* Phase D-7: 헤더 액션바(.dash-bar*)·§E 지원금(.dash-support*, .dash-row--4col)·§E 자체헤더(.dash-section-head*) 폐기.
   §B/§C 의 2x2 미니를 1행 4열(.dash-board-grid--4) 로 펼침 — 직관성 향상. */

/* 섹션 row */
.dash-row {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

/* 카드 헤더 — 좌측 제목 / 우측 보조설명 */
.dash-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--border-inner);
}
.dash-card-head h3 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-title);
}
.dash-card-sub {
  font-size: 0.72rem;
  color: var(--text-caption);
  font-weight: 500;
}

/* 차트 캔버스 컨테이너 — Chart.js responsive 가 잘 동작하도록 명시 높이 */
.dash-row .card > canvas {
  width: 100% !important;
  max-height: 240px;
}

/* 공용 막대 — §B/§C/§F 의 mini-row 게이지에 사용 */
.dash-bar-track {
  margin-top: 0.3rem;
  background: #f1f5f9;
  border-radius: var(--radius-pill);
  height: 6px;
  overflow: hidden;
}
.dash-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-pill);
  transition: width 0.4s ease;
}

/* Phase D-2 — 인사·보상 헤드라인 미니 보드 */
.dash-section {
  display: flex;
  flex-direction: column;
}
.dash-card-link {
  font-size: 0.72rem;
  color: var(--text-link);
  text-decoration: none;
  font-weight: 600;
}
.dash-card-link:hover { text-decoration: underline; }

/* Phase D-7: 미니 보드를 1행 4열로 펼침. 차트·리스트 모두 충분한 폭/높이 확보. */
.dash-board-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}
.dash-board-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) {
  .dash-board-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .dash-board-grid,
  .dash-board-grid--4 { grid-template-columns: 1fr; }
}
.dash-mini {
  background: var(--bg-canvas, #f8fafc);
  border: 1px solid var(--border-inner);
  border-radius: var(--radius-md, 8px);
  padding: 0.95rem 1rem 0.9rem;
  min-height: 290px;
  display: flex;
  flex-direction: column;
}
.dash-mini__head {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-title);
  margin-bottom: 0.6rem;
}
.dash-mini__body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.dash-mini__body--chart {
  position: relative;
  height: 240px;
}
.dash-mini__body--chart > canvas {
  max-height: 240px;
}
.dash-mini__body--list {
  gap: 0.6rem;
  overflow-y: auto;
  max-height: 250px;
}
.dash-mini-row {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}
.dash-mini-row__line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.4rem;
  font-size: 0.78rem;
}
.dash-mini-row__name {
  font-weight: 600;
  color: var(--text-body);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-mini-row__val {
  font-variant-numeric: tabular-nums;
  color: var(--text-body-2);
  font-size: 0.74rem;
}
.dash-mini-row__sub {
  font-size: 0.68rem;
  color: var(--text-caption);
}
.dash-mini-listitem {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.4rem;
  font-size: 0.76rem;
  padding: 0.18rem 0;
  border-bottom: 1px dashed var(--border-inner);
}
.dash-mini-listitem:last-child { border-bottom: none; }
.dash-mini-listitem__name { font-weight: 600; color: var(--text-body); }
.dash-mini-listitem__meta { color: var(--text-caption); font-size: 0.7rem; }

/* Phase D-5: 지급 구성 도넛(.dash-paymix*) 정의 제거. Phase D-7: 지원금 4 카드(.dash-support*) 정의 제거. */

/* 월마감 가이드 단계 카드 */
.dash-guide { margin-top: 1rem; }
.dash-guide-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.5rem;
  counter-reset: step;
}
.dash-guide-steps li {
  counter-increment: step;
  position: relative;
  padding: 0.6rem 0.85rem 0.6rem 2.3rem;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-form);
  border-radius: var(--radius-input);
  font-size: 0.82rem;
  color: var(--text-body-2);
  transition: background var(--tr-fast), border-color var(--tr-fast);
}
.dash-guide-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dash-guide-steps li a {
  color: var(--text-title);
  font-weight: 600;
}
.dash-guide-steps li:hover {
  background: var(--bg-main);
  border-color: var(--primary);
}

/* 운영가이드 (설정 ▸ 운영가이드) — 문서형 페이지 */
.og-card + .og-card { margin-top: 1rem; }
.og-steps li { padding-top: 0.7rem; padding-bottom: 0.7rem; }
.og-check {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}
.og-check li {
  position: relative;
  padding: 0.5rem 0.75rem 0.5rem 1.9rem;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-form);
  border-radius: var(--radius-input);
  font-size: 0.82rem;
  color: var(--text-body-2);
}
.og-check li::before {
  content: "✓";
  position: absolute;
  left: 0.7rem;
  top: 0.5rem;
  color: var(--primary);
  font-weight: 700;
}
.og-faq { margin: 0; }
.og-faq dt {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-title);
  margin-top: 0.85rem;
}
.og-faq dt:first-child { margin-top: 0; }
.og-faq dd {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  color: var(--text-body-2);
  line-height: 1.55;
}

/* 지원금 — 기타수당 유형별 합계 카드 (최대 4, 가로) */
.sp-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.9rem;
}
.sp-card {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  text-align: left;
  padding: 0.7rem 0.85rem;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-input);
  cursor: pointer;
  transition: border-color var(--tr-fast), background var(--tr-fast);
}
.sp-card:hover { background: var(--bg-main); border-color: var(--primary); }
.sp-card.is-active {
  border-color: var(--primary);
  background: var(--bg-main);
  box-shadow: inset 0 0 0 1px var(--primary);
}
.sp-card__label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-label);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sp-card__amt { font-size: 1.05rem; font-weight: 700; color: var(--text-title); }
.sp-card__meta { font-size: 0.74rem; color: var(--text-caption); }
.sp-card__delta { font-size: 0.72rem; font-weight: 600; }
.sp-d-up { color: #b45309; }
.sp-d-down { color: #0d9488; }
.sp-d-flat { color: var(--text-caption); font-weight: 500; }

/* 인사·급여 시각화 보드 (Phase 8) */
.emp-viz { margin: 0.75rem 0 0.25rem; }
.emp-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.9rem;
}
.emp-kpi {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.65rem 0.8rem;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-input);
}
.emp-kpi-v { font-size: 1.05rem; font-weight: 700; color: var(--text-title); }
.emp-kpi-l { font-size: 0.74rem; color: var(--text-caption); }
.emp-vgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.9rem;
  margin-bottom: 0.9rem;
}
.emp-vp { margin: 0; }
.emp-bars { display: grid; gap: 0.35rem; }
.emp-bar-row {
  display: grid;
  grid-template-columns: 7.5rem 1fr auto;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
}
.emp-bar-label {
  color: var(--text-body-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.emp-bar-track {
  height: 0.6rem;
  background: var(--border-inner);
  border-radius: 999px;
  overflow: hidden;
}
.emp-bar-fill { display: block; height: 100%; background: var(--viz-bar); border-radius: 999px; }
.emp-bar-val { color: var(--text-title); font-weight: 600; font-variant-numeric: tabular-nums; }
.emp-dq { margin: 0; padding-left: 1.1rem; font-size: 0.8rem; color: var(--text-body-2); }
.emp-dq li { margin: 0.2rem 0; }
/* 컴팩트 막대 — 부서별 현원 등 항목 수가 많은 막대의 세로 점유 축소 */
.emp-bars--compact { gap: 0.18rem; }
.emp-bars--compact .emp-bar-row {
  font-size: 0.72rem;
  grid-template-columns: 6rem 1fr auto;
  gap: 0.4rem;
}
.emp-bars--compact .emp-bar-track { height: 0.45rem; }

/* HR 보드 2분할 — 좌(부서별 현원) / 우(남녀비율·근속분포 스택) */
.emp-vgrid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.emp-vstack { display: grid; gap: 0.9rem; align-content: start; }

/* 페이지 그룹 분리 — 그룹1(현황 보드) / 구분선 / 그룹2(목록) */
.emp-group {
  position: relative;
  padding: 1.6rem 1rem 1rem;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card, 12px);
  background: var(--bg-card, #fff);
}
.emp-group--list { margin-top: 0; }
.emp-group-tag {
  position: absolute;
  top: -0.95rem;
  left: 1rem;
  padding: 0.32rem 0.95rem;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  background: linear-gradient(135deg, #06b6d4 0%, #0ea5e9 100%);
  border: none;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.35);
}
.emp-group-divider {
  height: 1px;
  margin: 1.4rem 0;
  background: linear-gradient(to right, transparent, var(--border-card) 12%, var(--border-card) 88%, transparent);
}
.emp-group .emp-viz { margin: 0; }

/* 부서별 연봉 — 실/본부 그룹 표 */
.emp-orgtbl .emp-orgrow td {
  font-weight: 700;
  color: var(--text-title);
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border-card);
}
.emp-orgtbl td.emp-orgteam { padding-left: 1.4rem; color: var(--text-body-2); }

/* 상위 부문 묶음 박스 — 단일 실/본부가 아닌 경우(예: 경영본부) 만 사용 */
.emp-subgroup {
  position: relative;
  margin-top: 1.6rem;
  padding: 1.25rem 0.7rem 0.4rem;
  border: 1px solid var(--border-card);
  border-radius: 10px;
  background: var(--bg-card, #fff);
}
.emp-subgroup .data { margin: 0; }
.emp-subgroup-tag {
  position: absolute;
  top: -0.85rem;
  left: 0.9rem;
  padding: 0.28rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  background: linear-gradient(135deg, #06b6d4 0%, #0ea5e9 100%);
  border: none;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(14, 165, 233, 0.3);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
}
.emp-subgroup-tag:hover,
.emp-subgroup-tag.emp-roster-link:hover { color: #fff; filter: brightness(1.08); }

/* 입·퇴사 명단 팝업 트리거 (숫자 링크) */
.emp-trend-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-variant-numeric: tabular-nums;
  color: var(--viz-bar);
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.emp-trend-link:hover { color: var(--primary-hover); }
.emp-roster-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-variant-numeric: tabular-nums;
  color: var(--viz-bar);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.emp-roster-link:hover { color: var(--primary-hover); }

/* 차트 컨테이너 — Chart.js 가 부모 사이즈를 안정적으로 측정하도록 정상 흐름 + 명시 높이. */
.emp-chart {
  position: relative;
  width: 100%;
  height: 260px;
  min-height: 260px;
}
.emp-chart canvas {
  display: block;
  max-width: 100%;
}
.emp-chart--tall { height: 420px; min-height: 420px; }

/* 패널 헤더 정보 아이콘(ⓘ) — 마우스 호버 시 title 툴팁 */
.emp-info {
  display: inline-block;
  margin-left: 0.35rem;
  color: var(--text-caption);
  font-size: 0.82em;
  cursor: help;
  user-select: none;
}

/* 부서별 현원 표 — 그룹 행의 인원 세부(본부장 1 · 팀원 4 등) 부속 라벨 */
.emp-orgsub {
  margin-left: 0.4rem;
  font-weight: 500;
  font-size: 0.78em;
  color: var(--text-caption);
}

/* 급여분석 요약 콘솔 — 지급항목 전월/당월 비교표 */
.ana-console { margin-bottom: 1.1rem; }
.ana-w--up { color: #b45309; }
.ana-w--down { color: #0d9488; }
.ana-bk { width: 100%; }
.ana-bk th { font-size: 0.74rem; }
.ana-bk td { font-variant-numeric: tabular-nums; }
.ana-bk td.ana-bk-item { padding-left: 1.4rem; color: var(--text-body-2); }
.ana-bk-group td {
  background: var(--bg-sidebar);
  font-weight: 700;
  color: var(--text-label);
  font-size: 0.73rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.ana-bk-sub td { font-weight: 600; border-top: 1px solid var(--border-inner); }
.ana-bk-total td {
  font-weight: 700;
  color: var(--text-title);
  background: rgba(99, 102, 241, 0.06);
  border-top: 2px solid var(--border-card);
}
.ana-bk-grand td {
  font-weight: 800;
  color: var(--text-title);
  background: rgba(22, 163, 74, 0.08);
  border-top: 2px solid var(--border-card);
}
.ana-bk-note { font-size: 0.72rem; color: var(--text-caption); }

/* =================== 검색형 콤보박스 (window.ui.enhanceSelectAsCombo) =================== */
.ui-combo {
  position: relative;
  width: 100%;
}
.ui-combo__input {
  width: 100%;
  padding: 0.45rem 2rem 0.45rem 0.75rem;
  border: 1px solid var(--border-form);
  border-radius: var(--radius-input);
  font-size: 0.85rem;
  color: var(--text-body-2);
  background: var(--bg-main);
  outline: none;
  transition: border-color var(--tr-fast), box-shadow var(--tr-fast);
  cursor: text;
}
.ui-combo__input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.12);
}
.ui-combo__caret {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  color: var(--text-caption);
  pointer-events: none;
}
.ui-combo__panel {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  background: var(--bg-main, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
  box-shadow: 0 10px 25px -8px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.06);
  z-index: 10000;
  padding: 0.25rem 0;
}
.ui-combo__opt {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text-body-2);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ui-combo__opt:hover,
.ui-combo__opt.is-active {
  background: #eef2ff;
  color: #4338ca;
}
.ui-combo__opt--placeholder {
  color: var(--text-caption);
  font-style: italic;
}
.ui-combo__empty {
  padding: 0.6rem 0.75rem;
  font-size: 0.82rem;
  color: var(--text-caption);
  text-align: center;
}

/* =================== 프린트 =================== */
@media print {
  .sidebar, .mobile-menu-toggle { display: none; }
  .main-content { margin-left: 0; padding: 0; }
  .card, .table-wrap { box-shadow: none; border-color: #ccc; }
}
