/* 국가연구안전정보시스템 감성 디자인 시스템 */
:root {
  --primary-color: var(--primary-color); /* 메인 Teal 컬러 */
  --primary-dark: var(--primary-dark);
  --secondary-color: #f4f7f6; /* 배경 연그레이 */
  --accent-orange: #ff9800;
  --accent-green: #4caf50;
  --accent-blue: #2196f3;
  --text-main: #263238;
  --text-sub: #607d8b;
  --white: #ffffff;
  --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  --border-radius: 12px;
  --transition: all 0.3s ease;
}

@font-face {
  font-family: 'Pretendard';
  src: url('https://cdn.jsdelivr.net/gh/Project-Noonnu/noonfonts_2107@1.1/Pretendard-Regular.woff') format('woff');
  font-weight: 400;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Pretendard', -apple-system, sans-serif;
}

body {
  background-color: var(--secondary-color);
  color: var(--text-main);
  overflow-x: hidden;
}

/* 상단 메인 헤더 */
.main-header {
  height: 70px;
  background: var(--white);
  border-bottom: 2px solid var(--primary-color);
  display: flex;
  align-items: center;
  padding: 0 40px;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-section img {
  height: 40px;
}

.system-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-color);
  letter-spacing: -0.5px;
}

/* 상단 메인 내비게이션 */
.top-nav {
  margin-left: 60px;
  display: flex;
  gap: 30px;
  height: 100%;
}

.nav-group {
  display: flex;
  align-items: center;
  height: 100%;
}

.nav-main {
  color: var(--text-main);
  font-weight: 700;
  font-size: 17px;
  cursor: pointer;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  border-bottom: 3px solid transparent;
  transition: var(--transition);
}

.nav-main:hover, .nav-main.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

/* 가로형 서브 내비게이션 바 (LNB) */
.sub-nav-bar {
  background: var(--white);
  border-bottom: 1px solid #e2e8f0;
  height: 50px;
  display: flex;
  align-items: center;
  padding: 0 40px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.sub-nav-container {
  display: flex;
  gap: 10px;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

.sub-nav-bar .nav-item {
  padding: 0 20px;
  height: 50px;
  display: flex;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  color: #64748b;
  position: relative;
  transition: var(--transition);
}

.sub-nav-bar .nav-item:hover, .sub-nav-bar .nav-item.active {
  color: var(--primary-color);
  background: none;
}

.sub-nav-bar .nav-item.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary-color);
}

/* 메인 컨테이너 레이아웃 */
.dashboard-container {
  padding: 30px 40px;
  max-width: 1600px;
  margin: 0 auto;
}

/* 요약 카드 그리드 */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--white);
  padding: 24px;
  border-radius: var(--border-radius);
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-left: 5px solid var(--primary-color);
}

.stat-label {
  font-size: 14px;
  color: var(--text-sub);
  font-weight: 600;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-main);
}

/* 메인 명단 카드 */
.content-card {
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--card-shadow);
  padding: 0;
  overflow: hidden;
  margin-bottom: 30px;
}

.card-header {
  padding: 20px 30px;
  background: #f8fafb;
  border-bottom: 1px solid #edf2f7;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title::before {
  content: '';
  width: 4px;
  height: 18px;
  background: var(--primary-color);
  border-radius: 2px;
}

/* 테이블 디자인 */
.table-wrapper {
  padding: 0;
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 220px);
}

/* 테이블 레이아웃 고정 */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  table-layout: fixed;
}

/* 각 컬럼 너비 강제 지정 (총 100%) */
th:nth-child(1) { width: 45px; }  /* 연번 */
th:nth-child(2) { width: 65px; }  /* 지역 */
th:nth-child(3) { width: 130px; } /* 팀 (여유있게) */
th:nth-child(4) { width: 120px; } /* 담당 */
th:nth-child(5) { width: 65px; }  /* 구분 */
th:nth-child(6) { width: 75px; }  /* 직급 */
th:nth-child(7) { width: 85px; }  /* 사번 */
th:nth-child(8) { width: 85px; }  /* 성명 */
th:nth-child(9) { width: 55px; }  /* 성별 */
th:nth-child(10) { width: 100px; } /* 입사일 */
th:nth-child(11) { width: 95px; }  /* 근속 (10년 10개월 등 대비) */
th:nth-child(12) { width: 100px; } /* 생년월일 */
th:nth-child(13) { width: 60px; }  /* 만나이 */
th:nth-child(14) { width: 110px; } /* 안전보건 */
th:nth-child(15) { width: 55px; }  /* 결혼 */
th:nth-child(16) { width: 80px; }  /* 배우자 */
th:nth-child(17) { width: 70px; }  /* 관리 */

thead th {
  background: #f1f5f9;
  color: #475569;
  font-weight: 700;
  padding: 12px 8px;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 10;
  border: 1px solid #e2e8f0;
  border-bottom: 2px solid #cbd5e1;
  white-space: nowrap;
  overflow: visible;
  text-overflow: ellipsis;
}

/* 컬럼 크기 조절 핸들 */
.resizer {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: 8px; /* 더 넓게 */
  background: transparent;
  cursor: col-resize;
  z-index: 100; /* 최상단 */
}

.resizer:hover, .resizing .resizer {
  border-right: 3px solid var(--primary-color);
}

.resizing {
  cursor: col-resize;
  user-select: none;
}

tbody td {
  padding: 10px 8px;
  text-align: center;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid #e2e8f0;
}

tbody tr {
  border-bottom: 1px solid #e2e8f0;
}

tbody tr:nth-child(even) {
  background: #fafafa;
}

/* 편집 모드 입력창 스타일 최적화 */
.edit-input {
  width: 100%;
  height: 28px;
  padding: 2px 5px;
  border: 1px solid var(--primary-color);
  border-radius: 4px;
  font-size: 13px;
  outline: none;
  background-color: #f0fdfa;
  box-sizing: border-box;
}

.editing-row td {
  padding: 5px 4px !important; /* 편집 시 높이 증가 억제 */
}

/* 버튼 스타일 */
.btn {
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.btn-primary { background: var(--primary-color); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }

.btn-excel { background: var(--primary-color); color: var(--white); }
.btn-excel:hover { background: #0f766e; }

/* 검색 및 필터 바 */
.action-bar {
  display: flex;
  gap: 15px;
  align-items: center;
}

.search-input-group {
  position: relative;
  width: 300px;
}

.search-input-group input {
  width: 100%;
  padding: 10px 15px 10px 40px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  outline: none;
  transition: var(--transition);
}

.search-input-group input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 151, 167, 0.1);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
}

/* 드래그 상태 */
.dragging { opacity: 0.5; background: #f1f5f9 !important; }
.drag-over { border-top: 2px solid var(--primary-color) !important; }

/* 테이블 헤더 필터 스타일 */
.filter-icon {
  display: inline-block;
  margin-left: 5px;
  cursor: pointer;
  color: #94a3b8;
  font-size: 10px;
  transition: var(--transition);
}

.filter-icon:hover, .filter-icon.active {
  color: var(--primary-color);
}

.filter-popup {
  position: fixed;
  background: white;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  padding: 15px;
  z-index: 3000;
  min-width: 180px;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  display: none;
  flex-direction: column;
  gap: 10px;
}

.filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
}

.filter-item input { cursor: pointer; }

.filter-footer {
  display: flex;
  gap: 5px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #eee;
}

.modal-content {
  background: var(--white);
  padding: 30px;
  border-radius: var(--border-radius);
  width: 450px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  animation: slideUp 0.3s ease-out;
}

@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes pmFadeIn { from { opacity:0; transform:translateX(-50%) translateY(8px); } to { opacity:1; transform:translateX(-50%) translateY(0); } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--primary-color);
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-sub);
  margin-bottom: 5px;
  font-weight: 600;
}

.form-group input, .form-group textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  outline: none;
}

/* 부서별 대시보드 커스텀 */
.dept-dashboard {
  padding: 30px;
  background: #f8fafb;
}

.dept-card {
  background: var(--white);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 15px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  border-left: 4px solid #cbd5e1;
}

.dept-card:hover {
  border-left-color: var(--primary-color);
  transform: translateX(5px);
}

/* 모달 오버레이 (팝업창 숨김 및 중앙 정렬 필수 스타일) */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none; /* 기본 숨김 */
  justify-content: center;
  align-items: center;
  z-index: 5000; /* 기본 모달 */
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease-out;
}

/* 알림/확인 전용 모달은 더 높은 우선순위 부여 */
#common-confirm-modal {
  z-index: 9999 !important;
}

/* 팝업이 활성화되었을 때만 보이도록 설정 */
.modal-overlay[style*="display: flex"],
.modal-overlay[style*="display:flex"] {
  display: flex !important;
}

/* ─── 다크 모드 ─────────────────────────────────────────────────── */
body.dark-mode {
  --primary-color: #38bdf8;
  --primary-dark:  #0ea5e9;
  --secondary-color: #0f172a;
  --text-main: #e2e8f0;
  --text-sub:  #94a3b8;
  --white: #1e293b;
  --card-shadow: 0 4px 20px rgba(0,0,0,0.4);
  background-color: #0f172a;
  color: #e2e8f0;
}

/* 헤더 */
body.dark-mode .main-header {
  background: #1e293b;
  border-bottom-color: #38bdf8;
  box-shadow: 0 2px 10px rgba(0,0,0,0.4);
}
body.dark-mode .system-title { color: #38bdf8; }
body.dark-mode .nav-main { color: #cbd5e1; }
body.dark-mode .nav-main:hover, body.dark-mode .nav-main.active {
  color: #38bdf8;
  border-bottom-color: #38bdf8;
}

/* 서브 내비게이션 */
body.dark-mode .sub-nav-bar {
  background: #1e293b;
  border-bottom-color: #334155;
}
body.dark-mode .sub-nav-bar .nav-item { color: #64748b; }
body.dark-mode .sub-nav-bar .nav-item:hover,
body.dark-mode .sub-nav-bar .nav-item.active { color: #38bdf8; }
body.dark-mode .sub-nav-bar .nav-item.active::after { background: #38bdf8; }

/* 요약 카드 */
body.dark-mode .stat-card {
  background: #1e293b;
  border-left-color: #38bdf8;
}
body.dark-mode .stat-label { color: #94a3b8; }
body.dark-mode .stat-value { color: #e2e8f0; }

/* 메인 카드 */
body.dark-mode .content-card { background: #1e293b; }
body.dark-mode .card-header {
  background: #162032;
  border-bottom-color: #334155;
}
body.dark-mode .card-title { color: #e2e8f0; }
body.dark-mode .card-title::before { background: #38bdf8; }

/* 테이블 */
body.dark-mode thead th {
  background: #162032 !important;
  color: #94a3b8 !important;
  border-color: #334155 !important;
}
body.dark-mode tbody td { color: #cbd5e1; background: transparent; border-color: #1e293b !important; }
body.dark-mode tbody tr { border-bottom-color: #1e293b !important; }
body.dark-mode tbody tr:nth-child(even) td { background: #162032; }
body.dark-mode tbody tr:hover td { background: #1e3a5f !important; }
body.dark-mode .table-wrapper { background: #1e293b; }
body.dark-mode thead th { background: #162032 !important; }
body.dark-mode tr[style*="background:#f0f9ff"],
body.dark-mode tr[style*="background: #f0f9ff"],
body.dark-mode tr[style*="background:#f8fafc"],
body.dark-mode tr[style*="background:#f1f5f9"] { background: #0d1a2d !important; }
body.dark-mode tr[style*="background:#f0f9ff"] td,
body.dark-mode tr[style*="background: #f0f9ff"] td { background: transparent !important; }

/* 검색 입력 */
body.dark-mode .search-input-group input {
  background: #334155;
  color: #e2e8f0;
  border-color: #475569;
}
body.dark-mode .search-input-group input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56,189,248,0.1);
}
body.dark-mode .search-input-group input::placeholder { color: #64748b; }

/* 편집 입력 */
body.dark-mode .edit-input {
  background: #1e3a5f;
  border-color: #38bdf8;
  color: #e2e8f0;
}

/* 체크박스 다크모드 */
body.dark-mode input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 2px solid #475569;
  border-radius: 3px;
  background: #1e293b;
  cursor: pointer;
  position: relative;
  vertical-align: middle;
  flex-shrink: 0;
}
body.dark-mode input[type="checkbox"]:checked {
  background: #38bdf8;
  border-color: #38bdf8;
}
body.dark-mode input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 0px;
  width: 5px;
  height: 9px;
  border: 2px solid #0f172a;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

/* 전역 input / textarea / select */
body.dark-mode input:not([type="color"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]),
body.dark-mode textarea,
body.dark-mode select {
  background: #1e293b !important;
  color: #e2e8f0 !important;
  border-color: #475569 !important;
}
body.dark-mode textarea::placeholder,
body.dark-mode input::placeholder { color: #64748b !important; }

/* 모달 */
body.dark-mode .modal-overlay { background: rgba(0,0,0,0.75); }
body.dark-mode .modal-content {
  background: #1e293b;
  color: #e2e8f0;
}
body.dark-mode .modal-header { color: #38bdf8; }
body.dark-mode .form-group label { color: #94a3b8; }
body.dark-mode .form-group input,
body.dark-mode .form-group textarea {
  background: #334155;
  color: #e2e8f0;
  border-color: #475569;
}

/* 필터 팝업 */
body.dark-mode .filter-popup {
  background: #1e293b;
  border-color: #334155;
}
body.dark-mode .filter-item { color: #cbd5e1; }
body.dark-mode .filter-footer { border-top-color: #334155; }

/* 버튼 비활성 색 보정 */
body.dark-mode .btn-primary { background: #0284c7; }
body.dark-mode .btn-primary:hover { background: #0369a1; }

/* 스크롤바 */
body.dark-mode ::-webkit-scrollbar-track { background: #0f172a; }
body.dark-mode ::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }
body.dark-mode ::-webkit-scrollbar-thumb:hover { background: #475569; }

/* 전체 레이아웃 배경 */
body.dark-mode,
body.dark-mode html,
body.dark-mode main,
body.dark-mode .dashboard-container { background-color: #0f172a; }

/* 인라인 스타일이 많은 뷰 영역 — 배경만 어둡게 */
body.dark-mode .view-section { background: #0f172a; }

/* 부서별 대시보드 */
body.dark-mode .dept-dashboard { background: #0f172a; }
body.dark-mode .dept-card {
  background: #1e293b;
  border-left-color: #334155;
}
body.dark-mode .dept-card:hover { border-left-color: #38bdf8; }

/* 안전인증 탭바 */
body.dark-mode #view-safety-cert > div[style*="background:white"] {
  background: #1e293b !important;
  border-bottom-color: #334155 !important;
}

/* 인라인 스타일 흰/회 배경 일괄 오버라이드 — div, td, th, button, span, li */
body.dark-mode div[style*="background:#f8fafc"],    body.dark-mode td[style*="background:#f8fafc"],    body.dark-mode th[style*="background:#f8fafc"],    body.dark-mode button[style*="background:#f8fafc"],
body.dark-mode div[style*="background: #f8fafc"],   body.dark-mode td[style*="background: #f8fafc"],   body.dark-mode th[style*="background: #f8fafc"],   body.dark-mode button[style*="background: #f8fafc"],
body.dark-mode div[style*="background:#f1f5f9"],    body.dark-mode td[style*="background:#f1f5f9"],    body.dark-mode th[style*="background:#f1f5f9"],    body.dark-mode button[style*="background:#f1f5f9"],
body.dark-mode div[style*="background:white"],      body.dark-mode td[style*="background:white"],      body.dark-mode th[style*="background:white"],      body.dark-mode button[style*="background:white"],
body.dark-mode div[style*="background: white"],     body.dark-mode td[style*="background: white"],     body.dark-mode th[style*="background: white"],     body.dark-mode button[style*="background: white"],
body.dark-mode div[style*="background:#ffffff"],    body.dark-mode td[style*="background:#ffffff"],    body.dark-mode th[style*="background:#ffffff"],    body.dark-mode button[style*="background:#ffffff"],
body.dark-mode div[style*="background: #ffffff"],   body.dark-mode td[style*="background: #ffffff"],   body.dark-mode th[style*="background: #ffffff"],   body.dark-mode button[style*="background: #ffffff"],
body.dark-mode div[style*="background:#fafafa"],    body.dark-mode td[style*="background:#fafafa"],    body.dark-mode th[style*="background:#fafafa"],    body.dark-mode button[style*="background:#fafafa"],
body.dark-mode div[style*="background:#fff"],       body.dark-mode td[style*="background:#fff"],       body.dark-mode th[style*="background:#fff"],       body.dark-mode button[style*="background:#fff"],
body.dark-mode div[style*="background-color:white"],    body.dark-mode td[style*="background-color:white"],    body.dark-mode th[style*="background-color:white"],    body.dark-mode button[style*="background-color:white"],
body.dark-mode div[style*="background-color:#fff"],     body.dark-mode td[style*="background-color:#fff"],     body.dark-mode th[style*="background-color:#fff"],     body.dark-mode button[style*="background-color:#fff"],
body.dark-mode div[style*="background-color:#ffffff"],  body.dark-mode td[style*="background-color:#ffffff"],  body.dark-mode th[style*="background-color:#ffffff"],  body.dark-mode button[style*="background-color:#ffffff"],
body.dark-mode div[style*="background-color: white"],   body.dark-mode td[style*="background-color: white"],   body.dark-mode th[style*="background-color: white"],   body.dark-mode button[style*="background-color: white"],
body.dark-mode div[style*="background-color: #fff"],    body.dark-mode td[style*="background-color: #fff"],    body.dark-mode th[style*="background-color: #fff"],    body.dark-mode button[style*="background-color: #fff"] {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

/* 연한 색 배경 카드 — div, td, th */
body.dark-mode div[style*="background:#f0f9ff"], body.dark-mode td[style*="background:#f0f9ff"], body.dark-mode th[style*="background:#f0f9ff"],
body.dark-mode div[style*="background:#eff6ff"], body.dark-mode td[style*="background:#eff6ff"], body.dark-mode th[style*="background:#eff6ff"],
body.dark-mode div[style*="background:#dbeafe"] { background: #0d1a2d !important; border-color: #1e3a5f !important; }

body.dark-mode div[style*="background:#fff7ed"], body.dark-mode td[style*="background:#fff7ed"], body.dark-mode th[style*="background:#fff7ed"],
body.dark-mode div[style*="background:#ffedd5"] { background: #2d1a08 !important; border-color: #7c2d12 !important; }

body.dark-mode div[style*="background:#fff1f2"], body.dark-mode td[style*="background:#fff1f2"],
body.dark-mode div[style*="background:#fef2f2"], body.dark-mode td[style*="background:#fef2f2"] { background: #2d1010 !important; border-color: #7f1d1d !important; }

body.dark-mode div[style*="background:#f0fdf4"], body.dark-mode td[style*="background:#f0fdf4"], body.dark-mode th[style*="background:#f0fdf4"],
body.dark-mode div[style*="background:#dcfce7"], body.dark-mode td[style*="background:#dcfce7"] { background: #0d2010 !important; border-color: #14532d !important; }

body.dark-mode div[style*="background:#f0fdfa"], body.dark-mode td[style*="background:#f0fdfa"],
body.dark-mode div[style*="background:#ccfbf1"] { background: #0d2420 !important; border-color: #134e4a !important; }

body.dark-mode div[style*="background:#faf5ff"], body.dark-mode td[style*="background:#faf5ff"],
body.dark-mode div[style*="background:#f5f3ff"] { background: #1a102d !important; border-color: #4c1d95 !important; }

body.dark-mode div[style*="background:#fef9c3"], body.dark-mode td[style*="background:#fef9c3"] { background: #2d2208 !important; border-color: #713f12 !important; }

/* 적격수급인 평가 모달 테이블 구분 칸 */
body.dark-mode td[style*="background:#f8fafc"],
body.dark-mode td[style*="background: #f8fafc"] { background: #162032 !important; color: #94a3b8 !important; }

/* 인라인 텍스트 색 보정 — div, td, th, span, p */
body.dark-mode div[style*="color:#1e293b"], body.dark-mode td[style*="color:#1e293b"], body.dark-mode th[style*="color:#1e293b"], body.dark-mode span[style*="color:#1e293b"], body.dark-mode p[style*="color:#1e293b"],
body.dark-mode div[style*="color:#334155"], body.dark-mode td[style*="color:#334155"], body.dark-mode th[style*="color:#334155"],
body.dark-mode div[style*="color:#475569"], body.dark-mode td[style*="color:#475569"], body.dark-mode th[style*="color:#475569"] { color: #cbd5e1 !important; }
body.dark-mode div[style*="color:#64748b"], body.dark-mode td[style*="color:#64748b"], body.dark-mode th[style*="color:#64748b"],
body.dark-mode div[style*="color:#94a3b8"] { color: #94a3b8 !important; }

/* 어두운 텍스트 색 보정 (light bg 전용 색상) */
body.dark-mode div[style*="color:#0369a1"], body.dark-mode td[style*="color:#0369a1"], body.dark-mode th[style*="color:#0369a1"], body.dark-mode h3[style*="color:#0369a1"] { color: #38bdf8 !important; }
body.dark-mode div[style*="color:#9a3412"], body.dark-mode h3[style*="color:#9a3412"], body.dark-mode p[style*="color:#9a3412"] { color: #fb923c !important; }
body.dark-mode div[style*="color:#166534"], body.dark-mode td[style*="color:#166534"] { color: #4ade80 !important; }
body.dark-mode div[style*="color:#854d0e"], body.dark-mode td[style*="color:#854d0e"] { color: #fbbf24 !important; }
body.dark-mode div[style*="color:#1e3a5f"] { color: #93c5fd !important; }

/* 테이블 border 색 보정 */
body.dark-mode td[style*="border:1px solid #e2e8f0"],
body.dark-mode th[style*="border:1px solid #e2e8f0"] { border-color: #334155 !important; }
body.dark-mode tr[style*="border-bottom:1px solid #e2e8f0"],
body.dark-mode tr[style*="border-bottom: 1px solid #e2e8f0"] { border-color: #334155 !important; }
body.dark-mode #user-info-bar button {
  background: #334155 !important;
  border-color: #475569 !important;
  color: #cbd5e1 !important;
}

/* 계정관리 모달 사이드바 */
body.dark-mode #acct-sidebar {
  background: #162032 !important;
  border-right-color: #334155 !important;
}
body.dark-mode .acct-light-btn {
  background: #1e293b !important;
  border-color: #475569 !important;
  color: #cbd5e1 !important;
}

/* 안전인증 항목 행 */
.sc-item-row {
  background: #f8fafc;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #f1f5f9;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  transition: background 0.15s;
}
.sc-item-row:hover { background: #f1f5f9; }
.sc-item-row .sc-count-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
  white-space: nowrap;
}
.sc-count-has  { background: #dcfce7; color: #166534; }
.sc-count-none { background: #f1f5f9; color: #94a3b8; }
body.dark-mode .sc-item-row { background: #1e293b; border-color: #334155; color: #cbd5e1; }
body.dark-mode .sc-item-row:hover { background: #1e3a5f; }
body.dark-mode .sc-count-has  { background: #0d2010; color: #4ade80; }
body.dark-mode .sc-count-none { background: #162032; color: #64748b; }

/* 관리자 드롭다운 */
body.dark-mode #admin-dropdown-menu {
  background: #1e293b;
  border-color: #334155;
}
body.dark-mode #admin-dropdown-menu button {
  color: #cbd5e1 !important;
  border-bottom-color: #334155 !important;
}
body.dark-mode #admin-dropdown-menu button:hover { background: #334155 !important; }
body.dark-mode #admin-dropdown-menu button:last-child { color: #f87171 !important; }
body.dark-mode #admin-dropdown-btn { background: #334155 !important; border-color: #475569 !important; color: #cbd5e1 !important; }

/* 건강증진 stat 카드 */
body.dark-mode .hp-stat-card {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

/* 다크모드 토글 버튼 */
.dark-toggle {
  background: none;
  border: 1.5px solid #e2e8f0;
  border-radius: 20px;
  padding: 4px 12px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  color: #475569;
  transition: all 0.2s;
  display: flex; align-items: center; gap: 5px;
}
.dark-toggle:hover { border-color: var(--primary-color); color: var(--primary-color); }
body.dark-mode .dark-toggle {
  border-color: #38bdf8;
  color: #38bdf8;
  background: rgba(56,189,248,0.08);
}
